Skip to content

Fix: moveit_servo: future-stamped commands remain active past incoming_command_timeout - #4034

Open
SIDDARTHAREDDY8 wants to merge 1 commit into
moveit:mainfrom
SIDDARTHAREDDY8:oss-bhai-2026-11-29-p1
Open

SIDDARTHAREDDY8 wants to merge 1 commit into
moveit:mainfrom
SIDDARTHAREDDY8:oss-bhai-2026-11-29-p1

Conversation

@SIDDARTHAREDDY8

@SIDDARTHAREDDY8 SIDDARTHAREDDY8 commented Nov 29, 2026 •

Copy link
Copy Markdown

Fixes #4033.

Fix for moveit/moveit2 issue #4033 (moveit_servo: future-stamped commands remain active past incoming_command_timeout). Collision check clean: issue timeline shows no linked PR, body search hit only unrelated 2022 PR #1333. Implemented the issue's first proposed fix (clamp + throttled warning): new parameter incoming_command_future_tolerance (double, default 0.1 s, gt_eq 0.0) in config/servo_parameters.yaml; ServoNode::clampFutureCommandStamp() clamps any joint-jog/twist/pose header stamp more than the tolerance ahead of node time back to receipt time and emits a 1 s-throttled warning naming the clock-sync cause; the existing (now - stamp) >= incoming_command_timeout staleness checks are unchanged, so a clamped command now expires normally once input stops while small millisecond skew passes through untouched. Added regression test testFutureStampedTwistExpires in tests/test_ros_integration.cpp: streams twist commands stamped +5 s for 1 s, asserts Servo drives while input is live, then asserts zero additional trajectory messages 1 s after the 0.5 s test-config timeout (pre-fix this fails: the command stays fresh for 5 s). Pushed to SIDDARTHAREDDY8/moveit2 branch oss-bhai-2026-11-29-p1, 1 commit ahead of main @ 5399d29 (the exact main SHA cited in the issue), compare verified: only these 4 files, all additions. DCO: single Signed-off-by line on the fresh commit. NOT verified in a live ROS run: this lane has no ROS (/opt/ros absent, no ros2/colcon), so the reporter's repro script and the repo's own gtest suite could not run here; verification was a C++ harness compiling the ACTUAL extracted clampFutureStamp function against stub rclcpp types (7/7 boundary checks pass: 5 s future clamps, 50 ms/100 ms-boundary untouched, 101 ms clamps, past stamp untouched, tolerance-0 behavior) plus a simulation showing the repro case flips from age -4.40 s (never stale) to +0.60 s (stale) at 0.6 s after input stops. The new integration test needs CI/a ROS Jazzy run to execute.

Tests pass: Repo gtest suite and reporter repro script NOT runnable in this lane: no ROS installed (/opt/ros absent, no ros2/colcon). Focused verification ran and passed: C++ harness compiled the actual extracted clampFutureStamp function from the pushed servo_node.cpp against stub rclcpp::Time/Duration and passed 7/7 boundary checks; Python simulation of the unchanged staleness check confirmed the repro case (5 s future stamp, 0.6 s after last command) flips from never-stale to stale. YAML validated by parse. New regression test testFutureStampedTwistExpires added but not executed here; must run under CI/ROS Jazzy.

Summary by CodeRabbit

  • Bug Fixes

    • Commands stamped significantly ahead of the current time are now adjusted to their receipt time, helping prevent outdated motion commands from continuing to generate trajectories.
    • Small differences between command timestamps and the current time remain unchanged.
  • Configuration

    • Added a nonnegative setting to control how far ahead a command timestamp can be before it is adjusted. The default tolerance is 0.1 seconds.

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Servo adds a configurable tolerance for future command timestamps. The JointJog, TwistStamped, and PoseStamped callbacks clamp timestamps beyond the tolerance to receipt time. An integration test checks trajectory generation after future-stamped twist commands stop arriving.

Changes: Future-stamped command handling

