INTRODUCTION
Overview
Download and Install
Quick Start
Documentation
Publications

NONFRAMEWORK CODE
Driver Interfaces
Drivers
Libraries
Utilities

FRAMEWORK CODE
Interfaces
Components
Libraries
Utilities

Full Software Listings

DEVELOPER
Tutorials
Examples
Dev Guide
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         

Using Orca with Player/Gazebo simulator

Note:
Reviewed for release 2.5.0, Player 2.0.4, and Gazebo 0.7.0.

In this tutorial we will assemble a simple robotic system and connect it to the 3D Player/Gazebo simulator. The system diagram is the same as in the this tutorial A bigger system with Player/Stage simulator (with Stage replaced by Gazebo). It is recommended to do the Stage tutorial first because the simulator setup is simpler. Here we assume that you've done that and so all the prerequisites are already met.

Player/Gazebo must be installed before we begin. Debian installation instructions are found here orca_doc_installdebian_gazebo. It's also useful to understand how Player/Stage/Gazebo works.

Starting Up

Start IceGrid Registry and IceStorm server as described in the Quick-Start Guide

We'll be using sample configuration files which are distributed with Orca and Gazebo. As a general rule, you shouldn't work or run programs from the distribution. So we'll create a separate directory and copy config and world files into it. After going through the quickstart guide, you would have created a sys directory in which you keep your cfg files. Create a new directory for this tutorial and copy the required config and world files there.

$ mkdir -p ~/sys/tutegazebo; cd ~/sys/tutegazebo
$ cp [GAZEBO_SRC]/worlds ./

One of the most important things that you should make sure of is that Gazebo runs by itself. Please see Gazebo installation instructions, Gazebo user guide, and the Gazebo mailing lists before anything else. Note that some of the instructions on the Gazebo website are out of date. These issues are hopefully addressed as we come across them below.

After Gazebo has been installed, run it from the tutegazebo directory by typing

$ gazebo ./worlds/example.world

for the non-graphical version or

$ wxgazebo ./worlds/example.world

for the graphical version.

You may find that some graphics cards report the following error when running Gazebo:

rendering: [GLX offscreen] direct [no] RGBA [5 6 5 0] depth [16]
 X Error of failed request:  GLXUnsupportedPrivateRequest
   Major opcode of failed request:  144 (GLX)
   Minor opcode of failed request:  16 (X_GLXVendorPrivate)
   Serial number of failed request:  35
   Current serial number in output stream:  36

For more information about OpenGL rendering methods see the Gazebo documentation. It is suggested to try all rendering methods to see which gives the best results because it is highly dependent on the video card, video card driver and xserver.

Select the most appropriate rendering method by changing the renderMethod tag in example.world (the file you just copied to the tutegazebo directory). For example, to select GLX rendering use the following tag:

<renderMethod>glx</renderMethod>

You also need to add this to the Sony camera's configuration:

<model:SonyVID30>
  ...
  <renderMethod>glx</renderMethod>
</model:SonyVID30>

Once Gazebo is running, you will need to stop it and change the example.world file so that it reports laser readings that orca will interpret properly. Add the following tags within the SickLMS200 model.

<model:SickLMS200>
  ...   
  <rangeCount>361</rangeCount>
  <rayCount>361</rayCount>
  ...  
</model:SickLMS200>

Restart Gazebo.

You can see the laser rays by clicking on the Controls (lefthand corner) of the guicam window and clicking the check box "Display Rays". You can also control the vehicle by clicking the check box "Pioneer2DX : position: robot1" and using the slide bars in the new window.

Player as an Intermediary

We will now use Player as an intermediary between Orca and Gazebo (this similar to how Orca works with Stage).

Copy the following lines into a new file called example.cfg and save it in the directory tutegazebo .

driver
(
    name "gazebo"
    provides ["simulation:0"]
    plugin "libgazeboplugin"
    server_id "default"
)

driver
(
   name "gazebo"
   provides ["position2d:0"]
   gz_id "robot1"
)

driver
(
   name "gazebo"
   provides ["power:0"]
   gz_id "robot1"
) 

driver
(
    name "gazebo"
    provides ["laser:0"]
    gz_id "laser1"
)

Start up Player using the example.cfg file (make sure you are still running gazebo or wxgazebo!).

$ player example.cfg

Orca

We'll now make Orca talk to Gazebo through Player. Firstly, copy a few standard component configuration files distributed with Orca.

$ cd ~/sys/tutegazebo
$ cp [ORCA_INSTALL]/cfg/laser2d.cfg ./
$ cp [ORCA_INSTALL]/cfg/robot2d.cfg ./
$ cp [ORCA_INSTALL]/cfg/faithlocaliser.cfg ./
$ cp [ORCA_INSTALL]/cfg/teleop.cfg ./
$ cp [ORCA_INSTALL]/cfg/orcaview2d.cfg ./

From here on, each component will need a separate terminal.

Setting up the Laser on the Robot

Tell the component to use the gazebo driver by modifying the laser2d.cfg file. Check that the following lines look like this.

...
Laser2d.Config.DriverLib=libHydroLaserScanner2dPlayerClient.so
Laser2d.Config.PlayerClient.Driver=gazebo
...

Note that if you want to change the configuration of the laser or other hardware components, see the Gazebo models page.

Now run the Laser2d component.

$ laser2d

Robot driver

We're now going to set up the low level control to the actuators for the simulated robot using the Robot2d component. No modifications to the robot2d.cfg file need to be made, so just run it.

$ robot2d

Localisation

To display the robot in the GUI we need a localisation component. Here we'll use the simplest one possible: FaithLocaliser which assumes porfect odometry. Nothing needs to be done to the .cfg file so just start the component.

$ faithlocaliser

View the World

To view the world and the robot we use orcaview. One line of the standard config file needs to be modified:

...
OrcaView2d.Config.Element2.Detail=localise2d@local/faithlocaliser
...

Start the GUI component

$ orcaview

You should now see the the robot and laser scan. If it is partially off the screen, drag it with the left mouse button so that you can view the full scan.

Keyboard/Joystick Control

To tell the robot to move we can use the teleop component which allows us to send commands to the Robot2d component via keyboard or joystick.

$ teleop

As the robot moves through the world, compare the display of the OrcaView and the Gazebo world window: they should be showing similar reports.

What's Next

If everything works, check out more Orca Tutorials.

 

Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)


Generated for Orca Robotics by  doxygen 1.4.5