ROS Resources: Documentation | Support | Discussion Forum | Service Status | Q&A
Ask Your Question

Joint::GetType() in Gazebo 1.x

asked 2012-07-09 11:08:17 -0600

I am porting a Gazebo 0.x plug-in to Gazebo 1.x. In the 0.x version, I had some code like this:

if (joint->GetType() == Joint::HINGE) doSomething();

For the 1.x plug-in, I replaced the code with this:

if (joint->GetType() == Joint::HINGE_JOINT) doSomething();

However, doSomething was never called. I ended up having to use this:

if (joint->GetType() == Joint::JOINT | Joint::HINGE_JOINT) doSomething();

Is plug-in code now supposed to test individual bits of the value returned by Joint::GetType()? For example, should the plug-in now do this:

if (joint->GetType() & Joint::HINGE_JOINT) doSomething();

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2012-07-16 10:40:43 -0600

hsu gravatar image

Using the binary AND-operator (&) should work, but you can also use Joint::HasType() to test joint type, for example:

if (joint->HasType(Joint::HINGE_JOINT)) doSomething();
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2012-07-09 11:08:17 -0600

Seen: 90 times

Last updated: Jul 16 '12