Skip to content

Smooth the timestamp of TwistStamped messages in velocity_smoother#5861

Merged
SteveMacenski merged 14 commits intoros-navigation:mainfrom
AndreiCostinescu:main
Jan 14, 2026
Merged

Smooth the timestamp of TwistStamped messages in velocity_smoother#5861
SteveMacenski merged 14 commits intoros-navigation:mainfrom
AndreiCostinescu:main

Conversation

@AndreiCostinescu
Copy link
Copy Markdown
Contributor


Basic Info

Info Please fill out this column
Ticket(s) this addresses #5857
Primary OS tested on Ubuntu
Robotic platform tested on Clearpath ridgeback r100
Does this PR contain AI generated software? No
Was this PR description generated by AI software? No

Description of contribution in a few bullet points

  • The builtin-interfaces/msg/Time stamp message header of the TwistStamped cmd_vel output is also smoothed based on the smoothing time
  • Compute the delta time between the last received command and the smoothing time
  • Add this delta time to the header timestamp

Description of documentation updates required from your changes

  • Commented the code
  • Updated the README.md

Description of how this change was tested

Similar to #5858


Future work that may be required in bullet points

For Maintainers:

  • Check that any new parameters added are updated in docs.nav2.org
  • Check that any significant change is added to the migration guide
  • Check that any new features OR changes to existing behaviors are reflected in the tuning guide
  • Check that any new functions have Doxygen added
  • Check that any new features have test coverage
  • Check that any new plugins is added to the plugins page
  • If BT Node, Additionally: add to BT's XML index of nodes for groot, BT package's readme table, and BT library lists
  • Should this be backported to current distributions? If so, tag with backport-*.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
nav2_velocity_smoother/src/velocity_smoother.cpp 94.21% <100.00%> (+0.05%) ⬆️

... and 6 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

@SteveMacenski SteveMacenski left a comment

Choose a reason for hiding this comment

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

Works, but I think we can make this more concise using the class operators. I don't think we need to manually populate the nanoseconds/seconds of the stamp

Comment thread nav2_velocity_smoother/src/velocity_smoother.cpp Outdated
Comment thread nav2_velocity_smoother/src/velocity_smoother.cpp Outdated
Comment thread nav2_velocity_smoother/src/velocity_smoother.cpp Outdated
@SteveMacenski
Copy link
Copy Markdown
Member

With that frame_id change, can you also fix the DCO job?

…p of the smoothed velocity header message

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>
…g_time in nav2_velocity_smoother/README.md

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>
…meter examples in nav2_bringup

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>
Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>
Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>
Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>
Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>
…t behavior

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>
…smoother

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>
Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>
Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>
Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>
…e timestamp), set the values individually. Has the advantage of not writing the timestamp two times.

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>
@SteveMacenski SteveMacenski merged commit 8f357f4 into ros-navigation:main Jan 14, 2026
17 checks passed
Lotusymt pushed a commit to Lotusymt/navigation2 that referenced this pull request Jan 16, 2026
…os-navigation#5861)

* Add new parameter to nav2_velocity_smoother that updates the timestamp of the smoothed velocity header message

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

* Update parameter description of stamp_smoothed_velocity_with_smoothing_time in nav2_velocity_smoother/README.md

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

* Add new parameter stamp_smoothed_velocity_with_smoothing_time in parameter examples in nav2_bringup

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

* Fix lines too long cpplint issues in velocity_smoother.cpp

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

* Rephrase parameter description for improved clarity

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

* Rename delta time variable for clarity.

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

* Revert jazzy-related changes to main

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

* Undo parametrization of smoothing timestamps and make this the default behavior

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

* Document the change in timestamp smoothing in the README of velocity_smoother

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

* Remove whitespace on line 322 to pass cpplint checks

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

* Part 2 of whitespace removals

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

* Make the smoothing time computation more concise.

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

* Instead of copying the whole header (which copies the frame_id and the timestamp), set the values individually. Has the advantage of not writing the timestamp two times.

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

---------

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>
Lotusymt pushed a commit to Lotusymt/navigation2 that referenced this pull request Jan 16, 2026
…os-navigation#5861)

* Add new parameter to nav2_velocity_smoother that updates the timestamp of the smoothed velocity header message

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

* Update parameter description of stamp_smoothed_velocity_with_smoothing_time in nav2_velocity_smoother/README.md

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

* Add new parameter stamp_smoothed_velocity_with_smoothing_time in parameter examples in nav2_bringup

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

* Fix lines too long cpplint issues in velocity_smoother.cpp

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

* Rephrase parameter description for improved clarity

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

* Rename delta time variable for clarity.

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

* Revert jazzy-related changes to main

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

* Undo parametrization of smoothing timestamps and make this the default behavior

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

* Document the change in timestamp smoothing in the README of velocity_smoother

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

* Remove whitespace on line 322 to pass cpplint checks

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

* Part 2 of whitespace removals

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

* Make the smoothing time computation more concise.

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

* Instead of copying the whole header (which copies the frame_id and the timestamp), set the values individually. Has the advantage of not writing the timestamp two times.

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

---------

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>
Signed-off-by: lotusymt <mengtiy5@uci.edu>
Pana1v pushed a commit to Arnav-panjla/navigation2 that referenced this pull request Feb 21, 2026
…os-navigation#5861)

* Add new parameter to nav2_velocity_smoother that updates the timestamp of the smoothed velocity header message

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

* Update parameter description of stamp_smoothed_velocity_with_smoothing_time in nav2_velocity_smoother/README.md

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

* Add new parameter stamp_smoothed_velocity_with_smoothing_time in parameter examples in nav2_bringup

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

* Fix lines too long cpplint issues in velocity_smoother.cpp

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

* Rephrase parameter description for improved clarity

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

* Rename delta time variable for clarity.

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

* Revert jazzy-related changes to main

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

* Undo parametrization of smoothing timestamps and make this the default behavior

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

* Document the change in timestamp smoothing in the README of velocity_smoother

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

* Remove whitespace on line 322 to pass cpplint checks

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

* Part 2 of whitespace removals

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

* Make the smoothing time computation more concise.

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

* Instead of copying the whole header (which copies the frame_id and the timestamp), set the values individually. Has the advantage of not writing the timestamp two times.

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.com>

---------

Signed-off-by: Andrei Costinescu <andreicostinescu96@gmail.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.

Jerky behavior caused by same timestamps in TwistStamped messages published by velocity_smoother

2 participants