Skip to content

egocap: add wrist offset calibration tools - #1625

Draft
Yunjuliii wants to merge 1 commit into
manus-raw-sensorsfrom
wrist-calibration
Draft

Yunjuliii wants to merge 1 commit into
manus-raw-sensorsfrom
wrist-calibration

Conversation

@Yunjuliii

@Yunjuliii Yunjuliii commented Nov 26, 2026 •

Copy link
Copy Markdown

Description

Depends on #1690 (raw fingertip sensor recording) and is stacked on its branch; the tools read the
{left,right}_sensor_pose fields that PR records.

Add wrist offset calibration tools (examples/egocap/tools/calibration/):

  • calibrate_aim_to_coil.py: where the glove's main coil sits on the controller.
  • calibrate_coil_to_wrist.py: where the wrist sits relative to the main coil.
  • Each tool records a take from CaptureServer in the terminal, solves it and prints PASS or FAIL
    per check. A passed result is saved in the station's wrist_calibration_offsets.json, which a
    recording already copies into every session.
  • Details: tools/calibration/README.md.

Type of change

  • New feature (non-breaking change which adds functionality)

Testing

  • egocap pytest suites and frontend tests: pass
  • SKIP=check-copyright-year pre-commit run --all-files: pass
  • Hardware: aim to coil passed on both hands; coil to wrist passed on the left hand
  • Not yet verified on hardware: coil to wrist on the right hand, and with the headset disconnected

Checklist

  • I have read and understood the contribution guidelines
  • I have run the linter and formatter with SKIP=check-copyright-year pre-commit run --all-files
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix/feature works (or explained why not)
  • I have signed off all my commits (git commit -s) per the DCO

🤖 Generated with Claude Code

Two terminal tools under examples/egocap/tools/calibration/ place a
Manus glove on the rig from its raw fingertip sensors:

- calibrate_aim_to_coil.py: the glove's main coil in the controller
  aim frame, from one clamped fingertip sensor while the controller is
  turned around it.
- calibrate_coil_to_wrist.py: the recorded wrist frame in the main-coil
  frame, from the five fingertip sensors and the hand skeleton.

Each tool records its take from a running CaptureServer through the
capture client, the backend's conversion functions and the recording
service, with no page or camera, then solves it. Only the calibrated
side is recorded, so the other glove and controller can stay off. The
tool lists what to switch on and the steps, waits for the devices and
names any that is missing. An existing episode can be solved instead.

Data selection and acceptance are fixed rules, so a take needs no
judgement: every check prints its value and, when it fails, what to
change. A passed transform is saved in the station calibration file
wrist_calibration_offsets.json, which a recording copies into every
session; a failed take saves nothing.

Signed-off-by: yunjul <yunjul@nvidia.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@gareth-morgan-nv

gareth-morgan-nv commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

🤖 Agent-generated (Claude Code · claude-sonnet-5-5)

Summary

This records the Manus raw fingertip sensors in egocap and adds two wrist-offset calibration tools. Commit 1 reads the plugin's manus_sensors_left / manus_sensors_right collections with one JointSe3PoseTracker each, carries them in the tracking payload (1995 to 2277 bytes), and records {left,right}_sensor_pose (5, 4, 4) in manus_glove. That is the plugin's existing sensor output, so no plugin change is needed. Commit 2 adds about 900 lines of calibration solvers, a recorder, a README and 230 lines of tests on top of it. The sensor plumbing is small and follows the existing hand-field pattern closely. The calibration tools are a different size and risk and should be reviewed separately. I read the diff and the surrounding main code but did not run the tests or any hardware.

Suggested split. Yes, two PRs. The commits already separate cleanly and the PR description says commit 2 depends on commit 1.

  1. Record the Manus raw sensors (commit 1, about 270 added lines plus docs). It changes the wire layout and the recorded data contract, so it needs a careful look and should not wait on the solvers.
  2. Calibration tools (commit 2), rebased once PR 1 lands. It adds scipy/zarr use, cross-package imports from tools/, an AGENTS.md section and a station-file contract. The right-hand coil-to-wrist check is not hardware verified, so calibrate_aim_to_coil.py could go first and calibrate_coil_to_wrist.py follow.

Legend: 🚫 Blocker · 💡 Suggestion · 🔍 Nit

