I wanted to hide certain objects or robots from the vision sensor. I enabled the explicit handling for the vision sensor and also made a collection for the objects that are wanted to be visible. The Lua Code I used is as follows:
Code: Select all
function sysCall_init()
-- do some initialization here
-- Collection defined as: <object1> + <object2> + <object3> + <object4>
local object1=sim.getObject('/Floor')
local object2=sim.getObject('/20cmHighWall100cm')
local object3=sim.getObject('/20cmHighWall100cm0')
local object4=sim.getObject('/20cmHighWall100cm1')
collectionHandle=sim.createCollection(0)
sim.addItemToCollection(collectionHandle,sim.handle_single,object1,0)
sim.addItemToCollection(collectionHandle,sim.handle_single,object2,0)
sim.addItemToCollection(collectionHandle,sim.handle_single,object3,0)
sim.addItemToCollection(collectionHandle,sim.handle_single,object4,0)
visionSensorHandle=sim.getObjectHandle(sim.handle_self)
end
function sysCall_sensing()
-- put your sensing code here
sim.checkVisionSensor(visionSensorHandle, collectionHandle)
end