Goals

The goals for this lab are to:

Resources

Deliverables

By the end of this Lab you will need to:

Launch Robot

First bring up either the simulator or an actual turtlebot.

You won’t need to launch rviz at this point. The navigation package will launch RViz with a navigation-specific configuration.

Launch Navigation

In Simulation

ros2 launch turtlebot3_navigation2 navigation2.launch.py use_sim_time:=true

For The Real Robot

ros2 launch turtlebot3_navigation2 navigation2.launch.py map:=./map_1203.yaml

(This assumes you are running from the folder where you downloaded the map files. Otherwise, provide the full path to the map yaml file.)

Try it Out

Experiment with localizing the robot and sending navigation goals using Rviz2.

Command Line Action Interface

The navigation system uses the ROS 2 action interface to send and monitor navigation requests. “Actions” are the ROS mechanism for making long-running requests.

Type the following in the terminal:

ros2 interface show nav2_msgs/action/NavigateToPose

You should see this output:

#goal definition
 geometry_msgs/PoseStamped pose
     std_msgs/Header header
         builtin_interfaces/Time stamp
             int32 sec
             uint32 nanosec
         string frame_id
     Pose pose
         Point position
             float64 x
             float64 y
             float64 z
         Quaternion orientation
             float64 x 0
             float64 y 0
             float64 z 0
             float64 w 1
 string behavior_tree
 ---
 #result definition
 std_msgs/Empty result
 ---
 #feedback definition
 geometry_msgs/PoseStamped current_pose
     std_msgs/Header header
         builtin_interfaces/Time stamp
             int32 sec
             uint32 nanosec
         string frame_id
     Pose pose
         Point position
             float64 x
             float64 y
             float64 z
         Quaternion orientation
             float64 x 0
             float64 y 0
             float64 z 0
             float64 w 1
 builtin_interfaces/Duration navigation_time
     int32 sec
     uint32 nanosec
 builtin_interfaces/Duration estimated_time_remaining
     int32 sec
     uint32 nanosec
 int16 number_of_recoveries
 float32 distance_remaining

The three areas represent the request format, the result format, and the format for feedback.

Sending an action request

It is possible to send action requests through the ROS 2 CLI. First, we’ll need an example of the required format for navigation goals:

ros2 interface proto nav2_msgs/action/NavigateToPose

Next, we use ros2 action to send a goal location:

ros2 action send_goal /navigate_to_pose nav2_msgs/action/NavigateToPose GOAL

Where the GOAL field uses the format we discovered above. The only fields you should need to change from the prototype are the x and y positions of the goal and the frame id.

Try adding the -f flag to see the feedback messages that are available during navigation:

ros2 action send_goal /navigate_to_pose nav2_msgs/action/NavigateToPose GOAL -f

COPY/PASTE a sample feedback message into nav.txt

Download the following file and examine the contents in a text editor:

Answer the following questions in nav.txt:

We can edit this file to modify the parameters used for planning and localization. Edit your local copy to set the maximum velocity for the /controller_server node to .05.

You can use your own parameter values as follows:

ros2 launch turtlebot3_navigation2 navigation2.launch.py use_sim_time:=true params_file:=./waffle_pi.yaml

If it worked correctly, the robot should move significantly more slowly after the parameter change.

Find one other interesting parameter and experiment with changing its value. Describe the outcome in nav.txt.

Submitting

Submit nav.txt through Canvas.


Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.