Add option to timestamp joint_states from hardware measurement-time interfaces - #2471
Open
JenniferBuehler wants to merge 9 commits into
Open
Add option to timestamp joint_states from hardware measurement-time interfaces#2471JenniferBuehler wants to merge 9 commits into
JenniferBuehler wants to merge 9 commits into
Conversation
JenniferBuehler
commented
Jul 13, 2026
Author
|
Update: Through testing and updating I noticed that the original reason to need |
JenniferBuehler
marked this pull request as ready for review
July 17, 2026 17:46
github-actions
Bot
requested review from
Juliaj,
MarqRazz,
Maverobot,
moriarty and
saikishor
July 17, 2026 17:47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The current state of the joint_state_broadcaster uses
now()to stamp the joint states. Some hardware however provides encoder measurement timestamps which the user may want to use instead, to get the true measurement time. This PR adds an option to reach such measurement time from the state interfaces optionally: if the hardware interface doesn't declare or write it, it falls back to the current behavior, so this wouldn't break any existing use of the joint state broadcaster.Is this user-facing behavior change?
It's an optional feature, while it's user facing (the user being the one writing the hardware interfaces), it's fully backwards compatible.
Did you use Generative AI?
Claude Opus 4.8 was used to execute an implementation plan that was done by the human (myself) and then questioned quite a bit and iterated on, and finally edited, verified and tested by the human (also myself).
Additional Information
This is a PR to
rollingfor convention, though for our use case it is required injazzyso it would be desirable if - once approved - we could backport this.Test plan
1. Unit tests
New cases cover the feature (should pass in CI). Please see inline comments.
2. Interactive test with mock hardware [optional]
If the unit tests are considered insufficient, here is a suggestion on how this can be tested interactively with
mock_components/GenericSystemto expose the two measurement-time state interfaces with fixed values.jsb_timestamp_test.urdfjsb_timestamp_test.yamlRun it (three terminals with the workspace sourced):
ros2 run robot_state_publisher robot_state_publisher \ --ros-args -p robot_description:="$(cat src/ros2_controllers/joint_state_broadcaster/jsb_timestamp_test.urdf)"ros2 run controller_manager ros2_control_node \ --ros-args --params-file src/ros2_controllers/joint_state_broadcaster/jsb_timestamp_test.yamlros2 run controller_manager spawner joint_state_broadcaster \ --param-file src/ros2_controllers/joint_state_broadcaster/jsb_timestamp_test.yamlros2 topic echo /joint_states --onceExpected: the message header shows the hardware-provided stamp:
Negative check (default behaviour preserved):
Remove the entire top-level
joint_state_broadcaster:block, leaving only thecontroller_manager:section from the yaml:header.stampnow shows the controller-manager clock (a current time)