2 Maps in RtabViz and Rviz

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

2 Maps in RtabViz and Rviz

tobi
Hey,

another problem. Im currently testing rtabmap with visual Odometry on a robot. The map looks like this:

I think one map is with the transformation from my rgbd camera and the other is from base_link. If I export the 2D Map with the map_server both maps are in it.
Maybe an error with the launch file?

    <include file="$(find rtabmap_ros)/launch/rtabmap.launch">
        <arg name="frame_id"                value="xtion_link" />
        <arg name="rgb_topic"               default="/xtion/rgb/image_rect_color" />
        <arg name="depth_topic"             default="/xtion/depth_registered/image_raw" />
        <arg name="camera_info_topic"       default="/xtion/rgb/camera_info" />
        <arg name="visual_odometry"         default="true"/>          <!-- Launch rtabmap visual odometry node -->
        <arg name="odom_topic"              default="/odom"/>         <!-- Odometry topic used if visual_odometry is false -->
        <arg name="odom_args"               default="--delete_db_on_start"/>
        <arg name="subscribe_scan"          default="false"/>
	<arg name="cfg"                     default="$(find rtabmap_ros)/launch/config/config.ini" />
    </include>

If I'm not using visual odometry  everything works well. I test everything with bags, so both launchfiles get the same data from the rosbags.

greets
Tobi
Reply | Threaded
Open this post in threaded view
|

Re: 2 Maps in RtabViz and Rviz

matlabbe
Administrator
Hi,

What data and TF are in your rosbags? If you are gonna mapping again, TF /map -> /odom should not be in the bag. If you are recomputing odometry, TF /odom -> /base_link (or /base_footprint) should not be in the bag either.
$ rosbag info mybag.bag

A tilted map like this from visual odometry means generally that the camera is tilted to ground and that frame_id is not set to base frame of the robot (/base_footprint or /base_link) or TF between /base_link and /xtion_link (the frame of the camera) is wrong. Try
 <arg name="frame_id" value="base_link" /> <!-- well, the fixed frame of your robot base --> 

There should not be two maps at the same time, unless your started two rtabmap. Is the bottom one from the rosbag?

cheers
Reply | Threaded
Open this post in threaded view
|

Re: 2 Maps in RtabViz and Rviz

tobi
matlabbe wrote
Hi,

What data and TF are in your rosbags? If you are gonna mapping again, TF /map -> /odom should not be in the bag. If you are recomputing odometry, TF /odom -> /base_link (or /base_footprint) should not be in the bag either.
$ rosbag info mybag.bag
/odom and /base_link are in the bag. Is there a way to filter them out?

matlabbe wrote
A tilted map like this from visual odometry means generally that the camera is tilted to ground and that frame_id is not set to base frame of the robot (/base_footprint or /base_link) or TF between /base_link and /xtion_link (the frame of the camera) is wrong. Try
 <arg name="frame_id" value="base_link" /> <!-- well, the fixed frame of your robot base --> 
Yes, I tried this, but then there are problems, because of the /tf?

matlabbe wrote
There should not be two maps at the same time, unless your started two rtabmap. Is the bottom one from the rosbag?
There is only one instance of rtabmap and one rosbag.

greets
Tobias
Reply | Threaded
Open this post in threaded view
|

Re: 2 Maps in RtabViz and Rviz

matlabbe
Administrator


Hi,

1)
Make sure /map is not in the bag too. To filter frames in bags, I use this script: filterBagTF.py (this example remove all /map frames in "input.bag").

2)
What are the problems when you set "frame_id" to "base_link"? If it is a TF problem, you can show the TF tree to debug:
$ rosrun tf  view_frames
$ evince frames.pdf

3)
Can you show your rosbag info? In RVIZ, which topics produce the two maps?
$rosbag info mybag.bag


Reply | Threaded
Open this post in threaded view
|

Re: 2 Maps in RtabViz and Rviz

tobi
Hey thanks.

in the meantime I have solved the Problem. I just filtered the odom tf with
rosbag filter input.bag output.bag 'topic!="/tf" or m.transforms[0].header.frame_id != "odom"'

I think the filterBagTF.py script would work, too.

Thank
Tobias
Reply | Threaded
Open this post in threaded view
|

Re: 2 Maps in RtabViz and Rviz

matlabbe
Administrator
Yes, it is another solution, but this assumes that the recorded TF has only one transform per TF message. I think TF groups messages with same timestamp, so if "odom" has always a different timestamp than all other TF, it should work.