Skip to content

egocap: the launcher starts, bridges and corrects every station camera - #1646

Open
NVshawnhwang wants to merge 2 commits into
nvShawnHwang/egocap_control_token_boxfrom
nvShawnHwang/egocap_three_camera_launch
Open

NVshawnhwang wants to merge 2 commits into
nvShawnHwang/egocap_control_token_boxfrom
nvShawnHwang/egocap_three_camera_launch

Conversation

@NVshawnhwang

Copy link
Copy Markdown
Collaborator

Branch: nvShawnHwang/egocap_three_camera_launch, opened against nvShawnHwang/egocap_control_token_box.

One commit:

  1. egocap: the launcher starts, bridges and corrects every station camera

Summary

The launcher (tools/start_system.py) bridged the one stream of its sender profile, so only the head camera was
corrected live. It now takes a profile of one to three mono streams and starts one chain for all of them: one
sender deployment, one receiver config listing every stream, one camera bridge with a --stream for each, and for
each corrected stream a table built at launch from that camera's own calibration and a --gpu-step of its own.
Each bridged camera has its own entry in the streams state, so the page, the calibration and rectification tools
and the recorder know per camera what was done.

No change to examples/camera_streamer/ or examples/camera_livekit_bridge/: both already take several streams.
No backend, library or page code changed either; tests were added where three cameras were never exercised.

Which camera is which

  • --stream-role STREAM=ROLE is the one authority. A profile's only stream is the head camera, as before. Among
    several, each stream needs its role; nothing is guessed from a stream's name or its place in the profile.
  • Among several streams, a lens file that names no camera is refused, and so is one lens file used for two
    cameras: a picture corrected with another camera's lens would be wrong without anything saying so.
  • A plan that cannot be built for one camera stops the whole start before anything is deployed, and names the
    stream. One camera can still be left uncorrected beside corrected ones.

What a profile must hold

  • All streams at one frame rate: the bridge takes one rate for every stream.
  • Refused before anything is deployed, where the sender would refuse it afterwards: two streams on one camera
    device, a stream without exactly one camera, a rate or bitrate that is not a whole number, a port out of range.
  • A child that has already exited is reported in place of the line that announces the page.

New files

  • configs/three-camera-settings.example.yaml: the structure of a three-camera profile with a placeholder for
    every value that belongs to one station. The launcher refuses it while one is left.
  • recording/egocap/stations/ego_stations.bridged.example.yaml: a station file for a station whose cameras all
    arrive through the bridge.

What to know before relying on it

  • A one-stream profile that started before starts the same. Every command, file and message was compared, old
    launcher against new, over the builder's 87 starts and an independent reviewer's 443. What differs is only what a
    broken profile gets: an earlier refusal or a sentence where there was a traceback.
  • One dropped camera may take the station down. A failed bridge worker exits the bridge, and the launcher then
    stops the whole stack.
  • A take is judged on every recorded camera. With three cameras the rate rule and the first-frame rule apply
    to each, so a take fails whole when any one stream fails. The frame-count comparison across cameras stays off
    unless a station switches it on.
  • The launcher adds the streams' bitrates up and prints the sum. The code sets no limit; the sum must fit the
    link.
  • The camera roles on the page (Settings, Station) are set once as well. The Rectification tool goes by the
    launcher's report and says where the two differ.
  • A wrong size, pipeline index or link mask is refused only by the sender on the Orin, after the deploy.

How it was reviewed and tested

  • The launcher's tests, driven by fake programs and held against the real programs' own parsers where those are
    Python; the backend suite; the page's lint, tests and build.
  • An independent reviewer read the launcher's bridge command with the bridge's own argument parser, compared each
    table's bytes with one planned from that role's own calibration across 43 starts, fed the launcher's output to
    the real backend and recorder, and made 28 deliberate breakages of the launcher, all caught by the tests. Its
    two findings (an unstamped lens file among several streams; profiles the sender refuses late) are fixed here.

Not yet verified on hardware

