Skip to content

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

Merged
christophfroehlich merged 7 commits intoros-controls:masterfrom
greencookie-afk:fix/confusing-warning-joint-state-broadcaster
Apr 27, 2026
Merged

fix(joint_state_broadcaster): suppress confusing warning for standard interfaces#2276
christophfroehlich merged 7 commits intoros-controls:masterfrom
greencookie-afk:fix/confusing-warning-joint-state-broadcaster

Conversation

@greencookie-afk
Copy link
Copy Markdown
Contributor

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

@greencookie-afk
Copy link
Copy Markdown
Contributor 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!

Comment thread joint_state_broadcaster/src/joint_state_broadcaster.cpp Outdated
@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!

@greencookie-afk
Copy link
Copy Markdown
Contributor Author

@thedevmystic thanks buddy i updated it.!!

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.94%. Comparing base (ede5b33) to head (1835ec7).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2276      +/-   ##
==========================================
- Coverage   85.01%   84.94%   -0.08%     
==========================================
  Files         145      145              
  Lines       15234    15359     +125     
  Branches     1336     1336              
==========================================
+ Hits        12951    13046      +95     
- Misses       1791     1822      +31     
+ Partials      492      491       -1     
Flag Coverage Δ
unittests 84.94% <100.00%> (-0.08%) ⬇️

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 70.21% <ø> (+0.53%) ⬆️
..._broadcaster/test/test_joint_state_broadcaster.cpp 97.46% <100.00%> (-0.45%) ⬇️

... and 17 files 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.

@bmagyar
Copy link
Copy Markdown
Member

bmagyar commented Apr 22, 2026

@greencookie-afk ☝️ we still miss the follow up action on this

@greencookie-afk
Copy link
Copy Markdown
Contributor Author

@greencookie-afk ☝️ we still miss the follow up action on this

i am working on it.

@greencookie-afk greencookie-afk force-pushed the fix/confusing-warning-joint-state-broadcaster branch from 444d294 to e0149f8 Compare April 24, 2026 11:54
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Apr 24, 2026

This pull request is in conflict. Could you fix it @greencookie-afk?

greencookie-afk and others added 3 commits April 24, 2026 17:29
… 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
Co-authored-by: Surya! <thedevmystic@gmail.com>
- Add TestStandardVelocityInterfaceNoWarning test that verifies no warning is printed
when using standard interface (velocity) without custom mapping
- Add TestCustomInterfaceMappingIgnoredWhenVelocityInterfaceIsRequested test that
verifies warning IS printed when custom mapping is ignored
- Update interfaces parameter description to clarify when warning is printed
- Update parameter_context.yml with same clarification

Addresses review feedback from christophfroehlich
@greencookie-afk greencookie-afk force-pushed the fix/confusing-warning-joint-state-broadcaster branch from e0149f8 to c5653ad Compare April 24, 2026 11:59
@christophfroehlich
Copy link
Copy Markdown
Member

@greencookie-afk

  1. Once a PR got reviewed, please don't do force pushes as this will break github UI and subsequent reviews will take more time.

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.

The newly added tests do not even build, please have a look

@greencookie-afk
Copy link
Copy Markdown
Contributor Author

The newly added tests do not even build, please have a look

I'm sorry I'll have a look at it again in a cleaner and better way. Kind of new here so it takes time to adjust.

@christophfroehlich
Copy link
Copy Markdown
Member

The newly added tests do not even build, please have a look

I'm sorry I'll have a look at it again in a cleaner and better way. Kind of new here so it takes time to adjust.

We are happy to help, but please check as a minimum if your changes build and tests succeed. See https://control.ros.org/rolling/doc/contributing/contributing.html

Comment thread joint_state_broadcaster/src/joint_state_broadcaster.cpp Outdated
Copy link
Copy Markdown
Member

@saikishor saikishor left a comment

Choose a reason for hiding this comment

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

LGTM

@christophfroehlich christophfroehlich added backport-jazzy Triggers PR backport to ROS 2 jazzy. backport-kilted Triggers PR backport to ROS 2 kilted. labels Apr 27, 2026
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!

@christophfroehlich christophfroehlich merged commit f6ebc8b into ros-controls:master Apr 27, 2026
17 of 21 checks passed
@greencookie-afk
Copy link
Copy Markdown
Contributor Author

Thank you!

Thank you so much everyone

christophfroehlich pushed a commit that referenced this pull request Apr 28, 2026
christophfroehlich pushed a commit that referenced this pull request Apr 28, 2026
@greencookie-afk greencookie-afk deleted the fix/confusing-warning-joint-state-broadcaster branch April 28, 2026 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-jazzy Triggers PR backport to ROS 2 jazzy. backport-kilted Triggers PR backport to ROS 2 kilted.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

confusing joint_state_broadcaster warning

5 participants