0
$\begingroup$

Rosanswers logo

Hi

Im using two point Grey Chameleon3 mono camera set up as Master Salve and synchronized so can work as stereo camera. I have a installed ROS driver and able to publish the camera topics . Im using this ROS driver https://github.com/KumarRobotics/flea3. And

roslaunch flea3 stereo_node.launch left:=13344889 right:=14472242 for stereo camera/ 

then with

ROS_NAMESPACE=stereo rosrun stereo_image_proc stereo_image_proc

can rectify the stereo image , and can be seen with

rosrun image_view stereo_view stereo:=/stereo image:=image_rect_color

Then tried to use this rtabmap_ros launch file.

<launch>
  <!-- Run the ROS package stereo_image_proc for image rectification and disparity computation -->
  <group ns="stereo">
    <node pkg="stereo_image_proc" type="stereo_image_proc" name="stereo_image_proc"/>

    <!-- Disparity to depth -->
    <node pkg="nodelet" type="nodelet" name="disparity2depth" args="standalone rtabmap_ros/disparity_to_depth"/>
  </group>

 <!-- Rotate the camera frame. -->
  <arg name="pi/2" value="1.5707963267948966" />
  <arg name="optical_rotate" value="0 0 0 -$(arg pi/2) 0 -$(arg pi/2)" />
  <node pkg="tf" type="static_transform_publisher" name="camera_base_link"
  args="$(arg optical_rotate) base_link stereo_camera 100" />  

  <group ns="rtabmap">
    <!-- Visual SLAM -->
    <node name="rtabmap" pkg="rtabmap_ros" type="rtabmap" output="screen" args="--delete_db_on_start">
      <param name="subscribe_depth" type="bool" value="true"/>
      <param name="subscribe_laserScan" type="bool" value="false"/>

      <remap from="rgb/image"       to="/stereo/left/image_rect"/>
      <remap from="rgb/camera_info" to="/stereo/left/camera_info"/>
      <remap from="depth/image"     to="/stereo/depth"/>

      <remap from="odom" to="/stereo_odometer/odometry"/>

      <param name="frame_id" type="string" value="/base_link"/>
      <param name="queue_size" type="int" value="30"/>

      <param name="Rtabmap/TimeThr" type="string" value="700"/>
      <param name="SURF/HessianThreshold" type="string" value="600"/>
      <param name="Vis/MaxDepth" type="string" value="12"/>
      <param name="Vis/MinInliers" type="string" value="10"/>
      <param name="Vis/InlierDistance" type="string" value="0.05"/>
    </node>
  </group>
</launch>

i can not see any map. I got this warnings

[ WARN] [1533288718.609296364]: /rtabmap/rtabmap: Did not receive data since 5 seconds! Make sure the input topics are published ("$ rostopic hz my_topic") and the timestamps in their header are set. If topics are coming from different computers, make sure the clocks of the computers are synchronized ("ntpdate"). If topics are not published at the same rate, you could increase "queue_size" parameter (current=30).
/rtabmap/rtabmap subscribed to (approx sync):
   /stereo_odometer/odometry,
   /stereo/left/image_rect,
   /stereo/depth,
   /stereo/left/camera_info

So, when rostopic hz to each topic rtabmap is subscribed to I got these:

rostopic hz /stereo_camera/right/image_rect
subscribed to [/stereo_camera/right/image_rect]
average rate: 7.658
    min: 0.118s max: 0.156s std dev: 0.01260s window: 7

.......

 rostopic hz  /rtabmap/odom_info
    subscribed to [/rtabmap/odom_info]
    no new messages
    no new messages

.......

rostopic hz  /odom
subscribed to [/odom]
no new messages
no new messages
no new messages

Also I got this warnings now after change the camera name in my ROS driver. It was camera and now is stereo_camera.

