Back to Openvino

runtime.yaml

docs/articles_en/physical-ai/how-to/runtime/run-policy-on-robot.md

2026.3.01.6 KB
Original Source

Run a Policy on a Robot

Python API

python
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.

yaml
# 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.

bash
physicalai run --config runtime.yaml --run.duration_s=60

Component Responsibilities

ObjectOwns
InferenceModelpolicy inference
PolicyRuntimerobot loop and timing
Executionwhere inference runs
Robothardware IO
Cameraimage capture