Regular API function

simCheckVisionSensor / sim.checkVisionSensor

Description Checks whether the vision sensor detects the indicated entity. Detection is silent (no visual feedback) compared to sim.handleVisionSensor. The vision callback functions will be called on the acquired image. Also, the visibility state of the entity is overridden if the entity is an object. See also sim.readVisionSensor and sim.checkVisionSensorEx.
C/C++
synopsis
simInt simCheckVisionSensor(simInt sensorHandle,simInt entityHandle,simFloat** auxValues,simInt** auxValuesCount)
C/C++
parameters
sensorHandle: handle of the vision sensor object
entityHandle: handle of entity to detect (object or collection), or sim.handle_all to detect all detectable objects
auxValues: by default CoppeliaSim returns one packet of 15 auxiliary values:the minimum of intensity, red, green, blue, depth value, the maximum of intensity, red, green, blue, depth value, and the average of intensity, red, green, blue, depth value. Additional packets can be appended in the vision callback functions. AuxValues can be nullptr. The user is in charge of releasing the auxValues buffer with simReleaseBuffer(*auxValues).
auxValuesCount: contains information about the number of auxiliary value packets and packet sizes returned in auxValues. The first value is the number of packets, the second is the size of packet1, the third is the size of packet2, etc. Can be nullptr if auxValues is also nullptr. The user is in charge of releasing the auxValuesCount buffer with simReleaseBuffer(*auxValuesCount).

Usage example:
float* auxValues=nullptr; int* auxValuesCount=nullptr; float averageColor[3]={0.0f,0.0f,0.0f}; if (simCheckVisionSensor(sensorHandle,entityHandle,&auxValues,&auxValuesCount)>=0) { if ((auxValuesCount[0]>0)||(auxValuesCount[1]>=15)) { averageColor[0]=auxValues[11]; averageColor[1]=auxValues[12]; averageColor[2]=auxValues[13]; } simReleaseBuffer((char*)auxValues); simReleaseBuffer((char*)auxValuesCount); }
C/C++
return value
-1 if operation was not successful, otherwise 0 (no detection) or 1 (detection)
Lua
synopsis
int result,float[] auxiliaryValuePacket1,float[] auxiliaryValuePacket2, etc.=sim.checkVisionSensor(int sensorHandle,int entityHandle)
Lua
parameters
sensorHandle: handle of the vision sensor object
entityHandle: handle of entity to detect (object or collection), or sim.handle_all to detect all detectable objects
Lua
return values
result: 0 (no detection) or 1 (detection)
auxiliaryValuePacket1: default auxiliary value packet (same as for the C-function) (values in Lua are indexed from 1, not 0!)
auxiliaryValuePacket2: additional auxiliary value packet (e.g. from an image processing component)
auxiliaryValuePacket3: etc. (the function returns as many tables as there are auxiliary value packets)
Python
synopsis
int result,list auxiliaryValuePacket1,list auxiliaryValuePacket2, etc.=sim.checkVisionSensor(int sensorHandle,int entityHandle)

<