Instructions to use LORDZHAOKAI/so101-card-dual-arm with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- stable-baselines3
How to use LORDZHAOKAI/so101-card-dual-arm with stable-baselines3:
from huggingface_sb3 import load_from_hub checkpoint = load_from_hub( repo_id="LORDZHAOKAI/so101-card-dual-arm", filename="{MODEL FILENAME}.zip", ) - Notebooks
- Google Colab
- Kaggle
SO-101 Dual-Arm Card Handling (MuJoCo)
This repository contains control policies, simulation environments and robot models for a two-arm playing-card cell, all built on SO-101 arms. Everything here was trained and evaluated in MuJoCo simulation only. Nothing has been run on real hardware.
The cell has two arms:
| Arm | End effector | Task | Policy |
|---|---|---|---|
| Pick arm | Suction cup | Pick a 0.30 mm card lying anywhere in a ~45 × 12 cm table region, lift it, and deliver it to a fixed handover pose | PPO (Stable-Baselines3), trained with a curriculum |
| Flip arm | Parallel gripper with thin 25° pads | Take the card from the other arm, flip it 180°, hand it back, and fold back to its rest pose | Behaviour cloning (DART + DAgger) |
Videos
Each clip is one deterministic episode of the trained policy in simulation, rendered offscreen with MuJoCo.
Pick arm (suction): four episodes played together in a 2 × 2 grid, all from the same camera. In each, the card starts at a far point of the pick region, and the four points lie in different directions:
| Panel | Card start (x, y) | Distance from arm base |
|---|---|---|
| top left | (−0.246, 0.026) m, left end of the region | 0.46 m |
| top right | (−0.040, −0.056) m, front centre | 0.46 m |
| bottom left | (0.083, −0.057) m, front right | 0.46 m |
| bottom right | (0.163, 0.036) m, right end | 0.39 m |
In all four the arm reaches the card, descends slowly, seals, lifts, and carries the card to the same handover pose. At the end the policy is switched off for 1 s and the card stays on the cup. Real time.
Flip arm (gripper): grasp the card held by the other arm, take it over, flip it 180°, hand it back and fold away. The card ends back-side up. Played at 2× speed.
Full-resolution videos (pick: 1286 × 966, flip: 960 × 720): media/pick_arm.mp4, media/flip_arm.mp4.
The two clips come from separate scenes. The pick-arm clip uses the suction scene; the flip-arm clip uses the gripper + gripper scene the flip policy was trained in. The two policies have not yet been run together in one episode.
Results
All results are from simulation. Each model is reloaded from disk and acts on its own: no scripted takeover and no state injection.
Pick arm (models/pick_arm/)
- Card placed uniformly at random in the region; 100 deterministic episodes; card penetration limit 50 µm.
- 98/100 full-task successes (1 timeout, 1 card dropped), max penetration 44 µm.
- Stochastic policy: 19/20.
- Hold test: once the card reaches the handover pose, the policy is switched off for 5 s. 96/96 cards stayed attached; slip ≤ 0.009 mm / 0.07°.
- Success at the handover pose means: suction-point error ≤ 5 mm, orientation error ≤ 5°, card speed ≤ 2 cm/s, held for 0.5 s.
Flip arm (models/flip_arm/)
- Held-out seeds (9000+, never used for model selection): 41/41 full-task successes, 1 deterministic + 40 stochastic.
- Stochastic action std is 0.003 on the arm and 0.01 on the jaw.
- Episode length is 1713–1767 control steps (≈ 35 s); max card penetration 37 µm.
- Success means:
- the card ends ≤ 5 mm from its start position and ≤ 5° from the flipped orientation;
- the arm returns to its folded pose;
- all of this holds continuously for 1 s.
Simulation setup
- Card: 63 × 88 × 0.30 mm, 1.8 g free rigid body under gravity.
- Timing: physics step 0.5 ms; control period 20 ms (40 substeps).
- Flip arm action: 6 joint-target increments (5 arm + 1 jaw), each scaled by 0.02 rad.
- Pick arm action: 5 joint-rate channels plus 1 binary suction channel.
- Suction: modelled as a weld constraint.
- It engages when vacuum is on, the pad touches the card, tilt is < 10°, and the whole 14 mm pad lies on the card face.
- It releases when vacuum is off, or the load exceeds 4 N / 0.02 Nm.
- Hard safety terminations:
- card penetration > 50 µm;
- joint limit overshoot > 0.01 rad;
- arm–arm or arm–table collision;
- card supported by anything other than the pads or cup;
- card dropped.
Layout
scenes/ MJCF scenes: dual_arm_card_scene.xml (gripper + gripper), suction_arm_card_scene.xml (suction + gripper)
assets/ robot meshes and card textures
*_config.json scene configuration; suction_region.json = reachable card region of the pick arm
data/ reference trajectory used by the flip-arm data collector
scripts/ environments, training and evaluation
models/ trained policies and their evaluation records
Main entry points (in scripts/):
| Script | Purpose |
|---|---|
pick_task_env.py |
Pick-arm task environment. Phases: reach → slow contact + suction → lift → carry |
train_pick_arm.py |
PPO training and the curriculum options for the pick arm |
run_pick_chain.py |
Runs a chain of pick-arm training stages |
eval_pick_arm.py |
Pick-arm evaluation, including the policy-off hold test |
flip_task_env.py |
Flip-arm task environment |
collect_tracker_data.py |
DART / DAgger data collection using a reference-tracking controller |
train_flip_arm_bc.py |
Behaviour-cloning training for the flip arm |
eval_flip_arm.py |
Flip-arm evaluation |
suction_cup.py |
Suction cup seal model |
check_suction_cup.py |
Scripted suction check |
Quick start
pip install -r requirements.txt
# Pick arm: 50 episodes + 5 s policy-off hold test (writes models/pick_arm/seal_hold_final.json)
python scripts/eval_pick_arm.py models/pick_arm --episodes 50
# Pick arm: watch one episode in the MuJoCo viewer
python scripts/eval_pick_arm.py models/pick_arm --view 930001
# Flip arm: 1 deterministic + 10 stochastic episodes
python scripts/eval_flip_arm.py models/flip_arm/policy.zip . flip_eval.json --episodes 10 --seed0 9000
Loading the pick-arm policy
The pick-arm policy expects observations normalized with the saved VecNormalize statistics. Use the observation-only form:
import pickle, numpy as np
from stable_baselines3 import PPO
vn = pickle.load(open("models/pick_arm/final_vecnormalize.pkl", "rb"))
model = PPO.load("models/pick_arm/final_model.zip", device="cpu")
o = np.clip((obs - vn.obs_rms.mean) / np.sqrt(vn.obs_rms.var + vn.epsilon), -vn.clip_obs, vn.clip_obs)
action, _ = model.predict(o.astype(np.float32), deterministic=True)
The flip-arm policy (models/flip_arm/policy.zip) takes raw observations directly.
Training summary
Pick arm (pure PPO, about 17 M environment steps in total across all stages)
- Reach and levelling curriculum:
- fixed target → 5 region centres → whole region;
- tolerance tightened in small steps from 1 cm to 3 mm / 3°;
- undiscounted potential-based shaping;
- approach-corridor cost;
- oversampling of failure regions during training only.
- Descent, seal and lift:
- the descent target is set 3 mm below the card face;
- when warm-starting, new observation inputs get zero-initialised first-layer weights, and the normalisation statistics are kept.
- Carry to the handover pose: reverse curriculum. 40 % of training episodes start already sealed somewhere on the lift → handover path. Evaluation always starts from the normal pose.
Flip arm (imitation learning)
- A reference-tracking controller labels the actions.
- Data comes from DART noise injection (noise set per phase) and two DAgger rounds.
- The network is an MLP, 512 × 3.
- No PPO fine-tuning.
- Pure PPO failed on this task. The contact phases tolerate only about 0.005–0.01 arm action noise, far below a typical PPO exploration std.
Requirements
Tested with Python 3.12, mujoco 3.16.0, stable-baselines3 2.9.2, gymnasium 1.4.0, torch 2.11, numpy 2.5.4 and scipy 1.18.1.
Limitations
- Simulation only. There is no domain randomisation and no sim-to-real validation.
- Each policy is trained and evaluated in its own scene. The full cell has not been run end to end with both learned policies together (suction pick → gripper flip → return).
- The flip arm works only for the single card start pose it was trained on. The pick arm generalises over the whole table region.
Attribution
Code, scenes and policies in this repository are released under the MIT License (see LICENSE). The robot meshes in assets/robot/ are derived from the SO-101 arm, part of TheRobotStudio's SO-ARM100 project, and remain under Apache-2.0. The suction tool, thin gripper pads, scenes, environments and policies are original to this repository.
- Downloads last month
- 43

