Gazebo | Ignition | Community
Ask Your Question

Adding joints via plugin

asked 2016-06-16 07:41:52 -0600

cmc gravatar image

I'm doing some work involving four-bar linkages. I can create the model manually through an SDF file, but then I have to solve for the dependent angles manually every time I change the lengths of the links or the initial configuration. I'd like to write a plugin that would take the names of four bodies as arguments, then position them correctly and add revolute joints to form a four-bar mechanism, but I can't figure out how to add joints to a model from within a plugin. Does anybody know how to do this?

I'm using Gazebo 5.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-06-16 11:48:09 -0600

chapulina gravatar image

This answer has the steps to follow in order to create new joints for an existing model.

For your use case, I think it might also be worth it looking into generating SDF using embedded ruby templates. Here's an example model. That way, you can easily generate different models just by changing a few parameters.

edit flag offensive delete link more


Thank you, that is very helpful. While we're on the subject, one of the benefits of writing a plugin is that I could use Gazebo's Pose class to calculate the absolute positions/orientations of various bodies from their relative positions/orientations. Do you know of a straightforward way to handle this in Ruby?

cmc gravatar imagecmc ( 2016-06-20 06:50:06 -0600 )edit

Not sure if there's something equivalent to Gazebo poses, you might need to hand-write the math...

chapulina gravatar imagechapulina ( 2016-06-20 11:24:45 -0600 )edit

Thanks again for your help. I ended up writing a quaternion class in Ruby to handle spatial rotations. I've made it available in case anyone else is facing the same issue and would find it useful:

cmc gravatar imagecmc ( 2016-07-03 17:35:19 -0600 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2016-06-16 07:41:52 -0600

Seen: 120 times

Last updated: Jun 16 '16