Gazebo | Ignition | Community
Ask Your Question
0

Applying a force to a link in gazebo plugin

asked 2017-09-04 19:12:37 -0600

kkrasnosky gravatar image

I am trying to simulate an autonomous surface vehicle with an azimuthing thruster. I set up a basic model and want to apply a force to the thruster in the thruster's reference frame. What recommendations do you have for accomplishing this?

So far I have tried:

this->model->GetJoints()[0]->SetForce(0, 300);  // in this method I can't seem to control the direction.  Is it applying a torque and not a force maybe?

and

math::Vector3 force(100,0,0);
model->GetLink("propeller")->SetForce(force);
// this method seems to work, however,  it applies a force in the global x direction not the thruster x direction.
edit retag flag offensive close merge delete

Comments

rotate the force vector into thruster's frame? you can get the world orientation or entities using `GetWorldPose().rot` and just apply that to `force`

iche033 gravatar imageiche033 ( 2017-09-05 13:08:55 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2017-11-09 14:29:39 -0600

Francimore gravatar image

updated 2017-11-09 14:30:02 -0600

try this:

gazebo::physics::LinkPtr link=  _model->GetChildLink("Path::to::Link");
link->AddForce(gazebo::math::Vector3(x, y, z)); //for global force
link->AddRelativeForce(math::Vector3(x, y, z)); // for relative force depends on actual pose and angular

Path to your link you can find over the GUI or from SDF file

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-09-04 19:12:37 -0600

Seen: 4,291 times

Last updated: Nov 09 '17