Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

A lot thanks to Ken, rock-ass.

Since I have succeeded in viewing 3D images in rgbdslam under your kindly help, I decide to show my commands here. I am not confident I am using ROS in the right way, but "comment" has words limit.

I am using a 3D camera with two "eyes" but only one USB line. 640x480 is the max resolution supported for single eye, but 640x480 with both eyes will not work because of USB bandwidth limit. so 352x288 is the max for stereo here.

All packages I used are: usb_cam, camera_calibration, camera_calibration_parsers, stereo_image_proc, image_view(optional), rgbdslam. usb_cam is the camera driver, and I used camera_calibration to calibrate my stereo cameras.

Open 1st terminal, run

roscore

Open 2nd terminal, run (drive the left eye)

rosparam set /stereo/left/video_device /dev/video2
rosparam set /stereo/left/image_width 352
rosparam set /stereo/left/image_height 288
rosparam set /stereo/left/pixel_format yuyv
rosparam set /stereo/left/camera_name left
rosrun usb_cam usb_cam_node /usb_cam:=/stereo/left/

Open 3rd terminal, run (drive the right eye)

rosparam set /stereo/right/video_device /dev/video1
rosparam set /stereo/right/image_width 352
rosparam set /stereo/right/image_height 288
rosparam set /stereo/right/pixel_format yuyv
rosparam set /stereo/right/camera_name right
rosrun usb_cam usb_cam_node /usb_cam:=/stereo/right/

Open 4th terminal, run (do calibration)

rosrun camera_calibration cameracalibrator.py --size 7x6 --square 0.049 left:=/stereo/left/image_raw right:=/stereo/right/image_raw left_camera:=/stereo/left right_camera:=/stereo/right --approximate=0.01 --no-service-check

notice that, before calibration, left and right camera will show warning messages saying cannot find some yaml files. that is ok at this point.

click "calibrate" button after it is enabled after taking 40 or more chessboard pictures. wait patiently. after quite a while, the calibration is done, check the epi value in top-right corner (let the camera see the chessboard again). if the epi is less than 2.5 it is acceptable, better value under 1.0. Then click "save". "commit" is a terrible button for me, because it will sometimes make my ubuntu reboot. just ignore the "commit" button.

"save" gives a /tmp/calibration.tar.gz(file name not sure). extract ost.txt out to /tmp/ost.ini, cut the ini file into two files manually half-half, for example /tmp/ost_left.ini and /tmp/ost_right.ini, then convert the ini files into yamls:

rosrun camera_calibration_parsers convert /tmp/ost_left.ini ~/.ros/camera_info/left.yaml
rosrun camera_calibration_parsers convert /tmp/ost_right.ini ~/.ros/camera_info/right.yaml

restart 2nd and 3rd terminal's command(ctrl+c and run again), this time there should be no warning messages

Open 5th terminal, run (mainly generate point cloud and disparity)

rosparam set /stereo/stereo_image_proc/approximate_sync true
ROS_NAMESPACE=stereo rosrun stereo_image_proc stereo_image_proc

the calibration must be done, or, stereo_image_proc will complain camera not calibrated

Open 6th terminal, run (showing left, right and disparity runtime images)

rosrun image_view stereo_view stereo:=stereo image:=image_rect _approximate_sync:=true

here is the chance to see disparity image, if the disparity is not good enough,it is a good idea to retry calibration with a larger chessboard (I got a low epi value after changing A4 chessboard to A3)

it seemed that image_view process must be killed before running rgbdslam.

Open 7th terminal, run

rosparam set /rgbdslam/config/camera_info_topic /stereo/left/camera_info
rosparam set /rgbdslam/config/wide_topic /stereo/left/image_rect_color
rosparam set /rgbdslam/config/wide_cloud_topic /stereo/points2
rosrun rgbdslam rgbdslam

/stereo/left/image_rect_color seems no different to /stereo/left/image_mono. press space key when rgbdslam window is active. if you see nothing, check if image_view is still running.

That is all I have done. but I am still confused with two questions:

1.the bottom-center image in rgbdslam window(where "waiting for depth image" showed before topic set), shows me a quite strange disparity image, with a vertical split line on it.

2.the 3D reconstruction process often stops, even I rotate the camera very slowly. that makes rgbdslam practically unusable for me.