In the navigation_bot_06 folder, a new subfolder called scripts was created. It holds Python scripts (for now: waypoint_follower.py and robot_navigator.py). Scripts are not part of ROS2 navigation stack, they are an extra custom layer on top of it. Scripts are copied from SteveMacenski/nav2_rosdevday_2021 site (see "Sources" section below), plus, as usual, some errors were fixed.
The idea is to run the simulation using the main_simulation_launch.py as we normally would, and when it is up, run the waypoint_follower.py script. It will send ROS messages to the navigation, same way as earlier we were sending commands from the teleop_twist_keyboard.
Let's start with robot_navigator.py. This file implements a BasicNavigator class that wraps navigation functionality, providing functions that we can call. This way we do not have to rely on ROS2 way of configuring things: Python script is much more flexible than any yaml configuration.
Don't forget to change the access permissions on the file.
chmod +x waypoint_follower.py
The waypoint_follower.py file uses the BasicNavigator, issuing commands that the simulation should execute:
Change the access permissions on the file.
chmod +x robot_navigator.py