Gazebo | Ignition | Community
Ask Your Question

GetAngleImpl fails on Revolute2 joints

asked 2012-11-17 21:22:22 -0500

cga gravatar image

updated 2013-01-09 16:09:56 -0500

nkoenig gravatar image

I gather that GetAngleImpl should be used to get the first angle of a revolute2 joint.

In that leads to a call to dJointGetHinge2Angle1(), which looks like the right helper function to calculate this angle.

However, in physics/Joint.hh GetAngleImpl seems to be wiped out:

    `protected: virtual math::Angle GetAngleImpl(int _index) const = 0;`

This leads to the following compiler complaint when I try to invoke GetAngleImpl():

`joint_state.position[0] = this->front_left_joint->GetAngleImpl( 0 ).Radian();`

gets the compiler error message:

`/usr/include/gazebo-1.2/gazebo/physics/Joint.hh: In member function ‘void gazebo::ROSModelPlugin::OnUpdate()’:`

`/usr/include/gazebo-1.2/gazebo/physics/Joint.hh:228:38: error: ‘virtual gazebo::math::Angle gazebo::physics::Joint::GetAngleImpl(int) const’ is protected`

/home/cga/drc-cmub/gazebo/models/car/ error: within this context

this->front_left_joint is a revolute2 joint. I can get velocities, but not positions.

Thanks, Chris

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2012-11-21 08:55:38 -0500

Erik Stoltenborg gravatar image

You can not use protected functions like that.

To get the angle(s), use gazebo::physics::joint::GetAngle(int _index).

Alternatively you can just get the child link ptr, to get the link pose (e.g.: GetChild()->GetPose().rot.GetAsEuler().x)).

edit flag offensive delete link more


I do not think ODEHinge2Joint::GetAngleImpl(...) is fully implemented. If you look at the source, it does not report the angles at all (it tries calculating for first axis only, then just returns zero).

eacousineau gravatar imageeacousineau ( 2013-01-03 01:25:11 -0500 )edit

It's fully implemented in the latest version of gazebo.

nkoenig gravatar imagenkoenig ( 2013-07-23 16:59:24 -0500 )edit
Login/Signup to Answer

Question Tools


Asked: 2012-11-17 21:22:22 -0500

Seen: 295 times

Last updated: Jan 09 '13