Layer / File(s) Summary
Configure and apply timestamp clamping
moveit_ros/moveit_servo/config/servo_parameters.yaml, moveit_ros/moveit_servo/include/moveit_servo/servo_node.hpp, moveit_ros/moveit_servo/src/servo_node.cpp, moveit_ros/moveit_servo/tests/test_ros_integration.cpp
Adds a nonnegative incoming_command_future_tolerance parameter, defaulting to 0.1 seconds. The JointJog, TwistStamped, and PoseStamped callbacks clamp timestamps beyond the tolerance to receipt time and issue a warning throttled to once per second. An integration test publishes commands stamped five seconds ahead and checks that trajectory generation stops after publishing ends.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant Publisher
  participant ServoNode
  participant TrajectoryOutput
  Publisher->>ServoNode: Publish stamped command
  ServoNode->>ServoNode: Compare stamp with future tolerance
  ServoNode->>ServoNode: Clamp to receipt time if beyond tolerance
  ServoNode->>TrajectoryOutput: Generate trajectory while commands arrive
Loading

Suggested reviewers: nbbrooks, rhaschke

Merge Risk: Minimal · up to a5d52

Servo now clamps command timestamps that are far in the future to their receipt time, so such commands expire after the configured timeout. The change is small and its default allows normal clock skew. The new integration test should be confirmed in CI before merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the Servo fix: future-stamped commands stay active past incoming_command_timeout. The changeset clamps future command stamps (joint jog, twist, pose) to receipt time when they exceed i…
Linked Issues check Passed Directly linked issue #4033 requires that future-dated Servo commands not stay active beyond incoming_command_timeout, that small positive skew be allowed, and that the fix apply to twist, joint jog, …
Out of Scope Changes check Passed The PR changes four files: the servo_parameters.yaml parameter addition, the servo_node.hpp helper declaration, the servo_node.cpp clamp logic and callback calls, and the regression test in test_ros_i…
Full details: Title check

Explanation

The title names the Servo fix: future-stamped commands stay active past incoming_command_timeout. The changeset clamps future command stamps (joint jog, twist, pose) to receipt time when they exceed incoming_command_future_tolerance, and adds a test for the expired-command behavior. The title matches the main change. The title uses the "Fix:" prefix and a package scope, which is acceptable.

Full details: Linked Issues check

Explanation

Directly linked issue #4033 requires that future-dated Servo commands not stay active beyond incoming_command_timeout, that small positive skew be allowed, and that the fix apply to twist, joint jog, and pose inputs. The file read of moveit_ros/moveit_servo/src/servo_node.cpp at the reviewed head shows: (1) clampFutureStamp returns node time when stamp - now exceeds incoming_command_future_tolerance and returns the stamp otherwise; (2) clampFutureCommandStamp applies this clamp and emits a 1 s throttled warning; (3) jointJogCallback, twistCallback, and poseCallback each call the clamp on the copied header stamp before setting the new-message flag; (4) the existing (node_->now() - stamp) >= incoming_command_timeout staleness checks are unchanged, so clamped commands expire after input stops. This matches the issue's first proposed fix. The config parameter and the header declaration were not read through the diff tool because the whole-PR diff was unavailable. The servo_node.cpp file read supports the call sites and the helper's use of servo_params_.incoming_command_future_tolerance. The new regression test in tests/test_ros_integration.cpp was not executed. This does not affect the verdict, because the issue requires code behavior and the code path is shown. Residual uncertainty: the build and the test run were not confirmed in this lane.

Full details: Out of Scope Changes check

Explanation

The PR changes four files: the servo_parameters.yaml parameter addition, the servo_node.hpp helper declaration, the servo_node.cpp clamp logic and callback calls, and the regression test in test_ros_integration.cpp. Each change supports the #4033 objective: the parameter sets the tolerance, the header and source implement the clamp, and the test checks the expiry behavior. The reviewed servo_node.cpp shows no unrelated logic changes in the staleness checks or the command processing paths. No unrelated change was found in the evidence available.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 5399d29 and a5d52a0.

Files selected for processing: 4

  • moveit_ros/moveit_servo/config/servo_parameters.yaml
  • moveit_ros/moveit_servo/include/moveit_servo/servo_node.hpp
  • moveit_ros/moveit_servo/src/servo_node.cpp
  • moveit_ros/moveit_servo/tests/test_ros_integration.cpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@mergify

mergify Bot commented Nov 29, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request once it meets the queue conditions

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.

moveit_servo: future-stamped commands remain active past incoming_command_timeout

1 participant