ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Joint::GetType() in Gazebo 1.x

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

Jim Rothrock gravatar image

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
0

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

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

Question Tools

1 follower

Stats

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

Seen: 178 times

Last updated: Jul 16 '12