Skip to content

Fix Servo Jacobian fallback without IK solver - #3826

Open
dlanov wants to merge 1 commit into
moveit:mainfrom
dlanov:fix-3789-servo-no-ik-fallback
Open

Fix Servo Jacobian fallback without IK solver#3826
dlanov wants to merge 1 commit into
moveit:mainfrom
dlanov:fix-3789-servo-no-ik-fallback

Conversation

@dlanov

@dlanov dlanov commented Aug 22, 2026

Copy link
Copy Markdown

Description

Fixes #3789.

MoveIt Servo already has a direct-Jacobian fallback in jointDeltaFromIK() when no IK solver is configured. However, TWIST and POSE commands could not reach that path because getIKSolverBaseFrame() and getIKSolverTipFrame() returned std::nullopt whenever the planning group had no IK solver.

This change allows solver-less kinematic chain groups to use the same base and tip frames that RobotState::getJacobian() uses internally:

  • base frame: parent link of the group's first joint
  • tip frame: last link in the group

Groups with an IK solver retain the existing behavior and continue using the solver-provided frames.

For non-chain groups without an IK solver, the helpers continue to fail safely with std::nullopt rather than choosing an ambiguous frame.

Regression coverage verifies:

  • solver-less chain groups resolve the expected base and tip frames;
  • non-chain groups without an IK solver still fail safely;
  • TWIST commands reach the existing Jacobian fallback;
  • POSE commands reach the existing Jacobian fallback.

Testing

Validated with an incremental moveit_servo build:

  • colcon build --packages-select moveit_servo — passed
  • targeted no-IK-solver regression tests — 4/4 passed
  • complete moveit_servo_utils_test — 18/18 passed
  • pre-commit on all changed files — passed
  • git diff --check — passed

Checklist

  • Required by CI: Code is auto formatted using clang-format
  • Extend the tutorials / documentation
  • Document API changes relevant to the user in MIGRATION.md
  • Create tests, which fail without this PR
  • Include a screenshot if changing a GUI

Summary by CodeRabbit

  • New Features

    • Twist and pose commands can now operate for unambiguous kinematic-chain groups even when no IK solver is configured.
    • Servo automatically determines suitable base and tip frames from the robot’s chain structure.
  • Bug Fixes

    • Improved handling and diagnostics when frame information cannot be determined.
    • Branched or empty groups now fail safely instead of producing invalid command results.
  • Tests

    • Added coverage for frame fallback behavior and Jacobian-based command handling without an IK solver.

Signed-off-by: Dennis Lanov <dennis.lanov@gmail.com>
@coderabbitai

coderabbitai Bot commented Aug 22, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9334a21c-e22d-4eea-857a-5f003898f5e4

📥 Commits

Reviewing files that changed from the base of the PR and between 8fcb5d2 and 21b5047.

📒 Files selected for processing (4)
  • moveit_ros/moveit_servo/include/moveit_servo/utils/common.hpp
  • moveit_ros/moveit_servo/src/servo.cpp
  • moveit_ros/moveit_servo/src/utils/common.cpp
  • moveit_ros/moveit_servo/tests/test_utils.cpp

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

This change enables solver-less chain groups to resolve Jacobian-compatible base and tip frames. Twist and Pose command handling now accepts these frames, reports ambiguous frame failures, and tests finite nonzero joint deltas.

Changes

Solver-less Jacobian command handling

Layer / File(s) Summary
Chain-based frame resolution
moveit_ros/moveit_servo/include/moveit_servo/utils/common.hpp, moveit_ros/moveit_servo/src/utils/common.cpp, moveit_ros/moveit_servo/tests/test_utils.cpp
Frame helpers fall back to the first joint’s parent link and the group’s last link for chain groups without IK solvers. Empty and non-chain groups return std::nullopt.
Twist and Pose Jacobian command flow
moveit_ros/moveit_servo/src/servo.cpp, moveit_ros/moveit_servo/tests/test_utils.cpp
Servo diagnostics accept solver-derived or chain-derived frames. Twist and Pose tests verify finite, nonzero joint deltas for solver-less chain groups.

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

Merge Risk: ⚪ Minimal · up to 21b50

The change enables TWIST and POSE commands to use the existing Jacobian fallback for solver-less chain groups while preserving safe behavior for non-chain groups; no actionable merge-blocking risk remains beyond normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant Servo
  participant FrameHelpers
  participant RobotState
  participant JacobianFallback
  Servo->>FrameHelpers: resolve planning base and tip frames
  FrameHelpers-->>Servo: return chain frames
  Servo->>RobotState: process Twist or Pose command
  RobotState->>JacobianFallback: compute joint deltas from Jacobian
  JacobianFallback-->>Servo: return finite nonzero joint deltas
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the Servo Jacobian fallback change for configurations without an IK solver.
Linked Issues check ✅ Passed The changes satisfy issue #3789 by enabling solver-less chain groups to use the existing direct Jacobian path while preserving safe failure for non-chain groups.
Out of Scope Changes check ✅ Passed The changes are limited to frame fallback logic, related diagnostics, documentation, and regression tests required by issue #3789.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@dlanov
dlanov marked this pull request as ready for review August 22, 2026 00:52
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] Twist-mode differential IK path unreachable when no kinematics plugin configured

1 participant