Regular API function

simReadForceSensor
remote API equivalent: simxReadForceSensor
RosPlugin API equivalent: simRosReadForceSensor

Description Reads the force and torque applied to a force sensor (filtered values are read), and its current state ('unbroken' or 'broken'). See also simBreakForceSensor and simGetJointForce.
C synopsis simInt simReadForceSensor(simInt objectHandle,simFloat* forceVector,simFloat* torqueVector)
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 call to simHandleDynamics (e.g. inside of a joint control callback script, or inside of a general callback script).
forceVector: pointer to 3 values (applied forces along the sensor's x, y and z-axes). Can be NULL
torqueVector: pointer to 3 values (applied torques about the sensor's x, y and z-axes). Can be NULL
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)
bit 1 set (2): force sensor is broken, otherwise it is still intact ('unbroken')
Lua synopsis number result, table_3 forceVector,table_3 torqueVector=simReadForceSensor(number objectHandle)
Lua parameters
Same as C-function
Lua return values
result: -1 in case of an error, otherwise 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)

All regular API functions on one page