ros2 runtime_error ai_generated true

tf2::TransformException: Frame 'base_link' already exists in static transform tree

ID: ros2/tf2-static-transform-broadcaster-duplicate

Also available as: JSON · Markdown · 中文
90%Fix Rate
88%Confidence
1Evidence
2023-11-05First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
ros2-humble active
ros2-iron active
ros2-rolling active

Root Cause

Two nodes are broadcasting the same static transform (e.g., base_link to odom) with different timestamps, causing a conflict in the static transform buffer.

generic

中文

两个节点以不同的时间戳广播相同的静态变换(例如base_link到odom),导致静态变换缓冲区冲突。

Official Documentation

https://docs.ros.org/en/rolling/Tutorials/Intermediate/Tf2/Adding-A-Frame.html

Workarounds

  1. 95% success Ensure only one node broadcasts the static transform; remove the duplicate broadcaster from the launch file. Example: in launch.py, comment out the second static_transform_publisher node.
    Ensure only one node broadcasts the static transform; remove the duplicate broadcaster from the launch file. Example: in launch.py, comment out the second static_transform_publisher node.
  2. 85% success If two broadcasters are necessary, use different frame names (e.g., base_link_static and base_link_dynamic) and update downstream nodes accordingly.
    If two broadcasters are necessary, use different frame names (e.g., base_link_static and base_link_dynamic) and update downstream nodes accordingly.

中文步骤

  1. 确保只有一个节点广播静态变换;从启动文件中移除重复的广播器。例如:在launch.py中注释掉第二个static_transform_publisher节点。
  2. 如果需要两个广播器,使用不同的帧名称(例如base_link_static和base_link_dynamic),并相应更新下游节点。

Dead Ends

Common approaches that don't work:

  1. 80% fail

    Static transforms are cached; delay doesn't resolve the duplicate conflict once both broadcast.

  2. 70% fail

    Renaming frames breaks transform chains and other nodes expecting the correct frame names.