botblocks
projectsgalleryworkspacedocsprofile
introdemospythondashboardcli

demos

these examples live in web/demos/. run them from the repository root after the cli setup. the homepage also offers demo workspaces. click outside the editor before using keyboard controls.

pickup

botblocks run web/demos/pickup.py

an so101 arm repeatedly moves a cube between two positions. it uses arm.lineto(..., aim=[0, 0, -1]), closes the jaw, and waits for the grasp to settle before lifting. use camera snapshots and arm.describe() to check where the gripper actually stopped; contact can leave a move short of its target.

for an agent-driven stacking scene, run this script and ask the workspace agent to place the pink cube on the blue cube:

from botblocks import Box, MujocoEnv, Plane, Robot

robot = Robot('public/so101')
cube = Box(pos=[0.28, -0.12, 0], size=0.03, color='#f8a')
goal = Box(pos=[0.22, 0.18, 0], size=0.03, color='#8cf')
MujocoEnv([Plane(), robot, cube, goal]).start()

teleop

botblocks run web/demos/teleop.py

two so101 arms share a KeyboardCounter in a physics-free ViewerEnv. q/a, w/s, e/d, r/f, and t/g control the five arm joints; y/h controls both jaws. the first key in each pair increases its angle, the second decreases it.

drive

botblocks run web/demos/drive.py

a duckiebot uses DiffDrive in mujoco. w/s moves forward/back and a/d turns. releasing the keys sets both commands to zero.

train

botblocks run web/demos/train.py
botblocks deploy web/demos/train.py --size medium

ppo learns to swing up a furuta pendulum. the reward is -cos(encoder_angle); subsys=[furuta] selects its encoder and servo observations and servo action. the demo trains 32 robots with the default eight shards and 50 million steps, saving scratch/policy.zip and scratch/policy.pkl on the host.

for a shorter run, copy the script and set steps=100_000, save='/tmp/furuta' in gym.train(...). see reinforcement learning for reward terms, episode timing, and replaying a saved policy.

walk

botblocks run web/demos/walk.py

pollen's microduck runs its pretrained onnx policy from public/microduck.onnx. w/s moves forward/back, a/d turns, q/e sidesteps, and r resets. releasing the keys requests a stop.

the script reads joint order and action scale from the model metadata. at 50 hz it feeds gyro, projected gravity, 14 joint positions and velocities, previous actions, and velocity/head/body commands into the policy. four 0.005-second physics steps follow each inference. reset clears the previous actions.

pollen's training setup uses ppo with mujoco warp and a bam xl330 motor model; this demo uses imported position actuators. low-speed tracking differs: 0.2 m/s can stall, so the keyboard requests 0.4 m/s. steer while walking with w+a or w+d. this runs a pretrained simulation policy; it does not retrain it or validate hardware control.

navigate

this experimental duckiebot task trains a camera-only ppo policy to visit red, yellow, then blue waypoints around an obstacle. each marker appears after the previous one is reached. the course mirrors left/right and the initial heading varies.

the policy receives four 64×64 rgb frames and chooses wheel-torque commands. positions are used for rewards and termination, never as policy inputs. the script raises wheel torque from 0.03 to 0.12 nm so the robot can turn against the imported model's rear chassis contact. collision termination uses a 0.25 m half-width around the obstacle center.

train locally with chrome or chromium installed:

ROVER_MODE=train BOTBLOCKS_RENDER=1 botblocks run web/demos/navigate.py

ROVER_STEPS defaults to 50000: one third for single-waypoint warmup, then the full course. training saves /tmp/botblocks-rover-policy.zip, evaluates ten held-out seeds, and starts replay. metrics stream to the workspace.

replay or evaluate your saved checkpoint explicitly:

ROVER_POLICY=/tmp/botblocks-rover-policy BOTBLOCKS_RENDER=1 botblocks run web/demos/navigate.py
ROVER_MODE=eval ROVER_POLICY=/tmp/botblocks-rover-policy BOTBLOCKS_RENDER=1 botblocks run web/demos/navigate.py

ROVER_MODE=eval exits after evaluation. without ROVER_POLICY, replay tries /demos/navigate.zip; that checkpoint is not included in the checkout, so train first and pass the saved path. the integration test checks pixels, motion, rewards, termination, and ppo save/reload; it does not establish that a trained policy completes the course.