Gazebo | Ignition | Community
Ask Your Question

How getvelocity function works ?

asked 2015-05-13 06:58:05 -0600

akshay5059 gravatar image

I wanted to get the velocity of a joint of my model using GetVelocity() function but can anyone tell me how to use this function. I saw this link Here I found the description but I am still not able to figure out how it works because they have mentioned that in parameters you have to give int value but how can I tell gazebo which joint's velocity do I need to know in this way? Shouldn't I give the whole name of the joint ?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2015-05-14 02:37:37 -0600

scpeters gravatar image

The index should be zero for any single-axis joints (revolute or prismatic), and can be 0 or 1 for 2-axis joints like universal.

edit flag offensive delete link more

answered 2015-05-13 15:45:34 -0600

JS gravatar image

If you want to get the velocity of a joint, you first need to get the joint pointer from your model using Model::GetJoint() by passing the joint name you want to get the velocity. Then Joint::GetVelocity(int index) will return the velocity of a specific dof in the joint. This index is for the joint that contains multiple dofs in the joints like HingeJoint, UniversalJoint, and BallJoint. Note that passing invalid index would return 0 value for the velocity.

edit flag offensive delete link more


Thank you JS for the information. You said that we need joint pointer but when I revisited the link I have mentioned in my question, I found out that in this case, we would rather need Base Pointer in constructor of gazebo::physics::Joint. Can you tell me what base pointer is and how to get it ?

akshay5059 gravatar imageakshay5059 ( 2015-05-19 09:07:01 -0600 )edit

I made a gazebo::physics::JointPtr to store my joint objects.

lrupert1 gravatar imagelrupert1 ( 2018-05-21 14:36:14 -0600 )edit

Question Tools


Asked: 2015-05-13 06:58:05 -0600

Seen: 2,944 times

Last updated: May 14 '15