How to get the gazebo::Entity from the entity's id in ignition
Hello all,
I am trying to get an entity from its id. As every entity in Ignition has a unique id, I think it is quiet a easy job, but unfortunately can't find a function to do that. I get the id from the contact sensor message (code shows below), also I get an entity of the collision object, but the type of the entity is msgs::Entity, which is not what I want.I have read the doc of the igition::gazebo, but no found.
-----------------------------------------#
auto contacts = _ecm.Component<components::contactsensordata>(entity); auto collisionEntity = contacts->Data().contact().Get(0).collision2(); long id = collisionEntity.id()
------------------------------------------#
I wonder:
- if there is any way to get the entity from the id;
- if there is any way to convert the msgs::Entity to the gazbo::Entity.
Either way will help me out. Many thanks!