Skip to content

egocap: show both hands in a panel on the recording screen - #1642

Open
NVshawnhwang wants to merge 2 commits into
nvShawnHwang/egocap_rectification_inspectionfrom
nvShawnHwang/egocap_hand_view
Open

NVshawnhwang wants to merge 2 commits into
nvShawnHwang/egocap_rectification_inspectionfrom
nvShawnHwang/egocap_hand_view

Conversation

@NVshawnhwang

Copy link
Copy Markdown
Collaborator

Branch: nvShawnHwang/egocap_hand_view, opened against nvShawnHwang/egocap_rectification_inspection.

One commit:

  1. egocap: show both hands in a panel on the recording screen

Summary

Adds a hand view to the Ego Capture recording screen: both hands as the hand source reports them, drawn in a
panel of their own at the top of the side panel, with a setting to switch it off. Until now the tracked hands
could only be seen in the 3D view. The camera pictures are not drawn on.

What changes (frontend only)

  • HandView.tsx: the panel. Left hand on the left, each hand drawn flat with the wrist at the bottom and the
    fingers up, scaled to its half. A hand that sends nothing leaves a dashed outline and "No data from the left
    glove"; joints flagged invalid are left out, with a dashed bridge between valid ones. The hands differ in
    colour and in the shape of their joints, so colour is never the only cue.
  • handProjection.ts: the geometry. The hand's frame is built from three joint positions (wrist, index
    knuckle, little-finger knuckle) and its scale from bone lengths, so a fist is drawn at the open hand's size
    and no axis convention of the tracking space is assumed.
  • handJoints.ts: the joint names and one named table of finger chains, with a test that each chain runs
    outward along a synthetic open hand.
  • Settings, Display, "Show the hand view", and a Hide button on the panel. The choice is remembered in the
    browser (localStorage), shown by default.
  • With the panel on, the Details tables move below the fold of the side panel at common window heights and
    keep a minimum height; with it off the layout is unchanged.

How it was tested

  • npm run lint, npm run test (669 tests), npm run build from examples/egocap/frontend.
  • Run against the mock capture server: both hands sending, one hand silent, fingertips flagged invalid, the
    setting and the Hide button by keyboard.

Not yet verified (needs real gloves)

The drawing has only been fed the mock and synthetic hands. With gloves on, each of these takes under a minute
(the same list is in the frontend README):

  • Joint order: with both hands open, each finger is one line from wrist to tip, and bending one finger at a
    time shortens only that finger's line.
  • Handedness: wiggling the left fingers moves only the left half, and both thumbs point to the middle.
  • Orientation independence: turning an open hand palm up, palm down or fingers down does not change the drawing.
  • Size: a fist keeps the palm's size.

🤖 Generated with Claude Code

Add a hand view to the side panel of the recording screen: both hands as
the hand source reports them, drawn flat with the wrist at the bottom and
the fingers up, so an operator can see at a glance that both gloves are
tracking and that the drawing follows the fingers. The camera pictures
are not drawn on.

- The drawing is made from joint positions only: the hand's frame comes
  from the wrist and two knuckles, and its scale from bone lengths, so a
  fist is drawn at the open hand's size and no axis convention of the
  tracking space is assumed.
- A hand that sends nothing leaves a dashed outline and a sentence; joints
  flagged invalid are left out. The hands differ in colour and in the
  shape of their joints.
- Settings, Display, "Show the hand view" switches the panel, as does its
  Hide button. The choice is remembered in the browser.
- The finger chains are one named table beside the joint names, with a
  test that each chain runs outward along a synthetic open hand.

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

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@gareth-morgan-nv

Copy link
Copy Markdown
Contributor

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

Summary

This adds a hand view to the recording screen: both hands drawn flat, wrist at the bottom, fingers up, scaled from bone lengths, with a Hide button and a Display setting. It is frontend only. I read handJoints.ts, handProjection.ts, HandView.tsx, handViewSetting.ts, and the changes to App.tsx, CaptureTree.tsx, SettingsPanel.tsx and styles.css. I did not run the frontend tests or the page; the PR itself says the drawing has only been fed the mock and synthetic hands.

The joint table is right: it matches HAND_JOINT_NAMES in capture_server/protocol.py entry for entry (Palm, Wrist, thumb with four, then five per finger), and Index Proximal / Little Proximal are the knuckle joints, so the palm frame is built from sensible points. Building the frame from three positions and never from orientations is a good choice for gloves. The cost is small: two hands of 26 points, a few dozen SVG elements, redrawn per accepted sample. I found no per-frame allocation that matters. The points below are about what the view can and cannot show, and a small smoothing detail.

Legend: 🚫 Blocker · 💡 Suggestion · 🔍 Nit

