0
$\begingroup$

Rosanswers logo

Hi, I just started using Rtabmap and I'm having an unexpected 2D occupancy grid map. First, here are the parameters I'm setting in the launch file:

parameters=[{
      'frame_id':'base_link',
      'subscribe_depth':False,
      'subscribe_rgbd':False,
      'subscribe_stereo':True,
      'map_empty_ray_tracing':True,
      'map_always_update':True,
      'approx_sync':False}]

Here is my output in the 'Rtarviz' viewer. There is the 3D map, which honestly, I don't need it - the 2D grid map is all I'm interested in. By the way, the 3D map generated is duplicated, any idea why this is happening?

image description

I subscribed to the topic '/map' in Rviz, then the map generated starts detecting the wall pretty well, but then all became black. . image description

This is a virtual scene, the simple as possible, and with lots of features to be detected (sample of the frames can be observed on the left side). By the way, the ray tracer option is set to true, but no ray is forming... =/

Thanks in advance!


Originally posted by mirella melo on ROS Answers with karma: 194 on 2020-10-15

Post score: 0


Original comments

Comment by matlabbe on 2020-10-17:
can you share the resulting database (~/.ros/rtabmap.db)? It could be that there is a missing optical transformation for the camera. If rtabmap thinks the camera is looking up, it may add only obstacles.

Comment by mirella melo on 2020-10-17:
Sure! i just added to this link. Let me know anything else. Thanks for your time!

Comment by matlabbe on 2020-10-20:
The quaternion looks ok. The Tf tree seems odd to me though, you have map -> base_link -> camera_link, but it should be more like map -> odom -> base_link -> camera_link. Make sure you set map fixed frame in global options of rviz to correctly visualize in map referential. Which odometry node are you using?

Comment by mirella melo on 2020-10-20:
Yes, the fixed frame is set to map. Regarding my node: I was publishing the odometry in the topic /odom, but just now I also added a TransformBroadcaster. I updated the main question again due to space in here. Thanks!

Comment by matlabbe on 2020-10-20:
odom->base_link should be published by an odometry node, not a static transform unless the robot is not moving.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

The problem is that there is a missing optical rotation. rtabmap thinks the camera is looking up. image description

The frame_id is set to camera_link. I don't know if it is on a robot or it is a single camera in simulation, for a robot, you may add in the URDF the optical rotation. Otherwise if camera_link is your only frame, in ros1 we would add a static transform publisher in the launch file like this:

<node pkg="tf" type="static_transform_publisher" name="camera_optical_rotation"
        args="0 0 0 -1.5707963267948966 0 -1.5707963267948966 base_link camera_link 100" /> 

Then use frame_id set to base_link for rtabmap node.


Originally posted by matlabbe with karma: 6409 on 2020-10-17

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by mirella melo on 2020-10-18:
Thank you for answering! I'm using ROS2, and I added to my launch file.:

        Node(
             package='tf2_ros', node_executable='static_transform_publisher',
             arguments=["0.0", "0.0", "0.0", "-1.57.0", "0.0", "-1.57", "base_link", "camera_link"]

Then, the error Could not convert stereo msgs! Aborting rtabmap update... and this warning:

     [ WARN] MsgConversion.cpp:1385::getTransform() (getting transform camera_link -> base_link) Could not find a connection between 'camera_link' and 'base_link' because they are not part of the same tree.Tf has two or more unconnected trees.

Regarding the publish rate, which you suggested 100Hz, from here, I can't input this info. Trying to figure it out, and I`ll let you know the news. Thanks!!

Comment by matlabbe on 2020-10-18:
Make sure base_link and camera_link is published by the static_transform_publisher (https://index.ros.org/doc/ros2/Tutorials/tf2/):

ros2 run tf2_ros tf2_echo base_link camera_link

Comment by mirella melo on 2020-10-18:
It says:

    Exception thrown: Could not find a connection between 'base_link' and 'camera_link' because they are not part of the same tree.Tf has two or more unconnected trees.
    The current list of frames is:
    Frame camera_link exists with parent map.

Comment by matlabbe on 2020-10-19:
With ros2 run rqt_console rqt_console, you can know from which node that exception is thrown. If camera_link has parent map, then frame_id is not correctly set to base_link. Maybe static_transform_publisher node is not publishing base_link for some reason. You could make a simple launch file with only that node, and check if the TF is published with tf2_echo.

Comment by matlabbe on 2020-10-19:
view_frames tool can also be used to output the Tf Tree for debugging.

ros2 run tf2_tools view_frames.py
$\endgroup$

Your Answer

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