Steps of running the navigation stack on RViz to initialize the localization system, send goals to the robot on a map previously created using SLAM for ROS robots in the Gazebo environment.
The navigation will be applied on the map created using the ros-slam-gazebo tutorial; make sure to follow the steps in this tutorial to obtain appropriate results.
Launch the Gazebo environment:
$ export TURTLEBOT3_MODEL=burger
$ source ~/catkin_ws/devel/setup.bash
$ roslaunch turtlebot3_gazebo turtlebot3_world.launch
Run the navigation node
$ export TURTLEBOT3_MODEL=burger
$ source ~/catkin_ws/devel/setup.bash
$ roslaunch turtlebot3_navigation turtlebot3_navigation.launch map_file:=$HOME/map.yaml
2D Pose Estimate
: Allows the user to initialize the localization system used by the navigation stack by setting the pose of the robot in the world.
1- In the RViz menu, click 2D Pose Estimate
button.
2- Click on the map where the actual robot is located and drag the large green arrow toward the direction where the robot is facing.
3- 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, and narrow down the estimated location of the TurtleBot3 on the map.
$ roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch
Then, terminate the keyboard teleoperation node using Ctrl
+ C
.
2D Nav Goal
: Allows the user to send a goal to the navigation by setting a desired pose for the robot to achieve.
1- Click the 2D Nav Goal
button in the RViz menu.
2- Click on the map to set the robot's destination and drag the green arrow toward the direction where the robot will be facing.
As soon as all the parameters x, y, θ are set, TurtleBot3 will start moving to the destination and manages to avoid obstacles as can be seen.