Finding
💡 handProjection.ts flattenHand and the README check "both thumbs point to the middle" — the mirroring comes from the side argument, not from the data, and in the (across, up) frame the thumb always lies on the index-finger side. So the thumbs pointing inward is true by construction for any data, and cannot show that a glove is labelled with the wrong hand. The other check in the list (wiggling the left fingers moves only the left half) does detect swapped routing. Please drop the thumb check from the README, or say it is not a handedness test, and note in the panel text that sides come from the stream's labels.
💡 HandView.tsx HandView — drawHand runs on every render and takes reaches.current (set in an effect after each render) as the previous size, and smoothReach eases 15% toward the measurement each call. The 1 s forceTick re-render, and a StrictMode double render, therefore advance the smoothing with no new sample, so the easing rate depends on how often React renders rather than on the sample rate. It converges and is harmless, but the "lag of a second or two" in the REACH_SMOOTHING comment does not hold as a number. Smoothing per accepted sample (keyed on the sample object) would match the comment.
💡 HandView.tsx — the panel says "as the gloves report them", and draws the live accepted sample from the page, with the hand present flag and joint.valid deciding what is shown. I could not tell from this PR whether the page's valid flag is the same one the recorder stores for those joints. If a joint can be flagged invalid here and recorded as valid (or the reverse), a quick look at the panel would mislead the operator about what a take holds. Please confirm they are the same decoded field.
💡 handJoints.ts — the table duplicates HAND_JOINT_NAMES in the capture server's protocol module. The comment says why it has to (the wire sends the order id, not names), which is reasonable; a short test that asserts the 26 names against the protocol document's table would stop the two drifting. The test described in the PR only checks the chains against a synthetic hand built from the same table.
💡 HandView.tsx REST_OUTLINE — the stand-in outline is a hand-entered table of 24 coordinate pairs with no source; it is used for the silent state only. Fine, but derive it from a single synthetic open hand in handTestDoubles.ts through flattenHand so a change to the chain table changes the outline too.
🔍 handTestDoubles.ts lives in src/ beside shipped code. If only tests import it, move it under the tests folder so it cannot reach the bundle.
🔍 HandView.tsx WORDS — left and right entries differ only in case ("Left hand tracked" / "right hand tracked") because the right clause follows a semicolon. Build both from one template and capitalise at the join.
🔍 App.tsx — the hidden status message "The hand view is hidden. Show it again in Settings" is read out on every render while hidden, as a permanent role="status" region. Fine for the first change; consider clearing it after the announcement, as the next PR does for the side panel.

Questions for the author

  • Is the reach scale intended to ignore the thumb? reach is the longest chain, which is the middle finger for any normal hand, so thumb length never sets the scale, but fitScale still shrinks the whole hand if the thumb runs outside its cell. Is that what you saw with the mock hands at full spread?
  • With gloves on, does a bent finger's projection stay readable? A fingertip curled toward the palm plane projects close to its knuckle; I could not judge from code.

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.

  • frontend/README.md hand view section — reword the "both thumbs point to the middle" check as a drawing sanity check, not a handedness check.
  • HandView.tsx — apply smoothReach once per accepted sample, not per render.
  • handJoints.ts — add a test that compares OPENXR_26_JOINT_NAMES with the protocol's joint list.
  • handTestDoubles.ts — move out of src/ if tests are its only users.
  • Confirm that the decoded joint_valid shown here is the field the recorder stores.

@gareth-morgan-nv gareth-morgan-nv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Approved. Please address the comments in my review as you see fit.

@NVshawnhwang
NVshawnhwang requested a review from NVdejung December 1, 2026 20:25
…awnHwang/egocap_hand_view

Signed-off-by: Shawn Hwang <shhwang@nvidia.com>

@NVdejung NVdejung left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Automated first-pass review (Claude, for Dejun) — I'll follow up personally where needed.

Summary — Adds a hand view at the top of the recording screen's side panel. Each hand is laid flat in a palm frame built from three joint positions and scaled by bone length. A Hide button and a Display setting (on by default, kept in localStorage) switch it off, and the tracking staleness rule moves into shared helpers in CaptureTree.tsx. The code is careful and well tested. The one blocker is what the README tells people to do when the glove joint-order check fails. This was a read-only review: I did not run the tests or the page.

Must fix

  1. examples/egocap/frontend/README.md:617 and examples/egocap/frontend/src/handJoints.ts:7 — the fix the docs give for a failed joint-order check is in the wrong layer.
    • The stream declares HandJointOrder.OPENXR_26. The recorder converts hands by those indices and refuses any other order (recording_adapter.py:127). The 3D view draws its bones from its own table (viser_scene.py:64).
    • So if a glove's joints really arrive in another order, every recorded take is mislabelled. Following "correct the tables in handJoints.ts" would make this panel look right and leave the 3D view crossed. It would hide the very data bug the check is there to catch.
    • Suggested wording: stop recording with that glove; the joint mapping where the glove's skeleton enters the stream is wrong.
    • Also drop "Everything that names a joint or draws a bone reads these tables, so a correction is made here once". That is only true for this page: protocol.py:482 and viser_scene.py keep their own tables.
    • A failed Thumb-side or Axes check (README.md:620) is a stream problem in the same way. The earlier review already covers what the thumb check can prove at all.

