Teach an xArm6 to Stack Blocks

You’ll teach a robot arm a skill by showing it instead of programming it. You move an SO-ARM101 leader arm by hand, the xArm6 copies you, and Viam records each demonstration. Then you train a policy on those recordings, and the xArm6 stacks the blocks by itself.

The leader and follower are different arms, and Viam connects them.

Required hardware

  • A uFactory xArm6 with its gripper, the follower arm that does the stacking.
  • An SO-ARM101 leader arm with its gripper, which you move by hand to demonstrate the task.
  • An Intel RealSense wrist camera, mounted on the xArm6. The workshop uses it for color only.
  • A USB webcam, fixed on a stand beside the table, facing the work area.
  • Two blocks in contrasting colors, sized for the xArm gripper.
  • An x86 Linux computer that runs viam-server and inference.

Phases

  1. Platform mental model
  2. Configure the cell
  3. Record demonstrations
  4. Review and build a dataset
  5. Train a policy (milestone one: a trained model)
  6. Deploy the policy (milestone two: an autonomous stack)
  7. Evaluate and iterate (optional)

When you finish, the wrap-up reviews what you built and points to next steps.

Plan your day

PhaseTime estimate
1. Platform mental model20 minutes
2. Configure the cell75 minutes
3. Record demonstrations90 minutes
4. Review and build a dataset30 minutes
5. Train a policy20 minutes plus a 45 to 60 minute training job
6. Deploy the policy60 minutes
7. Evaluate and iterate (optional)90 minutes plus a retrain

The Phase 5 training job runs for 45 to 60 minutes, so submit it before a break.

Companion code

The training script is viam-labs:lerobot-training, already published to the registry, so you don’t write it. The other supporting files live in the viam-devrel/xarm-act-stacking repository, under config/: the cell config and the policy and controller configuration.

Prerequisites

The workshop is self-serve, so confirm each of these before you start:

  • A Viam account with an online machine. Log in at app.viam.com, create a machine, and confirm the green Live indicator before you begin.
  • viam-server v0.127.0 or later. Data sequences, which every phase from Phase 3 on depends on, need v0.127.0.
  • git and curl on the machine. The policy module needs both to install its dependencies in Phase 6.
  • An xArm6 that’s networked and reachable from the machine.
  • An SO-ARM101 leader that’s built and calibrated. Follow the setup steps in the SO-ARM101 module documentation: configure the motors, build the arm, and calibrate it.
  • The Viam CLI, installed and logged in. See the Viam CLI documentation.
  • Python 3 with pip, to run the dataset script in Phase 4.
  • Optional: the pick-and-place workshop, a gentler introduction to the xArm6.

Where to start

  • Hardware ready and machine online (viam-server running): start at Phase 1.
  • Still building your SO-ARM101 leader: complete the SO-ARM101 setup first, then return here for Phase 1.