Regular API function

simGetVisionSensorDepth / sim.getVisionSensorDepth

Description Reads the depth buffer of a vision sensor. The returned data doesn't make sense if sim.handleVisionSensor wasn't called previously (sim.handleVisionSensor is called by default in the main script if the vision sensor is not tagged as explicit handling). See also other vision sensor related API functions
C/C++
synopsis
simFloat* simGetVisionSensorDepth(simInt sensorHandle,simInt options,const simInt* pos,const simInt* size,simInt* resolution)
C/C++
parameters
sensorHandle: handle of the vision sensor
options: options, bit-coded:
bit0 set (1): the returned values indicate distances in meters, otherwise return values are in the range of 0-1 (0=closest to sensor (i.e. close clipping plane), 1=farthest from sensor (i.e. far clipping plane))
pos: position of the depth buffer portion to retrieve. Can be nullptr, which defaults to {0,0}
size: size of the depth buffer portion to retrieve. Can be nullptr, which defaults to {0,0}, which corresponds to {resolutionX,resolutionY}
resolution: the returned vision sensor resolution. Can be nullptr
C/C++
return value
the depth buffer or nullptr in case of an error. The user is in charge of releasing the returned buffer with simReleaseBuffer
Lua
synopsis
buffer depth,int[2] resolution=sim.getVisionSensorDepth(int sensorHandle,int options=0,int[2] pos={0,0},int[2] size={0,0})
Lua
parameters
sensorHandle: handle of the vision sensor
options: options, bit-coded:
bit0 set (1): the returned values indicate distances in meters, otherwise return values are in the range of 0-1 (0=closest to sensor (i.e. close clipping plane), 1=farthest from sensor (i.e. far clipping plane))
pos: position of the depth buffer portion to retrieve. Defaults to {0,0}
size: size of the depth buffer portion to retrieve. Defaults to {0,0}, which corresponds to {resolutionX,resolutionY}
Lua
return values
depth: the depth buffer. Use sim.unpackFloatTable to obtain a table of float values
Python
synopsis
bytes depth=sim.getVisionSensorDepth(int sensorHandle,int options=0,list pos=[0,0],list size=[0,0])