fix(gazebo): fix duplicate TF tree issue by removing unexpected trail…#261
fix(gazebo): fix duplicate TF tree issue by removing unexpected trail…#261jiujiujiur0000 wants to merge 2 commits into
Conversation
…ing slash in frame_prefix ### Description In ROS 2, frame_ids do not start with a forward slash `/`. However, in `robot_state_publisher.launch.py`, `PythonExpression(["'", frame_prefix, "/'"])` forces `frame_prefix` to become `/` when no namespace is provided (since the default is `''`). This causes `robot_state_publisher` to broadcast frames with an unexpected leading slash (e.g., `/base_link`), resulting in unconnected double TF trees and warnings in visualization tools like Foxglove Studio, and potential `tf2::LookupException` in Nav2. ###🗣️ Fix Modified the `frame_prefix` evaluation to avoid appending the trailing slash when `frame_prefix` is empty. Signed-off-by: 任平静(ren_pingjing) <95092734+jiujiujiur0000@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR adjusts the frame_prefix parameter passed to robot_state_publisher so that a trailing / is only appended when a non-empty prefix is provided (avoiding a leading / when frame_prefix is empty).
Changes:
- Modify
frame_prefixconstruction in the launch file to conditionally append/only whenframe_prefix != ''.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Code Review
This pull request modifies the robot_state_publisher launch file to conditionally append a trailing slash to the frame_prefix parameter. The review feedback correctly identifies a syntax error caused by the use of non-breaking space characters for indentation and suggests a more robust implementation using rstrip to prevent potential double slashes in the frame prefix.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: 任平静(ren_pingjing) <95092734+jiujiujiur0000@users.noreply.github.com>
…ing slash in frame_prefix
Description
In ROS 2, frame_ids do not start with a forward slash
/. However, inrobot_state_publisher.launch.py,PythonExpression(["'", frame_prefix, "/'"])forcesframe_prefixto become/when no namespace is provided (since the default is'').This causes
robot_state_publisherto broadcast frames with an unexpected leading slash (e.g.,/base_link), resulting in unconnected double TF trees and warnings in visualization tools like Foxglove Studio, and potentialtf2::LookupExceptionin Nav2.###🗣️ Fix
Modified the
frame_prefixevaluation to avoid appending the trailing slash whenframe_prefixis empty.