rtabmap icon indicating copy to clipboard operation
rtabmap copied to clipboard

Could not transform IMU msg from fram "bebop/base_link" to frame "red/base_link"

Open JarrenBurleson opened this issue 2 years ago • 1 comments

Hello, I am very new to ROS and RTAB-Map. Bottom line up front I am trying to get visual odometry working with rtabmap and my drone, but I am getting this error that states TF is not available.

I got it working with odometry from the robot. It is able to map without error. For the competition I am in I cannot use the odometry topic and have to generate one. I am trying to implement the visual odometry through rtabmap, but I end up with what I believe is TF tree related issues. I have one file that runs with odometry from /red/odometry and one file I am trying to get working with visual odometry from rtabmap In both files I use this code to link the simulation and rtabmap.

  <arg name="frame_id"                default="red/base_link"/>     <!-- Changed to red/camera from camer_link Fixed frame id, you may set "base_link" or "base_footprint" if they are published -->
  <arg name="odom_frame_id"           default=""/>                <!-- If set, TF is used to get odometry instead of the topic -->
  <arg name="odom_frame_id_init"      default=""/>                <!-- If set, TF map->odom is published even if no odometry topic has been received yet. The frame id should match the one in the topic. -->
  <arg name="map_frame_id"            default="map"/>
  <arg name="ground_truth_frame_id"   default="world"/>     <!-- e.g., "world" -->

When I change the file from

  <arg name="visual_odometry"          default="false"/>          <!-- Launch rtabmap visual odometry node -->
  <arg name="icp_odometry"             default="false"/>         <!-- Launch rtabmap icp odometry node -->
  <arg name="odom_topic"               default="/red/odometry"/>          <!-- Odometry topic name put "odom" if we can't use red/odometry in competition-->
  <arg name="vo_frame_id"              default="$(arg odom_topic)"/> <!-- Visual/Icp odometry frame ID for TF -->
  <arg name="publish_tf_odom"          default="true"/>
  <arg name="odom_tf_angular_variance" default="0.001"/>         <!-- If TF is used to get odometry, this is the default angular variance -->
  <arg name="odom_tf_linear_variance"  default="0.001"/>         <!-- If TF is used to get odometry, this is the default linear variance -->
  <arg name="odom_args"                default=""/>              <!-- More arguments for odometry (overwrite same parameters in rtabmap_args) -->
  <arg name="odom_sensor_sync"         default="false"/>
  <arg name="odom_guess_frame_id"        default=""/>
  <arg name="odom_guess_min_translation" default="0"/>
  <arg name="odom_guess_min_rotation"    default="0"/>
  <arg name="odom_max_rate"            default="0"/>
  <arg name="odom_expected_rate"       default="0"/>
  <arg name="imu_topic"                default="/imu/data"/>          <!-- only used with VIO approaches -->
  <arg name="wait_imu_to_init"         default="false"/>
  <arg name="use_odom_features"        default="false"/>

to

 <arg name="visual_odometry"          default="true"/>          <!-- Launch rtabmap visual odometry node -->
  <arg name="icp_odometry"             default="false"/>         <!-- Launch rtabmap icp odometry node -->
  <arg name="odom_topic"               default="odom"/>          <!-- Odometry topic name put "odom" if we can't use red/odometry in competition-->
  <arg name="vo_frame_id"              default="$(arg odom_topic)"/> <!-- Visual/Icp odometry frame ID for TF -->
  <arg name="publish_tf_odom"          default="true"/>
  <arg name="odom_tf_angular_variance" default="0.001"/>         <!-- If TF is used to get odometry, this is the default angular variance -->
  <arg name="odom_tf_linear_variance"  default="0.001"/>         <!-- If TF is used to get odometry, this is the default linear variance -->
  <arg name="odom_args"                default=""/>              <!-- More arguments for odometry (overwrite same parameters in rtabmap_args) -->
  <arg name="odom_sensor_sync"         default="true"/>
  <arg name="odom_guess_frame_id"        default=""/>
  <arg name="odom_guess_min_translation" default="0"/>
  <arg name="odom_guess_min_rotation"    default="0"/>
  <arg name="odom_max_rate"            default="0"/>
  <arg name="odom_expected_rate"       default="0"/>
  <arg name="imu_topic"                default="/red/mavros/imu/data"/>          <!-- only used with VIO approaches -->
  <arg name="wait_imu_to_init"         default="true"/>
  <arg name="use_odom_features"        default="false"/>

I get the following error

[ WARN] [1678842543.821405342, 7094.080000000]: Could not get transform from red/base_link to bebop/base_link after 0.200000 seconds (for stamp=7092.605000)! Error="canTransform: source_frame bebop/base_link does not exist.. canTransform returned after 0.201 timeout was 0.2.".
[ERROR] [1678842543.821450457, 7094.080000000]: Could not transform IMU msg from frame "bebop/base_link" to frame "red/base_link", TF not available at time 7092.605
This is the TF tree of the not working version
![BrokenVersionTFTree](https://user-images.githubusercontent.com/124008770/225179175-13458c47-371f-4560-ba5c-148fe37ffa15.png)
000

This is the TF tree of the working version

WorkingVersionTFTree

I've also added the nodes and topics in case that helps. withoutrtabmap

withbrokenrtabmap

withworkingrtabmap

Thanks for any help you can provide and let me know if I can clarify anything.

JarrenBurleson avatar Mar 15 '23 01:03 JarrenBurleson

Not sure why bebop/base_link exists, it seems not in the tf tree.

Not sure if I like world->/red/base_link link, it feels a ground truth hard link from the simulator, I would remove that. How is /red/odometry computed? Does it give good odometry values? If so, I would try making it work with /red/odometry before trying including vo from rtabmap.

I don't know how you drone controller is configured, but to correctly feed back vo in mavros as visual pose, there are some tricks to do. See https://github.com/matlabbe/rtabmap_drone_example

matlabbe avatar Apr 16 '23 00:04 matlabbe