Building a Robot Learning Pipeline for the 6-DOF NexArm
A real-to-sim-to-real pipeline for the Hiwonder NexArm: a fixed three-camera rig, leader–follower demonstrations, a MuJoCo twin fitted to the real servos, and imitation-learning policies trained on both.
Robot learning depends on more than a model. A camera that shifts between sessions changes the images a policy sees; an arm that responds differently from its simulation changes the actions it needs. Our team built the parts around the model so that real demonstrations, simulated demonstrations and the policies trained on them describe the same robot.
- Fixed rigGantry holds the arms and three cameras in repeatable poses.
- TeleoperationLeader–follower demos recorded as LeRobot datasets.
- Digital twinMuJoCo arm fitted to real joint traces and camera views.
- Synthetic dataDomain-randomized bowl stacking with cuRobo planning.
- TrainingACT, TurboVLA, B-spline, DEM and RTPolicy.
- EvaluationSeeded sim benchmark, then a fixed hardware protocol.
The hardware
The NexArm is an all-metal six-axis arm driven by bus servos with 4096-count magnetic encoders. An ESP32 and an AT32 split communication and motor control, which is what lets a passive leader arm drive a powered follower with millisecond-level tracking. The repository’s LeRobot robot and teleoperator plugins speak its UART protocol directly: synchronous read and write of all six servos, torque control, and the bridge mode that streams state at the full control rate instead of the 5 Hz telemetry feed.
Arm
- Joints
- 5 + gripper
- Servo torque
- 65 kg·cm
- Payload
- 500 g
- Reach
- 0.5 m
- Controller
- ESP32 + AT32
Sensing
- Front
- Logitech, MJPG
- Wrist
- icSpring, YUYV
- Top
- RealSense D435i
- Capture
- 640×480 @ 30 fps
- Recording
- 20 fps
Software
- Framework
- LeRobot plugins
- Simulation
- MuJoCo, Isaac Lab
- Planning
- cuRobo
- Logging
- Rerun .rrd
- Env
- Gymnasium
Every joint uses the same encoder convention on hardware and in simulation, so a recorded action can be replayed in either without conversion code in between:
rad = (raw - 2048) * 2 * math.pi / 4096 # arm joints; gripper raw 1195 = open, 2833 = closed
A workspace that stays consistent
I designed an aluminium-extrusion gantry in Fusion 360 to hold the arm bases and cameras in fixed positions. The overhead RealSense sees the whole table, the front camera shows the gripper’s approach, and the wrist camera covers the moments when the arm blocks the other two. Fixed viewpoints make demonstrations comparable across sessions, and they give the simulator a camera pose it can match.
The gantry fixes the arm bases and all three camera poses, so the scene stays the same between sessions.
Collecting demonstrations
An operator moves the unpowered leader arm while the powered follower copies it. Each session records the follower’s joint state and actions with three synchronized RGB views, then merges into one local dataset. The merge checks fps, robot type, camera set and image shapes before recording starts, keeps an import ledger so a retried session adds no duplicates, and builds the new dataset beside the old one before swapping it in.
- Idle starts confuse the policy. Each real episode opened with about 1.5 s of no motion, 12% of all frames. The same image then meant both "wait" and "move", and rollouts hesitated. We now trim each episode to start 3 frames before the leader moves more than 10 encoder ticks.
- Control rate must match. The cameras capture at 30 fps but recording, simulation and rollout all run at 20 Hz. A policy trained at one rate and run at another moves at the wrong speed.
- Bridge mode matters. Without it the recorder reads the 5 Hz telemetry stream and silently records a quarter of the motion.
Fitting the simulation to the real arm
We built a MuJoCo scene for a three-bowl stacking task and fitted it to the hardware, in order, because each step depends on the one before it. A wrong joint mapping makes every dynamics fit wrong, and wrong dynamics make camera checks on a moving arm misleading.
- Joint mapping. Measure how each servo's raw reading maps to its simulated joint. Replaying one recorded episode without the correct mapping put the simulated gripper 39 mm inside the panel behind the arm.
- Latency and servo dynamics. From 20 free-motion episodes, fit the action delay (0–6 control steps) and each joint's time constant,
(kv + damping) / kp, within 0.25×–4× of the servo model. The spread of the fit becomes the domain-randomization range. - Cameras. Align each simulated camera's pose and field of view by overlaying real and rendered frames, and fit a colour transform for the RealSense's blue, washed-out image.
- Scene. Match the bowl slots and table to the real workspace, then check the result with replays and overlays before generating any data.
The generator then produces scripted demonstrations with cuRobo motion planning and physical grasping, randomizing lighting, materials, camera pose, servo dynamics, and object friction and mass. Failed or low-quality attempts are rejected and logged with a reason; a clean checkout accepts 90–100% of attempts. The published set, thanhkt/nexarm_stack_bowls_sim_mapped, has 300 episodes and 132,902 frames at 20 fps.
Policies
The project trains several policy families through the same LeRobot plugins, so each can be benchmarked in simulation and run on the arm with the same commands. The robot policy explorer walks through one control cycle of each, next to a 3D model of the NexArm in the bowl-stacking scene.
ACT
CVAE-trained transformer that predicts a long chunk of joint targets.
- Backbone ResNet18
- Encoder tokens 902
- Chunk / executed 100 / 100
TurboVLA
Compact VLA: DINOv3 vision and BERT text fused by bi-attention.
- Backbone DINOv3 ViT-B/16
- Vision tokens 588
- Chunk / executed 16 / 8
B-spline Policy
Diffusion Policy that denoises a cubic B-spline instead of a list of actions.
- Knots per segment 16
- Policy rate 10 Hz
- Controller rate 100 Hz
DEM
DINOv3 ConvNeXt and frozen NeoBERT feed a MeanFlow head that turns noise into actions in one pass.
- Context tokens 801
- Sampling steps 1
- Chunk / executed 16 / 8
RTPolicy
A real-time policy trained on mixed real and synthetic data.
- Real episodes 164
- Sim episodes 300
- Sim success 16 / 20
Policy rollout on the arm
A checkpoint first has to pass the seeded simulation benchmark; a model that fails there will not work on the arm. On hardware, every model runs the same fixed protocol:
- Place the three bowls on the slots the simulation uses, measured from the base's pan axis.
- Run each trial for up to 90 s and record success, meaning all three bowls stacked in order, or the failure: missed grasp, dropped bowl, wrong order, timeout or collision.
- Report successes out of 10 per model. With 10 trials, a gap under about 30 points between two models is within the noise.
What we learned
Stable cameras, clean demonstrations and a calibrated simulation are part of the learning system, not setup work before it. Each problem above, from idle frames to a 39 mm mapping error, would have looked like a model failure.
The next result we need is a controlled hardware comparison of policies trained on real data alone against policies trained on real and simulated data, run under the protocol above.
Thanks to our VinUniversity teammates, professors, and lab collaborators for their work on the hardware, workspace, and data collection. The code, calibration tools and experiment logs are in the NexArm repository.
Enjoy Reading This Article?
Here are some more articles you might like to read next: