The lab's xArm 6 setup as a digital twin, end to end: the tools that record the real arm, the twin built from those recordings and checked against them in Isaac Sim, and grasping policies trained in the twin with Isaac Lab and run back on the real arm.
| Part | What | Guide |
|---|---|---|
src/xarm_twin/ |
Real-arm tools. Identification runs, calibration, gripper measurements, tag detection, and a policy in the loop, all behind a safety preflight and a watchdog | docs/real.md |
src/mani_share/twin/ |
The twin. twin.json, the controller and gripper models fitted to logs, the kinematic corrections, replay and camera checks in Isaac Sim, and training, distillation and evaluation in Isaac Lab |
docs/twin.md |
src/mani_share/robot_arms/, configs/arms/ |
The arm assets. UFactory's xArm 6 description, with the xArm Gripper and the lab's soft fingers, expanded, converted to USD and checked | docs/arms/README.md |
data/twin/lab_xarm6/ |
The lab's twin: twin.json, the servo playback fit, the logged arm motion and the gripper sessions the checks replay |
below |
The lab setup is a UFactory xArm 6 (model 1303, firmware 2.4.0) with its xArm Gripper and soft fingers, a RealSense D435 on the wrist and one fixed in front of the arm, a table and two cubes (65 and 50 mm) with AprilTags on every face.
git clone https://github.com/CogRob/mani-share.git && cd mani-share
env/geometry/setup.sh # Python 3.12: fits, scores, URDF preparation, tests
ISAAC_PYTHON=/isaac-sim/python.sh env/isaac/setup.sh # Isaac Sim 6.1: the replay, camera and scene checks
ISAAC_PYTHON=/isaac-sim/python.sh env/isaaclab/setup.sh # Isaac Lab v3.0.0-EA on Isaac Sim 6.1: training
env/real/setup.sh # Python 3.10, on the computer cabled to the armEach setup prints the exports to apply. The data root is data/ in this repository, or $MANI_SHARE_DATA. Commands name its files as twin:<path> and arms:<path>. Isaac Lab needs one NVIDIA GPU; training runs on two CPU cores, anything that renders camera images needs four.
Isaac Lab loads the arm with the driven gripper, arms:xarm6_xarm_gripper_driven, built from UFactory's pinned description:
python scripts/fetch_models.py arm xarm6_xarm_gripper # pinned files, checked by SHA256
python -m mani_share.robot_arms.prepare_source --arm xarm6_xarm_gripper_driven # geometry env
$ISAAC_PYTHON -m mani_share.robot_hands.isaac.prepare_asset --arm xarm6_xarm_gripper_driven
pytest tests/arms/test_xarm6_xarm_gripper_driven.py # geometry envThe asset's own checks are in the arm procedure.
python -m mani_share.twin.scene prepare --twin twin:lab_xarm6/twin.json # geometry envThis writes scene/tags/ (the tag images on the cubes' faces) and scene/check.json (the scripted picks' poses) next to twin.json. Training refuses to start without the textures.
python -m mani_share.twin.spec check twin:lab_xarm6/twin.json # geometry env
G=twin:lab_xarm6/gripper_20261106/sessions
$ISAAC_PYTHON -m mani_share.twin.rl.gates --output runs/gates --num-envs 64 \
--gripper-logs $G/20261106_115521_gripper_dyn \
--cube cube_65=$G/20261106_115841_gripper_cube65 --cube cube_50=$G/20261106_115920_gripper_cube50gates.py runs the twin's checks on 64 copies of the scene:
- the settings read back from the stage;
- the flange against the corrected kinematics;
- the gripper closing free and against a box;
- a scripted pick of each cube;
- the arm and gripper replays against the logs;
- throughput.
Read summary.json, which gives "passed" overall and per gate; gates.json has the full results. Each gate and lab_xarm6's values are in docs/twin.md. Add --cameras (four CPU cores) to also check the tags as the cameras render them.
The pose policy sees the cube's pose as its tags would give it. Train in two stages.
First, with the gripper's default 6 cm gate, until the training success peaks (about 500 iterations, 1-1.5 h on one GPU):
$ISAAC_PYTHON -m mani_share.twin.rl.train --output runs/pose_a --num-envs 4096 --chunk 10 --iterations 800 \
--start-above 0.5 --grasp-raise 0.01 --w-table 1.0 --w-push 500Then, with the options for the real arm, starting from the first stage's best checkpoint:
- the gripper closes only over the observed cube, with the finger tips at its top;
- a closing gripper stays closed;
- a penalty for descending off-centre;
- the softer fingers' contact;
- the real cameras' tag scatter and constant offsets.
$ISAAC_PYTHON -m mani_share.twin.rl.train --output runs/pose_b --num-envs 4096 --chunk 10 \
--start-above 0.5 --grasp-raise 0.01 --w-table 1.0 --w-push 500 --init-from runs/pose_a/checkpoints/model_K.pt \
--set grip_enable_xy_m=0.015 grip_enable_tip_m=0.005 grip_latch_units=425 w_align=1.0 'align_xy_m=[0.002,0.005]' \
finger_stiffness=600 'held_drive_max_rad=[0.16,0.34]' 'tag_plane_mm=[0.1,0.5]' \
tag_head_bias_mm=5 tag_head_bias_yaw_deg=0.5 tag_wrist_bias_mm=1 tag_wrist_bias_yaw_deg=0.2This stage runs up to 3000 iterations, about 10 h. Started from scratch, the narrow gate leaves the gripper open and the policy never learns to close, which is why it starts from the first stage.
A run writes:
checkpoints/model_<iteration>.ptevery 10 iterations;metrics.csv, one row per chunk, with the training success and the action std;config.json, every setting,--setincluded;summary.json.
It resumes from its newest checkpoint when restarted with the same --output, and stops by itself after --iterations or --hours (11 by default).
Pick the checkpoint from metrics.csv. Runs peak and then drift as the action std grows. Take the peak, and confirm it on held-out seeds.
$ISAAC_PYTHON -m mani_share.twin.rl.evaluate --checkpoint runs/pose_b/checkpoints/model_K.pt --output runs/eval_pose_b \
--conditions nominal randomised measured-tags bias1000 held-out episodes per cube and condition (seed 1000), deterministic, every episode from HOME, with the settings from the run's config.json.
| Condition | What it varies |
|---|---|
nominal |
nothing |
randomised |
what is assumed: cube mass, the gripper's force, the table height, the controller's and the gripper's timing, the command latency, the tag noise |
no-tag-noise, no-timing |
the same with that factor removed |
weak-grip |
the same with half the grip force |
measured-tags |
randomised, with the real cameras' tag scatter |
bias |
that, plus a constant offset per episode on each camera's pose: up to 5 mm and 0.5° on the head camera, 1 mm and 0.2° on the wrist camera |
bias-all |
the same with 5 mm and 0.5° on both cameras |
evaluation.json gives, per cube and condition:
- the success rate with its Wilson 95 % interval;
- how the episodes ended (
ended_by), for example a safety limit the real runner enforces, or a finger tip at the table; - slip while lifted;
- the approach: the TCP's offset from the cube's centre where the tips reach its top, and the tips' height and offset when closing starts.
--trace 64 also writes every step of 64 arms of the first condition to trace.csv.
The image policy sees the wrist and head camera images at 160×120 instead of the tag pose. It learns from the pose policy (DAgger) on its own rollouts, with randomised looks:
$ISAAC_PYTHON -m mani_share.twin.rl.distil --teacher runs/pose_b/checkpoints/model_K.pt --output runs/student_b \
--num-envs 128 --rounds 24 --steps 120 --epochs 8 --dataset 80000
$ISAAC_PYTHON -m mani_share.twin.rl.evaluate --checkpoint runs/pose_b/checkpoints/model_K.pt \
--student runs/student_b/student_23.pt --output runs/eval_student_b --num-envs 256Both render, so give them four CPU cores. Distillation takes 1-2 h on one GPU and writes student_<round>.pt after each round.
docs/real.md runs a trained policy on the real arm, one episode at a time, behind the safety gates, with an operator at the emergency stop. The constants file it needs from the twin (twin_constants.json) is not yet written by a command here.
- Modelled from measurements:
- the arm's kinematics (calibrated);
- the servo mode's timing (each target reached 50 ms after it arrives, then each joint's delay and lag);
- the gripper's delay, rates and where it stops on each cube;
- the cameras' poses and lenses;
- the table's plane;
- the real runner's limits on commands (speed, acceleration, TCP step, the tool box and the grasp zone).
- Assumed, and randomised in training: the cubes' mass and friction, grip force, slip, the cubes' edges.
- Not modelled:
- the real arm's velocity ripple of about 6-10 %;
- the Cartesian mode (mode 7);
- irregular command timing beyond the 50 ms window;
- the lab's lighting and materials in the images;
- wrist-camera tag errors and dropouts during an approach as large as the real ones.
No policy trained here is ready for unsupervised use on the real arm.
Path in data/twin/lab_xarm6/ |
What | Read by |
|---|---|---|
twin.json |
the arm's calibrated kinematics, TCP and payload, the controller and gripper models, the cameras, the table and the cubes | every step |
density_20261105/fit_servo3/twin_playback.json |
the servo mode's fitted playback; only its controller.servo.playback is read |
training, evaluation and the gates (--playback, the default) |
logs/20261029_215314_first/, logs/20261029_215643_rest/ |
logged arm motion: steps, streamed targets, servo sweeps, held-out trajectories | the arm replay gate |
gripper_20261106/sessions/20261106_115521_gripper_dyn/ |
gripper steps, streams and retargets at three speeds | the gripper replay gate |
gripper_20261106/sessions/..._gripper_cube65/, ..._gripper_cube50/ |
the gripper closing on each cube, held by hand | the gripper stall gate |
All of it was recorded on the lab arm with xarm_twin:
- the arm's motion on 2026-10-29;
- the kinematic and camera calibration on 2026-11-01 and 2026-11-02;
- the servo playback from a 2026-11-05 session polled at 1000 Hz;
- the gripper on 2026-11-06;
- the head camera recalibrated on 2026-11-10.
twin.json's provenance holds the SHA256 of each input. Storage paths in the provenance fields read $MANI_SHARE_DATA/..., and the arm's serial number is redacted.
| Path | Contents |
|---|---|
src/mani_share/ |
twin (the twin), robot_arms (arm import), and the shared pieces they use: common (paths, I/O), robot_hands (URDF preparation, USD conversion, audit), scene (geometry and USD helpers) |
src/xarm_twin/ |
the real-arm tools |
configs/ |
arms/ (one file per arm, its xacro wrapper, the soft finger meshes), scene/physics.json |
env/ |
how to create each environment: geometry, isaac, isaaclab, real |
scripts/fetch_models.py |
the arms' pinned upstream files (sources.lock.json) |
tests/ |
common, robot_arms, arms, twin, xarm_twin |
docs/ |
the guides |
data/ |
the data root: the lab twin; prepared assets and the scene check written beside it are not committed |
The code of src/mani_share/ comes from the any2any_dex repository, where the twin was first built. Third-party components and their licenses are listed in THIRD_PARTY.md. This repository has no license yet.