Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to add a new collision to existing model with a model plugin?

Hello everyone,

I am trying to add dynamically a new collision and visual to my model. To do so, I found the member function CreateCollision(). I don't really know how to use it correctly. I also want to do this new collision visible, so how is this possible? Thank you in advance. Appreciating any help!!! Best wishes.

My approach:
namespace gazebo { class MyModelPlugin: public ModelPlugin { public: void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf) { physics::ModelPtr mymodel = _model; physicsLinkPtr new_link = _model->CreateLink("new_link"); physics::CollisionPtr new_collision = physics::physicsEngine::CreateCollision ("polyline", new_link); ... }}}

How to add a new collision to existing model with a model plugin?

Hello everyone,

I am trying to add dynamically a new collision and visual to my model. To do so, I found the member function CreateCollision(). I don't really know how to use it correctly. I also want to do this new collision visible, so how is this possible? Thank you in advance. Appreciating any help!!! Best wishes.

My approach:
namespace gazebo { { class MyModelPlugin: public ModelPlugin ModelPlugin { { public: void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf) { physics::ModelPtr mymodel = _model; _model ; physicsLinkPtr new_link = _model->CreateLink("new_link"); _model->CreateLink("new_link"); physics::CollisionPtr new_collision = physics::physicsEngine::CreateCollision ("polyline", new_link); new_link); ... }}}