Run a Policy on a Robot#
Python API#
from physicalai.runtime import PolicyRuntime, SyncExecution
from physicalai.inference import InferenceModel
from physicalai.robot import SO101
from physicalai.capture import UVCCamera
runtime = PolicyRuntime(
fps=30,
robot=SO101(port="/dev/ttyACM0"),
model=InferenceModel("./exports/act_policy"),
cameras={
"wrist": UVCCamera(device="/dev/video0", width=640, height=480),
},
execution=SyncExecution(),
)
with runtime:
runtime.run(duration_s=60)
From Config#
Write a runtime configuration file.
# runtime.yaml
runtime:
class_path: physicalai.runtime.PolicyRuntime
init_args:
fps: 30
robot:
class_path: physicalai.robot.so101.SO101
init_args:
port: /dev/ttyACM0
model:
class_path: physicalai.inference.InferenceModel
init_args:
export_dir: ./exports/act_policy
cameras:
wrist:
class_path: physicalai.capture.UVCCamera
init_args:
device: /dev/video0
width: 640
height: 480
execution:
class_path: physicalai.runtime.SyncExecution
init_args:
mode: chunk
Run it from the CLI.
physicalai run --config runtime.yaml --run.duration_s=60
Component Responsibilities#
Object |
Owns |
|---|---|
|
policy inference |
|
robot loop and timing |
|
where inference runs |
|
hardware IO |
|
image capture |