Suggestions

  • HandView.tsx:106 — when the feed is not live, the sample is stale, or none has arrived, App passes null (App.tsx:713). Both halves then say "No data from the left/right glove", which blames the gloves for a stream outage that also takes out the head. In the same situation Details says "No tracking sample yet." or "Tracking stale.". Give "no current sample" its own one-line wording across the panel, and keep the glove sentences for present === false.
  • styles.css:2465 — the 3D view right below colours the left hand blue and the right hand orange (viser_scene.py:67); this panel uses cyan and magenta. Two stacked drawings of the same hands with different side colours invite a misread, so pick one colour per side for both. Orange sits near --warning, so changing the 3D view may be the easier side.
  • styles.css:3362 / README.md:383 — rough arithmetic: the hand panel is about 265 px at 17vh, and the 3D view is clamp(300px, 42vh, 560px), plus chrome. In a maximised 1080p browser that likely leaves Details well under its 200 px floor. The session details would then start below the fold on typical station screens, not only in "a short window". Either let the 3D view give up height while the hand view is on, or say this plainly in the README. Worth checking on a station screen.
  • README.md:615 — "the joints evenly along it" is the wrong pass criterion. The index bones in handTestDoubles.ts are 55, 45, 26 and 20 mm, and real fingers taper the same way, so a correct glove fails this wording. Suggest "in order along it, the gaps shrinking toward the tip".
  • Nit, styles.css:3271 — an older copy of the .op-panel / .op-panel--3d / .op-panel--details rules still says "opening both never pushes either off the screen". With the hand view on, that is no longer true. Lines 3345–3380 repeat the same rules, so delete the older copy.
  • Nit, handTestDoubles.ts:6 — "and for the hand view's drawing harness": there is no harness in the tree.

Conflicts

  • With nvShawnHwang/egocap_rectification_inspection (the branch of #1641): 0 commits behind and the local 3-way merge is clean, so no rebase is needed. This PR merges after #1641 in the stack.
  • With open PRs: no textual conflicts with any PR in the stack (#1637–#1641 below, #1643–#1646 above, all from this author).
    • Semantic: #1643 (the side panel opens and closes) builds on this layout. The focus move after Hide and the hidden status line assume the <aside> is always on the page, so check both there with the panel closed.
    • #1586 (gareth-morgan-nv, based on main) also edits App.tsx and styles.css. Conflicts were not computed because the base differs; whichever reaches main second rebases.
Change-by-change (16 files)
File / area What changed Makes sense?
HandView.tsx New panel: one cell per hand, dashed rest outline for a missing hand, discs (left) and diamonds (right), captions plus a text alternative, a 1 s tick so a stale sample stops showing, smoothed reach kept in a ref and stored after render ✅ cell margins fit the mark sizes; ⚠️ wording of the no-sample state (suggestion 1)
handProjection.ts Palm frame from the wrist and the index/little knuckles, mirroring chosen by side, reach as the longest bone chain, bridged bones, fit-to-cell scale ✅ checked the mirror sign and the degenerate/null paths; the decoder already nulls non-finite positions
handJoints.ts OpenXR joint names moved here from CaptureTree.tsx, plus finger chains and the knuckle row ⚠️ docstring L7 (must-fix)
CaptureTree.tsx Staleness moved into trackingSampleAgeMs / currentTracking; joint names imported ✅ same behaviour (AcceptedTracking.decoded is never null)
App.tsx Hand-view state; Hide moves focus to the <aside> (now tabIndex={-1}); panel above the 3D view; visually hidden status line; Settings props ✅ Space and the letter shortcuts still fire with focus on the aside (RecordingPanel.tsx only skips inputs, buttons, summaries)
SettingsPanel.tsx "Hand view" card on Display with a checkbox; DisplayTab props via Pick ✅ App is the only caller
handViewSetting.ts egocap.handView on/off in localStorage, default on, tolerant of blocked storage ✅
styles.css Hand view styles and colours, flex: none for the hand panel, 200 px Details floor under it, focus ring for the aside, updated comments ✅ contrast claims hold (about 4.7, 5.1 and 3.4 : 1 on --surface); ⚠️ colours vs 3D view, Details floor, stale duplicate block
README.md Display tab, side panel layout, new Hand view section and glove checklist ⚠️ L617 (must-fix), L615, L383
Tests and doubles: HandView.test.tsx, handProjection.test.ts, handJoints.test.ts, handViewSetting.test.ts, SettingsPanel.test.tsx, App.operatorLayout.test.tsx, handTestDoubles.ts Same drawing for a moved or turned hand, fist scale, invalid joints, absent/stale/not-live feeds, Hide with focus and persistence, Settings round-trip, the shared freshness rule ✅ good coverage; localStorage is cleared between tests; ⚠️ nit on the harness comment
Public-repo hygiene Added lines, docs, fixtures, title and description ✅ no internal hosts, paths or names found

Reviewed at 51e35a4 · 16 files · 2026-12-01 14:25 PST

This branch was successfully deployed

1 active deployment
dev — a8c665b2 Deployed Dec 2, 2026 by NVshawnhwang via publish-wheel #7720
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