[ WARN] [1533529654.855086737]: odometry: Could not get transform from base_link to /stereo_camera/left (stamp=1533529651.500643) after 3.200000 seconds ("wait_for_transform_duration"=3.200000)! Error="canTransform: source_frame stereo_camera/left does not exist.. canTransform returned after 3.21201 timeout was 3.2."
[ WARN] [1533529657.531269291]: /rtabmap/rtabmap: Did not receive data since 5 seconds! Make sure the input topics are published ("$ rostopic hz my_topic") and the timestamps in their header are set. If topics are coming from different computers, make sure the clocks of the computers are synchronized ("ntpdate"). If topics are not published at the same rate, you could increase "queue_size" parameter (current=10).
/rtabmap/rtabmap subscribed to (approx sync):
   /odom,
   /stereo_camera/left/image_rect_color,
   /stereo_camera/right/image_rect,
   /stereo_camera/left/camera_info,
   /stereo_camera/right/camera_info,
   /rtabmap/odom_info

After run $ rosrun tf view_frames I got this.
Is missing map->odom->. Any help?

image description

I modified the launch file like this

launch>
<arg name="pi/2" value="1.5707963267948966" />
<arg name="optical_rotate" value="0 0 0 -$(arg pi/2) 0 -$(arg pi/2)" />
<node pkg="tf" type="static_transform_publisher" name="camera_base_link"
args="$(arg optical_rotate) base_link stereo_camera/left 400" />  

<!-- Run the ROS package stereo_image_proc -->
<group ns="/stereo_camera" >
    <node pkg="stereo_image_proc" type="stereo_image_proc" name="stereo_image_proc"/>

    <!-- Odometry -->
    <node pkg="rtabmap_ros" type="stereo_odometry" name="stereo_odometry" output="screen">
        <remap from="left/image_rect"       to="left/image_rect"/>
        <remap from="right/image_rect"      to="right/image_rect"/>
        <remap from="left/camera_info"      to="left/camera_info"/>
        <remap from="right/camera_info"     to="right/camera_info"/>

        <param name="frame_id" type="string" value="base_link"/>
        <param name="odom_frame_id" type="string" value="odom"/>
        <param name="approx_sync" type="bool" value="false"/>
        <param name="queue_size" type="int" value="30"/>

        <param name="Odom/InlierDistance" type="string" value="0.1"/>
        <param name="Odom/MinInliers" type="string" value="10"/>
        <param name="Odom/RoiRatios" type="string" value="0.03 0.03 0.04 0.04"/>
        <param name="Odom/MaxDepth" type="string" value="4"/>
    </node>     
</group>

<group ns="rtabmap">   
  <node name="rtabmap" pkg="rtabmap_ros" type="rtabmap" output="screen" args="--delete_db_on_start">
     <param name="frame_id" type="string" value="base_link"/>
     <param name="subscribe_stereo" type="bool" value="true"/>
     <param name="subscribe_depth" type="bool" value="false"/>
     <param name="stereo_approx_sync" type="bool" value="false"/>

     <remap from="left/image_rect" to="/stereo_camera/left/image_rect_color"/>
     <remap from="right/image_rect" to="/stereo_camera/right/image_rect"/>
     <remap from="left/camera_info" to="/stereo_camera/left/camera_info"/>
     <remap from="right/camera_info" to="/stereo_camera/right/camera_info"/>

     <remap from="odom" to="/stereo_camera/odom"/>

     <!-- RTAB-Map's parameters -->
     <param name="Rtabmap/TimeThr" type="string" value="700"/>
     <param name="Rtabmap/DetectionRate" type="string" value="20"/>

     <param name="Vis/MinInliers" type="string" value="20"/>
     <param name="Vis/InlierDistance" type="string" value="0.1"/>
</node>
<!-- Visualisation RTAB-Map -->
  <node 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="30"/>
     <param name="frame_id" type="string" value="base_link"/>
     <remap from="left/image_rect" to="/stereo_camera/left/image_rect_color"/>
     <remap from="right/image_rect" to="/stereo_camera/right/image_rect"/>
     <remap from="left/camera_info" to="/stereo_camera/left/camera_info"/>
     <remap from="right/camera_info" to="/stereo_camera/right/camera_info"/>
     <remap from="odom_info" to="/stereo_camera/odom_info"/>
     <remap from="odom" to="/stereo_camera/odom"/>
  </node>
 </group>

