Robotics StackExchange | Archived questions

Is it possible to set the traversal depth of EntityComponentManager.Each to call only main models of nested models

Hello ,

I'm new to Gazebo, so apologies if my question is a bit all over the place.

I want to output the main models from a running simulation to a separate ign topic. Via:

_ecm.Each<ignition::gazebo::components::Model, ignition::gazebo::components::Name,
ignition::gazebo::components::Pose>(
        [&](const ignition::gazebo::Entity & _entity,
            const ignition::gazebo::components::Model *_model,
            const ignition::gazebo::components::Name *_nameComp,
            const ignition::gazebo::components::Pose *_poseComp)-> bool 

However, with the current template, the models are also searched in the models themselves, which is not quite what I wanted. I do not want to output the models based on a subset of another model. For example, if Model A and C are nested within Model B, I only want Model B to appear in my output message. Is there a way to set the traversal depth of _ecm.Each? I would be very grateful if someone could help me.

Asked by Vasch on 2022-08-01 04:26:40 UTC

Comments

Answers