Regular API function

simReadForceSensor / sim.readForceSensor

Description Reads the force and torque applied to a force sensor (filtered values are read). See also sim.getJointForce.
C/C++
synopsis
simInt simReadForceSensor(simInt objectHandle,simFloat* forceVector,simFloat* torqueVector)
C/C++
parameters
objectHandle: handle of the object (must be a force sensor). Can be combined with sim.handleflag_rawvalue (simply add sim.handleflag_rawvalue to objectHandle), 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 callback function triggered by the physics engine.
forceVector: pointer to 3 values (applied forces along the sensor's x, y and z-axes). Can be nullptr
torqueVector: pointer to 3 values (applied torques about the sensor's x, y and z-axes). Can be nullptr
C/C++
return value
-1 in case of an error, otherwise bit-coded:
bit 0 set (1): force and torque data is available, otherwise it is not (yet) available (e.g. when not enough values are present for the filter)
Lua
synopsis
int result, float[3] forceVector,float[3] torqueVector=sim.readForceSensor(int objectHandle)
Lua
parameters
Similar to the C-function counterpart
Lua
return values
result: bit-coded (same as for the C-function return value)
forceVector: table holding 3 values (applied forces along the sensor's x, y and z-axes)
torqueVector: table holding 3 values (applied torques about the sensor's x, y and z-axes)
Python
synopsis
int result, list forceVector,list torqueVector=sim.readForceSensor(int objectHandle)

<