You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e575cff
Browse filesBrowse the repository at this point in the historyBrowse files
feat: 5D delta, replay_sequence, Test Zero PASS (BACKLOG 6A.3)
- Extended move_to_delta to 5D: (dx,dy,dz,dtheta,dgripper) — wrist_roll
and gripper changes integrated into the single delta primitive; grasp()/
release() now thin wrappers, segmenter no longer emits them
- Segmenter v2 outputs (dx,dy,dz,dtheta,dgripper) per segment; wrist_roll
interpolated linearly across IK waypoints in move_cartesian_delta
- Added --angle / --dip / --min-dist CLI overrides to segment_trajectory.py;
custom density files named episode_NNN_aA_dD_mM.json
- Fixed _wait_until_settled: always sends one command before convergence
check; gripper excluded from arm-joint error (prevents early exit)
- New scripts/replay_sequence.py: reads starting joints from Parquet,
loads segment JSON by convention, replays on real hardware via
LeRobotInterface directly (bypasses MCP async stack)
- Recorded datasets/sticks_v3 (1 episode, 714 frames); pre-segmented at
medium/high and four custom angle thresholds (10°–40°)
- Test Zero PASSED 2026-05-17: approach→descent→grasp zone→transit→
release→retreat structure correct on hardware; gravity sag in extended-
arm sections noted and tracked as 6A.1.x follow-up
- Updated EMERGENT_ROBOTICS_PLAN.md with verified status; merged Path A/B
into unified VQ-VAE + conditioned policy + RAG-over-codes direction in
ARCHITECTURE.md (decisions #8, #9); Phase 6D/6E/6F added to BACKLOG.md
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- RAG retrieval: given task description, find similar demo sequences as context
69
+
1.**Conditioned policy** (50-100Hz): `(state, latent_code) → delta`. Small MLP/GRU trained by behavioral cloning on segmented demos.
70
+
2.**Action VQ-VAE** (self-supervised): trained on delta-sequence segments. Codebook (K≈8-12) IS the vocabulary — discovered, not designed.
71
+
3.**LLM planner** (0.5-2Hz): emits sequences of latent codes. Names codes by observing scene-graph before/after of each code across demos. Reactive replan after each code execution.
74
72
75
-
**Why this first**: It proves the thesis end-to-end without requiring research breakthroughs.
76
-
If this works, even crudely, it validates the entire architecture.
73
+
**RAG over discovered codes** replaces RAG over raw demos. Every successful run stores `(task, scene_features, code_sequence)`. Retrieval keyed on task embedding + scene graph (object positions, gripper state, starting EE pose) — not task string alone. Few-shot inject into LLM prompt. Cold-start by encoding the original 30 demos through the VQ-VAE.
77
74
78
-
### Path A — Research Track (FUTURE)
75
+
**Why this composition:** the VQ-VAE solves the abstraction mismatch — segmentation and vocabulary are co-discovered from the same self-supervised loss. The LLM stays in its strength zone (discrete reasoning over a small symbol set). The conditioned policy absorbs state-dependent execution detail without needing language. RAG compounds with use without retraining.
79
76
80
-
**Goal**: Discover the right primitive vocabulary from data, bottom-up.
81
-
82
-
- High-frequency axis-relative primitives (the current 20 tools)
83
-
- Embed tool-call sequences using structured tokenization
84
-
- Bottom-up vocabulary discovery: cluster sequences into higher-level skills
85
-
- This is where the JEPA + differentiable MPC work eventually connects
86
-
87
-
**Why later**: This requires solving the abstraction mismatch problem (see below).
88
-
Path B proves the architecture; Path A optimizes it.
77
+
**Why merged:** Path B's "demo → primitive sequence → fine-tune" assumed hand-designed primitives. Path A's "bottom-up vocabulary discovery" assumed bespoke clustering. The VQ-VAE does both jobs at once, with a proven technique (VQ-BeT, VQ-VAE for action discretization). No need to keep the paths separate.
89
78
90
79
---
91
80
@@ -132,48 +121,68 @@ we're researching — the planning/execution decomposition is. ArUco lets us sid
132
121
vision uncertainty entirely for the PoC. The plan is to use a phone as camera via
133
122
IP Webcam app, which avoids USB camera driver headaches on Linux.
134
123
135
-
### 6. No IK — Data-Driven Joint-Space Lookup (CURRENT BLOCKER)
-[ ]**Replay segmenter v2 output on hardware** — Take sticks_v2 episode 0, run through segmenter v2 (high density), replay the `move_to_delta` sequence via MCP tools on the real arm. Film it. Compare to the original teleop recording.
95
-
-*Done when*: Side-by-side comparison video. Honest assessment: does the arm do the same thing?
96
-
-*Time*: 30 min
97
-
-*Tag*: `hardware`
98
-
-**This is the critical gate.** If this fails, Path B needs rethinking.
94
+
-[x]**Replay segmenter v2 output on hardware** — sticks_v3 ep0, tested at 19/21/31/49 primitives. Structure correct (approach → descent → grasp zone → transit → release → retreat). **PASSES.** Gravity sag causes drift in extended-arm sections — tracked separately.
95
+
-*Done 2026-05-17*: `scripts/replay_sequence.py` (new) reads starting joints from Parquet and replays via `LeRobotInterface` directly
## Phase 6D — Data Collection for Vocabulary Discovery (NEXT)
141
+
142
+
> 30+ teleop demos with deliberate variation so the VQ-VAE can discover meaningful action
143
+
> structure. Plan reference: Phase 1 in `EMERGENT_ROBOTICS_PLAN.md`.
144
+
>
145
+
> **Gate**: Test Zero (6A.3) must pass first. If delta replay fails on hardware, the
146
+
> conditioned policy in 6E will fail for the same reason.
147
+
148
+
### 6D.1 Recorder upgrades
149
+
150
+
-[ ]**Gripper force in observation** — Plan wants `gripper.force`. Decide: read force from Feetech if supported, or drop force and use gripper position deltas as the open/close signal. Document.
151
+
-*Tag*: `research`, then `claude-code`
152
+
-*Time*: 30 min
153
+
154
+
-[ ]**Wire camera frames into recorder** — Capture from `DECRAS_CAMERA` at 5Hz (every 6th control frame), store aligned with Parquet rows. Needed for later JEPA / scene graph annotation.
155
+
-*Tag*: `claude-code`
156
+
-*Time*: 30 min
157
+
158
+
### 6D.2 Record 30 demos with variation
137
159
138
-
-[x]**Build demo store writer** — Segmenter v2 output + task string → Demo JSON on disk. Store at `demos/` with deterministic id `<dataset>_ep<NNN>_<density>.json`. `decras.imitation.store` has `save_demo` / `load_demo` / `list_demos` / `ingest_sequence`. CLI: `uv run python -m scripts.add_demo <sequence.json> --task "..."`. Duplicates raise unless `--overwrite`. Provenance fields added at ingest: `created_at`, `source_sequence_path`, `segmenter_git_sha`.
160
+
-[ ]**Pick 2-3 task types** — e.g. cup→plate, block→stack, stick→bin. 10 demos each. Document in `datasets/README.md`.
161
+
-*Tag*: `hardware`
162
+
163
+
-[ ]**Vary starting positions deliberately** — Object positions, arm start poses, approach angles. At least 3 distinct starting regions per task. The plan is explicit: uniform starts kill conditioned-policy generalization.
164
+
-*Tag*: `hardware`
165
+
-*Time*: 30-45 min per batch of 10
166
+
167
+
-[ ]**Coverage sanity check** — `scripts/visualize_trajectory.py` over the new dataset. EE paths should span the workspace.
168
+
-*Tag*: `claude-code`
169
+
170
+
---
171
+
172
+
## Phase 6E — Action VQ-VAE (after 6D)
173
+
174
+
> ~300 LOC PyTorch. Plan reference: Phase 2.
175
+
176
+
### 6E.1 Baseline segments
177
+
178
+
-[ ]**Use segmenter v2 (medium) as segment source** — Already built. Per demo: ordered list of (delta_sequence, start_state, end_state) segments.
139
179
-*Tag*: `claude-code`
140
180
141
-
-[ ]**Build demo retriever** — TF-IDF or sentence-transformer cosine similarity on task descriptions. `retrieve("pick up the stick") → [demo_1, demo_3]`.
181
+
-[ ]**Segment-distribution viz** — Histogram of segment lengths, directions, cause (gripper / direction change / speed dip). Informs choice of K.
142
182
-*Tag*: `claude-code`
143
183
144
-
-[ ]**RAG integration** — Inject retrieved demos into LLM prompt via `llm_controller/prompt.py`.
184
+
### 6E.2 Train VQ-VAE
145
185
146
-
-[ ]**Record more demos** — 5-10 episodes of different tasks (pick-place, push, stack).
186
+
-[ ]**Build `decras/imitation/vqvae.py`** — 1D CNN or small GRU encoder, learnable codebook (K=8 first; try 12 and 16), decoder reconstructs delta sequence. Reconstruction + commitment losses.
> ~200 LOC for the policy, rest is glue. Plan reference: Phases 3 + 4.
204
+
205
+
### 6F.1 Conditioned policy
206
+
207
+
-[ ]**Build `decras/imitation/policy.py`** — Small MLP/GRU. Input: current joints + gripper + one-hot code. Output: next delta + gripper action. BC training on (state_t, gripper_t, code) → (delta_t, gripper_action_t).
208
+
-*Tag*: `claude-code`
209
+
210
+
-[ ]**`scripts/train_policy.py`**
211
+
-*Tag*: `claude-code`
212
+
213
+
-[ ]**Held-out replay test** — Held-out demo, encoded to codes, executed by the policy from the recorded starting state. Does it match the demo?
214
+
-*Tag*: `hardware`
215
+
216
+
-[ ]**Generalization test** — Same code from a different starting state. Sensible behavior?
147
217
-*Tag*: `hardware`
148
218
149
-
-[ ]**Export fine-tuning pairs** — `(task_description, tool_call_sequence)` JSONL for fine-tuning.
219
+
### 6F.2 LLM grounding
220
+
221
+
-[ ]**Collect before/after scene-graphs per code** — For each code, gather scene graphs before/after every segment that maps to it. Feed to LLM, save the assigned name in codebook metadata.
222
+
-*Tag*: `research`
223
+
224
+
### 6F.3 MCP `execute_code(k)` tool
225
+
226
+
-[ ]**Add `execute_code(code: int)` MCP tool** — Loads conditioned policy, runs at 50Hz from current state + code, returns post-execution scene graph.
227
+
-*Tag*: `claude-code`
228
+
229
+
-[ ]**Keep `move_to_delta` registered** — Useful for debugging and fallback.
230
+
231
+
### 6F.4 RAG over codes
232
+
233
+
-[ ]**Extend `Primitive` dataclass** — Add code-mode variant `{code: int, name: str}` alongside the current tool-call variant.
150
234
-*Tag*: `claude-code`
151
235
236
+
-[ ]**Code-sequence retriever** — Cosine similarity over `(task_embedding, scene_features)` where scene_features = object positions + gripper state + starting EE pose. Top-K past code sequences.
237
+
-*Tag*: `claude-code`
238
+
239
+
-[ ]**RAG integration** — Inject retrieved code sequences into `llm_controller/prompt.py`. Bootstrap by encoding all 30 Phase 6D demos.
240
+
-*Tag*: `claude-code`
241
+
242
+
-[ ]**End-to-end demo** — Natural-language task → LLM plans code sequence (with RAG few-shot) → MCP executes via `execute_code` → reactive replan after each code. Film a full pick-and-place.
-[ ] Extend deltas to (dx, dy, dz, dθ); retrain VQ-VAE + policy with 4D action space
250
+
-[ ] JEPA enters: encode (delta_sequence, latent_state_transition) pairs so vocabulary is grounded in what the world does, not just what the robot does
251
+
-[ ] Persistent memory across sessions (what worked, what failed, object locations)
0 commit comments