Hello,
I have a vision sensor in simulation and I know how to associate it with an RGB floating view, but I want to add another floating view to capture the vision sensor's live depth image, is there a way to do this?
Thank you!
Associate one vision sensor to two floating views (one for rgb and one for depth)
Re: Associate one vision sensor to two floating views (one for rgb and one for depth)
Hello,
you have 2 possibilities:
Cheers
you have 2 possibilities:
- the easiest would be to use a second vision sensor that only handles the depth, where the first one only handles the RGB
- the recommended one: use a secondary, passive vision sensor with the same resolution as the original, and associate it with the second floating view. Make sure that passive sensor is explicitly handled. Then, attached to your original vision sensor, use this code that simply copies the RGB to the passive sensor, and switches to the depth image, e.g.:
Code: Select all
function sysCall_init()
passiveSensor=sim.getObject('/passiveSensor')
end
function sysCall_vision(inData)
local rgb=sim.getVisionSensorCharImage(inData.handle)
sim.setVisionSensorCharImage(passiveSensor,rgb)
simVision.sensorDepthMapToWorkImg(inData.handle)
simVision.intensityScaleOnWorkImg(inData.handle,1.000000,0.000000,false)
simVision.workImgToSensorImg(inData.handle)
end