# Cartographer SLAM - TF Tree Errors

Hi everyone,

I am completely stuck on a tf problem. What I try to do is slam with a laser sensor and an imu with cartographer_ros. According to the related tutorial, I define my physical layout of the robot in a urdf file:

<robot name="robot_3d">
<material name="orange"> <color rgba="1.0 0.5 0.2 1"/> </material>
<material name="gray"> <color rgba="0.2 0.2 0.2 1"/> </material>

<link name="imu_link"> <visual> <origin xyz="0.0 0.0 0.13"/> <geometry> <box size="0.06 0.04 0.02"/> </geometry> <material name="orange"/> </visual> </link>

</robot>

* Update *

The TF tree appears to be constructed correctly just using the robot state publisher. This means the base_link is parent to imu_link and base_laser_link. However, as soon as I start cartographer_ros node the tf tree is ripped apart. Then it shows the new topic odom (which shall be generated by the slam) which is parent to imu_link. Separatly (unconnected) to this also we still have the base_link topic which is parent to "base_laser_link". The error the cartographer is throwing is:

"Could not find a connection between 'imu_link' and 'base_laser_link' because they are not part of the same tree.Tf has two or more unconnected trees.


Before starting cartographer After starting cartographer:

* Update * I could further break down the error, that the imu manager is causing this tf fault. The imu is based one the phidget imu package:

sudo apt install ros-melodic-phidgets-imu


Which is called with the following launch file:

<launch>
<node pkg="nodelet" type="nodelet" name="imu_manager"
args="manager" output="screen" />

<node pkg="nodelet" type="nodelet" name="PhidgetsImuNodelet"
output="screen">
<param name="period" value="4"/>
</node>

<node pkg="nodelet" type="nodelet" name="ImuFilterNodelet"
output="screen">

<param name="use_mag" value="true"/>
<param name="use_magnetic_field_msg" value="true"/>
</node>

</launch>


However, I cannot find out why this imu manager is creating a tf connection between frame /odom and /imu_link and at the same time breaking /imu_link and ...

edit retag close merge delete

Sort by » oldest newest most voted

<material> name="orange"> <color rgba="1.0 0.5 0.2 1"/> </material> ^ You have a typo here inducing that your material isn't correctly defined. So when you use the material orange for the link imu_link you get an error and the link isn't created.

Note : When you have something wrong with an URDF file you can use tools like check_urdf that will tell you every mistakes/errors/typos.

Edit : The frame odom is actually published by your nodelet ImuFilterNodelet. From the imu_filter_madgwick wiki :

~fixed_frame (string, default: odom)
The parent frame to be used in publish_tf.
~publish_tf (bool, default: true)
Whether to publish a TF transform that represents the orientation of the IMU, using the frame specified in fixed_frame as the parent frame and the frame given in the input imu message as the child frame.


Since you don't set those two parameters they are set to their default value, meaning that a frame odom is published and is set as the parent of the frame related to your imu messages (i.e. imu_link as defined when calling your other nodelet PhidgetsImuNodelet). So you end up with imu_link having odom as a parent from your nodelet AND base_link as a parent from the node robot_state_publisher, which explains why your tf tree is broken.

That being said, I'm not entirely sure about what you should do. You should see this discussion.

You'll probably have to change your URDF to set imu_link as the parent of base_link instead of its child and then change the tracking_frame param from cartographer to the base_link (you shouldn't have removed the cartographer params from your previous update, they are part of your issue. Can you add them back please ?).

more

Hi, thanks. Sorry this is a copy paste error. I updated the code above, but unfortunately this does not resolve the issue.

( 2019-02-27 01:47:40 -0500 )edit
1

What is the issue ? I just used your urdf and check_urdf returns no errors and the robot is correctly displayed in Rviz with all the frames connected.

( 2019-02-27 01:55:32 -0500 )edit

Hi, thanks you are completely right. I have updated the question/error accordingly.

( 2019-02-27 02:33:15 -0500 )edit
1

( 2019-02-27 02:48:31 -0500 )edit

Hi, you can find the screenshots above.

( 2019-02-27 03:28:29 -0500 )edit
1

What is this /imu_manager broadcaster ? Is it the name you used when launching the cartographer node ? Also, since your frames base_imu and base_link are at the same pose and fixed, what happen if you set the param tracking_frame to base_link ?

( 2019-02-27 04:05:40 -0500 )edit

Hi, thanks. Actually I thought the imu manager is called by the cartographer, however this is not true. I get the same problem if I only run the imu. I have updated the question...

( 2019-02-27 09:14:55 -0500 )edit

The velocity filter of the imu package has been using a tf tree for the filtering. By only using the raw imu data the problem has been resolved. The cartographer map still doesn't work, I opened a new question for this. Thanks a lot for your help!

( 2019-02-28 04:02:17 -0500 )edit