How to Autonomously Navigate through a list of WaypointsΒΆ
π Goal of this tutorial
By the end of this tutorial, you will know how to make the robot autonomously navigate through a list of waypoints, eventually executing action upon reaching each waypoint.
Pre-requisitesΒΆ
You should be able to remotely connect to your robot Set up ROS 2 communication with the robot.
You should be familiar with ROSβs RViz
You should first have completed the How to Localize in a known map of the environment
You should first have completed the How to Autonomously Navigate while avoiding obstacles
You should first have completed the How to create and annotate your Environment
Navigate Through Waypoints using RVizΒΆ
The easiest way to send a goal to the robot is by using the RViz GUI. This requires that you first establish the communication with the robot as explained in Set up ROS 2 communication with the robot.
Then, in the same terminal that is connected to the robot, you can start RViz with the command:
rviz2 -d /opt/pal/$PAL_DISTRO/share/<ROBOT>_advanced_2dnav/config/rviz/navigation.rviz
Attention
Make sure to replace the <ROBOT>
placeholder with the name of your robot (e.g. pmb2
, omni_base
,
ari
, etc.). If you are using a TIAGo-Family
robot, use the base_type
name
(either, pmb2
or omni_base
).
Otherwise, if you want to use the simulation, you can use the following command:
source /opt/pal/${PAL_DISTRO}/setup.bash
ros2 launch <robot>_gazebo <robot>_gazebo.launch.py navigation:=True advanced_navigation:=True
Once RViz is running and is connected to the robot, you can explore the default environments by following these steps:
If not already available, load the
PAL Navigation 2
panel in RViz
Go to the
Waypoint Navigation
tab in thePAL Navigation 2
panel
Add new Waypoints in the environment using the
Waypoint
tool in RViz or use the avaialble ones to create a list of waypoints. Eventually, you can also associate one or more actions to each waypoint by dragging and dropping the action from theAvailable Actions
list.
Most of the available Waypoint Actions can be configured by double-clicking on the relative item in the
Waypoint List
.
Note
The same action (e.g. WaitAtWaypoint) can be configured differently for each waypoint, allowing you to customize the robotβs behavior at each waypoint.
Once created, the Waypoint List can be executed by selecting a Behavior Tree using the
Select BT
and from the drop-down menu select one of the available Behavior Trees or specify the path to a custom one and clickOK
. Eventually, you can also set theNumber of loops
parameter to specify how many times the list of waypoints should be executed. If set to0
, the list will be executed only once.
Attention
The follow_waypoints
Behavior Tree will ignore all the actions associated to the waypoints and will
simply navigate through the list of waypoints. To execute the actions associated to the waypoints,
you need to select the follow_waypoints_with_actions
Behavior Tree.
If you want to store the list of waypoints for later use, you can save it by clicking on the
Save Waypoint List
button and specifying a name that will be used to save the list of waypoints in the current Floor. Later, you can load the saved list of waypoints by clicking on theLoad Waypoint List
button and selecting the desired list from the drop-down menu.
Next stepsΒΆ
If you want to learn more about the waypoints and how to use them, you can refer to π© Waypoint Navigation.
If you want to learn more about the environmental annotations, you can refer to How to create and annotate your Environment.