Skip to content

fix(joint_state_broadcaster): suppress confusing warning for standard interfaces#2276

Open
greencookie-afk wants to merge 4 commits intoros-controls:masterfrom
greencookie-afk:fix/confusing-warning-joint-state-broadcaster
Open

fix(joint_state_broadcaster): suppress confusing warning for standard interfaces#2276
greencookie-afk wants to merge 4 commits intoros-controls:masterfrom
greencookie-afk:fix/confusing-warning-joint-state-broadcaster

Conversation

@greencookie-afk
Copy link
Copy Markdown

Description

This PR fixes the confusing warning message from JointStateBroadcaster when using standard interfaces like velocity with the default mapping.

Problem

When configuring the broadcaster with standard interfaces:

rotor_state_broadcaster:
  ros__parameters:
    joints: [rotor/1, rotor/2, rotor/3, rotor/4]
    interfaces: [velocity]

The following confusing warning was displayed:

Mapping from 'velocity' to interface 'velocity' will not be done, because 'velocity' is defined in 'interface' parameter.

This warning is confusing because:

  1. The user didn't configure any custom mapping
  2. The data is being published correctly to the velocity field
  3. The warning suggests something is wrong when everything works as expected

Solution

The warning is now only displayed when there's an actual custom mapping being ignored (i.e., when the interface name differs from the JointState field name).

For example, if someone had:

interfaces: [velocity]
map_interface_to_joint_state:
  velocity: custom_velocity_interface

Then the warning would still be shown because the custom mapping custom_velocity_interface -> velocity would be ignored.

But for the standard case where interfaces: [velocity] and the default mapping velocity -> velocity, no warning is shown because no mapping is needed.

Changes

  • Modified joint_state_broadcaster.cpp to only print the warning when interface != interface_to_map

Related Issue

Fixes #2261

… interfaces

When using standard interfaces like 'velocity' with the default mapping,
the warning 'Mapping from velocity to interface velocity will not be done'
is confusing because no mapping is actually needed.

This change only shows the warning when there's a custom mapping being
ignored (i.e., when interface name differs from the JointState field name).

Fixes ros-controls#2261
@greencookie-afk
Copy link
Copy Markdown
Author

@christophfroehlich, I opened a PR for this issue. Would you be able to review when you have a chance? I am a beginner so any feedback will be appreciated.

Copy link
Copy Markdown
Contributor

@thedevmystic thedevmystic left a comment

Choose a reason for hiding this comment

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

Looks good!

@thedevmystic
Copy link
Copy Markdown
Contributor

@christophfroehlich, I opened a PR for this issue. Would you be able to review when you have a chance? I am a beginner so any feedback will be appreciated.

We're here for the community! Either beginner or expert. Welcome aboard to the project, @greencookie-afk!

Co-authored-by: Surya! <thedevmystic@gmail.com>
@greencookie-afk
Copy link
Copy Markdown
Author

@thedevmystic thanks buddy i updated it.!!

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 11, 2026

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.73%. Comparing base (6c1299f) to head (e53b2be).

Files with missing lines Patch % Lines
..._state_broadcaster/src/joint_state_broadcaster.cpp 0.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2276   +/-   ##
=======================================
  Coverage   84.72%   84.73%           
=======================================
  Files         153      153           
  Lines       15362    15364    +2     
  Branches     1332     1333    +1     
=======================================
+ Hits        13016    13018    +2     
  Misses       1858     1858           
  Partials      488      488           
Flag Coverage Δ
unittests 84.73% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
..._state_broadcaster/src/joint_state_broadcaster.cpp 68.94% <0.00%> (-0.74%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Member

@christophfroehlich christophfroehlich left a comment

Choose a reason for hiding this comment

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

Thank you. The changes LGTM, but I ask you to

  • clarify the wrong configuration (i.e., when the warning is printed) in the parameter description of interfaces and joint_state_broadcaster_parameter_context.yml
  • Add a test for this case to have coverage. You could copy TestCustomInterfaceMapping but run it with a velocity interface parameter.

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.

confusing joint_state_broadcaster warning

3 participants