Ask Your Question

Does Joint::GetForce() return the sum of all forces on the joint?

asked 2011-03-28 07:45:10 -0500

Jim Rothrock gravatar image

In Gazebo, does Joint::GetForce() return the last value specified by Joint::SetForce(), after clipping the value to the limit set by Joint::SetMaxForce()? Alternatively, does Joint::GetForce() return the sum of all forces on the joint? The comment in Joint.hh says only, "Get the force applied to an axis." I could not find any more documentation in . In fact, the documentation at that URL does not include Joint::GetForce(). I'm writing a Gazebo plug-in to steer a wheel on an autonomous vehicle, and want to know whether the force returned by Joint::GetForce() includes only the force my plug-in has applied to the wheel, or whether it also contains the force applied, for example, by a curb that the wheel has hit.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2011-03-29 04:47:06 -0500

hsu gravatar image

Joint::GetForce() has not been implemented, you will get back 0 in all instances. It might be worth a new ticket/patch to add an internal variable in each joint object to keep track of total forces added via ODEJoint::SetForce(...) calls and return the value when GetForce() is called.

Alternatively, you can also get back ODE's computed total force and torque applied on a body by calling ODEJoint::GetBodyForce(unsigned int) and ODEJoint::GetBodyTorque(unsigned int). The returned wrench will be the total force/torque applied to the body at each time step update due to gravity and constraints. Set <provideFeedback>True</provideFeedback> flag in the joint definition XML block to enable this feature. Please note that the returned value may need to be time averaged to be useful if the simulation is jittery.

edit flag offensive delete link more


Does this still apply in fuerte? Trying to use Link::GetRelativeForce(), GetWorldForce(), or Joint::GetForce gives me zeros while Joint::GetLinkForce() and GetLinkTorque() give seg faults...

mcevoyandy gravatar image mcevoyandy  ( 2012-07-26 12:46:59 -0500 )edit

also, is there an example of how to use this somewhere?

mcevoyandy gravatar image mcevoyandy  ( 2012-07-26 12:52:54 -0500 )edit

answered 2011-03-28 08:32:09 -0500

hsu gravatar image

Hi, I didn't see Joint::GetForce() in the recent gazebo repositories, which version are you using?

edit flag offensive delete link more


I am using C Turtle on Ubuntu 10.04 LTS. Joint::GetForce() is declared on line 144 of /opt/ros/cturtle/stacks/simulator_gazebo/gazebo/gazebo/include/gazebo/Joint.hh.
Jim Rothrock gravatar image Jim Rothrock  ( 2011-03-28 14:19:16 -0500 )edit

Your Answer

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

Add Answer

Question Tools



Asked: 2011-03-28 07:45:10 -0500

Seen: 673 times

Last updated: Mar 29 '11