Editing the Simulated World
In previous lessons we encountered with the simulated world. We understood how to move in it, change the camera view. In this lesson we will learn how to choose a world for simulation, create a new world, edit the existing world.
Specifying World for Simulation
We use following command to run the Gazebo world:
roslaunch turtlebot_gazebo turtlebot_world.launch
roslaunch
is an important tool that manages the start and stop of ROS processes.
Many ROS packages come with launch files, which you can run with:
roslaunch <package-name> <launch-filename> [args]
In this command:
roslaunch turtlebot_gazebo turtlebot_world.launch
turtlebot_gazebo
is a package name and turtle_world.launch
is a launch file.
We can specify which world we want to use with argument world_file
:
roslaunch turtlebot_gazebo turtlebot_world.launch world_file:=<full path to the world file>
You can find existing world files in this folder /opt/ros/indigo/share/turtlebot_gazebo/worlds
.
Try to run corridor.world
:
roslaunch turtlebot_gazebo turtlebot_world.launch world_file:=/opt/ros/indigo/share/turtlebot_gazebo/worlds/corridor.world
You will see this world:

Corridor World
The default world is in the environment variable TURTLEBOT_GAZEBO_WORLD_FILE
.
You can see it running this command:
echo $TURTLEBOT_GAZEBO_WORLD_FILE
# Output:
/opt/ros/indigo/share/turtlebot_gazebo/worlds/playground.world
You can update it:
1. For current terminal run this command:
TURTLEBOT_GAZEBO_WORLD_FILE=<full path to the world file>
2. For all new terminals run this command:
echo "export TURTLEBOT_GAZEBO_WORLD_FILE=<full path to the world file>" >> .bashrc
It will work after relaunching the terminals.
Launching an Empty World
1. Create a folder for new worlds:
mkdir ~/turtlebot_custom_gazebo_worlds
2. Launch an empty world:
roslaunch turtlebot_gazebo turtlebot_world.launch world_file:=/opt/ros/indigo/share/turtlebot_gazebo/worlds/empty.world
3. You will see:

Empty World
Editing a World
You can add simple shapes objects and objects from model database.
1. Select the Insert
tab.

Connecting to Model Database
NOTE: You can see Connecting to model database
. It might take a long
time to connect to Gazebo’s model database.
You will see this picture after connecting:

Adding models
2. Add a box.
Select the box icon, then move your mouse onto the render window. Left click when you choose the proper position of the box.
3. Add a sphere and a cylinder.
4. Add a bookshelf.
Select the Insert
tab to access the model database. Select the bookshelf. Add
it to the render window.
NOTE: It might take some time to download a model from Gazebo’s model database.
5. Add a cafe table and a dumpster.
You should have something similar to this picture:

Modification Tools
You can see on the picture how to modify the pose of each model.
6. Model may be deleted by right-clicking on a model and selecting Delete
.
Delete the dumpster.

Delete the Object
Saving a New World
Select the File
menu and choose Save World As
.

Delete the Object
A pop-up will appear asking you to choose a folder and enter a new filename.
Choose turtlebot_custom_gazebo_worlds
folder and type tutorial.world
, then
click Save
.
In terminal press Ctrl+C
. Now you can launch your world:
roslaunch turtlebot_gazebo turtlebot_world.launch world_file:=/home/<user_name>/turtlebot_custom_gazebo_worlds/tutorial.world
You can watch these steps in this video:
Creating a New World
In the next lessons we will use this command:
roslaunch turtlebot_gazebo turtlebot_world.launch
with the default world /opt/ros/indigo/share/turtlebot_gazebo/worlds/playground.world
.
Or we will specify the world file in the command:
roslaunch turtlebot_gazebo turtlebot_world.launch world_file:=<full path to the world file>
What to Read
You can find clear and full tutorial about editing the Gazebo world
here. You can
read more about roslaunch
here.