The Gazebo Simulator
Gazebo is a new simulator that is compatible with Player/Stage. It allows multiple robots to be simulated in high-fidelity OpenGL, especially useful in outdoor scenes. The client side of Gazebo is Player again and is identical to the Pyro interface for Stage. Gazebo world files are very different, and come in two parts: the world file, and a config file. However, Pyro hides this complexity for the novice user.
This is how worlds look in Gazebo:
The World File
The world file is an XML file that describes all of the items in a world, including the robot, the lighting, objects, sky, and ground. Here is pioneer2dxSonars.world:
<?xml version="1.0"?> <gz:world xmlns:gz='http://playerstage.sourceforge.net/gazebo/xmlschema/#gz' xmlns:model='http://playerstage.sourceforge.net/gazebo/xmlschema/#model' xmlns:window='http://playerstage.sourceforge.net/gazebo/xmlschema/#window' xmlns:params='http://playerstage.sourceforge.net/gazebo/xmlschema/#params'> <params:GlobalParams> <gravity>0.0 0.0 -9.8</gravity> </params:GlobalParams> <model:MapExtruder> <id>map1</id> <xyz>1 1 0</xyz> <imageFile>example2.png</imageFile> <threshold>200</threshold> <scale>0.1</scale> <height>2.0</height> <width>0.1</width> <color>0.0 1.0 0.0</color> </model:MapExtruder> <model:GroundPlane> <id>ground1</id> <texture2D>grid.ppm</texture2D> </model:GroundPlane> <model:LightSource> <id>light1</id> <xyz>0 0 10</xyz> </model:LightSource> <model:ObserverCam> <id>usercam1</id> <xyz>-1.5 0.0 2.0</xyz> <rpy>0.0 30.0 0.0</rpy> <updatePeriod>0.1</updatePeriod> <displayRays>true</displayRays> <window> <title>Gazebo1</title> <size>320 240</size> <xyz>0 0</xyz> </window> </model:ObserverCam> <model:Pioneer2DX> <id>robot1</id> <xyz>-0.35 0 0.25</xyz> <rpy>0 0 0</rpy> <model:ObserverCam> <id>usercam2</id> <xyz>-1.5 0.0 2.0</xyz> <rpy>0.0 30.0 0.0</rpy> <updatePeriod>0.1</updatePeriod> <displayRays>true</displayRays> <window> <title>Gazebo2</title> <size>320 240</size> <xyz>0 0</xyz> </window> </model:ObserverCam> <model:Pioneer2Sonars> <id>sonars1</id> </model:Pioneer2Sonars> <model:SickLMS200> <id>laser1</id> <xyz>0.0 0 0.101</xyz> <rayCount>91</rayCount> <rangeCount>361</rangeCount> </model:SickLMS200> </model:Pioneer2DX> <model:SimpleSolid> <xyz>2.0 0.0 0.35</xyz> <shape>box</shape> <size>0.7 0.7 0.7</size> <color>1 0 0</color> </model:SimpleSolid> </gz:world>
This world has two cameras: observercam1 and observercam2. However, one camera will be tied to the robot's location, and the other will remain fixed.
The world file also defines sonars and laser. You can see much more detail about this file format at: The World File, from the Player/Stage/Gazebo people.
To connect onto a rendered world you also need a config file.
The Config File
In Pyro, a world's associated config file is in the same subdirectory, and has the same name as the world file, but with an appended ".cfg".
position:0 ( driver "gz_position" gz_id "robot1" ) sonar:0 ( driver "gz_sonars" gz_id "sonars1" ) laser:0 ( driver "gz_laser" gz_id "laser1" ) ptz:0 ( driver "gz_ptz" gz_id "usercam1" ) camera:0 ( driver "gz_camera" gz_id "usercam1" )
In this file, you define a robot just like you would in Player server files. Here, you must know the gz_id of an item which you get from the world file. You must also know the name of the driver, which you can get from the Gazebo Manual, in the section Working with Player.
Pyro and Gazebo
You can create your own version of any Gazebo world file by selecting Server:, then GazeboSimulator, then highlight the world you would like to copy and click on the My Copy button. This will copy both the world and config file to your home directory, and open up Emacs (by default) with both files ready to be edited.
When you have made your changes, simple select Server:, then GazeboSimulator, then click the Home button on the top right of the file dialog window. Then select your version of the copied world.
Exercise 1: create a 3D world just like the tutorial world in the Pyrobot and Stage Simulator sections.
Exercise 2: Team up with a partner, and create a world with two robots in it, a maze, and a colored object. Position your robots an equal distance from the object. Then each of you start Pyro (on the same computer, or different ones if you don't have a firewall) and with the Joystick.py brain, each race to see who can get to the colored object first.