Regular API function

simGetJointForce
remote API equivalent: simxGetJointForce
RosPlugin API equivalent: simRosGetJointState

Description Retrieves the force or torque applied to a joint along/about its active axis. This function retrieves meaningful information only if the joint is prismatic or revolute, and is dynamically enabled. With the Bullet engine, this function returns the force or torque applied to the joint motor (torques from joint limits are not taken into account). With the ODE and Vortex engine, this function returns the total force or torque applied to a joint along/about its z-axis. See also simSetJointForce and simReadForceSensor.
C synopsis simInt simGetJointForce(simInt jointHandle,simFloat* forceOrTorque)
C parameters
jointHandle: handle of the joint. Can be combined with sim_handleflag_rawvalue (simply add sim_handleflag_rawvalue to jointHandle), if you wish to access the raw values generated by each individual dynamic simulation step (by default, there are 10 dynamic simulation steps for each simulation step). Raw values can only be accessed from inside a call to simHandleDynamics (e.g. inside of a joint control callback script, or inside of a general callback script).
forceOrTorque: the force or the torque applied to the joint along/about its z-axis.
C return value
-1 if operation was not successful. 0 if no value is available yet (e.g. when simHandleDynamics hasn't yet handled that joint), otherwise a value >0.
Lua synopsis number forceOrTorque=simGetJointForce(number jointHandle)
Lua parameters
Same as C-function
Lua return values
forceOrTorque: the force or the torque applied to the joint along/about its z-axis, or nil in case of an error, or if no value is available yet.

All regular API functions on one page