<node if="$(arg rviz)" pkg="rviz" type="rviz" name="rviz" args="-d $(find rtabmap_ros)/launch/config/demo_stereo_outdoor.rviz"/>
</launch>

and the TF is image description

Now the warnings and error are:

[

ERROR] (2018-08-08 16:50:17.812) Rtabmap.cpp:1003::process() RGB-D SLAM mode is enabled, memory is incremental but no odometry is provided. Image 689 is ignored!
[ INFO] [1533718217.812498232]: rtabmap (10): Rate=0.05s, Limit=0.700s, RTAB-Map=0.0001s, Maps update=0.0000s pub=0.0000s (local map=1, WM=1)
[ WARN] (2018-08-08 16:50:17.905) Stereo.cpp:160::computeCorrespondences() A large number (853/1000) of stereo correspondences are rejected! Optical flow may have failed because images are not calibrated, the background is too far (no disparity between the images), maximum disparity may be too small (128.000000) or that exposure between left and right images is too different.
[ WARN] [1533718217.912578258]: Could not get transform from odom to base_link after 0.200000 seconds (for stamp=1533718217.464278)! Error="Lookup would require extrapolation into the future.  Requested time 1533718217.464277837 but the latest data is at time 1533718214.530658937, when looking up transform from frame [base_link] to frame [odom]. canTransform returned after 0.200917 timeout was 0.2.".
[ WARN] (2018-08-08 16:50:17.945) OdometryF2M.cpp:472::computeTransform() Registration failed: "Too low inliers after bundle adjustment: 2<10"
[ INFO] [1533718217.946355427]: Odom: quality=2, std dev=0.000000m|0.000000rad, update time=0.115976s

This is the output of rosrun image_view image_view image:=/stereo/left/image_rect_color

image description image description image description


Originally posted by Astronaut on ROS Answers with karma: 330 on 2018-08-03

Post score: 0


Original comments

Comment by matlabbe on 2018-08-03:
Can you do rostopic hz on each topic that rtabmap is subscribed to? You may also want to set approx_sync to false if left, depth and odometry messages have exactly the same stamps (to avoid synchronization issues).

Comment by Astronaut on 2018-08-05:
I edit the comments. Now got different warnings. Is it synchronization problem or? So basically no odometry topic is subscribed. Why?But still no map can show. Im holding the cameras so there is no robot. I just would like to have the map first , so which parameter need to set?

Comment by matlabbe on 2018-08-06:
Show TF tree: $ rosrun tf view_frames. rtabmap won't start if odometry cannot be computed. In your case, odometry is failing because there is a missing TF.

Comment by Astronaut on 2018-08-07:
I run $ rosrun tf view_frames. I edit the comments is missing map->odom->base_link->camera. Is missing map->odom->. Any help?

Comment by matlabbe on 2018-08-07:
Where does camera_link -> base_link coming from? base_link should be the root of the robot, as frame_id is set to it. Your left image topic is publishing under /stereo_camera/left frame, which doesn't exist. For the camera_base_link, you may set base_link /stereo_camera/left instead

Comment by vinaykumarhs2020 on 2018-08-07:
Your launch file <remap from="odom" to="/stereo_odometer/odometry"/>. Are you starting stereo_odometry node from outside this launch file? Check if odom source is publishing correctly.

And as @matlabbe mentioned, camera_link->base_link tf sounds bit confusing. Please check your tf tree is clean.

Comment by Astronaut on 2018-08-08:
ok . I change it and edit the comments, The TF tree looks clean now. But I have thee problem still building the map. As I said I dont have the robot , just holding the cameras and would like to build the map while walking with the cameras in my hand

Comment by matlabbe on 2018-08-08:
This tutorial is about hand-held stereo mapping.

