In the past, I wrote the code of the camera publishing depth according to the forum, but now I suddenly found a bug that caused me unable to use the camera sensor. Here's the question:
kinect_depth.lua
Code: Select all
function sysCall_init()
end
function sysCall_vision(inData)
-- callback function automatically added for backward compatibility
-- (vision sensor have no filters anymore, but rather a callback function where image processing can be performed)
local retVal={}
retVal.trigger=false
retVal.packedPackets={}
simVision.sensorDepthMapToWorkImg(inData.handle)
simVision.verticalFlipWorkImg(inData.handle)
simVision.intensityScaleOnWorkImg(inData.handle,1.000000,0.000000,false)
simVision.workImgToSensorDepthMap(inData.handle,false)
return retVal
end
The depth image is correct, but the point cloud shown by rviz is wrong.
Then, I modify the kinect_depth code:
Code: Select all
function sysCall_vision(inData)
-- callback function automatically added for backward compatibility
-- (vision sensor have no filters anymore, but rather a callback function where image processing can be performed)
local retVal={}
retVal.trigger=false
retVal.packedPackets={}
simVision.sensorImgToWorkImg(inData.handle)
--simVision.verticalFlipWorkImg(inData.handle)
simVision.workImgToSensorImg(inData.handle)
return retVal
end
The point cloud is opposite to the left and the right, and the depth image is opposite to the up and the down.
scene image: https://share.weiyun.com/5FAnIOs
In any case, the point cloud image shown by rviz is wrong. What is the problem? It feels like a bug in the software?