Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

Thanks for the link to your code. One problem I noticed is the plugin (libgaz.cpp) iterates over all robots during load. This is a problem because the libgaz plugin is loaded by each robot instance. Since libgaz is a model plugin, you should only touch elements that belong to the model. This means you should remove the for loop that looks like:

//  for each robot
//for (char robot='a'; robot<'k'; robot++)
{

You can then get a sensor using:

  //  get sensor
  stringstream ss_name;
  ss_name << "default::" << _parent->GetScopedName() << "::main_link::cam" << i;
  sensor = sensors::SensorManager::Instance()->GetSensor(ss_name.str());

And finally, remove a sensor using:

    sensors::SensorManager::Instance()->RemoveSensor(sensor->GAZEBO_SCOPED_NAME());

I tried the above on Gazebo9, and it seemed to work.