Three cameras have never been run through the launcher on an Orin. CAMERA_SETTINGS.md has the first-run
checklist: that one platform file runs three mono streams; that each stream arrives as the camera its role says and
each corrected picture uses its own calibration; what happens when one camera stops; GPU load and memory for three
decode, remap and encode pipelines; the link under the summed bitrate; time sync for all three streams.

🤖 Generated with Claude Code

The launcher bridged the one stream of its sender profile. It now takes a
profile of one to three mono streams and starts one chain for all of
them: one sender deployment, one receiver config listing every stream in
the profile's order, one camera bridge with a --stream for each, and for
each corrected stream a table built at launch from that camera's own
calibration and a --gpu-step of its own. Each bridged camera has its own
entry in the streams state, so the page, the calibration and
rectification tools and the recorder know per camera what was done.

Which camera is which
- --stream-role STREAM=ROLE is the one authority. A profile's only stream
  is the head camera as before; among several, each stream needs its
  role, and nothing is guessed from a stream's name or its place.
- Among several streams a lens file that names no camera is refused, and
  so is one lens file used for two cameras: a picture corrected with
  another camera's lens would be wrong without anything saying so.
- A plan that cannot be built for one camera stops the whole start
  before anything is deployed, and names the stream.

What a profile must hold
- Streams at different rates are refused: the bridge takes one rate.
- Refused before anything is deployed, where the sender would refuse it
  afterwards: two streams on one camera device, a stream without exactly
  one camera, a rate or bitrate that is not a whole number, a port out
  of range. A value that is no number gets a sentence.
- A child that has already exited is reported in place of the line that
  announces the page.

configs/three-camera-settings.example.yaml has the structure of a
three-camera profile with a placeholder for every value that belongs to
one station; the launcher refuses it while one is left.
stations/ego_stations.bridged.example.yaml is a station file for a
station whose cameras all arrive through the bridge.

A one-stream profile that started before starts the same: every command,
file and message is unchanged.

