Skip to content

Add per-frame proprio context and JPEG-compress temporal image stacks#465

Merged
vertix merged 9 commits into
Positronic-Robotics:mainfrom
vertix:rik-video-context-proprio-and-jpeg
Jul 9, 2026
Merged

Add per-frame proprio context and JPEG-compress temporal image stacks#465
vertix merged 9 commits into
Positronic-Robotics:mainfrom
vertix:rik-video-context-proprio-and-jpeg

Conversation

@vertix

@vertix vertix commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary

For policies that condition on a short window of history plus per-frame proprio:

  • TemporalStack (policy/wrappers.py) — replaces each named observation entry in keys with a (T, ...) temporal stack sampled at strided offsets, so the model sees a history window at the training cadence even though the harness only forwards an observation at re-query boundaries. It's modality-agnostic: keys are the cameras plus any per-frame proprio (e.g. robot_state.ee_pose, grip), each stacked step carrying its own value at that time.
  • Opt-in JPEG compression of images — with --policy.compress_images (default off), each image — a single (H, W, 3) frame or a (T, H, W, 3) stack — is JPEG-encoded per frame before send (q90) to stay under the ~2 MB websocket message cap of a Modal-fronted endpoint. Encode/decode live together in utils/serialization.py, and the marker decodes as a first-class wire type in deserialise, so every inference server restores the array transparently with no per-server change.
  • video_context_wrappers default stacks images + proprio; DreamZero overrides to images-only.
  • Recorder collapses a stacked proprio observation to its current (last) frame when drawing the actual-gripper overlay, so recording works with the proprio-context default.

Test plan

Not yet verified end-to-end on hardware. Verified locally: the config instantiates, DreamZero resolves to images-only, the recorder handles stacked (T, 7) / (T,) proprio without the earlier broadcast crash, and the offboard test suite passes — including a round-trip test that a JPEG-compressed image (single frame and stack) survives serialise/deserialise back to the original array and frame order.

RikHeijdens and others added 6 commits July 6, 2026 20:56
Video-conditioned policies train on real proprio
on every clean frame. `TemporalFrameStack` stacked only images, so the
server saw the current pose repeated across history. Add `proprio_keys`
(default empty) to `TemporalFrameStack` and `video_context_wrappers` so
callers can stack e.g. `robot_state.ee_pose` + `grip` on the same buffer;
each history frame then carries its own pose. Default stays empty so codecs
that consume only the current proprio (e.g. DreamZero) are unaffected.
A `(T, H, W, 3)` frame stack is tens of MB raw and exceeds the ~2 MB
websocket message cap of a Modal-fronted endpoint, so the obs never reaches
the server. JPEG-encode 4D image stacks (q90 → ~0.9 MB for a 25-frame
two-camera stack) into a compact marker the server decodes back to the same
array; single frames stay raw. Also cuts upload latency on every request.
@vertix vertix marked this pull request as ready for review July 9, 2026 16:57
@vertix

vertix commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ee6517f4a1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread positronic/policy/remote.py Outdated
Comment thread positronic/cfg/policy.py

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6829d2f502

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread positronic/cfg/wrappers.py
@vertix vertix merged commit f9b8970 into Positronic-Robotics:main Jul 9, 2026
20 checks passed
@vertix vertix deleted the rik-video-context-proprio-and-jpeg branch July 9, 2026 21:53
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.

2 participants