Gazebo | Ignition | Community
Ask Your Question

How to set joint axis for both parts attached to a hinge?

asked 2017-05-01 15:00:46 -0500

dbrodeur gravatar image


I'm trying to implement an interface to a different physics engine than the four already available in Gazebo. In my case, an axis must be specified for each part attached to the joint. For instance, in the example tutorial "Making a mobile robot" found on the Gazebo website (its a differential-based robot with two motorized wheels), I would need to specify for both revolute joints, the axis on the wheel AND the axis on the chassis.

When I look at the code for the physics interface there is this method :

Joint::SetAxis(const unsigned int _index, const math::Vector3 &_axis)

which takes the axis value from the SDF and saves it into the physics engine data structure. My understanding is that the _index parameter gives me the part this axis is related to, but I can't see how to specify that index in an SDF, if it is possible.

If someone can tell me I am on the right direction or give me a hint about how to solve this, it will be truly appreciated!

Thanks to all!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-05-05 08:53:05 -0500

dbrodeur gravatar image

The _index parameter in any method from Joint class is for specifying the coordinate ID which is an unsigned int value less than GetAngleCount(). Thus, in the case of an Hinge, GetAngleCount() returns 1 and the only possible index value is 0.

In Hinge2, , GetAngleCount() returns 2 and the only possible index value are 0 and 1.

SetAxis has only one value per angle and it applies to both parts attached. If a different engines needs to specify different values, than an sdf tag like those for <ode>, <bullet>, etc. should be use to specify that particular property of the specific engine.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2017-05-01 15:00:46 -0500

Seen: 491 times

Last updated: May 05 '17