Navigation
WARNING: In this instruction, TurtleBot3 may move and rotate. Please place the robot on a safe ground.
NOTE
[Navigation][navigation] is to move the robot from one location to the specified destination in a given environment. For this purpose, a map that contains geometry information of furniture, objects, and walls of the given environment is required. As described in the previous [SLAM][slam] section, the map was created with the distance information obtained by the sensor and the pose information of the robot itself.
The [Navigation][navigation] enables a robot to move from the current pose to the designated goal pose on the map by using the map, robot’s encoder, IMU sensor, and distance sensor. The procedure for performing this task is as follows.
Run Navigation Nodes
- If
roscore
is not running on the Remote PC, run roscore. Skip this step if roscore is already running.
[Remote PC]$ roscore
- If the
Bringup
is not running on the TurtleBot3 SBC, launch the Bringup. Skip this step if you have launched bringup previously.- Open a new terminal from Remote PC with
Ctrl
+Alt
+T
and connect to Raspberry Pi with its IP address. The default password is turtlebot. Please use the proper keyword amongburger
,waffle
,waffle_pi
for theTURTLEBOT3_MODEL
parameter.
[Remote PC]$ ssh ubuntu@{IP_ADDRESS_OF_RASPBERRY_PI} $ export TURTLEBOT3_MODEL=${TB3_MODEL} $ roslaunch turtlebot3_bringup turtlebot3_robot.launch
- Open a new terminal from Remote PC with
- Launch the Navigation.
Please use the proper keyword amongburger
,waffle
,waffle_pi
for theTURTLEBOT3_MODEL
parameter.
[Remote PC]$ export TURTLEBOT3_MODEL=burger $ roslaunch turtlebot3_navigation turtlebot3_navigation.launch map_file:=$HOME/map.yaml
How to save the TURTLEBOT3_MODEL parameter?
The $ export TURTLEBOT3_MODEL=${TB3_MODEL}
command can be omitted if the TURTLEBOT3_MODEL parameter is predefined in the .bashrc
file.
The .bashrc
file is automatically loaded when a terminal window is created.
- Example of defining
TurtlBot3 Burger
as a default model.$ echo 'export TURTLEBOT3_MODEL=burger' >> ~/.bashrc $ source ~/.bashrc
- Example of defining
TurtlBot3 Waffle Pi
as a default model.$ echo 'export TURTLEBOT3_MODEL=waffle_pi' >> ~/.bashrc $ source ~/.bashrc
- If the
Bringup
is not running on the TurtleBot3 SBC, launch the Bringup. Skip this step if you have launched bringup previously.- Open a new terminal from Remote PC with
Ctrl
+Alt
+T
and connect to Raspberry Pi with its IP address. The default password is ubuntu.
[Remote PC]$ ssh ubuntu@{IP_ADDRESS_OF_RASPBERRY_PI} $ export TURTLEBOT3_MODEL=${TB3_MODEL} $ ros2 launch turtlebot3_bringup robot.launch.py
- Open a new terminal from Remote PC with
- Open a new terminal from Remote PC with
Ctrl
+Alt
+T
and launch the Navigation node. ROS 2 uses Navigation2. Please use the proper keyword amongburger
,waffle
,waffle_pi
for theTURTLEBOT3_MODEL
parameter.
[Remote PC]$ export TURTLEBOT3_MODEL=burger $ ros2 launch turtlebot3_navigation2 navigation2.launch.py map:=$HOME/map.yaml
How to save the TURTLEBOT3_MODEL parameter?
The $ export TURTLEBOT3_MODEL=${TB3_MODEL}
command can be omitted if the TURTLEBOT3_MODEL parameter is predefined in the .bashrc
file.
The .bashrc
file is automatically loaded when a terminal window is created.
- Example of defining
TurtlBot3 Burger
as a default model.
[Remote PC]$ echo 'export TURTLEBOT3_MODEL=burger' >> ~/.bashrc $ source ~/.bashrc
- Example of defining
TurtlBot3 Waffle Pi
as a default model.
[Remote PC]$ echo 'export TURTLEBOT3_MODEL=waffle_pi' >> ~/.bashrc $ source ~/.bashrc
Estimate Initial Pose
Initial Pose Estimation must be performed before running the Navigation as this process initializes the AMCL parameters that are critical in Navigation. TurtleBot3 has to be correctly located on the map with the LDS sensor data that neatly overlaps the displayed map.
- Click the
2D Pose Estimate
button in the RViz menu.
- Click on the map where the actual robot is located and drag the large green arrow toward the direction where the robot is facing.
- Repeat step 1 and 2 until the LDS sensor data is overlayed on the saved map.
- Launch keyboard teleoperation node to precisely locate the robot on the map.
[Remote PC]$ roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch
- Move the robot back and forth a bit to collect the surrounding environment information and narrow down the estimated location of the TurtleBot3 on the map which is displayed with tiny green arrows.
- Terminate the keyboard teleoperation node by entering
Ctrl
+C
to the teleop node terminal in order to prevent different cmd_vel values are published from multiple nodes during Navigation.
Initial Pose Estimation must be performed before running the Navigation as this process initializes the AMCL parameters that are critical in Navigation. TurtleBot3 has to be correctly located on the map with the LDS sensor data that neatly overlaps the displayed map.
- Click the
2D Pose Estimate
button in the RViz2 menu. - Click on the map where the actual robot is located and drag the large green arrow toward the direction where the robot is facing.
- Repeat step 1 and 2 until the LDS sensor data is overlayed on the saved map.
- Launch keyboard teleoperation node to precisely locate the robot on the map.
[Remote PC]$ ros2 run turtlebot3_teleop teleop_keyboard
- Move the robot back and forth a bit to collect the surrounding environment information and narrow down the estimated location of the TurtleBot3 on the map which is displayed with tiny green arrows.
- Terminate the keyboard teleoperation node by entering
Ctrl
+C
to the teleop node terminal in order to prevent different cmd_vel values are published from multiple nodes during Navigation.
Set Navigation Goal
- Click the
2D Nav Goal
button in the RViz menu.
- Click on the map to set the destination of the robot and drag the green arrow toward the direction where the robot will be facing.
- This green arrow is a marker that can specify the destination of the robot.
- The root of the arrow is
x
,y
coordinate of the destination, and the angleθ
is determined by the orientation of the arrow. - As soon as x, y, θ are set, TurtleBot3 will start moving to the destination immediately.
Read more about Navigation
-
The robot will create a path to reach to the Navigation Goal based on the global path planner. Then, the robot moves along the path. If an obstacle is placed in the path, the Navigation will use local path planner to avoid the obstacle.
-
Setting a Navigation Goal might fail if the path to the Navigation Goal cannot be created. If you wish to stop the robot before it reaches to the goal position, set the current position of TurtleBot3 as a Navigation Goal.
-
[Official ROS Navigation Wiki][navigation]
- Click the
Navigation2 Goal
button in the RViz2 menu. - Click on the map to set the destination of the robot and drag the green arrow toward the direction where the robot will be facing.
- This green arrow is a marker that can specify the destination of the robot.
- The root of the arrow is
x
,y
coordinate of the destination, and the angleθ
is determined by the orientation of the arrow. - As soon as x, y, θ are set, TurtleBot3 will start moving to the destination immediately.
Read more about Navigation2
-
The robot will create a path to reach to the Navigation2 Goal based on the global path planner. Then, the robot moves along the path. If an obstacle is placed in the path, the Navigation2 will use local path planner to avoid the obstacle.
-
Setting a Navigation2 Goal might fail if the path to the Navigation2 Goal cannot be created. If you wish to stop the robot before it reaches to the goal position, set the current position of TurtleBot3 as a Navigation2 Goal.
Tuning Guide
Navigation stack has many parameters to change performances for different robots.
You can get more information about Navigation tuning from Basic Navigation Tuning Guide, ROS Navigation Tuning Guide by Kaiyu Zheng, and the chapter 11 of ROS Robot Programming book.
inflation_radius
- Defined in
turtlebot3_navigation/param/costmap_common_param_${TB3_MODEL}.yaml
- This parameter makes inflation area from the obstacle. Path would be planned in order that it don’t across this area. It is safe that to set this to be bigger than robot radius. For more information, please refer to the costmap_2d wiki.
cost_scaling_factor
- Defined in
turtlebot3_navigation/param/costmap_common_param_${TB3_MODEL}.yaml
- This factor is multiplied by cost value. Because it is an reciprocal propotion, this parameter is increased, the cost is decreased.
The best path is for the robot to pass through a center of between obstacles. Set this factor to be smaller in order to far from obstacles.
max_vel_x
- Defined in
turtlebot3_navigation/param/dwa_local_planner_params_${TB3_MODEL}.yaml
- This factor is set the maximum value of translational velocity.
min_vel_x
- Defined in
turtlebot3_navigation/param/dwa_local_planner_params_${TB3_MODEL}.yaml
- This factor is set the minimum value of translational velocity. If set this negative, the robot can move backwards.
max_trans_vel
- Defined in
turtlebot3_navigation/param/dwa_local_planner_params_${TB3_MODEL}.yaml
- Actual value of the maximum translational velocity. The robot can not be faster than this.
min_trans_vel
- Defined in
turtlebot3_navigation/param/dwa_local_planner_params_${TB3_MODEL}.yaml
- Actual value of the minimum translational velocity. The robot can not be slower than this.
max_rot_vel
- Defined in
turtlebot3_navigation/param/dwa_local_planner_params_${TB3_MODEL}.yaml
- Actual value of the maximum rotational velocity. The robot can not be faster than this.
min_rot_vel
- Defined in
turtlebot3_navigation/param/dwa_local_planner_params_${TB3_MODEL}.yaml
- Actual value of the minimum rotational velocity. The robot can not be slower than this.
acc_lim_x
- Defined in
turtlebot3_navigation/param/dwa_local_planner_params_${TB3_MODEL}.yaml
- Actual value of the translational acceleration limit.
acc_lim_theta
- Defined in
turtlebot3_navigation/param/dwa_local_planner_params_${TB3_MODEL}.yaml
- Actual value of the rotational acceleration limit.
xy_goal_tolerance
- Defined in
turtlebot3_navigation/param/dwa_local_planner_params_${TB3_MODEL}.yaml
- The x,y distance allowed when the robot reaches its goal pose.
yaw_goal_tolerance
- Defined in
turtlebot3_navigation/param/dwa_local_planner_params_${TB3_MODEL}.yaml
- The yaw angle allowed when the robot reaches its goal pose.
sim_time
- Defined in
turtlebot3_navigation/param/dwa_local_planner_params_${TB3_MODEL}.yaml
- This factor is set forward simulation in seconds. Too low value is in sufficient time to pass narrow area and too high value is not allowed rapidly rotates. You can watch defferences of length of the yellow line in below image.
Navigation2 stack has many parameters to change performances for different robots. Although it’s similar to the ROS1 Navigation, please refer to the Configuration Guide of Navigation2 or ROS Navigation Tuning Guide by Kaiyu Zheng for more details.
Costmap Parameters
inflation_layer.inflation_radius
- Defined in
turtlebot3_navigation2/param/${TB3_MODEL}.yaml
- This parameter makes inflation area from the obstacle. Path would be planned in order that it does not across this area. It is safe that to set this to be bigger than robot radius. For more information, please refer to the costmap_2d wiki.
inflation_layer.cost_scaling_factor
- Defined in
turtlebot3_navigation2/param/${TB3_MODEL}.yaml
- This is an inverse proportional factor that is multiplied by the value of the costmap. If this parameter is increased, the value of the costmap is decreased.
The optimal path for the robot to pass through obstacles is to take a median path between them. Setting a smaller value for this parameter will create a farther path from the obstacles.
dwb_controller
max_vel_x
- Defined in
turtlebot3_navigation2/param/${TB3_MODEL}.yaml
- This factor is set the maximum value of translational velocity.
min_vel_x
- Defined in
turtlebot3_navigation2/param/${TB3_MODEL}.yaml
- This factor is set the minimum value of translational velocity. If set this negative, the robot can move backwards.
max_vel_y
- Defined in
turtlebot3_navigation2/param/${TB3_MODEL}.yaml
- The maximum y velocity for the robot in m/s.
min_vel_y
- Defined in
turtlebot3_navigation2/param/${TB3_MODEL}.yaml
- The minimum y velocity for the robot in m/s.
max_vel_theta
- Defined in
turtlebot3_navigation2/param/${TB3_MODEL}.yaml
- Actual value of the maximum rotational velocity. The robot can not be faster than this.
min_speed_theta
- Defined in
turtlebot3_navigation2/param/${TB3_MODEL}.yaml
- Actual value of the minimum rotational speed. The robot can not be slower than this.
max_speed_xy
- Defined in
turtlebot3_navigation2/param/${TB3_MODEL}.yaml
- The absolute value of the maximum translational velocity for the robot in m/s.
min_speed_xy
- Defined in
turtlebot3_navigation2/param/${TB3_MODEL}.yaml
- The absolute value of the minimum translational velocity for the robot in m/s.
acc_lim_x
- Defined in
turtlebot3_navigation2/param/${TB3_MODEL}.yaml
- The x acceleration limit of the robot in meters/sec^2.
acc_lim_y
- Defined in
turtlebot3_navigation2/param/${TB3_MODEL}.yaml
- The y acceleration limit of the robot in meters/sec^2.
acc_lim_theta
- Defined in
turtlebot3_navigation2/param/${TB3_MODEL}.yaml
- The rotational acceleration limit of the robot in radians/sec^2.
decel_lim_x
- Defined in
turtlebot3_navigation2/param/${TB3_MODEL}.yaml
- The deceleration limit of the robot in the x direction in m/s^2.
decel_lim_y
- Defined in
turtlebot3_navigation2/param/${TB3_MODEL}.yaml
- The deceleration limit of the robot in the y direction in m/s^2.
decel_lim_theta
- Defined in
turtlebot3_navigation2/param/${TB3_MODEL}.yaml
- The deceleration limit of the robot in the theta direction in rad/s^2.
xy_goal_tolerance
- Defined in
turtlebot3_navigation2/param/${TB3_MODEL}.yaml
- The x,y distance allowed when the robot reaches its goal pose.
yaw_goal_tolerance
- Defined in
turtlebot3_navigation2/param/${TB3_MODEL}.yaml
- The yaw angle allowed when the robot reaches its goal pose.
transform_tolerance
- Defined in
turtlebot3_navigation2/param/${TB3_MODEL}.yaml
- It allows the latency for tf messages.
sim_time
- Defined in
turtlebot3_navigation2/param/${TB3_MODEL}.yaml
- This factor is set forward simulation in seconds. Setting this too small makes robot difficult to pass a narrow space while large value limits dynamic turns. You can observe the defferences of length of the yellow line in below image that represents the simulation path.