To move the turtlebot
roslaunch kobuki_keyop keyop.launch
***OR***
roslaunch turtlebot_teleop keyboard_teleop.launch
|
To download the turtlebot navigation
sudo apt-get install ros-indigo-turtlebot-navigation
|
This installs gmapping and amcl required for the navigation
To start map building
roslaunch turtlebot_gazebo gmapping_demo.launch
|
Use RViz to visualize the map building process
roslaunch turtlebot_rviz_launchers view_navigation.launch –screen
|
Finally, save the map to disk
rosrun map_server map_saver -f <your map name>
|
Navigating the Background
To be sure that all will run as expected, kill all you launched in the previous section and repeat all steps except the map building. Instead, type:
roslaunch turtlebot_gazebo amcl_demo.launch map_file:=<full path to your map YAML file>
|
Or if you prefer to use an already created map, just omit the map_file argument.
To use the map that you saved – first close everything. Then,
Load the turtlebot simulator again:
source /opt/ros/indigo/setup.bash
roslaunch turtlebot_gazebo turtlebot_world.launch
|
**Need to make sure that you ALWAYS source the bashrc file before launching the turtlebot gazebo simulator
Run the navigation demo app passing in your generated map file.
roslaunch turtlebot_navigation amcl_demo.launch map_file:=/tmp/my_map.yaml
|
**When launching the map, make sure you put the full path, i.e. /home/turtlebot/map1.yaml (this path should be after ‘=’)
Launch RViz to visualize the map building process
roslaunch turtlebot_rviz_launchers view_navigation.launch
|
When starting up, the TurtleBot does not know where it is. To provide it its approximate location on the map:
-
Click the “2D Pose Estimate” button
-
Click on the map where the TurtleBot approximately is and drag in the direction the TurtleBot is pointing.
You will see a collection of arrows which are hypotheses of the position of the TurtleBot. The laser scan should line up approximately with the walls in the map. If things don’t line up well you can repeat the procedure.
Send a navigation goal
With the TurtleBot localized, it can then autonomously plan through the environment.
To send a goal:
-
Click the “2D Nav Goal” button
-
Click on the map where you want the TurtleBot to drive and drag in the direction the TurtleBot should be pointing at the end.
This can fail if the path or goal is blocked.
If you want to stop the robot before it reaches it’s goal, send it a goal at it’s current location.
On your Workstation
This assumes you have ROS on your workstation and ROS_MASTER_URI has been set to point to your turtlebot.
Launch rviz:
# Pre-Groovy
rosrun rviz rviz -d `rospack find turtlebot_navigation`/nav_rviz.vcg
|
# Groovy or later
roslaunch turtlebot_rviz_launchers view_navigation.launch –screen
|