Home | Tutorials | Wiki | Issues
Ask Your Question

how to bring up sensors in a stand alone Gazebo

asked 2015-09-22 06:28:34 -0600

scarlett gravatar image

Hello! I am starting a stand alone gazebo and loading a .world from a cpp file with :

    // Load a world
    gazebo::physics::WorldPtr world = gazebo::loadWorld(
   for (unsigned int i = 0; i < 10000; ++i)
   gazebo::runWorld(world, 1);

This world include a robot model containing an hokuyo laser : pepper_model.sdf :

      <pose>0.0562 0 -0.303 0 -0.0175 0</pose>
    <joint name="hokuyo_joint" type="revolute">
        <xyz>0 0 1</xyz>

When I am importing this model from the GUI gazebo, no problem, I can listen the laser topic with :

gz topic -e /gazebo/default/virtual_pepper/hokuyo/link/laser/scan

But when launching my cpp program ( without any gazebo launched, except the server written above ), there is no data comming from the laser.

I tried several function from the gazebo API as :

gazebo::sensors::SensorManager *mgr = gazebo::sensors::SensorManager::Instance();
gazebo::sensors::Sensor_V vect_sensor = mgr->GetSensors();

=> to init() the captors "by hand" but vect_sensor is always empty

whereas :

 gazebo::physics::LinkPtr tibia= pepper->GetLink("Tibia");

give me the name of my sensor

What I am missing?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-09-23 07:50:10 -0600

scarlett gravatar image

By searching into this file in Gazebo lib :


I had the idea to add few lines in my code to take care of sensors :

    gazebo::physics::WorldPtr world = gazebo::loadWorld(

    // Make sure the sensors are updated once before running the world.
    // This makes sure plugins get loaded properly.

 for (unsigned int i = 0; i < 100000; ++i)
        gazebo::runWorld(world, 1);

Now it is working fine

edit flag offensive delete link more
Login/Signup to Answer

Question Tools


Asked: 2015-09-22 06:28:34 -0600

Seen: 983 times

Last updated: Sep 23 '15