Skip to content

fix(topic remapping): a bug of remapping regarding goal_pose#196

Merged
xtk8532704 merged 2 commits intodevelopfrom
fix-pc-remapping-bug
Aug 15, 2025
Merged

fix(topic remapping): a bug of remapping regarding goal_pose#196
xtk8532704 merged 2 commits intodevelopfrom
fix-pc-remapping-bug

Conversation

@xtk8532704
Copy link
Copy Markdown
Contributor

@xtk8532704 xtk8532704 commented Aug 8, 2025

Types of PR

  • New Features
  • Upgrade of existing features
  • Bugfix

Description

The original remapping doesn't work as expected because the conf[goal_pose] may not be None but a string {} in planning_control or localization scenarios
This PR fixes this problem.

How to review this PR

Others

@xtk8532704 xtk8532704 marked this pull request as ready for review August 8, 2025 06:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a bug in the topic remapping logic where the goal_pose configuration check was incorrectly triggering even when the value was an empty string representation "{}". The fix adds an additional condition to properly validate the goal_pose configuration before applying remapping.

  • Updates the conditional check to exclude empty string representations of dictionaries
  • Ensures remapping only occurs when goal_pose has a meaningful value

add_remap("/localization/kinematic_state", remap_list)
add_remap("/localization/acceleration", remap_list)
if conf.get("goal_pose") is not None:
if conf.get("goal_pose") is not None and conf["goal_pose"] != "{}":
Copy link

Copilot AI Aug 8, 2025

Choose a reason for hiding this comment

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

The hardcoded string "{}" comparison is fragile and could break if the empty value format changes. Consider using a more robust check like not conf["goal_pose"].strip() or defining a constant for the empty value pattern.

Suggested change
if conf.get("goal_pose") is not None and conf["goal_pose"] != "{}":
if conf.get("goal_pose") is not None and conf["goal_pose"].strip() != "":

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

@MasatoSaeki MasatoSaeki left a comment

Choose a reason for hiding this comment

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

It is okay to use only if conf["goal_pose"] != "{}": I think. What do you think?

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Aug 8, 2025

@xtk8532704
Copy link
Copy Markdown
Contributor Author

xtk8532704 commented Aug 12, 2025

It is okay to use only if conf["goal_pose"] != "{}": I think. What do you think?

I‘m not sure if there are some cases where the goal_pose is None.

@xtk8532704 xtk8532704 requested a review from MasatoSaeki August 12, 2025 04:44
@go-sakayori
Copy link
Copy Markdown
Contributor

It is okay to use only if conf["goal_pose"] != "{}": I think. What do you think?

I‘m not sure if there are some cases where the goal_pose is None.

I think this process is done everytime, so I agree with @MasatoSaeki 's comment.

Signed-off-by: xtk8532704 <1041084556@qq.com>
@xtk8532704
Copy link
Copy Markdown
Contributor Author

Fixed in a safe manner.

@xtk8532704 xtk8532704 merged commit 31e428b into develop Aug 15, 2025
3 of 4 checks passed
@xtk8532704 xtk8532704 deleted the fix-pc-remapping-bug branch August 15, 2025 17:00
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.

4 participants