docs/articles_en/physical-ai/how-to/runtime/run-policy-on-robot.md
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)
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
| Object | Owns |
|---|---|
InferenceModel | policy inference |
PolicyRuntime | robot loop and timing |
Execution | where inference runs |
Robot | hardware IO |
Camera | image capture |