Regular API function

simCreateForceSensor / sim.createForceSensor

Description Creates a force sensor.
C synopsis simInt simCreateForceSensor(simInt options,const simInt* intParams,const simFloat* floatParams,const float* color)
C parameters
options: bit-coded options:
bit 0 set (1): force threshold enabled
bit 1 set (2): torque threshold enabled
intParams (input): 5 integer parameters:
intParams[0]: filter type (0=average, 1=median)
intParams[1]: value count the filter operates on
intParams[2]: number of consecutive threshold violation for the sensor to break
intParams[3]: reserved. Set to 0
intParams[4]: reserved. Set to 0
floatParams (input): 5 floating point parameters:
floatParams[0]: sensor size
floatParams[1]: force threshold value
floatParams[2]: torque threshold value
floatParams[3]: reserved. Set to 0.0
floatParams[4]: reserved. Set to 0.0
color: pointer to 2x4x3 values representing the various colors of the sensor ((part1, part2) x (ambient_diffuse rgb, 3 reserved values (set to zero), specular rgb and emission rgb)). Can be nullptr for default values
C return value
-1 if operation was not successful, otherwise the handle of the force sensor
Lua synopsis int sensorHandle=sim.createForceSensor(int options,table[5] intParams,table[5] floatParams,table[24] color=nil)
Lua parameters
Similar to the C-function counterpart
Lua return values
Similar to the C-function counterpart