Skip to content

fix(gazebo): fix duplicate TF tree issue by removing unexpected trail…#261

Open
jiujiujiur0000 wants to merge 2 commits into
ROBOTIS-GIT:jazzyfrom
jiujiujiur0000:patch-1
Open

fix(gazebo): fix duplicate TF tree issue by removing unexpected trail…#261
jiujiujiur0000 wants to merge 2 commits into
ROBOTIS-GIT:jazzyfrom
jiujiujiur0000:patch-1

Conversation

@jiujiujiur0000

Copy link
Copy Markdown

…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.

…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>
Copilot AI review requested due to automatic review settings May 22, 2026 15:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_prefix construction in the launch file to conditionally append / only when frame_prefix != ''.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread turtlebot3_gazebo/launch/robot_state_publisher.launch.py Outdated
Comment thread turtlebot3_gazebo/launch/robot_state_publisher.launch.py Outdated

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread turtlebot3_gazebo/launch/robot_state_publisher.launch.py Outdated
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants