[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-112889":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":8,"htmlUrl":8,"language":9,"languages":8,"totalLinesOfCode":8,"stars":10,"forks":11,"watchers":12,"openIssues":13,"contributorsCount":13,"subscribersCount":13,"size":13,"stars1d":14,"stars7d":15,"stars30d":16,"stars90d":13,"forks30d":13,"starsTrendScore":17,"compositeScore":18,"rankGlobal":8,"rankLanguage":8,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":20,"hasPages":20,"topics":22,"createdAt":8,"pushedAt":23,"updatedAt":24,"readmeContent":25,"aiSummary":26,"trendingCount":13,"starSnapshotCount":13,"syncStatus":14,"lastSyncTime":27,"discoverSource":28},112889,"flash-aloha","JohnYao93\u002Fflash-aloha","JohnYao93",null,"Python",140,15,65,0,2,25,72,8,64.31,"MIT License",false,"main",[],"2026-11-23 10:24:11","2026-11-22 20:07:46","# Flash ALOHA: Learning Fast and Precise Manipulation\n\nProject website: johnyao93.github.io\u002Fflash-aloha\n\nData collection, training and deployment for bimanual and single-arm manipulation\nwith ARX arms (L5 and Trossen_L5): camera servers, hand-guided recording, ACT\nand Flow policy training, direct and remote inference, and visualization.\n\nTwo policies are included: decoder-only ACT (the default) and Flow, which uses the\nLeRobot U-Net\u002Fvisual backbone. Both support training-time RTC prefix conditioning\nand optional image\u002Fproprioceptive masking. The remote client can also execute an\nOpenPI server's policy (for example Pi0.5); see `docs\u002Fimage_preprocessing.md`.\n\n## Quick start\n\nThe steps below are each described in their own section. Commands that move a robot\nare marked operator-run: read the section before running them.\n\n```bash\n# 1. Install and run the offline tests (no robot needed)\nuv sync --extra dev && source .venv\u002Fbin\u002Factivate && source scripts\u002Fsetup\u002Fpaths.sh\npython -m pytest\n\n# 2. Connect an arm, then tune its gravity and friction compensation\nuv run scripts\u002Ftune.py gravity L5 can0              # MODEL INTERFACE\nuv run scripts\u002Ftune.py friction L5 can0\n\n# 3. Practice: move the arm by hand, then record a motion and replay it (no cameras, nothing saved)\nuv run scripts\u002Fpractice.py --arm right\nuv run src\u002Frecording\u002Freplay_practice.py --arms right\n\n# 4. Save a start pose and record demonstrations\nuv run scripts\u002Fsetup\u002Fset_up_recording.py --task_name single_arm\npython scripts\u002Frun.py collect single_arm\n\n# 5. Train, then run the policy\npython scripts\u002Frun.py train single_arm_act\npython scripts\u002Frun.py infer single_arm_act\n```\n\n`single_arm` (one ARX arm, two cameras) and `bimanual` (two ARX arms, three cameras)\nare the example tasks in `src\u002Fconfig\u002Ftasks\u002F`; copy one to describe your own setup.\n\n## Setup\n\nRun commands from the repository root. Once per terminal:\n\n```bash\nuv sync --extra dev\nsource .venv\u002Fbin\u002Factivate\nsource scripts\u002Fsetup\u002Fpaths.sh\npython -m pytest                    # offline: synthetic observations, simulated hardware\n```\n\nThe tests never start a camera or a robot controller. `.python-version` selects\nPython 3.10.\n\nBuild the ARX SDK's Python extension on the robot computer following\n[src\u002Fhardware\u002Farx5-sdk\u002FREADME.md](src\u002Fhardware\u002Farx5-sdk\u002FREADME.md) (its Conda environment\nsupplies the native dependencies). `paths.sh` expects that environment at\n`$HOME\u002Fminiconda3\u002Fenvs\u002Farx-py310`; set `ARX_CONDA_PREFIX` if yours is elsewhere, and\n`OROCOS_KDL_PYTHON` if you built PyKDL from source.\n\nThe files under `calibration\u002F` were measured on one physical setup and are examples\nonly: recalibrate for your own arms and cameras before use\n([calibration\u002FREADME.md](calibration\u002FREADME.md)).\n\nDatasets, checkpoints and logs default to `data\u002F`, `ckpts\u002F` and `logs\u002F` in the\nrepository root and are not part of the repository. To keep them elsewhere, for\nexample on a larger disk, set any of:\n\n```bash\nexport FLASH_ALOHA_DATA_DIR=\u002Fpath\u002Fto\u002Fdatasets\nexport FLASH_ALOHA_CKPT_DIR=\u002Fpath\u002Fto\u002Fcheckpoints\nexport FLASH_ALOHA_LOG_DIR=\u002Fpath\u002Fto\u002Flogs\nexport WANDB_DIR=\u002Fpath\u002Fto\u002Fwandb          # Weights & Biases' own setting\n```\n\nEvery task, training and inference config follows these settings\n(`src\u002Fconfig\u002Fpaths.py`); the YAML files keep their repository-relative paths.\n\n\n## Connecting an arm (operator-run)\n\nConnect the arm's power and USB-CAN adapter, with arm controllers stopped. Most\nadapters appear as a native CAN interface; bring it up at 1 Mbit\u002Fs:\n\n```bash\nip -br link                                    # find the interface, commonly can0\nsudo ip link set can0 down\nsudo ip link set can0 type can bitrate 1000000\nsudo ip link set can0 up\n```\n\nThen match `robot.arms.\u003Cleft|right>.can_interface` in your task YAML to the adapter.\nTasks use `robot.type: arx`; each arm may name its `model` (`L5`, the default, or\n`Trossen_L5`). Start from [single_arm.yaml](src\u002Fconfig\u002Ftasks\u002Fsingle_arm.yaml) for one\narm or [bimanual.yaml](src\u002Fconfig\u002Ftasks\u002Fbimanual.yaml) for two. Set\n`FLASH_ALOHA_TASK_DIRS` to keep your own task YAMLs outside the repository and still\nselect them by name.\n\nCheck that the built SDK extension imports before moving anything:\n\n```bash\npython -c \"import arx5_interface; print(arx5_interface.__file__)\"\n```\n\n[docs\u002Farm_bringup.md](docs\u002Farm_bringup.md) has the full procedure: SLCAN and EtherCAT\nadapters, persistent device names and troubleshooting. It also lists the ARX utility\nscripts: `arx_setup.sh`, `scripts\u002Fsetup\u002Farx_arms.sh` and `scripts\u002Fsetup\u002Factivate_arm`\nshorten the ARX setup described in the\n[ARX SDK README](src\u002Fhardware\u002Farx5-sdk\u002FREADME.md), and `src\u002Fhardware\u002Fcheck_gain.py`\nprints the SDK's default gains.\n\n## Tuning gravity and friction compensation (operator-run)\n\nThis is the next step after setup, once per physical arm and before practice,\nrecording or inference: hand-guided collection relies on the saved compensation.\n`scripts\u002Ftune.py` runs the ARX SDK tuners, which take the SDK model (`L5` or\n`Trossen_L5`) and the CAN interface. Tune gravity first, then friction.\n\n```bash\nuv run scripts\u002Ftune.py gravity L5 can0         # link masses: the arm should float where you leave it\nuv run scripts\u002Ftune.py friction L5 can0        # gripper and joint friction feedforward\n```\n\nRepeat with the other interface (`can1`) for a second arm. Every other option passes\nto the tuner unchanged (`scripts\u002Ftune.py gravity --help`).\n\nBoth tuners enable the motors with zero position gain: support the arm before starting\nand before exiting. `s` saves the link masses (gravity) or the friction terms into the\nmodel's URDF in the SDK, which the SDK loads for that model. Controls are in\n[docs\u002Farm_bringup.md](docs\u002Farm_bringup.md#tuning-details).\n\n## Practice, record\u002Freplay and start poses (operator-run)\n\n### Practice without cameras\n\nRun gravity-compensated manual practice with both arms, or just one:\n\n```bash\nuv run scripts\u002Fpractice.py --arm both\nuv run scripts\u002Fpractice.py --arm right\n```\n\nLeft uses `can0`, right uses `can1`; optional `--can-interface` overrides this\nmapping, and `--arx-model` selects `L5` (default) or `Trossen_L5`. Arm and gripper\ngains are zero and the SDK provides gravity compensation. The Python loop only reads\nthe arm state, 200 times per second by default (`--controller-fps`).\nSupport the arms during startup and shutdown. Ctrl+C (or any failure) enters\ndamping; press `h` to return home, after which the controllers close (see\n[docs\u002Fsafe_exit.md](docs\u002Fsafe_exit.md)). A finished `--duration` closes without\nhoming. This entry point does not require cameras.\n\n### Record and replay a motion without cameras\n\nAfter practising, check that the arm reproduces a motion you guide it through,\nbefore saving a start pose or recording demonstrations. This tool uses no task\nand no cameras, has no time limit and writes nothing to disk. The take stays in\nmemory until the next recording replaces it.\n\n```bash\nuv run src\u002Frecording\u002Freplay_practice.py --arms right\nuv run src\u002Frecording\u002Freplay_practice.py --arms both\n```\n\nThe arms go passive where they are so you can move them by hand. The keys are\ntyped in the terminal or sent by a three-pedal foot switch:\n\n| State | Keys |\n| --- | --- |\n| Idle (arms passive) | `3` starts recording, `q` quits |\n| Recording | `3` stops |\n| Review (arms hold) | `2` replays, `3` records again, `1` releases the arms |\n| Replay | the arms move to the first recorded pose; `1` plays, `1` again stops into damping and `h` returns the arms to a hold; `h`\u002F`n` cancels before playing |\n\nRecord, replay, move the arms somewhere else and repeat as often as you like.\nThe replay runs at the recorded rate with active joint gains\n([tunable](#tuning-the-replay-gains)), so keep clear of the arms while it moves. `--fps` sets the sample and replay rate\n(default 100), `--can-left`\u002F`--can-right` override the CAN interfaces,\n`--start-position [PATH]` first moves to a saved start pose\n(`calibration\u002Fstart_position.npz` when no path is given) before releasing the\narms, and `--move-duration` sets the seconds taken to reach that pose and the\nfirst replay pose (default 3). Support the arms at startup and when quitting:\n`q` homes them and closes the controllers.\n\n### Tuning the replay gains\n\nReplay practice has two numbers for how hard the arm tracks the recorded\nmotion: one multiplies the default joint kp (stiffness), the other the default\njoint kd (damping). Both start at 1.00 and move in steps of 0.05, between 0.10\nand 2.00:\n\n| Number | Up | Down |\n| --- | --- | --- |\n| kp | up arrow or `w` | down arrow or `s` |\n| kd | right arrow or `d` | left arrow or `a` |\n\nEvery change prints the two numbers and the joint gains they give:\n\n```text\nReplay gains: kp x0.80, kd x1.20  (joints 1-3 kp 160 kd 8.4; joints 4-6 kp 80 kd 1.8)\n```\n\nPress the keys between replays; they apply from the next replay and are\nignored while recording or replaying. A loop that works well:\n\n1. Record a motion with the fast moves and stops you care about (`3`, `3`).\n2. Replay it (`2`, then `1` once the arm is at the first pose) and watch.\n3. If the arm lags or sags behind the motion, raise kp. If it buzzes or\n   overshoots, lower kp or raise kd. If it feels sluggish or the motors\n   whine, lower kd.\n4. Replay the same take again (`2`) and repeat, changing one number at a time.\n\nMove in small steps and keep clear of the arm: high kp with low kd can\noscillate. `--kp-scale` and `--kd-scale` set the starting numbers, and the\nlast ones are printed on exit so you can start from them next time. The\nnumbers are not saved and only affect this tool: recording and inference keep\nthe default gains. The replay itself is the collector's review replay, so the\nsame fractions scale the gripper gains too, and a failure or Ctrl+C enters\ndamping until `h`.\n\n#### Graphing commanded and achieved position\n\nAdd `--graph` to see how closely the arm followed each replay:\n\n```bash\nuv run src\u002Frecording\u002Freplay_practice.py --arms right --graph\n```\n\nAfter every replay that played (completed or stopped with `1`), a window opens\nwith one panel per joint and the gripper, and one column per arm. Each panel\nplots the commanded position and the achieved (measured) position against time,\nwith the RMS and largest error in its title and the kp and kd numbers at the\ntop. This is helpful for visualizing whether predicted trajectories are being\nfollowed sufficiently: a replay sends its rows the way policy execution sends\na policy's predicted actions, so the gap between the two lines here is the gap\nto expect when the arm runs a policy with these gains. A good result has the\nachieved line lying on the commanded one, trailing it only slightly, without\novershoot at stops or ripple. A steady offset or growing lag calls for more\nkp; overshoot or ripple calls for less kp or more kd.\n\nThe achieved position is read right after each target is sent, so it always\ntrails the commanded line by about one sample. Windows stay open so you can\ncompare replays at different gains; close them yourself, or they close when\nthe tool quits. The graph is drawn by a separate process from the tracking log\nthe replay already writes under `logs\u002Freplay\u002F`, and is also saved there as\n`tracking.png`. To draw a graph for an earlier replay log:\n\n```bash\nuv run src\u002Fvisualization\u002Freplay_tracking_graph.py logs\u002Freplay\u002F\u003Cdate>\u002F\u003Ctime>_practice_take\n```\n\n### Camera preview and saved start poses\n\nTo save a start pose for one task, pass its name; the task YAML supplies the\narm(s), CAN interfaces and cameras:\n\n```bash\nuv run scripts\u002Fsetup\u002Fset_up_recording.py --task_name single_arm\n```\n\nThis saves `calibration\u002Fstart_positions\u002Fsingle_arm.npz`. Recording\n(`scripts\u002Frecord.py single`) and inference for that task then start from it,\nincluding the saved gripper value; tasks without a saved pose keep using the\nshared `calibration\u002Fstart_position.npz`. Flags that contradict the task YAML\n(`--arm` or CAN overrides) are rejected; `--cameras` and `--output` may still be\noverridden. With `--gripper-only`, a task without its own pose starts from the\nshared pose.\n\nWithout a task, select the hardware directly (`--arm left|right|both`). In the\nUI, Space locks the measured arm and gripper pose, `y` saves it, `n` returns to\npractice and `q` exits. Options are in\n[docs\u002Farm_bringup.md](docs\u002Farm_bringup.md#saving-start-poses).\n\n## Configuration and training\n\nTask YAML owns cameras, arms\u002FCAN interfaces, action rate and prediction horizon.\nTraining YAML owns model\u002Ftraining settings. Inference YAML owns execution\nwindows, blending, RTC and recording choices. The same shared contracts enforce\nconsistency between collection, training and deployment.\n\n### How the configs, contracts and AGENTS.md fit together\n\nEach stage has one YAML under `src\u002Fconfig\u002F`, selected by name, and each later\nstage names the earlier one instead of repeating its values:\n\n| Stage | Config | Owns | Refers to |\n| --- | --- | --- | --- |\n| Collection | `tasks\u002FNAME.yaml` | arms and CAN interfaces, camera names and order, `control_freq`, data directory, state\u002Faction dimensions | `task_defaults.yaml` for defaults |\n| Training | `training\u002FNAME.yaml` | model type, `model.chunk_size`, optimizer and data options, training-time RTC, masking | `task:` names the task |\n| Inference | `inference\u002FNAME.yaml` | executed chunk steps, blending, runtime RTC, rollout recording, direct or remote backend | `task:` names the task; `checkpoint:` points at the checkpoint's `all_configs.json` |\n\nWhat a stage decides travels forward as metadata, and the next stage checks it\ninstead of trusting its own YAML. Each episode stores the task's rate, robot\nidentity and camera settings. Training copies those, plus its own model, RTC,\nmasking and image-preprocessing settings, into the checkpoint's\n`all_configs.json`. Inference loads that file and refuses to run if the task\nor the profile disagrees with it, so an inference profile cannot override the\nrate, cameras, dimensions or physical setup. Check any link offline with\n`check_task_config.py --recording ... --checkpoint-config ...`,\n`check_training_config.py` and `check_inference_config.py`\n([src\u002Fconfig\u002FREADME.md](src\u002Fconfig\u002FREADME.md)).\n\nThe checks themselves live in `src\u002Fcontracts\u002F`, shared by every stage so that\ncollection, training and inference cannot each keep their own copy:\n\n| Contract | Guarantees | Used by |\n| --- | --- | --- |\n| `standard_capture.py` | one proprio read, then one camera snapshot, with exact frame IDs and timestamps | live recording and inference |\n| `capture_gc.py` | no automatic garbage collection while capturing or streaming | recorder, camera servers, inference loop |\n| `standard_recording.py` | streams start before the first sample and drain on exit; the captured observation is stored as-is | every live recorder |\n| `standard_image_processing.py` | the same named, deterministic image transforms | training and inference |\n| `action_contract.py` | absolute action targets only | recording, training statistics, replay, inference |\n| `action_rate_contract.py` | one declared action rate per dataset and checkpoint | export, training, checkpoint loading, execution |\n| `sequence_contract.py` | no training sequence spans a recording gap | training data loading |\n| `robot_contract.py` | the arm models and left\u002Fright roles match | task, episodes, checkpoint, replay |\n\nDetails and the full rules are in [src\u002Fcontracts\u002FREADME.md](src\u002Fcontracts\u002FREADME.md)\nand [docs\u002Fcollection_inference_contracts.md](docs\u002Fcollection_inference_contracts.md).\n\n[AGENTS.md](AGENTS.md) makes these contracts binding on coding agents (and is a\ngood checklist for human contributors). It does not restate the code; each\nsection points an agent at the module it must reuse and the test to run:\n\n| AGENTS.md section | Requires | Verified by |\n| --- | --- | --- |\n| Robot operation | agents hand robot commands to the operator and never start a controller, collector or replay | — |\n| Mandatory observation and recording contract | new recorders and inference entry points reuse `standard_capture.capture_observation` and record through `standard_recording` | `scripts\u002Ftests\u002Ftest_standard_capture.py` |\n| Mandatory garbage-collection pause during capture | GC control only through `capture_gc` | `scripts\u002Ftests\u002Ftest_standard_capture.py` |\n| Mandatory policy image preprocessing | train and deploy share one `standard_image_processing` profile; an OpenPI server must advertise the matching image contract | `scripts\u002Ftests\u002Ftest_standard_image_processing.py` |\n| Protected recording and hardware code | no change that alters capture, timestamps, recording, drivers, action execution, RTC, chunks\u002Frates\u002Fmasking, gripper conversion or homing; storage locations change only through `src\u002Fconfig\u002Fpaths.py` | the contract tests above |\n\nThe action, action-rate, sequence and robot contracts have no section of their\nown in AGENTS.md; they fall under the protected-code rule.\n\n```bash\npython scripts\u002Fconfig\u002Fcheck_training_config.py --training-config single_arm_act\npython scripts\u002Fconfig\u002Fcheck_inference_config.py single_arm_act --schema-only\npython scripts\u002Fconfig\u002Fcheck_inference_config.py single_arm_remote --schema-only\npython scripts\u002Fpolicy\u002Fimitate_episodes_train.py --training-config single_arm_act\n```\n\n`single_arm_act` is the single-arm ACT example; `bimanual_act` trains both\narms. The `*_flow` recipes train Flow instead\n([src\u002Fconfig\u002Ftraining\u002FREADME.md](src\u002Fconfig\u002Ftraining\u002FREADME.md)). Point the\ntask\u002Ftraining configuration at your recordings. A recipe can also train with an\nimage or proprioceptive mask (`data.masking_strategy`), which direct inference then\napplies too; see [docs\u002Fimage_preprocessing.md](docs\u002Fimage_preprocessing.md#masking). For new\nconfigs, use `scripts\u002Fconfig\u002Fcreate_config.py --help`. A checkpoint\ndirectory holds `all_configs.json`, `dataset_stats.pkl` and the weights; copy the\nwhole directory when moving a checkpoint to another machine.\n\n### Training-time RTC\n\nBoth ACT and Flow support training-time real-time chunking (RTC). Set\n`training.training_time_rtc: true` in the training recipe (the `*_flow` recipes\nalready do; the `*_act` recipes leave it off). The prefix length defaults to 10\nactions (`--training_time_rtc_max_delay`). The model then learns to continue a committed action prefix: at inference\neach new chunk is conditioned on the previous plan's next actions, so chunks join\nwithout a jump while the policy query runs in the background. RTC is off by\ndefault at inference, where chunk blending is used instead; enable it with\n`rtc.training_time: true` and `rtc.enabled: true` in the inference YAML. The\ncheckpoint must have been trained with it. Details are in\n[src\u002Fconfig\u002Ftraining\u002FREADME.md](src\u002Fconfig\u002Ftraining\u002FREADME.md) and\n[src\u002Fconfig\u002Finference\u002FREADME.md](src\u002Fconfig\u002Finference\u002FREADME.md).\n\n## One command per workflow\n\n`scripts\u002Frun.py` resolves task and training-config names into the full command\nfor `scripts\u002Frecord.py`, `scripts\u002Finfer.py`, `scripts\u002Fvisualize.py` or training.\nAdd `--dry-run` to print that command without starting it; other options pass\nthrough to the entry point ([src\u002Fconfig\u002FREADME.md](src\u002Fconfig\u002FREADME.md)).\n\n```bash\npython scripts\u002Frun.py collect single_arm\npython scripts\u002Frun.py train single_arm_act\npython scripts\u002Frun.py infer single_arm_act\npython scripts\u002Frun.py serve single_arm_flow --device cuda:0\npython scripts\u002Frun.py infer single_arm_flow --inference-config single_arm_remote --remote_host SERVER_HOST\npython scripts\u002Frun.py view single_arm 24\npython scripts\u002Frun.py replay single_arm 24 27\n```\n\n## Inference (operator-run)\n\nThese commands can operate the robot; run them yourself after setup.\nDirect inference loads the ACT or Flow checkpoint locally:\n\n```bash\npython scripts\u002Finfer.py direct --inference-config single_arm_act\n```\n\nDirect and remote rollouts move to the task's saved start pose first, including\nits saved gripper value, so they start where the recorded takes started.\n\nFor server\u002Fclient operation, start the model server on the inference machine:\n\n```bash\npython scripts\u002Finfer.py serve \\\n  --config ckpts\u002Fsingle_arm_flow\u002Fall_configs.json --device cuda:0 --port 8000\n```\n\nRun the client on the robot host:\n\n```bash\npython scripts\u002Finfer.py remote \\\n  --inference-config single_arm_remote --remote_host SERVER_HOST\n```\n\nThe transport uses a NumPy\u002FMessagePack WebSocket protocol; no OpenPI checkout is\nrequired for this repository's own server. An offline client run can use\n`--dry-run --dry_run_dataset_dir \u002Fpath\u002Fto\u002Fraw\u002Frecordings` against the model server.\nThe server consumes native recorded frames and applies the shared image\npreprocessing at checkpoint resolution. The same client runs an OpenPI server's\npolicy (profiles `*_openpi_remote`). This repository does not export data for or\ntrain OpenPI; `docs\u002Fimage_preprocessing.md` describes the image contract that\nserver must advertise.\n\nBy default, direct inference crossfades each new chunk into the previous one with\nsigmoid blending (`blending.method: sigmoid` in every direct profile), and RTC is\noff (`rtc.enabled: false`). Turning RTC on keeps the crossfade, applied right after\nthe pinned prefix.\n\nDirect inference supports linear, exponential and sigmoid chunk blending,\n`--mixing_steps`, optional nearest-neighbor chunk matching, and temporal\naggregation. `--action_lookahead` and `--gripper_lookahead` skip the start of\neach new chunk; see [tuning the lookahead](#tuning-the-action-and-gripper-lookahead).\nPrediction horizons must cover the execution window, offsets and blending tail.\n\n### Tuning the action and gripper lookahead\n\nA chunk's first action describes the moment its images were captured. By the\ntime the policy has answered and the arm has caught up with its last target,\nthat moment has passed, so executing the chunk from its first action pulls the\narm back. Direct inference without RTC therefore skips the start of every chunk\nafter the first:\n\n| Flag | Default | Effect |\n| --- | --- | --- |\n| `--action_lookahead N` | 10 | at each chunk boundary, the new chunk starts at its action `N` instead of action 0 |\n| `--gripper_lookahead M` | 5 | the gripper is read a further `M` actions ahead, at `N + M` |\n\nBoth are counted in actions, so at 100 Hz the defaults are 100 ms for the arm and\n150 ms for the gripper. They are\ncommand-line options, passed through by `run.py`:\n\n```bash\npython scripts\u002Frun.py infer single_arm_act --action_lookahead 12 --gripper_lookahead 5\n```\n\nHow the skip fits the rest of the execution:\n\n- **Chunk boundary.** The policy is queried at each boundary (`execution.chunk_steps`\n  after the previous one). The new chunk replaces the old one from its action `N`,\n  and the following `chunk_steps` actions are executed.\n- **Blending.** With `blending.method` set, the first `blending.steps` executed\n  actions, starting at action `N`, are blended with the previous chunk's\n  continuation past its own executed window. The lookahead moves where the blend\n  starts; it does not shorten it.\n- **Running out of actions.** A profile is rejected before the robot moves unless\n  `max(chunk_steps, first_chunk_steps) + N + M` fits in the checkpoint's\n  `chunk_size` (this check counts `N` as at least 10). With the 100-action example\n  checkpoint and 50-step chunks, `N + M` can be at most 50.\n- **First chunk.** The first chunk of a rollout, and the first after a reset, has\n  no chunk boundary before it, so it always runs from action 0. Only the gripper\n  offset `M` applies to it.\n\nYou can change both numbers during a rollout, while it is paused (`c`, `p` or\nthe go pedal freezes the arm in place):\n\n| Number | Up | Down |\n| --- | --- | --- |\n| action lookahead | up arrow or `w` | down arrow or `s` |\n| gripper lookahead | right arrow or `d` | left arrow or `a` |\n\nEach press moves one action and prints both numbers with their time:\n\n```text\n[Lookahead] action 12 (120 ms), gripper +5 (170 ms); applies when the rollout continues\n```\n\nA value below 0, or one that would run past the end of a chunk, is refused and\nthe reason is printed. When you continue, the gripper offset applies from the\nnext step and the action lookahead from the next chunk boundary. The keys do\nnothing while the policy is moving the arm. The numbers are not saved: put the\nones you settle on in the command line.\n\nTo tune, run a rollout, pause it to change a number, continue, and read the line\nprinted at every boundary (the numbers here are only an example of the format):\n\n```text\n[Direct lookahead] handoff step=150: target jump 0.0041 (previous step 0.0038); new vs old plan\nover next 10: max 0.0120, -0.0065 along motion (behind) of 0.0410; arm trailed its target ...\n```\n\n`target jump` should be close to `previous step`. If the new plan is repeatedly\n`(behind)` and the arm hesitates or steps back at boundaries, raise\n`--action_lookahead`; if it is repeatedly `(ahead)` and the arm lurches forward,\nlower it. Change it one or two actions at a time. Then set `--gripper_lookahead`\nso the gripper closes when the arm arrives: raise it if the gripper closes late,\nlower it if it closes early.\n\nThe two flags apply to direct inference without RTC only. The asynchronous modes\nskip the start of a chunk in their own way and reject these flags or do not have\nthem: direct RTC executes the pinned prefix while the query runs and takes over\nafter it, and the remote client starts each chunk at `execution.overlap_steps`.\nNeither has a separate gripper offset.\n\nRemote RTC uses an asynchronous fixed-overlap handoff and hard action\nprefix conditioning. Set `execution.overlap_steps`, `rtc.prefix_steps` and\n`rtc.enabled` in its inference YAML; the checkpoint must declare compatible\ntraining-time RTC. The configured overlap is the new chunk's start offset;\nmeasured delay is checked against the overlap budget. Overruns fail closed.\nRemote inference requires `blending.method: none`. Direct inference with RTC is\ndescribed in [src\u002Fconfig\u002Finference\u002FREADME.md](src\u002Fconfig\u002Finference\u002FREADME.md).\n\n## Capture, recording, diagnostics and visualization\n\nOperator entry points are `scripts\u002Frecord.py`, `scripts\u002Fvisualize.py` and those under `scripts\u002Fcameras` and\n`scripts\u002Fsetup`. Recording uses `capture_observation`, `DistributedRecorder`\nand `RawEpisodeBuffer`; encoding stays in camera-server processes. Sampled\nframe IDs, camera\u002Fconsumer timestamps, capture ordering and retained-frame\nreferences are preserved. Missing or invalid references fail closed.\n\nFor hand-guided demonstrations with the `single_arm` task (left\u002Fcan0,\n`video_overhead` and `video_left`, 100 Hz, up to 15 seconds), close the camera\ntuner and run:\n\n```bash\nbash scripts\u002Fcameras\u002Fcamera_servers_tmux.sh start left overhead\nuv run scripts\u002Frecord.py single --task_name single_arm\n```\n\nStart the camera server only if it is not already running. The recorder moves to the\ntask's start pose, including the saved gripper value, and holds it; `1` starts a take\n(the arm and gripper go passive so you can guide them), `1` stops it and the arm holds\nthe measured pose, then `1` saves or `h`\u002F`n` discards, `r` replays the take before\ndeciding, and `q` quits. These keys match the two-pedal foot switch. Takes are started\nand stopped with the `1` key or pedal only. `--guided-start` starts each take wherever\nyou place the arm, and `--record-replay` also records a replay of each saved take.\nCtrl+C or any failure enters damping until `h` homes the arm\n([docs\u002Fsafe_exit.md](docs\u002Fsafe_exit.md)). The full walkthrough is in\n[docs\u002Fhand_guided_recording.md](docs\u002Fhand_guided_recording.md); review replay is in\n[docs\u002Frecording_review_replay.md](docs\u002Frecording_review_replay.md).\n\n```bash\npython scripts\u002Frecord.py single --help\npython scripts\u002Fdiagnostics\u002Fwrite_recording_rate_metadata.py --help\npython scripts\u002Fvisualize.py episode --data-dir \u002Fpath\u002Fto\u002Fraw\u002Fepisode --save-rrd episode.rrd\n```\n\nRecording review\u002Freplay, generic DAgger collection, raw-episode training,\ntraining-resolution previews and Rerun visualization are available. Robot replay and setup are operator-run too.\n\nSee `docs\u002Frecording_timestamps.md`, `docs\u002Fimage_preprocessing.md`,\n`docs\u002Fcamera_settings_contract.md`, `docs\u002Freplay_timestamps.md` and\n`docs\u002Fepisode_storage.md` for contract details. See `AGENTS.md` for the rules\ncoding agents follow in this repository.\n\n## Masking (optional)\n\nA policy can be trained with parts of its inputs hidden: image regions that follow the\narms, fixed image regions, whole cameras, or the proprioception. Set\n`data.masking_strategy` in a training recipe; direct inference then applies the same\nmask. Strategies are defined as data in `calibration\u002Fmasking\u002Fmasking.yaml`, not code,\nand work at any image resolution\n([docs\u002Fimage_preprocessing.md](docs\u002Fimage_preprocessing.md#masking)).\n\nMasks that follow the arms need a calibration of your cameras and arms\n([calibration\u002Fmasking\u002FREADME.md](calibration\u002Fmasking\u002FREADME.md)):\n\n```bash\npython scripts\u002Fcameras\u002Fcamera_int.py --camera_name video_overhead     # intrinsics, per camera\npython scripts\u002Fsetup\u002Fcalibrate_masking.py wrist-camera --arm left      # operator-run\npython scripts\u002Fsetup\u002Fcalibrate_masking.py overhead --arm left          # operator-run\n```\n\nTuning the mask shapes is optional. `scripts\u002Fsetup\u002Ftune_masking.py` shows the masks on\na recorded episode (or on live cameras with hand-guided ARX arms) while you move, resize\nand reshape a strategy's polygons, and saves a tuned config:\n\n```bash\npython scripts\u002Fsetup\u002Ftune_masking.py end_effector --episode data\u002FTASK\u002Fepisode_00000.zarr\npython scripts\u002Fsetup\u002Ftune_masking.py end_effector --live               # operator-run\n```\n\n## Documentation\n\n| Topic | Where |\n| --- | --- |\n| Arm bring-up, tuning details, start poses | [docs\u002Farm_bringup.md](docs\u002Farm_bringup.md) |\n| Failure handling (damping, homing) | [docs\u002Fsafe_exit.md](docs\u002Fsafe_exit.md) |\n| Hand-guided recording, review and replay | [docs\u002Fhand_guided_recording.md](docs\u002Fhand_guided_recording.md), [docs\u002Frecording_review_replay.md](docs\u002Frecording_review_replay.md) |\n| Inference layout and the shared hardware runtime | [docs\u002Finference_layout.md](docs\u002Finference_layout.md) |\n| Task, training and inference configs | [src\u002Fconfig\u002FREADME.md](src\u002Fconfig\u002FREADME.md) and the READMEs beside each config folder |\n| Contracts shared by collection, training and inference | [src\u002Fcontracts\u002FREADME.md](src\u002Fcontracts\u002FREADME.md), [docs\u002Fcollection_inference_contracts.md](docs\u002Fcollection_inference_contracts.md) |\n| Image preprocessing and masking | [docs\u002Fimage_preprocessing.md](docs\u002Fimage_preprocessing.md) |\n| Recording format, timestamps and storage | [docs\u002Frecording_timestamps.md](docs\u002Frecording_timestamps.md), [docs\u002Fepisode_storage.md](docs\u002Fepisode_storage.md), [docs\u002Fraw_training.md](docs\u002Fraw_training.md) |\n| Cameras | [scripts\u002Fcameras\u002FREADME.md](scripts\u002Fcameras\u002FREADME.md), [docs\u002Fcamera_settings_contract.md](docs\u002Fcamera_settings_contract.md) |\n\n## Licence and vendored code\n\nThis repository is released under the MIT License ([LICENSE](LICENSE)). Two\ncomponents are included with local modifications under their own licences, which\ncontinue to apply to those directories. Please cite and refer to the original projects:\n\n| Directory | Original project | Licence |\n| --- | --- | --- |\n| `src\u002Fhardware\u002Farx5-sdk` | [real-stanford\u002Farx5-sdk](https:\u002F\u002Fgithub.com\u002Freal-stanford\u002Farx5-sdk) (ARX5 arm SDK; base commit `79240ef`, changes listed in [CHANGES_FROM_UPSTREAM.md](src\u002Fhardware\u002Farx5-sdk\u002FCHANGES_FROM_UPSTREAM.md)) | MIT, `src\u002Fhardware\u002Farx5-sdk\u002FLICENSE` |\n| `src\u002Fkdl_parser` | [ros\u002Fkdl_parser](https:\u002F\u002Fgithub.com\u002Fros\u002Fkdl_parser) (URDF to KDL tree parser, C++ and Python) | BSD 3-Clause, `src\u002Fkdl_parser\u002FLICENSE` |\n","Flash ALOHA 是一个面向双臂\u002F单臂机器人操作任务的端到端模仿学习框架，支持基于 ARX 硬件（L5\u002FTrossen_L5）的数据采集、ACT 与 Flow 策略训练、实时推理及可视化。核心功能包括手导示教录制、RTC 前缀条件控制、图像\u002F本体感知输入掩码、本地与远程部署，并兼容 OpenPI 服务器策略调用。技术上采用 decoder-only ACT 和 LeRobot 风格 U-Net 视觉主干，强调训练与部署的轻量化和低延迟。适用于实验室环境下的灵巧操作研究、具身智能算法验证及硬件在环（HIL）快速原型开发。","2026-11-24 04:44:31","CREATED_QUERY"]