Three cameras have not been run on an Orin; CAMERA_SETTINGS.md lists what
a first run must check.

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 makes tools/start_system.py start one chain for one to three mono streams: one sender deployment, one receiver config listing every stream, one bridge with a --stream and, for each corrected stream, its own --gpu-step STREAM:rectify=TABLE, and a per-camera table planned at launch from that role's own calibration. I read the whole start_system.py diff and the example profile and station file, and checked the bridge's --gpu-step parser. The multi-stream wiring is correct as far as I can verify: the receiver index is the profile's list position, the bridge stream name equals the receiver's IPC name, each stream carries its own divisor and table, the descriptor declares each camera at the size actually published, and the one-stream path keeps sensing-head, the default role, the old messages and the old command (the old receiver_yaml, streams_yaml and mock_sender_command are kept as thin wrappers). The code is careful, though dense. The main risk is not in the code but in ordering: this PR conflicts head-on with four open PRs, and one of them (#1606) implements the same feature with a different track-naming contract. I did not run the tests (the checkout's uv environment would not resolve here), so test results are not verified by me.

Conflict and ordering risk (concrete).

Legend: 🚫 Blocker · 💡 Suggestion · 🔍 Nit

Finding
🚫 PR stack/scope: #1606 is the same feature with a different track contract (sensing-<id> against role-based tracks). Decide which one is authoritative before either merges; do not merge both.
💡 start_system.py plan_stream_rectification / plan_rectifications — a camera with no usable calibration but a rectification choice switched on stops the whole start (the PR says so and --no-rectify is the way out). That is right for correctness, but with three cameras one missing wrist file keeps the head camera down too. Consider --no-rectify-stream STREAM or a per-role skip, or say in the error which --no-rectify hint is the narrowest. A camera whose role has no plan entry at all starts uncorrected, with only a printed line; for a wrist stream, which is likely to be consumed by a policy, that is a silent downgrade worth a WARNING:.
💡 start_system.py load_sender_config / sender_settings — these add refusals that also hit one-stream profiles that started before: any string containing PLACEHOLDER, a float fps such as 30.0 (previously int(30.0)), a port outside 1..65535, and cameras without exactly one entry. The PR says one-stream behaviour is unchanged "over 87 and 443 starts", but these are changes for profiles that happened to work. They are probably all desirable, so call them out as intentional refusals rather than "unchanged", and confirm the sender really refuses 30.0 (not verified here; the sender does require device).
💡 start_system.py stream_roles / stream_tracks — a profile id, a role and a track are three names for one camera (example profile: id left_wrist, role wrist_left, track sensing-wrist-left). The example profile's ids are the reverse word order of the roles, which invites a swapped --stream-role; the mismatch cannot be detected (the launcher prints the mapping for a human to check). Use the role names as ids in the example profile, which also removes the need for --stream-role to be typed for the common case, or accept a role in the profile.
💡 start_system.py refuse_one_lens_for_two_cameras — compares bytes of the two calibration files only; a copy with one added whitespace or a re-save passes. The stamp check in plan_stream_rectification is the stronger test; this one is a partial guard and its docstring should say so rather than "are one file by their content".
💡 start_system.py stream_sizes / frame_size — a stream with no output.width/height is refused only with several streams; with one stream it still defaults to the head's 2560x1984, as before. Fine for compatibility; note that --width/--height apply to every unsized stream, which is only right when all cameras send the same size.
💡 start_system.py main — the bridge's --fps and the descriptor's fps are the first stream's, guarded by sender_streams refusing differing rates. After --fps override this holds trivially; good. But bitrate_mbps as a sum is printed only; no check against the link. Acceptable and stated in the PR.
💡 Hardware: the PR says three mono streams from one platform file have never been run on an Orin. Treat the first-run checklist in CAMERA_SETTINGS.md as a merge gate for the three-camera path, not only for the example, since the sender-side stereo/YUV support is in #1606, not here.
🔍 start_system.py — streams_yaml, receiver_yaml and mock_sender_command are kept as one-line wrappers with no remaining caller in the launcher (tests excepted). Dead code unless tests need them; if they do, say so or move them to the tests.
🔍 start_system.py — HEAD_TRACK, ROLE_TRACKS, MAX_STREAMS = len(ROLE_INTRINSICS): the limit comes from the number of lens files rather than from the sender or bridge (the comment says both take more). Fine, but name the constant for what it limits (MAX_BRIDGED_CAMERAS).
🔍 start_system.py placeholders — returns paths like streams[0].output.fps through manual string building; the comment "named the way the guides name it" is narration, and the docstring can be a line. Several comments in the new code are long for the repo's rule (say it once, briefly); e.g. the sender_streams and _whole_number blocks.
🔍 PR size — about 1500 added lines of tests for the three-camera case against about 480 lines of launcher; the launcher helpers are fine but the PR is hard to review in one go.

Per-stream wiring checked. Stream ids are unique-checked, device-unique-checked and =-free; the bridge's --gpu-step parser splits at the last : before the first =, so ids that hold : still work. Sizes: stream_sizes calls frame_size per stream, so each is checked against the divisibility rule; the receiver is given each stream's source size and the descriptor each stream's published size (rectified size, or the source over the divisor), which matches the bridge flags NAME=TRACK:DIV and NAME:rectify=TABLE. fps: one value, enforced. Table per camera: rectify_<role>.icrmap in the run directory, planned from that role's calibration with the stream's own source size. Failure with no calibration: refused whole, naming the stream and role, before anything starts. The existing one-stream launch: same flags and files by inspection of the diff; not re-run by me.

Questions for the author

  • Is this PR meant to replace Support an S56C + 2x SHF3L camera rig #1606's launcher half, or to sit on top of it? Which track names are the contract?
  • Should one camera's missing calibration be able to leave only that camera uncorrected?
  • Does the sender accept fps: 30.0 and a string port? If not, say so in the refusal text so the change reads as a fix.

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.

  • Agree with the Support an S56C + 2x SHF3L camera rig #1606 author on one multi-stream launcher and one track-naming scheme before merging either.
  • start_system.py plan_rectifications: print WARNING: for a bridged stream whose role has no switched-on plan entry when more than one stream is bridged; consider a per-stream way past a missing calibration.
  • configs/three-camera-settings.example.yaml: use the role names as stream ids so id, role and track are one word.
  • start_system.py: remove streams_yaml/receiver_yaml/mock_sender_command wrappers if no non-test caller remains.
  • start_system.py refuse_one_lens_for_two_cameras: say in the docstring it is a byte comparison only.
  • PR description: list the one-stream profiles that are now refused (placeholders, non-integer fps, port range, camera count) instead of "starts the same".

@NVshawnhwang
NVshawnhwang requested a review from NVdejung December 1, 2026 20:26

@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: this PR makes tools/start_system.py run one sender, one receiver and one bridge for a profile of one to three mono streams. Each stream gets its own track, role, calibration and remap table. The launcher also refuses up front several profiles the sender would otherwise refuse only after the deploy. I read the new code against the bridge, receiver, CaptureServer and sender parsers in this tree and found no blocker; a test pins the one-stream start byte for byte. Two things need attention: the printed bitrate sum can come out too low, and #1606 needs a decision on which contract to keep.

Must fix

None found. This is a public repository: the internal-name scan is clean, and I found no internal names in the added configs, fixtures or docs.

Suggestions

  1. examples/egocap/tools/start_system.py:394: a stream without bitrate_mbps counts as 0, and an explicit 0 is accepted. The sender does neither:

    The guides tell stations to budget the link with the "N Mbit/s in all" line (:663), so it can be 50 Mbit/s too low for each stream that leaves the value out. Fix: require bitrate_mbps ≥ 1 for an HEVC stream, as the sender does, or count a missing value at the sender's default.

  2. tests/tools/test_start_system_three_cameras.py:17: the new module imports about 20 private helpers and both fixtures from test_start_system.py by bare module name.

    • This works only under pytest's default import mode, and only while tests/tools/ has no __init__.py.
    • Five other open PRs edit test_start_system.py. If one of them renames a helper, every three-camera test fails at import, and no textual conflict warns anyone.
    • Fix: move recorded_main, station_calibration and the shared helpers into tests/tools/conftest.py or a helper module. The one-stream wrappers (streams_yaml, receiver_yaml, mock_sender_command) now serve only the tests and could move with them.
  3. start_system.py:555 ("None when it fills none") and :792 ("A stream without a role … is published as it arrives") are now stale. Every bridged stream has a role: stream_roles gives a profile's only stream ego, and stream_tracks refuses a stream with no role when there are several. Update the comments, or narrow role to str.

  4. test_start_system_three_cameras.py:1357 reads argus_sender/src/Config.cpp without a guard. The neighbouring tests skip when the receiver, mock sender or deploy tool is missing; add the same skipif here.

  5. The "never been run on an Orin" paragraph is copied into five guides: CAMERA_SETTINGS.md:263, README.md:443, LIVEKIT_PREVIEW.md:194, backend/README.md:769 and CALIBRATION_TOOLS.md:2662. Keep it in CAMERA_SETTINGS.md and link to it from the others, so the first hardware run only has to update one place.

Conflicts

  • With nvShawnHwang/egocap_control_token_box (the head branch of #1645): the local 3-way merge is clean and the PR is 0 commits behind, so no rebase is needed. This PR is the top of the #1634…#1645 stack and lands after it.
  • #1606 (Yunjuliii, draft, base main) shares start_system.py, test_start_system.py and CAMERA_SETTINGS.md. The earlier review comment says it builds the same feature with a different track-naming contract; that is still unresolved. Agree on one contract before either PR merges, and rebase the other onto it.
  • #1566 and #1571 (gareth-morgan-nv) share start_system.py, test_start_system.py, default-camera-settings.yaml, CAMERA_SETTINGS.md and README.md.
    • They have other bases, so textual conflicts were not computed. Conflicts are likely around sender_settings and parse_args.
    • Semantic risk: check that #1566's range signalling agrees with the single --source-full-range flag this PR passes for every stream.
  • #1586 (gareth-morgan-nv) shares start_system.py, test_start_system.py and README.md. Check that its per-session delivery test covers every LiveKit stream in the descriptor, which can now hold three.
  • #1587 (fvaloppi-nv) touches only test_start_system.py, but see suggestion 2. #1625 shares only README.md; low risk.
  • Whichever of these PRs lands second should re-run both test_start_system*.py files.
  • I did not run any tests; this review only read the code.
Change-by-change (13 files)
File / area What changed Makes sense?
tools/start_system.py Profile loading: 1–3 mono streams through sender_streams, which checks per-stream settings, unique ids and devices, and one rate for all. Per-stream sizes come from stream_sizes. Placeholders are refused, and port, rate and bitrate must be whole numbers.
Roles and tracks: stream_tracks maps role to track and requires a role for each of several streams.
Rectification: planned per stream. With several streams, a lens file that names no camera and one lens file used for two roles are both refused.
Child commands: the receiver config, descriptor, bridge and mock-sender commands now carry several streams.
Output: the bitrate sum is printed, and a child that has already exited is reported before the page is announced. The old one-stream helpers are kept as wrappers.
✅ Checked against the bridge's --stream/--gpu-step parsing, the receiver's index checks, CaptureServer's LiveKit limits and the sender's Config.cpp. ⚠️ The bitrate sum (suggestion 1) and stale role comments (suggestion 3).
tests/tools/test_start_system_three_cameras.py (new) Three-stream starts against stub programs; every refusal; output read with the real receiver, mock-sender, deploy-tool and CaptureServer parsers; a check of the example's keys against Config.cpp; stop order with real child processes; the one-stream output pinned byte for byte. ✅ Read in full. ⚠️ Coupling (suggestion 2) and the unguarded Config.cpp read (suggestion 4).
tests/tools/test_start_system.py The time-sync test now kills the bridge once the time-sync follower starts; otherwise the new pre-announcement check would catch it first. ✅ The test still checks what it was written for.
tests/backend/test_three_camera_run.py (new) The launcher's planning and streams state, read by the backend: seven session files, recorder assets, the Rectification and calibration tools for each role, alignment, and the bridged station example. ✅
frontend/src/RectificationDialog.threeCameras.test.tsx (new) The Rectification dialog with three bridged cameras, each with its own facts and restart note. ✅ The fixtures and props it uses exist.
configs/three-camera-settings.example.yaml (new) A three-stream SIPL profile with a placeholder for every station value. ✅ Every key is one the sender's parser knows (a test checks this).
recording/egocap/stations/ego_stations.bridged.example.yaml (new) Station template with no CaptureServer cameras; index source head. ✅ It copies record_fps: 60 from the base template; the backend does not read it, but it looks odd next to a 30 fps profile.
configs/default-camera-settings.yaml The header comment now points to the three-camera example. ✅
CALIBRATION_TOOLS.md Launcher steps rewritten for several streams, plus the refusal catalogue and limits. ✅ Matches the code.
CAMERA_SETTINGS.md New "A profile for three cameras" section, bitrate and GPU notes, receiver keys and a hardware checklist. ✅ The bridge README's bitrate figures, the 48-byte table header and the discover/linktest subcommands all check out.
README.md, LIVEKIT_PREVIEW.md, backend/README.md Three-camera usage and notes on what is not yet verified on hardware. ⚠️ The same paragraph appears in five files (suggestion 5).

Reviewed at 2b6dd98 · 13 files · 2026-12-01 15:20 PST

…g/egocap_three_camera_launch

No conflict. Adds tests that every take the station starts carries the
capture session's facts and each row's sequence, that a label correction
leaves them as they were, and that upload sends them with the take.

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

This branch was successfully deployed

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