GazeboProblemResolutionGuide

From The Player Project

Jump to: navigation, search

Contents

Problem resolution guide

This is a problem resolution guide contributed by Gazebo users.


What is the focal length of the camera? How to set it?

By default, Gazebo sets the horizontal field of view to 60 degrees, being the vertical field of view the one that makes pixels square (i.e. 45 degrees). To calculate the corresponding focal length you can use the following equation:

flength = (width/2)/tan(hfov/2)

If you want to set a specific focal length you have to set the 'vfov' and 'hfov' camera sensor parameters. To calculate those values you can use the following equation:

vfov = 2*atan(height/(2*flength))
hfov = 2*atan(width/(2*flength))

This example would led to a focal length of 440 pixels:

<sensor:camera name="custom_camera_sensor">
 ...
 <imageSize>320 240</imageSize>
 <vfov>30.510237</vfov>
 <hfov>39.966214</hfov>
 ...
</sensor:camera>

How can I make Gazebo run in real time?

How can I make Gazebo fun faster than real time?

How can I make Gazebo fun slower than real time?

According to the mailing list, time is controlled by the 'updateRate' tag inside 'physics:ode'.

<physics:ode>
 ...
 <stepTime>STEP_TIME</stepTime>
 <updateRate>UPDATE_RATE</updateRate>
 ...
</physics:ode>

The number you set updateRate to follows these rules:

  • < 0: Gazebo will attempt to run the simulation in real time
  • - 0: Gazebo will run as fast as it can
  • > 0: This number will represent the desired physics update frequency. In this case, Gazebo will run STEP_TIME*UPDATE_RATE times reality.

How can I add new materials?

When Gazebo is executed it tries to open “~/.gazeborc” in order to read its configuration paths. The following is its default content:

<?xml version="1.0"?>
<gazeborc>
  <gazeboPath>/usr/local/share/gazebo</gazeboPath>
  <ogrePath>/usr/local/lib/OGRE</ogrePath>
</gazeborc>

Gazebo appends the content of every 'gazeboPath' node to the list of directories where media files (audio, fonts, materials or models) are searched.

The first step is to create the directory where the material file and textures will be stored. In this recipe the directory '~/.gazebo/' will be used. Feel free to use any other directory, but make sure to make the corresponding changes in further steps. Thus, the content of the "~/.gazeborc" file should be like the following:

<?xml version="1.0"?>
<gazeborc>
  <gazeboPath>/usr/local/share/gazebo</gazeboPath>
  <gazeboPath>/home/USERNAME/.gazebo</gazeboPath>
  <ogrePath>/usr/local/lib/OGRE</ogrePath>
</gazeborc>

The second step is to create the following directory tree:

/home/USERNAME/.gazebo/
`-- Media/
    `-- materials/
        |-- scripts/
        `-- textures/

Texture files (images), go in Media/materials/textures. The Gazebo.material file go in Media/materials/scripts. The last step is to write the Gazebo.material file by appending a new entry like the following one for every new material:

material TextureName
{
  technique
  {
    pass
    {
      texture_unit
      {
        texture texturename.png
      }
    }
  }
} 

where TextureName is the name of the new material and texturename.png is the filename of any of the images stored in Media/materials/textures.

Personal tools