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
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:
In this command:
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
:
You can find existing world files in this folder /opt/ros/indigo/share/turtlebot_gazebo/worlds
.
Try to run corridor.world
:
You will see this world:
The default world is in the environment variable TURTLEBOT_GAZEBO_WORLD_FILE
.
You can see it running this command:
You can update it:
1. For current terminal run this command:
2. For all new terminals run this command:
It will work after relaunching the terminals.
Launching an Empty World
1. Create a folder for new worlds:
2. Launch an empty world:
3. You will see:
Editing a World
You can add simple shapes objects and objects from model database.
1. Select the Insert
tab.
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:
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:
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.
Saving a New World
Select the File
menu and choose Save World As
.
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:
You can watch these steps in this video:
In the next lessons we will use this command:
with the default world /opt/ros/indigo/share/turtlebot_gazebo/worlds/playground.world
.
Or we will specify the world file in the command:
What to Read
You can find clear and full tutorial about editing the Gazebo world
here. You can
read more about roslaunch
here.