turtlebot Simulation Tutorial Memo


Turtlebot Installation

Assumes ROS has been installed on your computer.

sudo apt-get install ros-indigo-turtlebot ros-indigo-turtlebot-apps ros-indigo-turtlebot-interactions ros-indigo-turtlebot-simulator ros-indigo-kobuki-ftdi ros-indigo-rocon-remocon ros-indigo-rocon-qt-library ros-indigo-ar-track-alvar-msgs


TurtleBot in Stage Simulator

roslaunch turtlebot_stage turtlebot_in_stage.launch

Customizing the Stage Simulator


The following files in the turtlebot_stage folder are all the preset launch and configuration files:

launch/turtlebot_in_stage.launch # launch文件
maps/maze.png # 定义地图基本形状
maps/maze.yaml # 定义地图参数
maps/stage/maze.world # 定义可移动物体的位置
maps/stage/turtlebot.inc # 定义turtlebot模型(一般不用改)
rviz/robot_navigation.rviz # rviz参数 (一般不用改) 

Modifiying a map

Change args in launch/turtlebot_in_stage.launch.

  • Method #1:
roslaunch turtlebot_stage turtlebot_in_stage.launch map_file:="%FULL_PATH_TO_YOUR_CUSTOMED_YAML_FILE%" world_file:="%FULL_PATH_TO_YOUR_CUSTOMED_WORLD_FILE%"
  • Method #2
export TURTLEBOT_STAGE_MAP_FILE=~/stageTutorial/tutorial.yaml
export TURTLEBOT_STAGE_WORLD_FILE=~/stageTutorial/tutorial.world
roslaunch turtlebot_stage turtlebot_in_stage.launch

Modifiying robot position

Change args in launch/turtlebot_in_stage.launch.

Related args:

  • initial_pose_x
  • initial_pose_y
  • initial_pose_a

Adding Objects and Includes

To add moveable objects which can represent dynamic obstacles we can define a new block in a seperated file we call “myBlock.inc”:

define block model
  size [0.500 0.500 1.500]
  gui_nose 0

Append to your “world” file.

include "myBlock.inc"

#adding blocks
block( pose [ 2.000 4.000 0.000 0.000 ] color "green")
block( pose [ 4.000 4.000 0.000 0.000 ] color "red")

Gazebo Bringup Guide

roslaunch turtlebot_gazebo turtlebot_world.launch

Explore the Gazebo world

Make the TurtleBot move

roslaunch turtlebot_teleop keyboard_teleop.launch

See what the robot sees

roslaunch turtlebot_rviz_launchers view_robot.launch

Make a map and navigate with it

Make a map

roslaunch turtlebot_gazebo turtlebot_world.launch
roslaunch turtlebot_gazebo gmapping_demo.launch
roslaunch turtlebot_rviz_launchers view_navigation.launch
rosrun map_server map_saver -f <your map name>

Navigate the playground

roslaunch turtlebot_gazebo amcl_demo.launch map_file:=<full path to your map YAML file>