Finding
🚫 PR scope — every session that requests the Manus plugin now carries sensors and records two more arrays in manus_glove, and the plugin still runs with its default datasets (skeleton, sensors and haptic). Existing egocap recording behaviour must not change unless asked for: add an opt-in on the plugin request, off by default, that turns on the sensor trackers, the sensor wire content and the {left,right}_sensor_pose recording, and selects --datasets=human,sensors through plugin_args (main's _manus_args already builds that list). Growing the ic_tracking_v1 payload is fine, since there are no deployed clients to keep compatible; what must not change is the Manus glove functionality egocap already provides. With it off, the recorded manus_glove layout and the plugin's datasets are the same as on main.
🚫 recording_adapter.py MANUS_GLOVE_SPEC / alignment.py FRAME_FIELD_RULES — ManusFrame already declares rules for {side}_sensor_position, {side}_sensor_orientation, {side}_sensor_rotation and {side}_sensor_count, which look like the reference recording's sensor fields. This PR adds {side}_sensor_pose instead and adds it to the same rule table. If the reference format is what downstream conversion reads, a new name or shape breaks it silently. Please confirm {side}_sensor_pose is the agreed layout, or record the existing field names.
💡 isaac_capture.py _map_tracking — the sensor frame is read with tracker.get_data() and any non-None result becomes sensor_present=1. The documented behaviour is "None until the plugin pushes a frame", and the plugin stops pushing when a glove reports fewer than five tips. If the tracker keeps returning its last frame, a disconnected or degraded glove records its last pose as live data indefinitely. Please confirm the tracker returns None again, or compare the sample age against a limit.
💡 recording_adapter.py build_manus_glove_fields — a row is built only when both wrists are valid, so sensor samples are dropped whenever the skeleton is invalid, even though the sensors are independent data from the glove. Fine for the calibration tools, which need the hand anyway, but a recording loses sensor data for no sensor reason.
💡 recording_adapter.py convert_sensor_pose — an unreported set is recorded as all-zero 4x4 matrices, and alignment.py resamples the field linear, element-wise. Interpolating between a zero matrix and a real transform produces matrices that are neither, and nothing marks them. The hand joints have the same convention, but the sensors flip between absent and present much more often. Consider writing a presence flag next to the stack and not interpolating across it, or at least stating the behaviour in recording/README.md.
💡 calibration/* — the leave-one-segment-out rejection, point trimming and multistart ambiguity checks carry eight tunable constants (SEG_FACTOR, TRIM_K, MIN_TAKE_S and so on). Please show what a plain robust fit fails on, so the complexity is justified by a measured case.
💡 calibration/record.py — it imports capture_server, egocap_web and recording_service internals and re-implements the glove conversion path, so a change to convert_hand_pose or the recording service moves the tools too. Calling the recording adapter's public conversion and keeping the tools thin would reduce that.
💡 Naming — "Manus glove calibration" is also what the plugin's --left-calibration / --right-calibration files are (the SDK's glove calibration). These tools solve controller-to-wrist offsets. wrist_offset names the thing.
💡 Tests — convert_sensor_pose has no direct test for the absent case or for the quaternion sign flip it exists to handle; the recorder tests only add default values.
🔍 isaac_capture.py _build_config — it now also assigns self._sensor_trackers, so building a config has a side effect. Create the trackers where the other session state is created.
🔍 mock_isaac_capture.py / replay_isaac_capture.py — the mock and replay never produce sensor data (get_data is always None, replay has deviceio_session = None), so mock and replayed sessions record zeros. Fine for the layout, but it means no desktop path exercises the recorded sensors.
🔍 isaac_capture.py — _SENSOR_TIPS and _MANUS_SENSOR_COLLECTIONS restate the plugin's collection ids and joint order. The header says this order is the contract, so a test that checks them against JointName would stop the two drifting.

Questions for Yunju

  • Is {side}_sensor_pose the field the downstream pipeline expects, given the existing {side}_sensor_position/orientation/rotation/count rules?
  • What does JointSe3PoseTracker.get_data return after the plugin stops pushing?
  • Can sensors be opt-in, off by default, so existing egocap recordings are unchanged?
  • Could the PR be split into the sensor recording and the calibration tools?

Actionables (for bots — copy-paste-ready for AI)

Agent-generated suggestions, not human-vetted obligations. Skip anything wrong, already addressed, or not worth the churn.

  • isaac_capture.py — add an opt-in, off by default, so existing recordings and plugin datasets are unchanged, for sensors on the Manus plugin request and pass --datasets through plugin_args.
  • recording_adapter.py / alignment.py — reconcile {side}_sensor_pose with the existing ManusFrame sensor field names, or confirm it is the agreed layout.
  • isaac_capture.py _map_tracking — treat a stale get_data result as not present, if the tracker keeps returning its last frame.
  • recording_adapter.py build_manus_glove_fields — do not drop sensor data when the skeleton is invalid.
  • recording_adapter.py / alignment.py — write a presence marker for the sensor stack and do not interpolate across an absent sample.
  • Add tests for convert_sensor_pose (absent set, sign-flipped quaternions) and for the sensor constants against JointName.
  • Split the calibration tools into a follow-up PR.

@gareth-morgan-nv

Copy link
Copy Markdown
Contributor

🤖 Agent-generated (Claude Code · claude-sonnet-5-5)

@Yunjuliii this PR's second commit (the controller-to-wrist offset calibration tools) overlaps with the controller-to-glove offset in @NVshawnhwang's stacked pull requests #1635, #1636 and #1637. They reach the same kind of result by different routes: these tools fit from recorded sessions using the raw fingertip sensors, and Shawn's fit works from operator clicks on camera frames, run from the page.

As suggested in my review, please split this PR so the raw sensor recording is its own pull request and the offset calibration tools are their own. Shawn is being asked to break out his offset change the same way. We will then compare the two (output format and convention, where the result is stored and read, how it is run, what it needs recorded) and agree one design before either offset implementation merges.

Shawn is now a reviewer on this PR, and you are a reviewer on #1635, #1636 and #1637.

@Yunjuliii Yunjuliii changed the title egocap: record the Manus raw fingertip sensors and add wrist calibration tools egocap: add wrist offset calibration tools Dec 2, 2026
@Yunjuliii
Yunjuliii changed the base branch from main to manus-raw-sensors December 2, 2026 03:19
@Yunjuliii

Yunjuliii commented Dec 2, 2026 •

Copy link
Copy Markdown
Author

Split as requested: the raw sensor recording is now #1690, and this PR is the offset calibration tools only, stacked on that branch. The review findings on the sensor recording are addressed in #1690.

This branch was previously deployed

1 inactive deployment
dev — 759b969b Deployed Nov 26, 2026 by Yunjuliii via publish-wheel #7401
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants