CS 354 Autonomous Robotics

Fall 2020

Turtlebot3 Navigation

Learning Objectives

The purpose of this lab is to gain experience working with the ROS2 Navigation System and ROS2 OccupancyGrid messages.

Resources

Dependencies

  • The random_nav package you will be using for this lab depends on the following source packages. If you haven't yet, you'll need to clone this packages into ~/dev_ws/src and build them. If you already have them make sure to git pull to ensure that you have the latest versions:

Part 1 - Experimenting with Navigation

  • Clone and build the random_nav repository. I suggest you use the --symlink-install option so that you won't need to re-build every time you edit a Python file.

  • Launch the package as follows:

    ros2 launch random_nav sim_nav.launch.py
    This should bring up both Gazebo and Rviz pre-configured to show navigation-related topics.
  • Provide an initial localization using the 2d Pose Estimate button in Rviz.
  • Experiment with selecting navigation goals using the 2d Nav Goal button.
  • In a separate terminal, experiment with sending navigation goals using the nav_demo node:

    ros2 run random_nav nav_demo 2 2 0

    Take some time to read through the code in nav_demo.py to make sure you understand what's going on.

Part2 - Random Navigation

Modify random_nav.py so that it randomly wanders around the environment by repeatedly selecting random navigation targets. The pseudocode for the desired behavior should be as follows:

repeat forever:

   # randomly select a free location in the map
   while goal location not selected:
       select a random location in the map
       check the map to see if that location is free
   
   Ask the navigation system to navigate to the selected goal location
   
   Wait until the the goal is reached or aborted

Once you are satisfied with the behavior of your random_nav node push your final version to Github.