Title: Nate Koenig
1Stage and GazeboThe Instant Experts Guide
2Overview
- Simulators
- When, why, how, what
- The right tool Stage or Gazebo?
- Stage in depth
- Installation, usage
- Examples
- Gazebo in depth
- Installation and usage
- Examples
- Where to get help
3Working with Simulators
- What
- Mimic the real world, to a certain extent
- When
- Always!!
- Why
- Save time and your sanity
- Experimentation much less destructive
- Use hardware you dont have
- Create really cool videos
- How
- Someone has probably already done it, so use it
4Which Simulator?
Gazebo 3D Sensor-based Player Dynamic
O(n) O(n3) Small teams (10s)
Stage 2D Sensor-based Player interface
Kinematic O(1) O(n) Large teams (100s)
5The Big Picture
Stage
TCP/UDP
Cmds
Player
Gazebo
Client
Data
SHM
Real Hardware
TCP/UDP
TCP/UDP
6Stage
7Stage Environment
- Simulates mobile robots, sensors and objects on
2-D bitmapped environment
8Stage Models
- Designed for multi-agent autonomous research
- Each model simple (computationally cheap)
- Can simulate many such models
9Stage Control
- Control models via Player
- Simulated hardware appear as their real
counterparts - Easy transition between simulation and real world
- Supports a wide range of devices
- Pioneers, laser, sonar, camera, pucks, etc.
10Stage In Depth
11Stage Worldfile
- Stage environment specified in a worldfile
- Describes the robots, sensors and objects
- Many examples provided in distribution
12Example Stage Worldfile
the resolution of Stage's raytrace model in
meters resolution 0.02 GUI settings gui (
size 502.000 506.000 origin 5.018 4.950
0 scale 0.021 the size of each bitmap pixel
in meters ) load a bitmapped environment from
a file bitmap ( file "cave.pnm.gz"
resolution 0.02 ) include "pioneer.inc
create a robot, set start position and Player
port, and equip it with laser scanner position (
port 6665 pose 1.0 1.0 20 laser() )
13Running Stage
- To run stage
- Note Stage automatically starts a player server
- Problem abstract devices not implemented in
Stage are needed. Such as VFH, or AMCL - Solution start another Player server using
passthrough devices - Passthrough devices send data/cmds between Player
servers - A secondary server can collect data from Player,
and run abstract devices
stage ltmyworldgt
14Working With Stage
Stage
Player localhost8000
Controller (client)
position0 port 7000 laser0
position0 driver passthrough port
7000 laser0 driver passthrough port
7000 position0 driver vfh position_index 0
laser_index 0 port 7000
Controller (client)
TCP/UDP
TCP/UDP
15Gazebo
16Gazebo In Depth
- Simulates robots, sensors, and objects in a 3-D
dynamic environment - Generates realistic sensor feedback and physical
interactions between objects
17Gazebo In Depth
- Gazebo aims to be a high fidelity simulator
- Each model is NOT computationally cheap
- Small robot populations are possible.
- Dependent on number and type of robots
18Exception to the rule
19Gazebo Architecture
20Gazebo Architecture
21Gazebo Architecture
22Gazebo Client Code
- Client code (your program), can interface to
Gazebo in two ways - libgazebo
- Shared Memory, direct interface
- Fast, but requires more work
- Player
- Simulation transparency
- Get all of Players goodies
- Easier, but with more computational overhead
- Recommended for most cases
23Gazebo Architecture
24Libgazebo
- Simple C library
- Treat as a blackbox
- Client and server must run on same machine
- Read sensor data and send commands to simulated
devices - Devices and Interfaces
- Devices (Model), represent real world objects
- Pioneer2AT, SickLMS200
- The objects within Gazebo simulation
- Interfaces are general specifications for entire
classes of devices - Position, Laser
- The programmatic hooks to devices
25Gazebo Architecture
26The World
- A world is composed of a model hierarchy
- Models define simulated devices
- Models can be nested
- Specifies how models are physically attached to
one another - Think of it as bolting one model to another
ltmodelPioneer2ATgt ltidgtrobot1lt/idgt
ltmodelSickLMS200gt ltidgtlaser1lt/idgt
ltxyzgt0.10.0 0.2lt/xyzgt lt/modelSickLMS200gt lt/m
odelPioneer2ATgt
- Worldfile snippet
- Pioneer with a sick laser attached
- Sicks ltxyzgt relative location to Pioneer
27Gazebo Architecture
28Models
- Each model contains a few key properties
- Physical presence (optional)
- Body sphere, box, composite shapes
- Kinematics joints, velocities
- Dynamics mass, friction, forces
- Appearance color, texture
- Interface (optional)
- Control and feedback interface (libgazebo)
29Types of Models
- Static Models
- Built into Gazebo statically linked into server
- In general such models added by lead developers
- Plugin Models
- Shared objects loaded at runtime. Akin to linux
kernel modules - Recommended for new, experimental, third-party
models - Easier to build, faster code/compile/test cycle,
source can be maintained in separate repository
30Available Models
- Factory
- GarminGPS
- GroundPlane
- LightSource
- MapExtruder
- ObserverCam
- Pioneer2AT
- Pioneer2DX
- Pioneer2Gripper
- Pioneer2Sonars
- SegwayRMP
- SickLMS200
- SimpleSolid
- SonyVID30
- Terrain
- TruthWidget
MapExtruder
31Working with Player
- Steps to creating a simulation
- Write Gazebo worldfile
- Start Gazebo
- Write corresponding Player configuration file
- Start Player
- Start client program
- Note
- Gazebo must be started before Player
- Player must be re-started whenever Gazebo is
restarted
32Example Using a single robot
- Single robot with a scanning laser range finder
driver ( name "gz_position" devices
"position0" gz_id "robot1_position" )
driver ( name "gz_laser" devices
"laser0" gz_id "robot1_laser" )
ltmodelPioneer2DXgt ltidgtrobot1_positionlt/idgt
ltxyzgt0 0 0.40lt/xyzgt ltrpygt0 0 45lt/rpygt
ltmodelSickLMS200gt ltidgtrobot1_laserlt/idgt
ltxyzgt0.15 0 0.20lt/xyzgt ltrpygt0 0
0lt/rpygt lt/modelSickLMS200gt lt/modelPioneer2D
Xgt
Gazebo world
Player config
33Example Using a single robot
- Run Gazebo
- Run Player
- Now run your code
gazebo ltmyworldgt
player g default ltmyconfiggt
34Getting Player/Stage/Gazebo
- Source distributions from the Player/Stage
website - http//playerstage.sourceforge.net/
- No binary (pre-built) distributions
- Basic requirements
- Posix-like OS (Linux, OS X)
- GCC
- Gazebo additional requirements
- OpenGL with hardware acceleration
- Open Dynamics Engine (www.ode.org)
35Installing Packages
- To use Gazebo
- Download, install
- librtk-src-2.2.0
- gazebo-src-0.2.0
- player-src-1.4rc1
- To use Stage
- Download, install
- librtk-src-2.2.0
- player-src-1.3.2
- stage-src-1.3.2
36Getting Help
- Where to get help
- Your peers
- Player/Stage website
- Player/Stage/Gazebo mailing list archives
- Player/Stage/Gazebo mailing lists
37Questions?