Comment by Astronaut on 2018-08-13:
Im not using Bumblebee2 either ZED. Im still not clear following the hand-held stereo mapping tutorial which parameters need to be set . Do I need The camera1394stereo node ? I dont know what parameters to change in my launch file to make it work

Comment by matlabbe on 2018-08-14:
No, camera1394stereo node is just an example of a stereo driver. As said in the first point in section 2 of the tutorial, your stereo driver node should publish left/image_raw, right/image_raw, left/camera_info and left/camera_info. Read http://wiki.ros.org/stereo_image_proc

Comment by matlabbe on 2018-08-14:
Following http://wiki.ros.org/stereo_image_proc, can you add to your question a screenshot of rosrun image_view stereo_view stereo:=/stereo image:=image_rect_color? If your images are not correctly rectified, follow http://wiki.ros.org/camera_calibration/Tutorials/StereoCalibration

Comment by Astronaut on 2018-08-15:
ok. added. thanks looks like they are not rectified.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

There is a problem about stereo calibration. Based on the rosbag of the outdoor stereo demo here, the rectified images and disparity images (outputs of stereo_image_proc) should look more like this:

$ rosrun image_view stereo_view stereo:=stereo_camera image:=image_rect_color

image description

Look how dense is the disparity image. The following are the raw images (there are some distortions: lines are not straight like the rectified above) and camera_info used as inputs to stereo_image_proc:

image description

Left camera_info:

header: 
  seq: 844
  stamp: 
    secs: 1415737755
    nsecs: 627326965
  frame_id: stereo_camera
height: 480
width: 640
distortion_model: plumb_bob
D: [-0.344858300062205, 0.131731614744127, -0.00032220157418798, -0.000178643627395838, 0.0]
K: [520.84106910681, 0.0, 320.207922533597, 0.0, 520.652683004955, 251.69140630101, 0.0, 0.0, 1.0]
R: [0.999977409119708, -0.00542294021453702, -0.00397151981806852, 0.00542696944573559, 0.999984769417176, 0.00100445821860056, 0.00396601221263954, -0.00102598884371095, 0.999991609011807]
P: [487.608731712861, 0.0, 318.1162109375, 0.0, 0.0, 487.608731712861, 249.44425201416, 0.0, 0.0, 0.0, 1.0, 0.0]
binning_x: 1
binning_y: 1
roi: 
  x_offset: 0
  y_offset: 0
  height: 480
  width: 640
  do_rectify: False

Right camera_info:

header: 
  seq: 844
  stamp: 
    secs: 1415737755
    nsecs: 627326965
  frame_id: stereo_camera
height: 480
width: 640
distortion_model: plumb_bob
D: [-0.350198880846778, 0.143262162037345, -0.000540958577710845, -0.000386869942974346, 0.0]
K: [525.042672813, 0.0, 315.778978739153, 0.0, 524.605377865008, 246.116481979902, 0.0, 0.0, 1.0]
R: [0.999991166299663, -0.00384047779504094, 0.00170823094047773, 0.00384221006573169, 0.999992106658553, -0.00101194980141688, -0.0017043310860856, 0.0010185042442697, 0.999998028950384]
P: [487.608731712861, 0.0, 318.1162109375, -58.3626989865376, 0.0, 487.608731712861, 249.44425201416, 0.0, 0.0, 0.0, 1.0, 0.0]
binning_x: 1
binning_y: 1
roi: 
  x_offset: 0
  y_offset: 0
  height: 480
  width: 640
  do_rectify: False

I thus recommend to carefully follow the stereo calibration tutorial to get similar results like above with a dense disparity image. Make sure your camera driver publishes the camera_info created from the stereo calibration so that stereo_img_proc can correctly rectify the raw images. Without that dense disparity image, you won't be able to create a 3D map as rtabmap is using the same algorithm (cv::StereoBM) than stereo_img_proc to create the disparity image used to create the clouds.


Originally posted by matlabbe with karma: 6409 on 2018-08-15

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.