Adjust moveit_servo clock to work with fake_hardware#3529
Adjust moveit_servo clock to work with fake_hardware#3529AndyZe merged 4 commits intomoveit:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3529 +/- ##
==========================================
- Coverage 46.21% 46.19% -0.02%
==========================================
Files 720 720
Lines 62742 59180 -3562
Branches 7594 7595 +1
==========================================
- Hits 28991 27330 -1661
+ Misses 33584 31683 -1901
Partials 167 167 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
79586bd to
e35a295
Compare
AndyZe
left a comment
There was a problem hiding this comment.
Thanks. I'm good to merge this if CI passes
|
Maybe @nbbrooks will push this across the finish line |
There was a problem hiding this comment.
PlanningSceneMonitor does not update last_update_time_ using RCL_ROS_TIME. (it only updates when the joint states change)
Instead, last_update_time_ is updated with RCL_SYSTEM_TIME.
This sounds like the actual issue. Have we dug into why it is hard coded to SYSTEM_TIME?
I don't think anybody has the appetite to make changes in planning_scene_monitor right now. I'll make the anonymous namespace change, though |
Head branch was pushed to by a user without write access
|
Add a note of why we needed to add the function and I think it's good. |
|
I would merge it if I were able to... |
|
Are the 3 failing checks something new? That is why it has not already been auto-merged. I can bypass the checks but it'd be good to know what is going on there. |
|
The checks are also failing on this PR we have been wanting to merge in for a while #2994 and I have re-run them a couple times. So if something is flaky, it must be fairly reliably flaky at this point? |
|
Looks like they are related to TF2 h to hpp deprecations https://github.com/moveit/moveit2/actions/runs/16886460567/job/47835375146?pr=3529#step:11:1188 |
|
I'm going to attempt to rebase and merge 👍 |
The planning scene monitor may use a different clock type (e.g., system clock) than the servo node (ROS clock), causing timestamp comparison failures that prevented servo from starting properly with fake_hardware controllers. --> Add convert_clock_type() helper function to handle clock type conversions
This PR resolves an initialization issue in moveit_servo when used with ros2_control mock hardware components. The robot must be manually moved at startup to trigger joint state updates, otherwise moveit_servo fails to initialize due to a mismatch in clock types between the PlanningSceneMonitor and the ServoNode.
This fixes issue #3040
Description
At startup, servo_node checks whether a recent robot_state has been received by comparing the current time with the timestamp of the latest update (
last_update_time_). However, when using a ros2_control mock component, it may wait indefinitely—even if joint states are being published regularly. This issue stems from a mismatch in clock types between the PlanningSceneMonitor and the moveit_servo node.Mock components typically publish ideal, noise-free joint states, which results in the robot appearing idle.
Consequently:
last_update_time_using RCL_ROS_TIME. (it only updates when the joint states change)last_update_time_is updated with RCL_SYSTEM_TIME.Solution:
This PR introduces a clock type conversion to ensure that time comparisons between moveit_servo and PlanningSceneMonitor are consistent, regardless of the underlying clock type.
This resolves the startup issue when using mock components that produce static, noise-free joint states and therefore do not trigger joint state updates.
There are no relevant API changes.
Checklist