Kinect PointCloud values [closed]
Hello, I'm using depth/points topic published by kinect controller gazebo_ros_openni_kinect. My problem is that, even if an obstacle is set at distance 2.0, selecting the minimum depth point (no other obstacles in the scene) it always returns 1.0 depth (and relatives x-y coords). Now, all these coords should be in meters, so I can't reach my objective of obtaining the coord of the mimimum depth point in the scene (for obstacle avoidance purposes). Thank you.
EDIT: An other big problem is that, moving the robot, this depth measurement changes only when it is really close to the obstacle! How can I solve it?
EDIT #2: The .xacro of the kinect is:
<gazebo reference="objective">
<sensor:camera name="cam_sensor">
<updateRate>20.0</updateRate>
<!-- <imageFormat>B8G8R8</imageFormat>-->
<imageSize>640 480</imageSize>
<hfov>58</hfov>
<nearClip>0.1</nearClip>
<farClip>100</farClip>
<controller:gazebo_ros_openni_kinect name="kin_controller" plugin="libgazebo_ros_openni_kinect.so">
<frameName>generic_camera_link</frameName>
<cameraName>kinect</cameraName>
<alwaysOn>true</alwaysOn>
<!-- <CxPrime>320</CxPrime>-->
<!-- <Cx>320</Cx>-->
<!-- <Cy>240</Cy>-->
<!-- <focal_length>320</focal_length> <! image_width / (2*tan(hfov_radian /2)) >-->
<imageTopicName>rgb/image</imageTopicName>
<cameraInfoTopicName>rgb/camera_info</cameraInfoTopicName>
<depthImageTopicName>depth/image</depthImageTopicName>
<depthImageCameraInfoTopicName>depth/camera_info</depthImageCameraInfoTopicName>
<pointCloudTopicName>points</pointCloudTopicName>
<pointCloudCutoff>0.5</pointCloudCutoff>
</controller:gazebo_ros_openni_kinect>
</sensor:camera>
which is included in another .xacro file (and then in a .launch):
<kinectSensor parent="chassis_link"><origin xyz="0.05 0 ${chassis_height+topTable_height+topCyl_height+laserCylHeight+laserBaseSide+0.015}" rpy="0 0 0"/></kinectSensor>
EDIT #3: Could it be the plane on which the obstacle and the robot stay which always gives depth = 1.0? How can I solve, if it is the problem?
EDIT #4: That's what I obtain from rviz: http://imageshack.us/photo/my-images/27/screenshotxyt.png/ It seems everything has the same depth... and the floor is a big problem!
Could the problem be that you have Kinect on a robot at the height of 1m and you query for the depth in the Z coordinate of the base_link frame where that Z is constantly 1m? Which launch file are you using?
No, because my kinect is at height 0.71 and I'm considering the z in the point cloud frame (which should be the depth). Furthermore, as I said, the Z values changes only when I'm really close to the obstacle (for example: when i'm going to touch the obstacle I obtain 0.58 for Z).
To me the xacro file looks OK. Can you visualize the robot and the point cloud in rviz? As a last resort, could provide the whole code (best as a ROS package)?
rviz crashes with segmentation fault, even if (as I found) delete the HOME/.rviz directory. I'm not sure I can provide the whole code, it doesn't depend on me.
Ok, some news: I solved the problem with rviz. I tried to subscribe many different topics from my kinect: /kinect/rgb/image works perfectly. From /kinect/depth/image I obtain only a NO IMAGE error (why?!). From /kinect/points I obtain only a little box which never changes even if the robot moves.
I am really not sure what is going on your side. I ran the roslaunch pr2_gazebo pr2_empty_world.launch today and these are the resulting point cloud and depth image that I get in rviz: http://imageshack.us/a/img19/5182/kinectgazeboplugin.png.
Maybe you can try and follow that pr2_empty_world.launch and see how they include their Kinect sensor. I think that in the end the following file gets included: <include filename="$(find pr2_description)/urdf/sensors/kinect_prosilica_camera.urdf.xacro" />
I really don't know, it's completely different. However, the real strange thing is that my max depth value is 1.0!