Skip to content

feat: pink ik adapter for manipulation module#2481

Merged
TomCC7 merged 11 commits into
mainfrom
cc/feat/pink-ik
Jun 16, 2026
Merged

feat: pink ik adapter for manipulation module#2481
TomCC7 merged 11 commits into
mainfrom
cc/feat/pink-ik

Conversation

@TomCC7

@TomCC7 TomCC7 commented Jun 12, 2026

Copy link
Copy Markdown
Member

Straight forward IK solver addition trying to resolve current IK speed issue in viser visualizer #2475 . Can be merged independently.

Features

  • Implement pink ik as a new ik spec in manipulation module
  • Adds RPC method for IK so we can test ik in cli separately (also useful for future application).

How to Test

uv run dimos run xarm7-planner-coordinator \
  -o manipulationmodule.kinematics_name=pink
# in a different term
uv run python -i -m dimos.manipulation.planning.examples.manipulation_client
ik_pose(0.45, 0, 0.25)

Contributor License Agreement

  • I have read and approved the CLA.

@TomCC7 TomCC7 marked this pull request as ready for review June 12, 2026 20:25
@greptile-apps

greptile-apps Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a Pink-based differential IK solver as a new pink backend for the manipulation module, addressing the IK speed issue in the Viser visualizer (#2475). It also introduces a typed discriminated-union config system for kinematics backends and exposes a new solve_ik RPC endpoint to let callers run IK in isolation (useful for testing and future applications).

  • PinkIK implements the KinematicsSpec protocol using Pink's task/QP solver with random-restart multi-attempt logic; pin-pink>=4.2.0 and qpsolvers[proxqp]>=4.12.0 are added to the manipulation extra.
  • ManipulationKinematicsConfig replaces the plain kinematics_name: str field with a Pydantic discriminated union of typed configs (jacobian, drake_optimization, pink), retaining the old string field as a deprecated compatibility shim.
  • The new solve_ik RPC method on ManipulationModule solves IK for a given pose without path planning, includes proper state machine transitions (PLANNINGCOMPLETED/IDLE), and stores no trajectory so execute() remains a no-op after a pure IK call.

Confidence Score: 5/5

Safe to merge — all new code is additive, the previous review issues were both resolved, and the change is guarded behind an opt-in config field.

The Pink IK backend follows the existing KinematicsSpec contract precisely, the JOINT_LIMITS early-return and wrong install-hint bugs called out in prior review are both fixed, the new solve_ik RPC properly resets module state on every exit path, and the discriminated-union config is backward-compatible with the deprecated kinematics_name string. Unit tests cover the retry loop, collision rejection, and dependency error messaging.

No files require special attention. The new pink_ik.py is the most complex file but it is fully unit-tested.

Important Files Changed

Filename Overview
dimos/manipulation/planning/kinematics/pink_ik.py New Pink IK backend with multi-attempt retry and name-based joint mapping; previous review issues (wrong extra hint, early JOINT_LIMITS exit) are both fixed.
dimos/manipulation/manipulation_module.py Adds solve_ik RPC with correct state transitions and introduces the typed kinematics config field with backward-compatible kinematics_name shim.
dimos/manipulation/planning/kinematics/config.py Introduces PinkKinematicsConfig and ManipulationKinematicsConfig discriminated union; clean Pydantic design.
dimos/manipulation/planning/factory.py Factory wires PinkKinematicsConfig to PinkIK; passes the full config object through so tuning params survive creation.
dimos/manipulation/planning/kinematics/test_pink_ik.py Thorough unit tests including JOINT_LIMITS retry, collision rejection, joint name ordering, and dependency error messaging.
dimos/manipulation/test_manipulation_unit.py New tests verify the solve_ik RPC state machine, explicit seed handling, and legacy kinematics_name backward compat.
dimos/manipulation/planning/examples/manipulation_client.py Adds ik_pose convenience function and supporting helpers to the RPC client for interactive IK testing.
pyproject.toml Adds pin-pink>=4.2.0 and qpsolvers[proxqp]>=4.12.0 to the manipulation extra, matching the error-message hints in the implementation.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[ManipulationModule.solve_ik / plan_to_pose] --> B{kinematics_name set?}
    B -- yes --> C[kinematics_config_from_name]
    B -- no --> D[use config.kinematics]
    C --> E[create_kinematics factory]
    D --> E

    E --> F{config type?}
    F -- JacobianKinematicsConfig --> G[JacobianIK.solve]
    F -- DrakeOptimizationKinematicsConfig --> H[DrakeOptimizationIK.solve]
    F -- PinkKinematicsConfig --> I[PinkIK.solve]

    I --> J[_get_robot_context pinocchio model + frame + mapping]
    J --> K{attempt loop max_attempts}
    K -- attempt 0 --> L[seed q from JointState]
    K -- attempt 1..N --> M[random q from joint limits]
    L --> N[_solve_single pink.solve_ik iterations]
    M --> N
    N -- SUCCESS --> O{collision check?}
    O -- free --> P[return IKResult SUCCESS]
    O -- collision --> Q[fallback = COLLISION continue]
    N -- JOINT_LIMITS --> R[fallback = JOINT_LIMITS continue]
    N -- NO_SOLUTION --> S[fallback = NO_SOLUTION continue]
    Q --> K
    R --> K
    S --> K
    K -- exhausted --> T[return fallback or NO_SOLUTION]
Loading

Reviews (3): Last reviewed commit: "feat: expose kinematics backend config" | Re-trigger Greptile

Comment thread dimos/manipulation/planning/kinematics/pink_ik.py Outdated
Comment thread dimos/manipulation/planning/kinematics/pink_ik.py Outdated
@TomCC7 TomCC7 removed the PlzReview label Jun 12, 2026
@codecov

codecov Bot commented Jun 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.96610% with 71 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
dimos/manipulation/planning/kinematics/pink_ik.py 75.68% 41 Missing and 12 partials ⚠️
dimos/manipulation/manipulation_module.py 77.77% 4 Missing and 4 partials ⚠️
dimos/manipulation/planning/factory.py 63.63% 3 Missing and 1 partial ⚠️
...s/manipulation/planning/kinematics/test_pink_ik.py 98.13% 3 Missing and 1 partial ⚠️
dimos/manipulation/planning/kinematics/config.py 93.33% 1 Missing and 1 partial ⚠️
Flag Coverage Δ
OS-ubuntu-24.04-arm 63.84% <87.96%> (-0.02%) ⬇️
OS-ubuntu-latest 64.67% <87.96%> (-0.03%) ⬇️
Py-3.10 64.66% <87.96%> (-0.03%) ⬇️
Py-3.11 64.67% <87.96%> (-0.03%) ⬇️
Py-3.12 64.67% <87.96%> (-0.03%) ⬇️
Py-3.13 64.67% <87.96%> (-0.03%) ⬇️
Py-3.14 64.68% <87.96%> (-0.03%) ⬇️
Py-3.14t 64.66% <87.96%> (-0.03%) ⬇️
SelfHosted-Large 30.28% <29.66%> (?)
SelfHosted-Linux 38.21% <30.00%> (-0.07%) ⬇️
SelfHosted-macOS 36.94% <30.00%> (-0.10%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
dimos/manipulation/test_manipulation_unit.py 100.00% <100.00%> (ø)
dimos/manipulation/planning/kinematics/config.py 93.33% <93.33%> (ø)
dimos/manipulation/planning/factory.py 63.63% <63.63%> (+19.19%) ⬆️
...s/manipulation/planning/kinematics/test_pink_ik.py 98.13% <98.13%> (ø)
dimos/manipulation/manipulation_module.py 48.52% <77.77%> (+1.52%) ⬆️
dimos/manipulation/planning/kinematics/pink_ik.py 75.68% <75.68%> (ø)

... and 21 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions Bot added the ready-to-merge Required CI checks have passed on this PR label Jun 12, 2026
@TomCC7

TomCC7 commented Jun 12, 2026

Copy link
Copy Markdown
Member Author

@mustafab0 confirmed that using this for vis ik solving will be much faster than original in-house ik

mustafab0
mustafab0 previously approved these changes Jun 13, 2026
Comment thread dimos/manipulation/planning/kinematics/pink_ik.py Outdated
Comment thread dimos/manipulation/planning/kinematics/pink_ik.py Outdated
@github-actions github-actions Bot added ready-to-merge Required CI checks have passed on this PR and removed ready-to-merge Required CI checks have passed on this PR labels Jun 13, 2026
@TomCC7

TomCC7 commented Jun 13, 2026

Copy link
Copy Markdown
Member Author

@mustafab0 can you review again?

@TomCC7 TomCC7 merged commit f3dbafe into main Jun 16, 2026
25 checks passed
@TomCC7 TomCC7 deleted the cc/feat/pink-ik branch June 16, 2026 04:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Required CI checks have passed on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants