Add files using upload-large-folder tool
Browse filesFiles changed (16)
- chess-sim/README.md+10-1
- chess-sim/code/sim/README.md+4-1
- chess-sim/code/sim/episode.py+37-13
- chess-sim/code/sim/eval_policy.py+7-1
- chess-sim/code/sim/expert.py+65
- chess-sim/code/sim/generate_dataset.py+40-7
- chess-sim/code/sim/paired_compare.pyAdded+83
- chess-sim/code/sim/phase2_dart.tomlAdded+20
- chess-sim/code/sim/push_dataset.py+22
- chess-sim/datasets/baseline_dart_v1/meta/info.jsonAdded+127
- chess-sim/datasets/baseline_dart_v1/meta/stats.jsonAdded+632
- chess-sim/datasets/baseline_dart_v1/meta/tasks.parquetAdded+3
- chess-sim/datasets/baseline_dart_v1/phase2_episodes.jsonlAdded
- chess-sim/datasets/baseline_dart_v1/phase2_summary.jsonAdded+462
- chess-sim/reports/dart_teacher/validation.jsonAdded
- chess-sim/reports/dart_teacher/validation.mdAdded+13
7 unmodified lines891011121336 unmodified lines505152535455567 unmodified lines| folder | episodes | frames | cameras | video | notes ||---|---|---|---|---|---|| `datasets/baseline_recovery_v1/` | 120 | 36645 | overhead, wrist | h264 yuv444p | Correction demonstrations in the baseline scene (see *Corrections*), first attempt: the teacher rises and pauses before regrasping, which made the fine-tuned policy hover (20%). Kept for reference; not used for training. || `datasets/baseline_recovery_v2/` | 120 | 29044 | overhead, wrist | h264 yuv444p | Correction demonstrations, second attempt (`collect_recovery.py --style v2`): the teacher lines up from where the arm is, rising only as far as needed, and goes straight down, with no pause. Fine-tuning the baseline on these plus baseline_v1 lowered success (30% vs 51.7% on the same episodes: more pieces knocked over). Kept for reference; not used. || `datasets/baseline_v1/` | 300 | 89008 | overhead, wrist | h264 yuv444p | The simple baseline (see *Baseline scene*): one fixed scene and ten fixed opening moves. Trains `Machanize/chess_phase_smolvla_baseline`. |36 unmodified linesFine-tuning the baseline on these plus baseline_v1 gave 20% (from 36.7%): in `pre_grasp` and after a misaligned close the teacher first rises to its approach height and pauses, and the policy learned to hover over pawns. The next attempt (`--style v2`) lines up from where the arm is and goes straight down.Expert validation (random layouts): 99.02% of 1536 trials (target above 99.0%).## Load7 unmodified lines89101112131436 unmodified lines5152535455565758596061626364657 unmodified lines| folder | episodes | frames | cameras | video | notes ||---|---|---|---|---|---|| `datasets/baseline_dart_v1/` | 300 | 89007 | overhead, wrist | h264 yuv444p | baseline_v1's 300 scenes (same episode seeds) with a perturbed teacher (see *Perturbed teacher*): in about half the episodes the executed approach drifts 2-10 mm off-centre and returns before the fingertips reach the piece, while the recorded actions stay the clean plan. || `datasets/baseline_recovery_v1/` | 120 | 36645 | overhead, wrist | h264 yuv444p | Correction demonstrations in the baseline scene (see *Corrections*), first attempt: the teacher rises and pauses before regrasping, which made the fine-tuned policy hover (20%). Kept for reference; not used for training. || `datasets/baseline_recovery_v2/` | 120 | 29044 | overhead, wrist | h264 yuv444p | Correction demonstrations, second attempt (`collect_recovery.py --style v2`): the teacher lines up from where the arm is, rising only as far as needed, and goes straight down, with no pause. Fine-tuning the baseline on these plus baseline_v1 lowered success (30% vs 51.7% on the same episodes: more pieces knocked over). Kept for reference; not used. || `datasets/baseline_v1/` | 300 | 89008 | overhead, wrist | h264 yuv444p | The simple baseline (see *Baseline scene*): one fixed scene and ten fixed opening moves. Trains `Machanize/chess_phase_smolvla_baseline`. |36 unmodified linesFine-tuning the baseline on these plus baseline_v1 gave 20% (from 36.7%): in `pre_grasp` and after a misaligned close the teacher first rises to its approach height and pauses, and the policy learned to hover over pawns. The next attempt (`--style v2`) lines up from where the arm is and goes straight down.## Perturbed teacher (baseline_dart_v1)DART-style demonstrations (`PHASE2_PROFILE=baseline,dart`, `Expert.perturb_pick`). The plain teacher always starts its descent exactly centred and goes straight down, so near the piece its next action can be predicted from the joint state alone; the baseline policy's roughly 7 mm aiming error is never corrected on the way down.- In about half the episodes the executed hand drifts sideways by a random 2-10 mm (any direction) during the approach, holds the offset into the descent and returns to the plan over 0.3-0.8 s, ending 4 mm above the target's top. Each offset is collision-checked with the target included.- The recorded `action` is the clean plan throughout; `observation.state` and the images show the perturbed hand. The episodes therefore show "from off-centre, command the centred path", and never an off-centre aim.- Same 300 episode seeds as baseline_v1 (`--seeds-from`), so each episode repeats the same scene, move and timing. `dart_offset_mm` in `phase2_episodes.jsonl` is the executed offset (null when unperturbed).Teacher validation, 100 scenes: 100% success perturbed and plain, no touches on the target or its neighbours before the grasp (`reports/dart_teacher/`).## Load
33 unmodified lines343536373839401 unmodified line42434445464733 unmodified lines| `episode.py` | One episode: chess position, set-up, execution, success judgement. || `lerobot_export.py` | LeRobot v3.0 features and recorder. || `validate_expert.py` | Grasp validation over every piece on every square; writes `reports/`. || `generate_dataset.py` | Parallel dataset generation into LeRobot shards, merged at the end. || `review_video.py` | Side-by-side video of random dataset episodes, read back through LeRobot. || `make_train_view.py` | Training copy of a dataset with only the policy's cameras (overhead and wrist). || `eval_policy.py` | Closed-loop test of a trained policy in simulation: unseen random scenes, or `--scenes` to rebuild training episodes from `phase2_episodes.jsonl`; records reach, lift and success. |1 unmodified line| `marker_test.py` | Marker dependence: same scene and start, red square moved over several pieces; does the gripper follow it? || `inspect_grasps.py` | Where the policy's jaws are when it starts closing, against the expert's grasp on the same piece. || `collect_recovery.py` | DAgger-style correction demonstrations: the policy drives, the scripted teacher takes over (before the grasp, at a misaligned close, after a failed lift) and only its part is recorded. `--style v2` lines up from where the arm is; `v1` (first attempt) replanned from the approach height with a pause and made the policy hover. || `train_policy.sh` / `train_act.sh` | SmolVLA (from the base model, or `BASE=` a checkpoint) and ACT training on the pod. || `reports/grasp_validation.md` | Latest validation report (and `.json` with every trial). |33 unmodified lines343536373839401 unmodified line42434445464748495033 unmodified lines| `episode.py` | One episode: chess position, set-up, execution, success judgement. || `lerobot_export.py` | LeRobot v3.0 features and recorder. || `validate_expert.py` | Grasp validation over every piece on every square; writes `reports/`. || `generate_dataset.py` | Parallel dataset generation into LeRobot shards, merged at the end. `--seeds-from` repeats another dataset's episode seeds (same scenes, same order). || `review_video.py` | Side-by-side video of random dataset episodes, read back through LeRobot. || `make_train_view.py` | Training copy of a dataset with only the policy's cameras (overhead and wrist). || `eval_policy.py` | Closed-loop test of a trained policy in simulation: unseen random scenes, or `--scenes` to rebuild training episodes from `phase2_episodes.jsonl`; records reach, lift and success. |1 unmodified line| `marker_test.py` | Marker dependence: same scene and start, red square moved over several pieces; does the gripper follow it? || `inspect_grasps.py` | Where the policy's jaws are when it starts closing, against the expert's grasp on the same piece. || `collect_recovery.py` | DAgger-style correction demonstrations: the policy drives, the scripted teacher takes over (before the grasp, at a misaligned close, after a failed lift) and only its part is recorded. `--style v2` lines up from where the arm is; `v1` (first attempt) replanned from the approach height with a pause and made the policy hover. || `phase2_dart.toml` | Perturbed (DART-style) teacher, merged after another profile (`PHASE2_PROFILE=baseline,dart`): in a share of episodes the executed approach drifts 2-10 mm off-centre and returns before the fingertips reach the piece, while the recorded actions stay the clean plan (`Expert.perturb_pick`). || `validate_dart.py` | The perturbed teacher against the plain one on the same scenes, without cameras: success, touches on the target before closing, contacts with neighbours. || `paired_compare.py` | Two `eval_policy.py` runs on the same scenes, paired by episode index: success, discordant scenes with an exact McNemar test, per piece and per move. || `train_policy.sh` / `train_act.sh` | SmolVLA (from the base model, or `BASE=` a checkpoint) and ACT training on the pod. || `reports/grasp_validation.md` | Latest validation report (and `.json` with every trial). |
36 unmodified lines373839404142434445464720 unmodified lines686970717273158 unmodified lines2322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622 unmodified lines2652662672682692702712722732742752761 unmodified line2782792802812822832842852862 unmodified lines28929029129229329429529629729829930030130230330430530630730810 unmodified lines31932032132232332432536 unmodified linesdef load_config(path: Path = CONFIG) -> dict:"""The phase 2 config; with PHASE2_PROFILE=<name> set, sim/phase2_<name>.toml is mergedover it (only the keys it lists change). Worker processes inherit the variable."""cfg = tomllib.loads(path.read_text())profile = os.environ.get("PHASE2_PROFILE")if profile:cfg = _merge(cfg, tomllib.loads((path.parent / f"phase2_{profile}.toml").read_text()))cfg["profile"] = profilereturn cfg20 unmodified linesdisturbed: list = field(default_factory=list)stray_contacts: dict = field(default_factory=dict) # unintended arm-piece contactsyaw_deg: float | None = Noneclass EpisodeRunner:158 unmodified linesreturn squares# ------------------------------------------------------------------ executiondef _step_frame(self, q5, g, task, recorder, phase, monitor):if recorder is not None:recorder.frame(self, task, np.r_[q5, g])self.d.ctrl[:5] = q5self.d.ctrl[5] = gfor _ in range(self.n_sub):mujoco.mj_step(self.m, self.d)monitor(phase)def run(self, task: Task, rng_seed: int, recorder=None, look_s: float = 0.0, pick=None) -> Result:"""Execute the primitive from the current (set-up) state. `look_s` holds the handstill above the piece, jaws open, before the descent (the wrist camera sees it).`pick`: a ready PickPlan to execute instead of planning one."""rng = np.random.default_rng(rng_seed)d, w = self.d, self.wstart = {n: w.base_pos(d, n) for n in w.pieces}watched = [n for n in task.squares.values() if n != task.target]stray = {}def monitor(phase):for c in d.contact[:d.ncon]:g1, g2 = c.geom1, c.geom2for arm_g, other in ((g1, g2), (g2, g1)):if arm_g in self.arm_geoms and other in self.piece_of_geom:piece = self.piece_of_geom[other]if piece != task.target or arm_g not in self.finger_geoms:key = f"{phase}:{piece}"stray[key] = stray.get(key, 0) + 12 unmodified linesif task.target in (p1, p2) and p1 and p2 and p1 != p2:key = f"carried:{p2 if p1 == task.target else p1}"stray[key] = stray.get(key, 0) + 1frames = 0try:pick = pick or self.expert.plan_pick(d, task.target, rng)except PlanningFailed as exc:return Result(False, f"plan {exc}")if look_s > 0:t = pick.traji = next((k for k, ph in enumerate(t.phase) if ph == "descend"), len(t))1 unmodified linet.q[i:i] = [t.q[i - 1].copy()] * nt.g[i:i] = [t.g[i - 1]] * nt.phase[i:i] = ["look"] * nfor q, g, ph in zip(pick.traj.q, pick.traj.g, pick.traj.phase):self._step_frame(q, g, task, recorder, ph, monitor)frames += len(pick.traj)touching = set()for c in d.contact[:d.ncon]:if self.piece_of_geom.get(c.geom1) == task.target:2 unmodified linestouching.add(self.m.geom_bodyid[c.geom1])jaws = {self.m.body("gripper").id, self.m.body("moving_jaw_so101_v1").id}if not jaws <= touching or d.qpos[self.grip_qadr] < self.expert.close_q + 0.01:return Result(False, "grasp: jaws not both on the piece", frames, stray_contacts=stray)try:lift = self.expert.plan_lift(d, task.target, pick, task.dest)except PlanningFailed as exc:return Result(False, f"plan {exc}", frames, stray_contacts=stray)for q, g, ph in zip(lift.q, lift.g, lift.phase):self._step_frame(q, g, task, recorder, ph, monitor)frames += len(lift)if w.base_pos(d, task.target)[2] < start[task.target][2] + 0.003:return Result(False, "grasp: piece did not lift", frames, stray_contacts=stray)try:place = self.expert.plan_place(d, task.target, pick, task.dest, rng, self.home_end)except PlanningFailed as exc:return Result(False, f"plan {exc}", frames, stray_contacts=stray)# Carry to above the destination, then re-aim the descent from where the piece# actually hangs in the hand (it can slip a few millimetres on the way).split = next((i for i, ph in enumerate(place.phase) if ph == "place"), len(place))10 unmodified linesfor q, g, ph in zip(rest.q, rest.g, rest.phase):self._step_frame(q, g, task, recorder, ph, monitor)frames += split + len(rest)return self._judge(task, start, watched, stray, frames, pick.yaw)def _judge(self, task, start, watched, stray, frames, yaw) -> Result:d, w, v = self.d, self.w, self.cfg["validation"]36 unmodified lines3738394041424344454647484920 unmodified lines7071727374757677158 unmodified lines2362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722 unmodified lines2752762772782792802812822832842852862872882892902912921 unmodified line2942952962972982993003013023033043053063073082 unmodified lines31131231331431531631731831932032132232332432532632732832933010 unmodified lines34134234334434534634734834936 unmodified linesdef load_config(path: Path = CONFIG) -> dict:"""The phase 2 config; with PHASE2_PROFILE=<name> set, sim/phase2_<name>.toml is mergedover it (only the keys it lists change). Several comma-separated names are merged inorder (e.g. baseline,dart). Worker processes inherit the variable."""cfg = tomllib.loads(path.read_text())profile = os.environ.get("PHASE2_PROFILE")if profile:for name in profile.split(","):cfg = _merge(cfg, tomllib.loads((path.parent / f"phase2_{name.strip()}.toml").read_text()))cfg["profile"] = profilereturn cfg20 unmodified linesdisturbed: list = field(default_factory=list)stray_contacts: dict = field(default_factory=dict) # unintended arm-piece contactsyaw_deg: float | None = Nonedart_offset_mm: list | None = None # executed sideways offset of a perturbed pickpre_close_touch: int = 0 # frames the arm touched the target before the jaws closeclass EpisodeRunner:158 unmodified linesreturn squares# ------------------------------------------------------------------ executiondef _step_frame(self, q5, g, task, recorder, phase, monitor, label=None):if recorder is not None:recorder.frame(self, task, np.r_[q5 if label is None else label, g])self.d.ctrl[:5] = q5self.d.ctrl[5] = gfor _ in range(self.n_sub):mujoco.mj_step(self.m, self.d)monitor(phase)def run(self, task: Task, rng_seed: int, recorder=None, look_s: float = 0.0, pick=None,dart_attempt: int = 0) -> Result:"""Execute the primitive from the current (set-up) state. `look_s` holds the handstill above the piece, jaws open, before the descent (the wrist camera sees it).`pick`: a ready PickPlan to execute instead of planning one.With [expert] dart_probability > 0 the pick is perturbed (Expert.perturb_pick) with thatprobability, drawn from (rng_seed, dart_attempt); dart_attempt < 0 turns it off."""rng = np.random.default_rng(rng_seed)d, w = self.d, self.wstart = {n: w.base_pos(d, n) for n in w.pieces}watched = [n for n in task.squares.values() if n != task.target]stray = {}pre_touch = [0]def monitor(phase):touched = Falsefor c in d.contact[:d.ncon]:g1, g2 = c.geom1, c.geom2for arm_g, other in ((g1, g2), (g2, g1)):if arm_g in self.arm_geoms and other in self.piece_of_geom:piece = self.piece_of_geom[other]touched |= piece == task.target and phase in ("approach", "look", "descend")if piece != task.target or arm_g not in self.finger_geoms:key = f"{phase}:{piece}"stray[key] = stray.get(key, 0) + 12 unmodified linesif task.target in (p1, p2) and p1 and p2 and p1 != p2:key = f"carried:{p2 if p1 == task.target else p1}"stray[key] = stray.get(key, 0) + 1pre_touch[0] += touchedframes = 0try:pick = pick or self.expert.plan_pick(d, task.target, rng)except PlanningFailed as exc:return Result(False, f"plan {exc}")dart = self.cfg["expert"].get("dart_probability", 0.0)if dart > 0 and dart_attempt >= 0 and pick.traj.label is None:drng = np.random.default_rng([rng_seed, 0xDA27, dart_attempt])if drng.random() < dart:pick = self.expert.perturb_pick(d, task.target, pick, drng)if look_s > 0:t = pick.traji = next((k for k, ph in enumerate(t.phase) if ph == "descend"), len(t))1 unmodified linet.q[i:i] = [t.q[i - 1].copy()] * nt.g[i:i] = [t.g[i - 1]] * nt.phase[i:i] = ["look"] * nif t.label is not None:t.label[i:i] = [t.label[i - 1].copy()] * nlabels = pick.traj.label or [None] * len(pick.traj)for q, g, ph, ql in zip(pick.traj.q, pick.traj.g, pick.traj.phase, labels):self._step_frame(q, g, task, recorder, ph, monitor, label=ql)frames += len(pick.traj)def result(*a, **k):return Result(*a, **k, dart_offset_mm=pick.dart_offset_mm, pre_close_touch=pre_touch[0])touching = set()for c in d.contact[:d.ncon]:if self.piece_of_geom.get(c.geom1) == task.target:2 unmodified linestouching.add(self.m.geom_bodyid[c.geom1])jaws = {self.m.body("gripper").id, self.m.body("moving_jaw_so101_v1").id}if not jaws <= touching or d.qpos[self.grip_qadr] < self.expert.close_q + 0.01:return result(False, "grasp: jaws not both on the piece", frames, stray_contacts=stray)try:lift = self.expert.plan_lift(d, task.target, pick, task.dest)except PlanningFailed as exc:return result(False, f"plan {exc}", frames, stray_contacts=stray)for q, g, ph in zip(lift.q, lift.g, lift.phase):self._step_frame(q, g, task, recorder, ph, monitor)frames += len(lift)if w.base_pos(d, task.target)[2] < start[task.target][2] + 0.003:return result(False, "grasp: piece did not lift", frames, stray_contacts=stray)try:place = self.expert.plan_place(d, task.target, pick, task.dest, rng, self.home_end)except PlanningFailed as exc:return result(False, f"plan {exc}", frames, stray_contacts=stray)# Carry to above the destination, then re-aim the descent from where the piece# actually hangs in the hand (it can slip a few millimetres on the way).split = next((i for i, ph in enumerate(place.phase) if ph == "place"), len(place))10 unmodified linesfor q, g, ph in zip(rest.q, rest.g, rest.phase):self._step_frame(q, g, task, recorder, ph, monitor)frames += split + len(rest)r = self._judge(task, start, watched, stray, frames, pick.yaw)r.dart_offset_mm, r.pre_close_touch = pick.dart_offset_mm, pre_touch[0]return rdef _judge(self, task, start, watched, stray, frames, yaw) -> Result:d, w, v = self.d, self.w, self.cfg["validation"]
297 unmodified lines2982993003013023036 unmodified lines310311312313314315316317297 unmodified linesfor p in procs:p.start()t0, results, finished = time.time(), [], 0while finished < len(procs):try:r = queue.get(timeout=60)6 unmodified linesfinished += 1continueresults.append(r)ok = sum(x["success"] for x in results)print(f"{len(results)}/{args.episodes}: {'ok ' if r['success'] else 'fail'} {r['piece']} {r['source']}->{r['destination']} "f"closest {r['closest_mm']} mm, lifted {r['lifted']} ({r['frames']} frames) | "f"{ok}/{len(results)} = {100 * ok / len(results):.1f}%", flush=True)for p in procs:297 unmodified lines2982993003013023033043053066 unmodified lines313314315316317318319320321322323297 unmodified linesfor p in procs:p.start()t0, results, finished = time.time(), [], 0# One line per finished episode, written as it arrives, so a stopped run can still be paired.partial = out / "eval_episodes.jsonl"partial.unlink(missing_ok=True)while finished < len(procs):try:r = queue.get(timeout=60)6 unmodified linesfinished += 1continueresults.append(r)with partial.open("a") as f:f.write(json.dumps({k: v for k, v in r.items() if k != "video"},default=lambda o: o.item() if hasattr(o, "item") else str(o)) + "\n")ok = sum(x["success"] for x in results)print(f"{len(results)}/{args.episodes} [ep {r['index']}]: {'ok ' if r['success'] else 'fail'} {r['piece']} {r['source']}->{r['destination']} "f"closest {r['closest_mm']} mm, lifted {r['lifted']} ({r['frames']} frames) | "f"{ok}/{len(results)} = {100 * ok / len(results):.1f}%", flush=True)for p in procs:
81 unmodified lines8283848586874 unmodified lines9293949596979 unmodified lines107108109110111112297 unmodified lines41041141241341441581 unmodified linesq: list = field(default_factory=list) # 5 arm joint targets per frameg: list = field(default_factory=list) # gripper target per framephase: list = field(default_factory=list)def add(self, q, g, phase):self.q.append(np.asarray(q, float).copy())4 unmodified linesreturn len(self.q)def extend(self, other: "Trajectory"):self.q += other.qself.g += other.gself.phase += other.phase9 unmodified linesq_grasp: np.ndarraycarry_tilt: float = 0.0 # outward tilt at the top of the liftgrasp_tilt: float = 0.0 # lean at the grasp (negative: fingertips toward the base)class PlanningFailed(Exception):297 unmodified lineserrors.append(str(exc))raise PlanningFailed("pick: " + "; ".join(errors))def _yaw_order(self, d, name, base, offsets=None):"""Diagonals, best finger clearance to neighbouring pieces first (or the givenboard-relative `offsets`, ordered the same way)."""81 unmodified lines828384858687884 unmodified lines939495969798991001019 unmodified lines111112113114115116117297 unmodified lines41541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948081 unmodified linesq: list = field(default_factory=list) # 5 arm joint targets per frameg: list = field(default_factory=list) # gripper target per framephase: list = field(default_factory=list)label: list | None = None # arm targets to record as the action, if not q (perturb_pick)def add(self, q, g, phase):self.q.append(np.asarray(q, float).copy())4 unmodified linesreturn len(self.q)def extend(self, other: "Trajectory"):if self.label is not None or other.label is not None:self.label = (list(self.q) if self.label is None else self.label) + \(list(other.q) if other.label is None else other.label)self.q += other.qself.g += other.gself.phase += other.phase9 unmodified linesq_grasp: np.ndarraycarry_tilt: float = 0.0 # outward tilt at the top of the liftgrasp_tilt: float = 0.0 # lean at the grasp (negative: fingertips toward the base)dart_offset_mm: list | None = None # executed sideways offset (x, y) if perturbed (perturb_pick)class PlanningFailed(Exception):297 unmodified lineserrors.append(str(exc))raise PlanningFailed("pick: " + "; ".join(errors))def perturb_pick(self, d, name: str, pick: PickPlan, rng) -> PickPlan:"""DART-style perturbation: execute the approach off-centre, record the clean plan.The executed hand drifts sideways by a random offset (`dart_radius_mm`, any direction)during the approach, holds it into the descent and returns to the planned path over arandom `dart_return_s`, ending before the fingertips come within `dart_clear_mm` of thepiece's top.From there on it follows the plan exactly. The recorded actions (`traj.label`) are theclean plan throughout, so an episode shows "from off-centre, command the centred path"and never an off-centre aim. The executed part is collision-checked with the targetincluded; an offset that collides is redrawn, up to `dart_tries` times, else the planruns unperturbed."""e, t = self.e, pick.trajdesc = [i for i, ph in enumerate(t.phase) if ph == "descend"]if not desc or desc[0] < 2:return pickk0 = desc[0]top = self.w.base_pos(d, name)[2] + self.w.height[self.w.kind[name]]z_clear = top + e["dart_clear_mm"] / 1000pts = [self.kin.pose(q, pick.offset)[0] for q in t.q[k0:desc[-1] + 1]]k_clear = k0 + next((j for j, p in enumerate(pts) if p[2] <= z_clear), len(pts) - 1)n_down = min(round(rng.uniform(*e["dart_return_s"]) * self.fps), k_clear - 2)k_peak = k_clear - n_downk_up = min(k0, k_peak)w = np.zeros(len(t))w[:k_up] = np.r_[0.0, min_jerk(k_up - 1)] # 0 at the start, full by the end of the approachw[k_up:k_peak] = 1.0 # held into the descentw[k_peak:k_clear] = 1 - min_jerk(n_down) # back to 0 at k_clear - 1q_above = t.q[k0 - 1]p_above = self.kin.pose(q_above, pick.offset)[0]lo, hi = e["dart_radius_mm"]for _ in range(e["dart_tries"]):r, a = rng.uniform(lo, hi) / 1000, rng.uniform(0, 2 * np.pi)delta = np.array([r * np.cos(a), r * np.sin(a), 0.0])try:dq = self._solve(p_above + delta, pick.yaw, pick.offset, q_above, tilt=pick.grasp_tilt) - q_aboveex = Trajectory()q = q_abovefor i in range(k_clear):if i < k0:q = t.q[i] + w[i] * dqelse:q = self._solve(pts[i - k0] + w[i] * delta, pick.yaw, pick.offset, q, tilt=pick.grasp_tilt)ex.add(q, t.g[i], t.phase[i])except PlanningFailed:continueself._sync_planning(d) # the target counts while the hand is off the planfree = self._collision_free(ex)self._sync_planning(d, ignored=(name,))if not free:continueex.q += [q.copy() for q in t.q[k_clear:]]ex.g += t.g[k_clear:]ex.phase += t.phase[k_clear:]ex.label = [q.copy() for q in t.q]return PickPlan(ex, pick.yaw, pick.grasp, pick.offset, pick.grasp_point, pick.q_grasp,pick.carry_tilt, pick.grasp_tilt, dart_offset_mm=[round(float(x), 2) for x in delta[:2] * 1000])return pickdef _yaw_order(self, d, name, base, offsets=None):"""Diagonals, best finger clearance to neighbouring pieces first (or the givenboard-relative `offsets`, ordered the same way)."""
4 unmodified lines56789101111 unmodified lines2324252627282912 unmodified lines4243444546471 unmodified line495051525354555657585960616263644 unmodified lines69707172737416 unmodified lines919293949596975 unmodified lines1031041051061071082 unmodified lines11111211311411511611731 unmodified lines1491501511521531544 unmodified linessame seed with rendering into its own LeRobot shard. The shards are then mergedwith LeRobot's aggregate_datasets and the result is loaded back as a check.Run: .venv/bin/python sim/generate_dataset.py --episodes 200 --workers 8"""from __future__ import annotations11 unmodified linessys.path.insert(0, str(HERE))def worker(k: int, n_target: int, cfg: dict, shard_root: str, repo_id: str, seed: int, queue):import warningswarnings.filterwarnings("ignore")12 unmodified linesdone, attempts, replay_mismatch = 0, 0, 0failures = Counter()t0 = time.time()while done < n_target:if on_set >= per_set:if runner is not None:1 unmodified linepset = sample_piece_set(rng, cfg, f"worker{k}_set{n_sets}")runner = EpisodeRunner(cfg, pset, render=True)on_set, n_sets = 0, n_sets + 1ep_seed = int(rng.integers(2**62))attempts += 1task = runner.setup(np.random.default_rng(ep_seed))res = runner.run(task, ep_seed)if not res.success:failures[res.reason.split(":")[0].split(" ")[0] or "other"] += 1continuetask = runner.setup(np.random.default_rng(ep_seed))rec.begin(runner, task, np.random.default_rng(ep_seed ^ 0x5EED))res = runner.run(task, ep_seed, recorder=rec)if not res.success:rec.discard()replay_mismatch += 14 unmodified linesshard=k, shard_episode=done, seed=ep_seed, piece=runner.w.kind[task.target], body=task.target,source=task.source, destination=task.dest.square or "bin", move_kind=task.kind, fen=task.fen,frames=res.frames, centre_error_mm=res.centre_error_mm, jaw_yaw_deg=res.yaw_deg,piece_set=runner.piece_set.name, piece_set_dims=runner.piece_set.describe(), **runner.episode_info))done += 1queue.put((k, done, attempts))16 unmodified linesap.add_argument("--root", default=ds["root"])ap.add_argument("--seed", type=int, default=0)ap.add_argument("--overwrite", action="store_true", help="delete an existing dataset at --root first")args = ap.parse_args()root = (ROOT / args.root).resolve()shards = root.parent / (root.name + "_shards")5 unmodified linesshards.mkdir(parents=True)n = args.workersquota = [args.episodes // n + (1 if i < args.episodes % n else 0) for i in range(n)]ctx = mp.get_context("spawn")queue = ctx.Queue()procs, repo_ids, roots = [], [], []2 unmodified linescontinuerepo_ids.append(f"{ds['repo_id']}_shard{k:02d}")roots.append(shards / f"shard_{k:02d}")p = ctx.Process(target=worker, args=(k, quota[k], cfg, str(roots[-1]), repo_ids[-1], args.seed, queue))p.start()procs.append(p)t0, progress, summaries = time.time(), {}, {}31 unmodified linesfor s in summaries.values():failures.update(s["failures"])summary = dict(episodes=offset, attempts=attempts, success_rate=round(offset / attempts, 4),failures=dict(failures), replay_mismatch=sum(s["replay_mismatch"] for s in summaries.values()),piece_sets=sum(s["piece_sets"] for s in summaries.values()),minutes=round((time.time() - t0) / 60, 1), workers=n, config=cfg)4 unmodified lines567891011121314151617181911 unmodified lines313233343536373812 unmodified lines51525354555657581 unmodified line606162636465666768697071727374757677787980818283844 unmodified lines8990919293949516 unmodified lines1121131141151161171181191201211221231241251265 unmodified lines1321331341351361371382 unmodified lines14114214314414514614714814931 unmodified lines1811821831841851861874 unmodified linessame seed with rendering into its own LeRobot shard. The shards are then mergedwith LeRobot's aggregate_datasets and the result is loaded back as a check.With --seeds-from, the episode seeds are read from another dataset'sphase2_episodes.jsonl (in its episode order) instead of drawn, so each episode repeatsthat dataset's scene; each worker takes a contiguous block, so the merged order matches.With the dart profile, a perturbed episode that fails is retried with fresh offsets(--dart-retries), then run unperturbed.Run: .venv/bin/python sim/generate_dataset.py --episodes 200 --workers 8PHASE2_PROFILE=baseline,dart .venv/bin/python sim/generate_dataset.py \--seeds-from hub/chess-sim/datasets/baseline_v1/phase2_episodes.jsonl --workers 12"""from __future__ import annotations11 unmodified linessys.path.insert(0, str(HERE))def worker(k: int, n_target: int, cfg: dict, shard_root: str, repo_id: str, seed: int, queue,seeds: list | None = None, dart_retries: int = 2):import warningswarnings.filterwarnings("ignore")12 unmodified linesdone, attempts, replay_mismatch = 0, 0, 0failures = Counter()t0 = time.time()dart = cfg["expert"].get("dart_probability", 0.0) > 0listed = iter(seeds) if seeds is not None else Nonewhile done < n_target:if on_set >= per_set:if runner is not None:1 unmodified linepset = sample_piece_set(rng, cfg, f"worker{k}_set{n_sets}")runner = EpisodeRunner(cfg, pset, render=True)on_set, n_sets = 0, n_sets + 1if listed is not None:ep_seed = next(listed, None)if ep_seed is None:break # listed seeds used up (some failed)else:ep_seed = int(rng.integers(2**62))attempts += 1# Perturbed tries first (fresh offsets each), then the plain teacher; the first that succeeds is recorded.for dart_attempt in (list(range(1 + dart_retries)) + [-1]) if dart else [0]:task = runner.setup(np.random.default_rng(ep_seed))res = runner.run(task, ep_seed, dart_attempt=dart_attempt)if res.success:breakfailures[res.reason.split(":")[0].split(" ")[0] or "other"] += 1if not res.success:continuetask = runner.setup(np.random.default_rng(ep_seed))rec.begin(runner, task, np.random.default_rng(ep_seed ^ 0x5EED))res = runner.run(task, ep_seed, recorder=rec, dart_attempt=dart_attempt)if not res.success:rec.discard()replay_mismatch += 14 unmodified linesshard=k, shard_episode=done, seed=ep_seed, piece=runner.w.kind[task.target], body=task.target,source=task.source, destination=task.dest.square or "bin", move_kind=task.kind, fen=task.fen,frames=res.frames, centre_error_mm=res.centre_error_mm, jaw_yaw_deg=res.yaw_deg,dart_offset_mm=res.dart_offset_mm, dart_attempt=dart_attempt if dart else None,piece_set=runner.piece_set.name, piece_set_dims=runner.piece_set.describe(), **runner.episode_info))done += 1queue.put((k, done, attempts))16 unmodified linesap.add_argument("--root", default=ds["root"])ap.add_argument("--seed", type=int, default=0)ap.add_argument("--overwrite", action="store_true", help="delete an existing dataset at --root first")ap.add_argument("--seeds-from", help="phase2_episodes.jsonl whose episode seeds to repeat, in its order")ap.add_argument("--dart-retries", type=int, default=2)args = ap.parse_args()seeds = Noneif args.seeds_from:recs = [json.loads(line) for line in Path(args.seeds_from).read_text().splitlines() if line.strip()]recs.sort(key=lambda r: r["episode_index"])seeds = [int(r["seed"]) for r in recs][:args.episodes]args.episodes = len(seeds)root = (ROOT / args.root).resolve()shards = root.parent / (root.name + "_shards")5 unmodified linesshards.mkdir(parents=True)n = args.workersquota = [args.episodes // n + (1 if i < args.episodes % n else 0) for i in range(n)]starts = [sum(quota[:i]) for i in range(n)]ctx = mp.get_context("spawn")queue = ctx.Queue()procs, repo_ids, roots = [], [], []2 unmodified linescontinuerepo_ids.append(f"{ds['repo_id']}_shard{k:02d}")roots.append(shards / f"shard_{k:02d}")block = seeds[starts[k]:starts[k] + quota[k]] if seeds is not None else Nonep = ctx.Process(target=worker, args=(k, quota[k], cfg, str(roots[-1]), repo_ids[-1], args.seed, queue,block, args.dart_retries))p.start()procs.append(p)t0, progress, summaries = time.time(), {}, {}31 unmodified linesfor s in summaries.values():failures.update(s["failures"])summary = dict(episodes=offset, attempts=attempts, success_rate=round(offset / attempts, 4),seeds_from=args.seeds_from,failures=dict(failures), replay_mismatch=sum(s["replay_mismatch"] for s in summaries.values()),piece_sets=sum(s["piece_sets"] for s in summaries.values()),minutes=round((time.time() - t0) / 60, 1), workers=n, config=cfg)
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283"""Paired comparison of two policy evaluations on the same scenes (same --seed in eval_policy.py).
Reads each run's eval_results.json, or eval_episodes.jsonl if the run was stopped, and pairsepisodes by index (only indices both runs finished). Reports success per model, the discordantpairs with an exact two-sided McNemar test, results per piece, and the grasp measurements.
Run: .venv/bin/python sim/paired_compare.py A=sim/reports/dart_eval/baseline B=sim/reports/dart_eval/dart \ --out sim/reports/dart_eval/paired.md"""from __future__ import annotations
import argparseimport jsonfrom math import combfrom pathlib import Pathfrom statistics import median
def load(path: Path) -> dict: f = path / "eval_results.json" if f.exists(): eps = json.loads(f.read_text())["episodes"] else: eps = [json.loads(line) for line in (path / "eval_episodes.jsonl").read_text().splitlines() if line.strip()] return {e["index"]: e for e in eps}
def mcnemar(b: int, c: int) -> float: n = b + c if n == 0: return 1.0 k = min(b, c) return min(1.0, 2 * sum(comb(n, i) for i in range(k + 1)) / 2 ** n)
def med(values): values = [v for v in values if v is not None] return round(median(values), 1) if values else None
def main(): ap = argparse.ArgumentParser(description=__doc__) ap.add_argument("runs", nargs=2, help="NAME=path to an eval_policy.py output folder") ap.add_argument("--out") args = ap.parse_args() (na, pa), (nb, pb) = (r.split("=", 1) for r in args.runs) A, B = load(Path(pa)), load(Path(pb)) idx = sorted(set(A) & set(B)) n = len(idx) sa = sum(A[i]["success"] for i in idx) sb = sum(B[i]["success"] for i in idx) only_a = sum(A[i]["success"] and not B[i]["success"] for i in idx) only_b = sum(B[i]["success"] and not A[i]["success"] for i in idx) lines = [f"# Paired comparison: {na} vs {nb}", "", f"{n} scenes finished by both ({na}: {len(A)}, {nb}: {len(B)}).", "", "| | " + na + " | " + nb + " |", "|---|---|---|", f"| success | {sa}/{n} ({100 * sa / max(n, 1):.1f}%) | {sb}/{n} ({100 * sb / max(n, 1):.1f}%) |"] for piece in sorted({A[i]["piece"] for i in idx}): ids = [i for i in idx if A[i]["piece"] == piece] lines.append(f"| {piece}s | {sum(A[i]['success'] for i in ids)}/{len(ids)} | {sum(B[i]['success'] for i in ids)}/{len(ids)} |") for key, label in (("lifted", "piece lifted"),): lines.append(f"| {label} | {sum(bool(A[i].get(key)) for i in idx)} | {sum(bool(B[i].get(key)) for i in idx)} |") for key, label in (("close_lateral_mm", "sideways error when closing, median mm"), ("closest_mm", "closest approach to the piece, median mm")): if any(key in A[i] for i in idx): lines.append(f"| {label} | {med(A[i].get(key) for i in idx)} | {med(B[i].get(key) for i in idx)} |") lines += ["", f"Discordant scenes: only {na} succeeded {only_a}, only {nb} succeeded {only_b}; " f"exact McNemar p = {mcnemar(only_a, only_b):.3g}. Both succeeded " f"{sum(A[i]['success'] and B[i]['success'] for i in idx)}, neither " f"{sum(not A[i]['success'] and not B[i]['success'] for i in idx)}."] moves = sorted({f"{A[i]['source']}-{A[i]['destination']}" for i in idx}) lines += ["", "| move | " + na + " | " + nb + " |", "|---|---|---|"] for mv in moves: ids = [i for i in idx if f"{A[i]['source']}-{A[i]['destination']}" == mv] lines.append(f"| {mv} | {sum(A[i]['success'] for i in ids)}/{len(ids)} | {sum(B[i]['success'] for i in ids)}/{len(ids)} |") text = "\n".join(lines) + "\n" if args.out: Path(args.out).write_text(text) print(text)
if __name__ == "__main__": main()1234567891011121314151617181920# DART-style perturbed demonstrations, merged after another profile:# PHASE2_PROFILE=baseline,dart# In a share of episodes the executed approach drifts off-centre by a random sideways offset# and returns to the plan during the descent, while the recorded actions stay the clean# plan (Expert.perturb_pick). The policy then sees off-centre states labelled with the# centred path, which the unperturbed teacher never shows: in its demonstrations the hand# always starts the descent exactly centred and goes straight down, so the action near the# piece can be predicted from the joint state alone (sim/reports/replan_test).
[dataset]repo_id = "local/so101_chess_baseline_dart"root = "data/so101_chess_baseline_dart"
[expert]dart_probability = 0.5 # share of episodes perturbeddart_radius_mm = [2.0, 10.0] # offset size, uniform, any direction (the baseline policy's # error 40 mm above the piece: ~4 mm in successes, ~8 mm in failures)dart_clear_mm = 4.0 # back on the plan this far above the target's topdart_return_s = [0.3, 0.8] # the return takes this long (uniform), so off-centre states reach different heightsdart_tries = 4 # offsets drawn before running the episode unperturbed65 unmodified lines66676869707192 unmodified lines16416516616716816965 unmodified lines"straight down, with no pause. Fine-tuning the baseline on these plus baseline_v1 ""lowered success (30% vs 51.7% on the same episodes: more pieces knocked over). ""Kept for reference; not used.",}92 unmodified lines"and after a misaligned close the teacher first rises to its approach height and pauses, ""and the policy learned to hover over pawns. The next attempt (`--style v2`) lines up from ""where the arm is and goes straight down.", ""]if val:lines += [f"Expert validation (random layouts): {val['success_percent']}% of {val['trials']} trials "f"(target above {val['target_percent']}%).", ""]65 unmodified lines6667686970717273747592 unmodified lines16816917017117217317417517617717817918018118218318418518618718818919019165 unmodified lines"straight down, with no pause. Fine-tuning the baseline on these plus baseline_v1 ""lowered success (30% vs 51.7% on the same episodes: more pieces knocked over). ""Kept for reference; not used.","baseline_dart_v1": "baseline_v1's 300 scenes (same episode seeds) with a perturbed teacher (see *Perturbed ""teacher*): in about half the episodes the executed approach drifts 2-10 mm off-centre and ""returns before the fingertips reach the piece, while the recorded actions stay the clean ""plan.",}92 unmodified lines"and after a misaligned close the teacher first rises to its approach height and pauses, ""and the policy learned to hover over pawns. The next attempt (`--style v2`) lines up from ""where the arm is and goes straight down.", ""]if "baseline_dart_v1" in names:lines += ["## Perturbed teacher (baseline_dart_v1)", "","DART-style demonstrations (`PHASE2_PROFILE=baseline,dart`, `Expert.perturb_pick`). The plain ""teacher always starts its descent exactly centred and goes straight down, so near the piece ""its next action can be predicted from the joint state alone; the baseline policy's roughly ""7 mm aiming error is never corrected on the way down.", "","- In about half the episodes the executed hand drifts sideways by a random 2-10 mm (any ""direction) during the approach, holds the offset into the descent and returns to the plan ""over 0.3-0.8 s, ending 4 mm above the target's top. Each offset is collision-checked with ""the target included.","- The recorded `action` is the clean plan throughout; `observation.state` and the images ""show the perturbed hand. The episodes therefore show \"from off-centre, command the centred ""path\", and never an off-centre aim.","- Same 300 episode seeds as baseline_v1 (`--seeds-from`), so each episode repeats the same ""scene, move and timing. `dart_offset_mm` in `phase2_episodes.jsonl` is the executed offset ""(null when unperturbed).", "","Teacher validation, 100 scenes: 100% success perturbed and plain, no touches on the target ""or its neighbours before the grasp (`reports/dart_teacher/`).", ""]if val:lines += [f"Expert validation (random layouts): {val['success_percent']}% of {val['trials']} trials "f"(target above {val['target_percent']}%).", ""]
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127{ "codebase_version": "v3.0", "robot_type": "so101_follower", "total_episodes": 300, "total_frames": 89007, "total_tasks": 1, "chunks_size": 1000, "data_files_size_in_mb": 100, "video_files_size_in_mb": 200, "fps": 30, "splits": { "train": "0:300" }, "data_path": "data/chunk-{chunk_index:03d}/file-{file_index:03d}.parquet", "video_path": "videos/{video_key}/chunk-{chunk_index:03d}/file-{file_index:03d}.mp4", "features": { "observation.images.overhead": { "dtype": "video", "shape": [ 480, 640, 3 ], "names": [ "height", "width", "channels" ], "info": { "video.height": 480, "video.width": 640, "video.codec": "h264", "video.pix_fmt": "yuv444p", "video.is_depth_map": false, "video.fps": 30, "video.channels": 3, "has_audio": false } }, "observation.images.wrist": { "dtype": "video", "shape": [ 480, 640, 3 ], "names": [ "height", "width", "channels" ], "info": { "video.height": 480, "video.width": 640, "video.codec": "h264", "video.pix_fmt": "yuv444p", "video.is_depth_map": false, "video.fps": 30, "video.channels": 3, "has_audio": false } }, "observation.state": { "dtype": "float32", "shape": [ 6 ], "names": [ "shoulder_pan.pos", "shoulder_lift.pos", "elbow_flex.pos", "wrist_flex.pos", "wrist_roll.pos", "gripper.pos" ] }, "action": { "dtype": "float32", "shape": [ 6 ], "names": [ "shoulder_pan.pos", "shoulder_lift.pos", "elbow_flex.pos", "wrist_flex.pos", "wrist_roll.pos", "gripper.pos" ] }, "timestamp": { "dtype": "float32", "shape": [ 1 ], "names": null }, "frame_index": { "dtype": "int64", "shape": [ 1 ], "names": null }, "episode_index": { "dtype": "int64", "shape": [ 1 ], "names": null }, "index": { "dtype": "int64", "shape": [ 1 ], "names": null }, "task_index": { "dtype": "int64", "shape": [ 1 ], "names": null } }}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632{ "observation.state": { "min": [ -40.65826416015625, -72.18864440917969, -65.00843811035156, 36.90049362182617, -136.56935119628906, 3.1062369346618652 ], "max": [ 40.05377960205078, 60.818634033203125, 71.81863403320312, 94.2590560913086, 148.88377380371094, 24.69868278503418 ], "mean": [ 2.3195208522479973, -12.376053826834404, 33.28706150314955, 63.54405649065113, -11.120372534041975, 9.087216388374696 ], "std": [ 12.660685004603222, 36.20813903478973, 30.66339015022113, 15.289261097997963, 73.84164631915502, 4.864019408739631 ], "count": [ 89007 ], "q01": [ -6.2758009991291015, -69.88942716424141, 6.6867994736915595, 43.66822202510868, -50.06866767983563, 4.763086094916355 ], "q10": [ -5.241127341302159, -67.43451068360383, 9.492493837028734, 45.17984061055057, -48.89890257380647, 4.865741722640832 ], "q50": [ 2.6034672481316528, -1.7320372887537314, 36.503923016417595, 61.42873502513581, -13.469873895089966, 8.035161678256964 ], "q90": [ 9.452480016577084, 23.33294736549002, 60.46759897789112, 82.6674198898814, 32.36926151947513, 16.403425103713708 ], "q99": [ 10.150647188535501, 24.193942426820644, 61.71682090320716, 84.56714441306916, 33.96168726634475, 18.836842704729097 ] }, "observation.images.overhead": { "min": [ [ [ 0.0 ] ], [ [ 0.0 ] ], [ [ 0.0 ] ] ], "max": [ [ [ 1.0 ] ], [ [ 1.0 ] ], [ [ 1.0 ] ] ], "mean": [ [ [ 0.5419043119417212 ] ], [ [ 0.4304681522739652 ] ], [ [ 0.35114633898420483 ] ] ], "std": [ [ [ 0.0016506071159243527 ] ], [ [ 0.0019390734522879494 ] ], [ [ 0.0025130182449726725 ] ] ], "count": [ 30000 ], "q01": [ [ [ 0.07394869726942692 ] ], [ [ 0.0741435735566462 ] ], [ [ 0.07072739991737509 ] ] ], "q10": [ [ [ 0.26372618249408875 ] ], [ [ 0.21486540778614113 ] ], [ [ 0.20440059426522858 ] ] ], "q50": [ [ [ 0.5694803754651756 ] ], [ [ 0.43148919373374556 ] ], [ [ 0.33902459017963993 ] ] ], "q90": [ [ [ 0.6428045143841429 ] ], [ [ 0.517363208717772 ] ], [ [ 0.41396953046375323 ] ] ], "q99": [ [ [ 0.8929017209709634 ] ], [ [ 0.8787513103436666 ] ], [ [ 0.8649004539880101 ] ] ] }, "action": { "min": [ -36.24530792236328, -72.19010162353516, -42.96904754638672, 36.922279357910156, -135.7710418701172, 0.00015509591321460903 ], "max": [ 35.939876556396484, 53.256752014160156, 71.8017349243164, 86.518310546875, 148.88015747070312, 24.698781967163086 ], "mean": [ 2.3292199498780164, -12.451959486204947, 33.33016718560703, 63.51432984896938, -11.110126096821102, 7.5639963821026175 ], "std": [ 12.66464851617185, 36.15450863959028, 30.565267124678154, 15.250989560695185, 73.84942172782806, 6.314002152147408 ], "count": [ 89007 ], "q01": [ -6.196265227792532, -69.85062441473384, 7.372562449305549, 43.66931707698518, -49.99980446282459, 0.00015509581135120243 ], "q10": [ -5.26095142377373, -67.46272332415919, 9.592401411273357, 45.141739756201126, -48.90222658449696, 0.00015509581135120243 ], "q50": [ 2.614204198580934, -1.7936427503380354, 36.518516941442776, 61.43518865978989, -13.447456536042683, 8.027563472655943 ], "q90": [ 9.468008643034295, 23.280864342455263, 60.48524950943169, 82.60471037869262, 32.38767019994752, 16.397228549597404 ], "q99": [ 10.029985386831559, 24.089823968163806, 61.689061065736446, 84.35451188639064, 33.89545395680785, 18.825386801184173 ] }, "observation.images.wrist": { "min": [ [ [ 0.0 ] ], [ [ 0.0 ] ], [ [ 0.0 ] ] ], "max": [ [ [ 1.0 ] ], [ [ 1.0 ] ], [ [ 1.0 ] ] ], "mean": [ [ [ 0.4796342796568628 ] ], [ [ 0.3995350723039216 ] ], [ [ 0.34535309639161216 ] ] ], "std": [ [ [ 0.027914067871107704 ] ], [ [ 0.01930094589390023 ] ], [ [ 0.012887355486575464 ] ] ], "count": [ 30000 ], "q01": [ [ [ 0.05281518129261759 ] ], [ [ 0.05278418119227583 ] ], [ [ 0.04859839701613106 ] ] ], "q10": [ [ [ 0.15475241042440557 ] ], [ [ 0.13073931895862073 ] ], [ [ 0.09587077506294092 ] ] ], "q50": [ [ [ 0.5496295770902001 ] ], [ [ 0.4262309194009911 ] ], [ [ 0.33654564676781934 ] ] ], "q90": [ [ [ 0.8055213170778873 ] ], [ [ 0.6404869111293606 ] ], [ [ 0.5645099712253494 ] ] ], "q99": [ [ [ 0.9261082808083375 ] ], [ [ 0.8650428315470554 ] ], [ [ 0.8646764643701405 ] ] ] }, "frame_index": { "min": [ 0 ], "max": [ 431 ], "mean": [ 153.0851281359893 ], "std": [ 94.36207785314795 ], "count": [ 89007 ], "q01": [ 2.559645868428862 ], "q10": [ 30.167673169445685 ], "q50": [ 152.85933151549864 ], "q90": [ 275.93696057846176 ], "q99": [ 303.5998570920124 ] }, "episode_index": { "min": [ 0 ], "max": [ 42 ], "mean": [ 20.93949914051704 ], "std": [ 12.373923017521488 ], "count": [ 89007 ], "q01": [ 20.93949914051704 ], "q10": [ 20.93949914051704 ], "q50": [ 20.939499140517054 ], "q90": [ 20.939499140517068 ], "q99": [ 20.939499140517075 ] }, "timestamp": { "min": [ 0.0 ], "max": [ 14.366666666666667 ], "mean": [ 5.102837604532976 ], "std": [ 3.1454025951049314 ], "count": [ 89007 ], "q01": [ 0.08532152885257514 ], "q10": [ 1.0055891055705626 ], "q50": [ 5.095296231457298 ], "q90": [ 9.197898686026308 ], "q99": [ 10.119995236495464 ] }, "index": { "min": [ 0 ], "max": [ 13071 ], "mean": [ 6362.463581516061 ], "std": [ 3679.5952908859067 ], "count": [ 89007 ], "q01": [ 6211.9380992485 ], "q10": [ 6239.546126549516 ], "q50": [ 6362.238372062871 ], "q90": [ 6485.315413958533 ], "q99": [ 6512.978310472085 ] }, "task_index": { "min": [ 0 ], "max": [ 0 ], "mean": [ 0.0 ], "std": [ 0.0 ], "count": [ 89007 ], "q01": [ 3.9999999999994176e-16 ], "q10": [ 3.999999999999418e-15 ], "q50": [ 1.9999999999997088e-14 ], "q90": [ 3.599999999999476e-14 ], "q99": [ 3.9599999999994235e-14 ] }}123version https://git-lfs.github.com/spec/v1oid sha256:7153b5abfa610653bc259a9e66db6647ebd372954317ae3f17dc8cc884b65e5fsize 2328123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462{ "episodes": 300, "attempts": 300, "success_rate": 1.0, "seeds_from": "hub/chess-sim/datasets/baseline_v1/phase2_episodes.jsonl", "failures": {}, "replay_mismatch": 0, "piece_sets": 7, "minutes": 81.2, "workers": 7, "config": { "dataset": { "repo_id": "local/so101_chess_baseline_dart", "root": "data/so101_chess_baseline_dart", "fps": 30, "cameras": [ "overhead", "wrist" ], "image_width": 640, "image_height": 480, "instruction": "move the piece on the red square to the blue square", "episodes": 300, "workers": 8, "episodes_per_piece_set": 1000, "vcodec": "h264", "video_crf": 18, "video_pix_fmt": "yuv444p" }, "overlay": { "source_rgb": [ 230, 40, 30 ], "destination_rgb": [ 70, 90, 255 ], "alpha": 0.6, "jitter_mm": 0.0, "jitter_rot_deg": 0.0, "jitter_scale": 0.0, "wrist_frame_jitter_mm": 0.0, "outline_px": 2 }, "piece_sets": { "scale": [ 0.9, 1.08 ], "height_stretch": [ 0.95, 1.08 ], "per_kind_height": [ 0.96, 1.04 ], "max_foot_mm": 20.0, "fixed": true }, "grasp": { "tip_fraction": { "pawn": 0.63, "rook": 0.55, "knight": 0.4, "bishop": 0.63, "queen": 0.45, "king": 0.39 }, "fixed_gap_mm": 0.8, "open_margins_mm": [ 3.0, 2.0 ], "release_margins_mm": [ 3.0, 1.8 ], "close_q": -0.17453 }, "expert": { "home": [ 0.0, -1.2, 0.95, 1.45, 0.0 ], "home_jitter": 0.06, "home_gripper": [ -0.05, 0.3 ], "speed_scale": [ 0.8, 1.2 ], "joint_speed": 0.8, "carry_speed": 0.08, "vertical_speed": 0.045, "travel_clearance_mm": 10.0, "plan_margin_mm": 2.0, "carry_margin_mm": 4.0, "vertical_margin_mm": 1.0, "vertical_carry_margin_mm": 1.5, "lift_carry_margin_mm": 0.5, "place_nudge_mm": 2.5, "static_margin_mm": 1.5, "self_margin_mm": 0.5, "place_drop_mm": 1.5, "bin_release_mm": 30.0, "retreat_mm": 45.0, "plan_budget_s": 300.0, "dart_probability": 0.5, "dart_radius_mm": [ 2.0, 10.0 ], "dart_clear_mm": 4.0, "dart_return_s": [ 0.3, 0.8 ], "dart_tries": 4 }, "layout": { "square_mm": [ 22.0, 25.0 ], "border_mm": [ 6.0, 22.0 ], "board_thickness_mm": [ 3.0, 20.0 ], "tray_half_x_mm": [ 39.0, 50.0 ], "tray_half_y_mm": [ 30.0, 40.0 ], "tray_rim_mm": [ 12.0, 25.0 ], "min_slack_m": 0.003 }, "board": { "robot_plays_white_probability": 0.0, "yaw_deg": [ 0.0, 0.0 ], "offset_x": [ 0.0, 0.0 ], "offset_y": [ 0.0, 0.0 ], "deck_gap_m": 0.002, "reach_m": 0.278 }, "tray": { "left_probability": 0.0, "azimuth_deg": [ 47.0, 47.0 ], "radius_m": [ 0.236, 0.236 ], "yaw_deg": [ 0.0, 0.0 ], "board_gap_m": 0.01, "deck_gap_m": 0.01, "rover_camera_clearance_m": 0.1, "reach_m": 0.272 }, "table": { "margin_m": 0.03, "back_edge_min_x": -0.72, "edge_bias": [ 0.6, 0.6 ], "fixed_offset": [ 0.0, 0.0 ] }, "pieces": { "offcentre_mm": 0.0, "knight_yaw_deg": 0.0, "random_plies": [ 0, 70 ], "free_move_probability": 0.15, "capture_to_bin_probability": 0.5, "pieces_in_bin": [ 0, 3 ], "fixed_moves": [ "e7e5", "d7d5", "g8f6", "b8c6", "c7c5", "e2e4", "d2d4", "g1f3", "b1c3", "c2c4" ] }, "physics": { "mass_scale": [ 1.0, 1.0 ], "friction": [ 0.7, 0.7 ], "board_friction": [ 0.6, 0.6 ] }, "appearance": { "flat_board_probability": 0.3, "tint": 0.12, "table_specular": [ 0.05, 0.7 ], "table_shininess": [ 0.1, 0.9 ], "two_tone_arm_probability": 0.0, "fixed_look": true, "piece_colours": "black_white", "arm_colours": [ "white" ] }, "lighting": { "key_weights": { "window_key": 0.3, "ceiling_fill": 0.3, "desk_lamp": 0.25, "sun": 0.15 }, "extra_probability": 0.3, "max_lights": 4, "max_shadows": 2, "lamp_k": [ 2700.0, 6500.0 ], "sun_k": [ 5000.0, 6500.0 ], "ambient": [ 0.15, 0.5 ], "intensity": { "window_key": [ 0.25, 0.8 ], "ceiling_fill": [ 0.15, 0.6 ], "ceiling_2": [ 0.1, 0.5 ], "desk_lamp": [ 0.3, 0.9 ], "sun": [ 0.2, 0.7 ], "fill_2": [ 0.05, 0.25 ] }, "cutoff_deg": { "window_key": [ 50.0, 80.0 ], "ceiling_fill": [ 55.0, 90.0 ], "ceiling_2": [ 55.0, 90.0 ], "desk_lamp": [ 25.0, 50.0 ], "fill_2": [ 60.0, 90.0 ] }, "ceiling_height_m": [ 1.0, 1.6 ], "window_distance_m": [ 0.7, 1.4 ], "window_height_m": [ 0.5, 1.3 ], "desk_lamp_distance_m": [ 0.25, 0.6 ], "desk_lamp_height_m": [ 0.25, 0.6 ], "sun_elevation_deg": [ 20.0, 70.0 ], "fixed": true }, "clutter": { "probability": { "laptop": 0.0, "phone": 0.0, "mug": 0.0, "notebook": 0.0, "pen": 0.0 }, "cable_probability": [ 0.0, 0.0 ], "cable_length_m": [ 0.35, 1.0 ], "cable_radius_m": [ 0.0018, 0.003 ], "keep_out_m": 0.02, "tall_min_reach_m": 0.34 }, "cameras": { "overhead_height_m": [ 0.65, 0.65 ], "overhead_tilt_deg": [ 0.0, 0.0 ], "overhead_azimuth_deg": [ 0.0, 0.0 ], "overhead_roll_deg": [ 0.0, 0.0 ], "overhead_fovy_deg": [ 44.0, 44.0 ], "overhead_target_jitter_m": 0.0, "overhead_margin": 0.02, "rover_pos_jitter": 0.0, "rover_rot_jitter_deg": 0.0, "rover_fovy_jitter_deg": 0.0, "wrist_pos_jitter": 0.0, "wrist_rot_jitter_deg": 0.0, "wrist_fovy_jitter_deg": 0.0, "overhead_arm_may_hide": true }, "webcam": { "auto_exposure_target": [ 0.45, 0.45 ], "white_balance": 0.0, "exposure": [ 1.0, 1.0 ], "gamma": [ 1.0, 1.0 ], "saturation": [ 1.0, 1.0 ], "contrast": [ 1.0, 1.0 ], "blur_px": [ 0.0, 0.0 ], "noise": [ 0.0, 0.0 ], "jpeg_quality": [ 95, 95 ], "vignette": [ 0.0, 0.0 ] }, "validation": { "layouts": 4, "piece_sets": 4, "bin_every": 4, "success_center_mm": 6.0, "success_tilt_deg": 10.0, "disturb_mm": 2.0, "workers": 8 }, "profile": "baseline,dart" }}12345678910111213# Perturbed (DART) teacher: validation
100 scenes of the baseline profile (seed 5000003), each run plain and perturbed (offset [2.0, 10.0] mm, back on the plan 4.0 mm above the target, return over [0.3, 0.8] s). No cameras.
| | plain teacher | perturbed teacher ||---|---|---|| success | 100/100 (100.0%) | 100/100 (100.0%) (within 2 retries: 100/100 (100.0%)) || arm touched the target before closing | 0/100 (0.0%) | 0/100 (0.0%) || arm touched another piece during approach/descent | 0/100 (0.0%) | 0/100 (0.0%) || perturbation found (collision-free) | - | 100/100 (100.0%) |
Executed offset: {'median': 6.31, 'min': 2.12, 'max': 9.97} mm.
chess-sim/README.md+10-1
chess-sim/code/sim/README.md+4-1
chess-sim/code/sim/episode.py+37-13
chess-sim/code/sim/eval_policy.py+7-1
chess-sim/code/sim/expert.py+65
chess-sim/code/sim/generate_dataset.py+40-7
chess-sim/code/sim/paired_compare.pyAdded+83
chess-sim/code/sim/phase2_dart.tomlAdded+20
chess-sim/code/sim/push_dataset.py+22
chess-sim/datasets/baseline_dart_v1/meta/info.jsonAdded+127
chess-sim/datasets/baseline_dart_v1/meta/stats.jsonAdded+632
chess-sim/datasets/baseline_dart_v1/meta/tasks.parquetAdded+3
chess-sim/datasets/baseline_dart_v1/phase2_episodes.jsonlAdded
chess-sim/datasets/baseline_dart_v1/phase2_summary.jsonAdded+462
chess-sim/reports/dart_teacher/validation.jsonAdded
chess-sim/reports/dart_teacher/validation.mdAdded+13