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>
<link name="base_laser_link"> <visual> <origin xyz="0.0 0.0 0.035"/> <geometry> <cylinder length="0.15" radius="0.08"/> </geometry> <material name="gray"/> </visual> </link>
<link name="base_link"/>
<joint name="imu_link_joint" type="fixed"> <parent link="base_link"/> <child link="imu_link"/> <origin xyz="0 0 0" rpy="0 0 0"/> </joint>
<joint name="base_laser_link_joint" type="fixed"> <parent link="base_link"/> <child link="base_laser_link"/> <origin xyz="0.0 0. 0.0" rpy="0 0 0"/> </joint>
</robot>
This file clearly defines the transformation between base_link and imu_link as well as base_link with base_laser_link. Than I call cartographer to do slam which is calling state_publisher. However, cartographer shows an error that it cannot relate the imu_link to the base_link. Also in tf viewer in rqt it is visible, that imu_link and base_link are not connected via a transformation, while base_link and base_laser_link are connected without problems. Did anyone of you have a similar issue? Why doe the state_publisher not relate the imu_link with the base_link?
* 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"
args="load phidgets_imu/PhidgetsImuNodelet imu_manager"
output="screen">
<param name="period" value="4"/>
<param name="frame_id" value="imu_link"/>
</node>
<node pkg="nodelet" type="nodelet" name="ImuFilterNodelet"
args="load imu_filter_madgwick/ImuFilterNodelet imu_manager"
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 ...