Gazebo | Ignition | Community
Ask Your Question

Apply force to object through plugin

asked 2019-09-13 05:50:13 -0500

lolistic gravatar image


is there a way to apply a force to objects/models.

There is "SetLinearAccel", but I can't find any command for applying a force.

Thanks in advance

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-09-23 02:51:07 -0500

lolistic gravatar image

From my own experience, it seems like the answer is that one can't apply force to a model/object, only a link. This can be solved by getting the desired link from the model, where the names of the links can be changed in the .world file:

this->model->GetLink("body")->SetForce(ignition::math::Vector3d(1.0, 0.0, 0.0);

The same goes for applying torque:

this->model->GetLink("body")->SetTorque(1.0, ignition::math::Vector3d(1.0, 0.0, 0.0);

Hope this helps someone else.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2019-09-13 05:50:13 -0500

Seen: 171 times

Last updated: Sep 23 '19