rtabmap+stereo camera+two web cam
hi all. i have two Microsoft webcams that use for stereo mapping and localization with rtabmap. my launch file for run these camera and use rtabmap is this:
<launch>
<arg name="rtabmapviz" default="true" />
<group ns="stereo">
<node name="left" pkg="usb_cam" type="usb_cam_node" output="screen" >
<param name="video_device" value="/dev/video0" />
<param name="image_width" value="640" />
<param name="image_height" value="480" />
<param name="pixel_format" value="yuyv" />
<param name="camera_frame_id" value="left" />
<param name="io_method" value="mmap"/>
<param name="camera_info_url" value="file:////home/zahra/Desktop/stereo/left.yaml"/>
</node>
<node name="right" pkg="usb_cam" type="usb_cam_node" output="screen" >
<param name="video_device" value="/dev/video1" />
<param name="image_width" value="640" />
<param name="image_height" value="480" />
<param name="pixel_format" value="yuyv" />
<param name="camera_frame_id" value="right" />
<param name="io_method" value="mmap"/>
<param name="camera_info_url" value="file:///home/zahra/Desktop/stereo/right.yaml"/>
</node>
<node name="stereo_image_proc" pkg="stereo_image_proc" type="stereo_image_proc" output="screen" >
<remap from="/stereo/left/image" to="/stereo/left/image_raw"/>
<remap from="/stereo/right/image" to="/stereo/right/image_raw"/>
<param name="prefilter_size" value="35"/>
<param name="prefilter_cap" value="11"/>
<param name="correlation_window_size" value="41"/>
<param name="min_disparity" value="-15"/>
<param name="disparity_range" value="128"/>
<param name="uniqueness_ratio" value="0.0"/>
<param name="texture_threshold" value="1000"/>
<param name="speckle_size" value="500"/>
<param name="speckle_range" value="16"/>
<param name="approximate_sync" value="true"/>
<param name="queue_size" value="5"/>
</node>
</group>
<node name="stereo_cam" pkg="image_view" type="stereo_view" output="screen" >
<param name="queue_size" value="2000" />
<param name="approximate_sync" value="True" />
<remap from="/stereo/left/image" to="/stereo/left/image_raw"/>
<remap from="/stereo/right/image" to="/stereo/right/image_raw"/>
</node>
<!-- rotate camera so z axis is up and x forward. -->
<arg name="pi/2" value="1.5707963267948966" />
<node pkg="tf" type="static_transform_publisher" name="camera_base_link" args="0 0 0 -$(arg pi/2) 0 -$(arg pi/2) camera_link stereo/left 100" />
<group ns="rtabmap">
<!-- Stereo Odometry -->
<node pkg="rtabmap_ros" type="stereo_odometry" name="stereo_odometry" output="screen">
<remap from="left/image_rect" to="/stereo/left/image_rect"/>
<remap from="right/image_rect" to="/stereo/right/image_rect"/>
<remap from="left/camera_info" to="/stereo/left/camera_info"/>
<remap from="right/camera_info" to="/stereo_camera/right/camera_info"/>
<param name="approx_sync" type="bool" value="true"/>
<param name="frame_id" type="string" value="camera_link"/>
<param name="odom_frame_id" type="string" value="odom"/>
<param name="queue_size" type="int" value="5"/>
</node>
<!-- Visual SLAM: args: "delete_db_on_start" and "udebug" -->
<node name="rtabmap" pkg="rtabmap_ros" type="rtabmap" output="screen" args="--delete_db_on_start">
<param name="frame_id" type="string" value="camera_link"/>
<param name="subscribe_stereo" type="bool" value="true"/>
<param name="subscribe_depth" type="bool" value="false"/>
<remap from="left/image_rect" to="/stereo/left/image_rect_color"/>
<remap from="right/image_rect" to="/stereo/right/image_rect"/>
<remap from="left/camera_info" to="/stereo/left/camera_info"/>
<remap from="right/camera_info" to="/stereo_camera/right/camera_info"/>
<remap from="odom" to="/rtabmap/odom"/>
<param name="approx_sync" type="bool" value="true"/>
<param name="queue_size" type="int" value="30"/>
</node>
<!-- Visualisation RTAB-Map -->
<node if="$(arg rtabmapviz)" pkg="rtabmap_ros" type="rtabmapviz" name="rtabmapviz" args="-d $(find rtabmap_ros)/launch/config/rgbd_gui.ini" output="screen">
<param name="subscribe_stereo" type="bool" value="true"/>
<param name="subscribe_odom_info" type="bool" value="true"/>
<param name="queue_size" type="int" value="10"/>
<param name="frame_id" type="string" value="camera_link"/>
<remap from="left/image_rect" to="/stereo/left/image_rect_color"/>
<remap from="right/image_rect" to="/stereo/right/image_rect"/>
<remap from="left/camera_info" to="/stereo/left/camera_info"/>
<remap from="right/camera_info" to="/stereo/right/camera_info"/>
<remap from="odom_info" to="/rtabmap/odom_info"/>
<remap from="odom" to="/rtabmap/odom"/>
<param name="frame_id" type="string" value="true"/>
<param name="queue_size" type="int" value="10"/>
<param name="subscribe_stereo" type="bool" value="true"/>
<param name="subscribe_odom_info" type="bool" value="true"/>
</node>
</group>
</launch>
but the launch file wasn't run and error is: [ WARN] [1509489284.298859011]: /rtabmap/stereoodometry: Did not receive data since 5 seconds! Make sure the input topics are published ("$ rostopic hz mytopic") and the timestamps in their header are set. /rtabmap/stereoodometry subscribed to (approx sync): /stereo/left/imagerect, /stereo/right/imagerect, /stereo/left/camerainfo, /stereocamera/right/camerainfo
can anyone help me?!
Asked by zahra.kh on 2017-10-31 14:25:44 UTC
Comments
Can you verify that topics that stereo_odometry is subscribed to are actually published? "
$ rostopic hz
"Asked by matlabbe on 2017-11-01 09:28:31 UTC
i changed my launch file : for <!-- Stereo Odometry --> ( ) , for <!-- Visual SLAM: ( ) and for
Asked by zahra.kh on 2017-11-02 00:33:34 UTC
<!-- rotate camera so z axis is up and x forward. --> (i changed stereo/left to left ) , but when run the error is:
Asked by zahra.kh on 2017-11-02 00:35:15 UTC
WARN Stereo.cpp:159::computeCorrespondences() A large number (374/382) of stereo correspondences are rejected!
Asked by zahra.kh on 2017-11-02 00:36:16 UTC
Optical flow may have failed, images are not calibrated, the background is too far (no disparity between the images) or maximum disparity may be too small (128).
Asked by zahra.kh on 2017-11-02 00:36:23 UTC
WARN OdometryF2M.cpp:386::computeTransform() Registration failed: "Not enough features in images (old=1, new=327, min=20)"
Asked by zahra.kh on 2017-11-02 00:36:48 UTC
It seems a calibration problem. Also, if the two webcams cannot be hardware synchronized, you can only use the cameras in static because disparity would change between left and right images while moving. Can you show a screenshot of left and right image side by side?
rosrun image_view stereo_view
Asked by matlabbe on 2017-11-03 08:01:18 UTC
See https://answers.ros.org/question/267915/rtabmap-non-overlapping-3d-cloud/
Asked by matlabbe on 2017-11-03 08:04:06 UTC
thanks matlabbe. also, i have one question. can i use two webcams for take left and right images from scene and then use rtabmap?
Asked by zahra.kh on 2017-11-03 14:03:34 UTC
i saw example at RTABMAP site that use stereo images from that save in file (link: https://github.com/introlab/rtabmap/wiki/Stereo-mapping#process-a-directory-of-stereo-images-in-ros). my qustion is, how can create left.yaml and right.yaml calibrated file?
Asked by zahra.kh on 2017-11-03 14:09:29 UTC
i must be calibrated left and right camera separate or no?
Asked by zahra.kh on 2017-11-03 14:11:19 UTC
Look at this tutorial: http://wiki.ros.org/camera_calibration/Tutorials/StereoCalibration, then calibration parameters can be copied in yaml files used by rtabmap.
Asked by matlabbe on 2017-11-03 18:48:12 UTC
thanks matlabbe
Asked by zahra.kh on 2017-11-04 03:06:23 UTC