Skip to content

Policies

A policy turns an observation into an action. Policy() takes a function, an ONNX skill, a LeRobot checkpoint, a policy server or a recorded episode.

A policy decides what the robot does next. Each step, it gets an observation and returns joint targets.

v03_one_loopv03_one_loop

from strands_robots import Policy, Robot

arm = Robot("so101")
wave = Policy(lambda obs: {"shoulder_pan": 0.4})
arm.run(wave, seconds=2)

Policy() picks the right kind from what you pass:

You pass You get
lambda obs: {...} Your function, called every step
"microduck?skill=velstand&vx=0.3", "holosoma" An ONNX skill
"lerobot/smolvla_base" A LeRobot checkpoint in this process
"zenoh://gpu-box:7447/smolvla" A LeRobot policy on another machine
"data/wave?episode=0" A recorded episode, replayed

A function can return None to keep the last target for that step.

ONNX skills

The microduck has ten skills from Pollen Robotics. Pick one with a query string:

walk
skill=velstand&vx=0.3 walk
turn
skill=velstand&wz=1.2 turn
roll
skill=roulade roll
pick
skill=alpha_ground_pick reach down

The others are alpha_walking, alpha_stand, alpha_sitstand, ball_kick_left, ball_kick_right, roller and roller_crouch. Policy("holosoma") makes a Unitree G1 stand and walk.

Let an agent pick skills

from strands import Agent

duck = Robot("microduck")
Agent(tools=[duck.tool])("walk forward a bit, turn left, do a roll, then stand still")

The agent chooses a skill and its parameters. It never sets joint positions. See Agent tools.

LeRobot

See Running a LeRobot policy.

Teleoperate with a leader arm

d18_leader_sourced18_leader_source

Pass a LeRobot Teleoperator, or another Robot, to run(). The follower copies it:

arm.run(leader, hz=30, seconds=60)

The library converts each reading through both arms' calibration.

Edit page