Gazebo User Notes
From DGC Wiki
Contents |
Gazebo Notes
This page contains various information that will be very valuable to every Gazebo developer. I suggest everyone puts their notes about anything they experience they spent time on figuring out!
Network issues
Running remotely through X
It is not recommended to run Player+Gazebo remotely on another computer, forwarding X-packets over the network. This is because the X windows system is rendering images remotely and then sends them over the socket to display on your computer. That is very slow and takes alot of CPU, so simulation is impossible to do like that. Example: a PlayerClient.Read() call took 3.5 seconds on grandchallenge compared with <0.1 sec locally. There is a workaround though, that is to start gazebo with the -g0 switch. That turns off the GUI and you will get a Gazebo engine running without showing any camera windows. Not so fun but it is working just as fast as it would if you were running locally.
Running MTA modules locally
With a recent version of MTA it is now possible to run it on a local machine Here's instructions on how to do: Running MTA on a local machine
Reading from devices (using PlayerClient)
You have to be aware of that Gazebo's default feeding of data is 10Hz, so if you have a PlayerClient object that is connected to Player, you better be sure to catch up with that pace, or you will end up flooding the buffers and always reading very old data. A way to get away from this is to look at the int SetDataMode(unsigned char mode) or int SetFrequency(unsigned short freq) methods in playerclient.h (see the manual).
Important to know is that if you use PULL mode, you must call RequestData() before you do Read() or the program will stop at the Read() forever. Be aware that this slows down the getting of the data a LOT!
Example estimated timing:
Mode Function Time ==== ======== ========= PLAYER_DATAMODE_PULL_NEW PlayerClient.RequestData() + Read() 80000 us PLAYER_DATAMODE_PUSH_NEW PlayerClient.Read() 20 us
Running Gazebo+Player on your local machine
You might want to run as many as possible of your MTA modules on remote computers (probably race computers). I noticed that MTA SendQuery() function call took 900ms when I was running Gazebo+Player+PlayerInterface+GlobalPlanner compared to 2ms when PlayerInterface+GlobalPlanner was running on a race computer instead. This difference also relates to the previous note, about filling up the buffers since Gazebo will post data to Player faster than your program is fetching it!
Documentation sources
- Gazebo mailing lists on SourceForge contains many discussions about issues in Gazebo. They are also searchable for keywords, which is very useful. If you're working with Gazebo you might want to sign up for some of them.
<li> For a complete documentation for the Gazebo and Player source API, check these Doxygen pages
<li> When integrating the planning software with the gazebo simulation I found it hard to find good documentation on how the angles are really defined. So here's a summary of what I've realized (the hard way): Angle conversion
<li> Instructions for accessing the latest Player and Gazebo source code from CVS (on SourceForge) are available at Player_Gazebo_CVS
</ul>
[edit]
Using Gazebo
[edit]Observer camera shortcuts
A list of shortcuts (not found anywhere I think --Henrik 15:19, 13 Aug 2004 (PDT)):
Key Description === =========== w Toggle writing of displayed frames to harddrive < Set the active camera to the previous one in the array > Set the active camera to the next one in the array F,f Toggle "Move fast mode" P,p Write the current camera pose (in gazebo output, for easy copying to a .world file) ESC Quit
Mouse move Description ========== =========== left button + drag pan view middle button + drag change altitude of camera right button + drag change camera "ground position"
[edit]Using playerv to control your model
If you want to use playerv to control your model at higher speeds (suitable when testing with the Tahoelooking modified Clodbuster model). Do this:
Edit player-src-1.5/utils/playerv/dev_position.c at line 311 and modify it to something like this:min_vr = -10.00; max_vr = +10.00; min_va = -M_PI; max_va = +M_PI; kr = max_vr / 2.00; ka = max_va / 2.00;
[edit]Using Player CVS vs Player 1.5 release
Be aware that there's differences between the Player 1.5 release and the later CVS releases. I noticed the difference when using the position3d device, which is not fully implemented in the 1.5 release. Therefore, be aware of this when compiling (for example PlayerInterface) with the player libraries, so that you're using the same player libraries as the other computer you're actually running Player on. --Henrik 16:04, 14 Oct 2004 (PDT)
[edit]Simulating fast/slower than realtime
There's a variable called stepTime which decides how much time is spent on the simulation. The default value is 0.02 seconds. Edit it in the World.cc file, line 60in the 0.4.0 release.
If you're using 0.5.0 (CVS) you can change it by setting a parameter in the .world file instead:<params:GlobalParams> <gravity>0.0 0.0 -9.8</gravity> <stepTime></stepTime> </params:GlobalParams>
For more time-related info, check this post on the mailing list
[edit]Bugs in existing releases
[edit]Gazebo 0.4.0 release
-
<li>TruthWidget device: It makes the robot impossible to move when it has a TruthWidget mounted on it (this bug is fixed in the CVS release). Fix it by doing this:
Edit server/models/TruthWidget/TruthWidget.cc at line 66 and make the Load method look like this: Body * b; b = new Body(this->world, NULL, false); this->AddBody(b, true); return 0;[edit]Tips creating .world files
-
<li> If you're going to use more than one camera in your .world file (for example for stereo vision), make sure to name the <title> tag different for each, otherwise it won't run. This took me quite some time to realize since I thought it was the <id> that identified each model. --Henrik 11:57, 17 Aug 2004 (PDT)
<li> If you want to edit the LADAR beam range, you have two choices:
-
<li> Use these XML keywords to set the variables in your .world file:
<rayCount>201</rayCount> <rangeCount>201</rangeCount> <scanPeriod>0.100</scanPeriod> <minRange>0.20</minRange> <maxRange>50.0</maxRange><li>Edit the source file for the LADAR device: gazebo-dir/server/models/SickLMS200/SickLMS200.cc and modify the Load method at starting at line 67. Then run make install in your gazebo-src-0.4.0 directory.
<li>When running on large RDDF maps, the default ground plane is probably not big enough to contain all the waypoints. To fix this, just add a size tag to the Groundplane section of the .world file, like this (100x100 meters is the default, this example shows 300x300m):
<model:GroundPlane> <id>ground1</id> <color>0.1 0.7 0.1</color> <size>300 300 0</size> <texture2D>grid.ppm</texture2D> </model:GroundPlane>
Using existing addons
RDDF corridor painter
To plot RDDF waypoints into the Gazebo world, check out the Corridor plugin in dgc/gazebo/models/Corridor and the README.
![[Main Page]](../../../../upload/alice.jpg)