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

asked 2022-08-01 04:26:40 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

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.

edit retag flag offensive close merge delete