Clone-able helpers, reference code, config, and a printable template for the Miniature Palletizing with the SO-ARM101 workshop: teach an affordable desktop arm where the cubes and pallet are by hand, then write the Python that packs a two-by-two-by-two stack of cubes on its own.
This repo holds the supplemental assets the workshop links to. Follow the step-by-step tutorial in the Viam docs:
Tutorial: Miniature Palletizing with the SO-ARM101 (link goes live when the workshop ships)
You don't need to read this repo cover to cover. The tutorial tells you which file to grab at each phase.
mini-palletizer/
├── helpers.py # provided plumbing you import from palletizer.py
├── reference/
│ └── palletizer.py # the finished script the tutorial builds (check your work)
├── config/
│ └── machine-fragment.json # arm + gripper + frames, for checking your config by hand
├── template/
│ ├── cube-and-pallet-template.pdf # print at 100%: fold-up cubes + pallet mat
│ └── generate_template.py # regenerates the PDF (uv run --with reportlab ...)
├── pyproject.toml # uv project, declares viam-sdk
└── .python-version # pins Python 3.11
You write palletizer.py yourself in the repo root as you work through the
phases; helpers.py is provided so you import the connection and grid math
instead of rewriting them.
| Item | Role |
|---|---|
| SO-ARM101 arm + finger gripper | picks and stacks the cubes; connects over USB serial |
| Eight ~20 mm cubes | what gets packed (fold the template, or use wooden/foam cubes) |
| Pallet mat + staging spot | where cubes get stacked and fed from (print the template) |
| Personal computer | runs viam-server and your Python |
-
Clone and enter the project:
git clone https://github.com/viam-devrel/mini-palletizer.git cd mini-palletizer -
Print the template at
template/cube-and-pallet-template.pdfat 100% scale (turn off "fit to page"), then fold eight cubes and cut out the pallet mat. Wooden or foam 20 mm cubes work too. -
Add your machine credentials and taught poses to
helpers.py: paste the machine address and API key/ID from your machine's CONNECT tab, and the two anchor poses you read off the arm's test card in Phase 3. -
Run a step (uv installs
viam-sdkon first run):uv run palletizer.py move # send the gripper to a safe pose uv run palletizer.py pick # pick one hand-fed cube uv run palletizer.py pack # the static bottom-layer pack (default)
To check your work against the finished version, run
uv run reference/palletizer.py <step>.
config/machine-fragment.jsonmirrors the end state of Phase 2 (arm at the world origin, gripper parented to the arm). ReplaceREPLACE_WITH_ARM_PORTwith your serial port. Use it to check your config; the tutorial has you configure resources by hand with the discovery service.- The template dimensions (
CUBE = 20 mm,PITCH = 30 mm) match the constants in the code. If you change one, change the other, and regenerate the PDF withuv run --with reportlab python template/generate_template.py. - Never commit real credentials.
helpers.pyships with placeholders; keep it that way in any fork.