Skip to content

Workshop 8 ‐ Navigation functionality

gcielniak edited this page Nov 17, 2024 · 7 revisions

Preliminaries

First, synchronise your fork with the main repository on GitHub (Sync fork) as some structural changes were made and new files were added. Then clone or pull the repository to your local PC and re-open it in the dev container using VSC. Rebuild the updated packages colcon build --symlink-install, and source the repository source install/setup.bash.

Task 1 - Map-based navigation

For this task, you should work in simulation for the time being.

  1. First, launch the simulation ros2 launch limo_gazebosim limo_gazebo_diff.launch.py.

  2. Launch the navigation stack by invoking the following command ros2 launch limo_navigation limo_navigation.launch.py. You should see the rviz visualisation of the robot, its sensors and the map of the environment.

  3. Send the robot a goal by using the 2D Goal Pose button in the top bar in Rviz. A green arrow will appear at the point where you click on your mouse, and releasing the click the new goal will be sent to the robot. Note the behaviour of the robot in this autonomous mode. Try out different locations and note any problematic situations.

Task 2 - Planners

The navigation system uses two planners to direct the robot to the desired goal. The global planner devises an obstacle-free route to the goal using the entire metric map whilst the local planner plans the safe route in the local vicinity of the robot and keeps the robot away from obstacles.

  1. In Rviz add visualisations for local and global paths: rviz option Add/By topic/ and then /plan/Path and /local_plan/Path. Change the colours so you can differentiate between both paths.

  2. Inspect how the global and local paths differ, while the robot is approaching the destination point.

  3. Now, add some obstacles to the Gazebo environment and note the behaviour of both planners in presence of objects not originally present in the map.

Task 3 - Custom maps

The navigation stack is using the metric maps of the environment which need to be created by driving the robot around with its laser sensor. To create your own maps, follow the instructions below.

  1. Close the navigation stack and restart the simulation.

  2. Launch the slam toolbox: ros2 launch slam_toolbox online_async_launch.py use_sim_time:=true.

  3. Run RViz with the config file from the Limo's navigation toolbox rviz2 -d /opt/ros/lcas/install/limo_navigation/share/limo_navigation/rviz/limo_navigation.rviz.

  4. Use the teloperation node to drive the robot around and cover the entire environment to complete the map: ros2 run teleop_twist_keyboard teleop_twist_keyboard.

  5. Save the created map using map_saver: ros2 run nav2_map_server map_saver_cli -f my_map.

  6. Inspect the created files including my_map.yaml and .pgm. It is a good practice to store these files in the maps folder of your development package (e.g. in rob2002_tutorial/maps/).

  7. You can now terminate the slam_toolbox and restart the simulator. To use the newly created map, launch the navigation stack with an additional parameter specifying the map file: ros2 launch limo_navigation limo_navigation.launch.py map:=my_map.yaml use_sim_time:=true. If your map files are stored in the maps folder, remember to source your workspace first and then issue ros2 launch limo_navigation limo_navigation.launch.py map:=src/rob2002_tutorial/maps/my_map.yaml use_sim_time:=true. Note the performance of the robot localisation component whilst navigating around.

  8. Modify the simulation environment by adding 2-4 new static obstacles, remap the environment again and save the resulting map. Note the changes in localisation/navigation quality when using the two maps built before and after the modifications.

  9. Run the slam_toolbox with the real robot, map the lab and use the map with the navigation stack to direct the robot to selected points in the environment. Identify the difficult spots - what might be the reasons for the lower performance in such places?