Skip to main content

Run a VLA policy

A vision-language-action (VLA) policy looks at camera images and a task instruction and returns where the robot's tool should go next. PLEM runs such a policy for you: its policy executor sends camera frames and the robot state to the model's own inference server, turns the actions it returns into a timed path, and moves the arm through jog. You write one config file and call one action.

What you provide:

  • The policy server. Start the model's official inference server (GR00T or openpi) and optimize it yourself (TensorRT or other). PLEM does not ship or run models.
  • The cameras. Any node that publishes sensor_msgs/Image, on the same device by default. The executor subscribes to a camera topic when a run first uses it and keeps that subscription while the executor runs: a driver that processes a stream only while someone subscribes keeps processing it between runs.
  • The config file (schema: policy/v1): the server address, the model's names for its inputs and outputs, and the camera topics. The robot is not in the file: the action you call names it.

The executor​

The executor is on by default. Every robot of a launch serves /<robot>/plem/run_policy, whether the stack comes up from the plem start screen or with ros2 launch, and its jog engine follows the path the executor sends. The executor moves nothing until a goal comes, and subscribes to no camera and no /tf until then. Your policy server, and often your camera stack, run beside it as your own processes.

Beta

The policy path has not been verified on a robot yet. Before the first run, check one reply of your server and lower the policy caps (Reference setup).

To leave the executor out, add policy_executor:=false to the launch. The executor reads the robot description when the stack starts: one URDF root, one arm chain in the SRDF, and the link jog's tcp_frame names. A robot that lacks one of them stops the whole launch with that message; launch it with policy_executor:=false. The other arguments are those of Launching directly. For one Neuromeka arm without the executor:

ros2 launch neuromeka_robot_driver robot.launch.py robots:=robot1 serials:=<serial> masters:=0 policy_executor:=false

A login shell sources only /opt/plem/setup.bash, which does not include the packages under /opt/plem/vendors: plem_bringup, the robot drivers and plem.policy. In the shell where you launch the stack or run Python against it, source them too:

for f in /opt/plem/vendors/*/*/setup.bash; do source "$f"; done

plem policy needs none of this: its command sources them itself.

Install the client for your server​

Serverserver: schemeClient library
GR00T PolicyServer (ZMQ)gr00t+zmq://<host>:<port>python3-zmq, python3-msgpack, python3-msgpack-numpy (below)
openpi websocket serveropenpi+ws://<host>:<port>openpi-client, installed with pip (below)

GR00T client libraries​

On the device that runs the robot stack, check that the three libraries import, and install them from apt when they do not. Without them the GR00T client does not load: a goal ends preflight_error, and its detail gives this command. plem policy check does not load the client, so it passes either way. The apt names are the same on JP6 and JP7:

python3 -c "import zmq, msgpack, msgpack_numpy"
sudo apt install python3-zmq python3-msgpack python3-msgpack-numpy

openpi client​

Install it with pip as the user that runs the robot stack, then check that it imports:

pip install --user openpi-client
python3 -c "import openpi_client"

Without it an openpi goal ends preflight_error, and its detail gives the install command.

This was checked on JP6 (Ubuntu 22.04) only. On JP7 (Ubuntu 24.04) the system Python refuses pip install outside a virtual environment (PEP 668), and no command for it has been checked yet.

openpi-client pins numpy below 2

openpi-client requires numpy<2 and websockets>=11. pip can put a newer numpy 1.x and websockets into your user site-packages, and every Python program of that user then imports those instead of the system ones. Install it only on a device that runs openpi, and check that your other Python code still works. Only the client of the config's scheme is loaded, so a GR00T config runs without openpi-client.

The config file​

A config for a GR00T model with a front and a wrist camera:

gr00t.yaml
schema: policy/v1
server: gr00t+zmq://127.0.0.1:5555
fps: 30
chunk: {action_horizon: 16, execution_horizon: 8, request_ahead: 2}
action:
arm: {key: eef_9d, rep: eef_pose, rotation: rot6d}
gripper: {key: gripper, range: [0, 1], force_n: 40}
state:
arm: {key: eef_9d}
gripper: {key: gripper, range: [0, 1], open_width_m: 0.152}
cameras:
front: {key: front, topic: /front/front/color/image_raw}
wrist: {key: wrist, topic: /wrist/wrist/color/image_raw}
language: {key: annotation.human.task_description}
image: {size: 256, letterbox: true}

An openpi model takes one flat input and returns one actions array, so each part names its columns with slice:

openpi.yaml
schema: policy/v1
server: openpi+ws://127.0.0.1:8000
fps: 30
chunk: {action_horizon: 16, execution_horizon: 8}
action:
arm: {key: actions, slice: [0, 9], rep: eef_pose, rotation: rot6d}
gripper: {key: actions, slice: [9, 10], range: [0, 1], force_n: 40}
state:
arm: {key: observation/state, slice: [0, 9]}
gripper: {key: observation/state, slice: [9, 10], range: [0, 1], open_width_m: 0.152}
cameras:
front: {key: observation/image, topic: /front/front/color/image_raw}
wrist: {key: observation/wrist_image, topic: /wrist/wrist/color/image_raw}
language: {key: prompt}
image: {size: 224, letterbox: true}
KeyMeaning
serverThe scheme picks the client (table above); host and port are the server's
fpsPolicy steps per second, as the model was trained. A step may not be longer than the 0.2 s jog follows a path without a new one, so below 5 plem policy check refuses the file and a goal with it ends config_invalid
chunk.action_horizon · chunk.execution_horizonSteps the server predicts per request, and how many of them run before the next chunk takes over. The execution horizon is below the action horizon: the rows after it cover the inference delay
chunk.request_aheadAsk for the next chunk when this many steps are left. Default 2
action.arm.repWhat the arm action means: eef_pose, a TCP pose, eef_delta, a TCP move per policy step, or joint_position, the arm's joint positions (below). The server's own declaration does not decide it (which rep)
state.arm.rep · jointsWhat the arm state is: eef_pose (the default), the measured TCP pose, or joint_position, the measured joints. joints is the arm's joint count, for joint_position only (below)
action.gripper.range · state.gripper.range[open, closed]: the model's gripper values for open and for closed, in either order ([1, 0] for a model that calls closed 0). The gripper closes once 3 action values in a row within a chunk are past the midpoint toward closed, and opens the same way. The run's first decision always goes to the gripper, because the width cannot tell whether it is holding something wide. The state gives the measured width on its own range: the open width is open, width 0 is closed. No default
action.gripper.force_n · state.gripper.open_width_mThe closing force and open width the model was trained with. No default
cameras.<role>The model's image key and the sensor_msgs/Image topic
language.keyWhere the instruction goes. Leave it out for a model without one
imageOptional. The executor resizes every frame to this square size in pixels (cv2 INTER_AREA); letterbox: true keeps the aspect ratio and pads black. Without it each frame goes to the server as it came: resize the way the model was trained, in the server or by publishing the camera at that resolution, which also spares moving large frames (images)
limits.min_speed_scaleRefuse the run while jog's speed scale is below this. No default (no floor)
limits.max_latency_stepsBrake when the latency is above this many steps for 3 chunks in a row. Default (action_horizon − execution_horizon + request_ahead) / 2, the most latency with no empty step

key is the model's own name for a value, and slice: [start, end] picks its columns when parts share one key. Any other key is refused, so a typo never falls back to a default.

The gripper's force and width are training conditions: a state halfway along range means half of the width the model saw open, and a different width or force replays a different grasp. The gripper on the robot is checked only to see that it can reproduce them (gripper_out_of_range).

Check a file before the robot moves. The check needs no server and no robot, and names every problem with its key and the fix:

plem policy check gr00t.yaml
plem policy check --json gr00t.yaml # one JSON document for scripts ("format": "plem-policy-check/1")

Example files are installed in the examples folder of the plem_policy_nodes share directory (ros2 pkg prefix --share plem_policy_nodes).

Joint positions​

A model trained on the arm's joint positions instead of a TCP pose sets rep: joint_position and gives the arm's joint count in joints. It has no rotation. The state's arm takes a rep too: eef_pose, the default, or joint_position. The action and the state choose theirs independently.

gr00t_joint.yaml
schema: policy/v1
server: gr00t+zmq://127.0.0.1:5555
fps: 30
chunk: {action_horizon: 16, execution_horizon: 8, request_ahead: 2}
action:
arm: {key: single_arm, rep: joint_position, joints: 6}
gripper: {key: gripper, range: [0, 1], force_n: 40}
state:
arm: {key: single_arm, rep: joint_position, joints: 6}
gripper: {key: gripper, range: [0, 1], open_width_m: 0.152}
cameras:
front: {key: front, topic: /front/front/color/image_raw}
wrist: {key: wrist, topic: /wrist/wrist/color/image_raw}
language: {key: annotation.human.task_description}
image: {size: 256, letterbox: true}
  • Order and unit. Positions are in radians, one column per joint, in the arm's order: its movable joints from the base to the TCP. The executor's arm_joints parameter lists them, and the launch sets it from the robot description. To see them: ros2 param get /robot1/run_policy_executor arm_joints.
  • Joint count. joints must be the robot arm's joint count, or the goal ends arm_mismatch. A joint action and a joint state give the same count. plem policy check has no robot, so it checks only that the two agree.
  • Motion. The measured joints come from the robot's joint_states. Each row is an absolute joint target; there is no joint counterpart of eef_delta. The targets go to jog on jog/joint_plan, and jog moves the arm within its joint limits, its speed scale and the policy caps on the TCP (Policy contract).

Images​

PLEM does not decide how a model sees its cameras: the resize, crop and filter belong with the training.

  • Without image each frame goes to the server as an RGB uint8 array as it came. GR00T's policy server resizes in its own processor. openpi's official clients resize on the client before they send (openpi_client.image_tools.resize_with_pad, 224 in openpi's examples), and its server resizes only a frame of another size.
  • With image the executor resizes every frame with cv2 INTER_AREA (and pads black with letterbox: true). It is close to openpi's client resize, not the same (that one uses PIL bilinear). Use it when the model was trained on frames resized this way.
  • Large frames cost CPU. The executor takes every frame of every camera in Python. Have the camera driver publish at the resolution the model was trained with and name that topic in cameras. The executor does not process frames on the GPU.

Run it​

From the command line, no code:

plem policy run /abs/path/gr00t.yaml "stack the red box on the green box" --seconds 30 --robot robot1

It prints progress, then the outcome, reason and detail. Ctrl+C cancels the run and the command waits for the result; how the robot stopped is in the outcome (Results). Exit codes: 0 FINISHED, 130 when Ctrl+C stopped a run that ended CANCELED or FINISHED, 2 a usage error, 1 any other end, a run that braked after Ctrl+C included.

From Python, in a shell with the robot packages sourced (above):

from plem.policy import Policy, PolicyError

policy = Policy("/abs/path/gr00t.yaml", robot="robot1")
result = policy.run("stack the red box on the green box", seconds=30)
print(result.outcome.name, result.reason)

From C++, a behavior tree or another language, send a plem_msgs/action/RunPolicy goal to /<robot>/plem/run_policy: config (the absolute path on the device that runs the executor), instruction and duration_s.

Python API​

Policy(config, robot=) holds its own ROS context and spin thread, so your code needs no rclpy. run() blocks until the run ends.

policy.run(instruction, seconds=seconds, until=None, on_progress=None)
  • seconds is motion time and must be given by keyword; it has no default. It is counted in the policy steps run and rounded up to a whole step. Time spent waiting for inference or the gripper does not count, so the wall-clock time is longer. It is not a measurement of how long the TCP moved.
  • FINISHED means the time was used up, not that the task succeeded. A policy cannot tell that the task is done. Judge it yourself.
  • until is a function of no arguments. run() calls it about 20 times a second, on the thread that called run(); once it returns True, run() asks for the stop (cancels the goal) and waits for the result. Keep it quick: a slow until or on_progress spaces the calls out and so delays the stop. Run a slow check (a vision model, say) on its own thread and let until read the flag it sets.
  • on_progress gets a Progress (elapsed, seconds, latency, inference time) for each feedback. It runs on the same thread as until.
  • Results. run() returns a Result for FINISHED and CANCELED and raises PolicyError (outcome, reason, detail) for every other end. A sequence that does not check the outcome therefore does not continue after a failed run. After a stop request, no result within 30 s also raises PolicyError: the robot may not have stopped.
  • Stopping. An exception from until or on_progress, policy.cancel() from another thread, or Ctrl+C on the main thread all ask for the stop (cancel the goal) and wait for the result. If that result is CANCELED or FINISHED, run() returns it, or after Ctrl+C raises KeyboardInterrupt. If it is BRAKED or any other end, or no result comes within 30 s, run() raises PolicyError, after Ctrl+C too. A stop that comes as the run ends on its own can still return FINISHED, so branch on the result, not on why you stopped. A stop asked before the goal was sent returns CANCELED with reason not_sent, made by the client and not by the executor.
  • One run at a time. run() during a run raises RuntimeError.
import threading
from plem.policy import Policy, PolicyError

done = threading.Event() # set by your own checker thread (a vision model, a sensor)

with Policy("/abs/path/gr00t.yaml", robot="robot1") as policy:
try:
result = policy.run("stack the red box on the green box", seconds=30,
until=done.is_set, on_progress=print)
except PolicyError as e:
print("run failed:", e.outcome, e.reason, e.detail)
What does not stop the robot
  • Canceling an asyncio task. await asyncio.to_thread(policy.run, ...) works, but canceling the awaiting task leaves the thread and the goal running. Call policy.cancel() to stop them.
  • Killing the process outright (kill -9). Nothing is canceled: the run goes on until its time is used up or the executor stops it.

Policy contract​

The model's action is where the robot's TCP goes, how far it moves, or the arm's joint positions. A command meant for one specific controller is not accepted. The executor applies no model-specific correction, but it does not pass the rows through unchanged either: it skips the rows a chunk's latency has already passed, blends up to the first 8 rows of a new chunk into the rest of the previous one, and starts an eef_delta move from the last target, pulled back toward the measured TCP when that target runs too far ahead: more than the usual tracking lag (about 50 ms of motion) plus 5 mm or 0.05 rad. Within that lag the moves add up as labelled; where the arm falls further behind (a low policy cap, contact) it moves less than the labels add up to. A joint target is absolute, so it is not pulled back.

  • Frame. Poses are in the robot base frame, in metres.

  • rot6d. The first two rows of the rotation matrix, row by row: [r11, r12, r13, r21, r22, r23].

  • State. arm is 9 columns [x, y, z, rot6d], the measured TCP pose, or with rep: joint_position the measured joints, one column per joint; gripper is 1 column, the measured width on state.gripper.range from open to closed.

  • Arm action, eef_pose: [x, y, z, rot6d], the TCP target pose.

  • Arm action, eef_delta: [dx, dy, dz, rot6d(dR)], the move over one policy step: target position = position + [dx, dy, dz], target rotation = dR · R, both in base axes.

  • Arm action, joint_position: the joint target positions in radians, in the arm's joint order (Joint positions).

  • Speed. The targets go through jog, so jog's speed limits and speed scale apply, for joint targets as well. A run never changes the speed scale. To run policies slower than manual jog, lower the jog engine's policy caps. They act on policy runs only; manual jog keeps its caps. Each is above 0 and at most the manual cap (0.25 m/s, 1.0 rad/s), and a higher value is refused. They hold until the stack restarts:

    ros2 param set /robot1/jog_engine plan_max_tcp_linear_speed 0.1 # m/s, TCP origin
    ros2 param set /robot1/jog_engine plan_max_tcp_angular_speed 0.5 # rad/s

Which rep the reply is​

rep is what the reply your server actually sends means, not how the data was labelled. Training transforms sit in between: a model trained on relative actions may still reply with absolute ones, because its server turns them back. Whether it does depends on your training configuration, not on the PLEM adapter.

Your server replies withrep
The TCP pose to reach, in the base frameeef_pose
The TCP move over one policy step, in base axeseef_delta
The joint positions to reachjoint_position
GR00T, an arm group declared RELATIVE and trained with use_relative_action on (the official fine-tuning sets it)The server turns the reply back into absolute values from the state you sent: eef_pose for an EEF group, joint_position for joints. Check one reply
openpi with AbsoluteActions in the output transformsAbsolute too: eef_pose or joint_position, by what the model predicts
Moves relative to the chunk's first state that the server does not turn back, or joint velocitiesNot supported. Turn them into targets on the server side
warning
A controller's command is not a rep

Numbers made for one controller's input do not mean any rep. Isaac Lab's relative IK command (IK-Rel), for example, is a step that its scaled differential IK carries out only in part. Declared as eef_delta, it moves the arm much further than the demonstrations did. Label the data with the TCP target or the move the TCP made.

Policy server contract​

GR00Topenpi
ServerThe official PolicyServer (gr00t/policy/server_client.py)The official websocket server (openpi/serving/websocket_policy_server.py)
ProtocolZMQ REQ/REP, msgpack with numpy arraysWebsocket, one msgpack frame per request and reply
Protocol taken fromGR00T 944fe70openpi 15a9616

The protocol follows these upstream commits. The adapters' tests talk to a fake server that speaks it, not to the official servers.

  • Batch 1. One observation per request, one time step.
  • Same host by default. Every millisecond of network round trip comes out of the latency budget.
  • Latency budget. The executor judges each chunk in steps of time: the policy steps since it was requested, whether the arm ran a row in them or not, plus the age the camera frame had at the request times fps. A chunk skips the rows that latency has passed (Real-Time Chunking calls it the delay); one taken while the arm stands still, at the start or after a gripper wait, skips only the frame's age. The next request goes out with request_ahead rows left, and until its chunk comes the arm runs those and then the spare rows past the execution horizon, so in steady state no step goes empty while the latency is at most (action_horizon − execution_horizon + request_ahead) / 2 steps. That is the default limit: above it for 3 chunks in a row, the run brakes (latency) instead of going on stalling between chunks. chunk.action_horizon is the rows the server returns. A higher limit is allowed: the arm then pauses between chunks while it waits. At 16, 8 and 2 rows and 30 Hz it is 5 steps, at most about 167 ms for inference, round trip and frame age together; a larger action horizon leaves more (40, 16 and 2: 13 steps). Set a lower limit for a model that acts worse on older frames. The feedback's latency (effective_latency_s) is a different number, the age of the observation when its chunk arrived, so it does not show the brake measure directly.
  • Timing. The executor reads the server's inference time when it reports one (openpi server_timing.infer_ms, GR00T policy_ms in info when a wrapper adds it) and shows it as feedback.
  • Errors. A server error (GR00T {"error": …}, an openpi traceback frame) or a malformed reply brakes the run (policy_error); on the first inference the run ends warmup_failed.

Reference setup: start the model's official server on the device, point server: at it and check the file. Before the first run, send the server one observation of the arm standing still and read the reply as the file says (which rep): units, frame, direction and size should match where the arm is. Then lower the policy caps (Speed), run with a short seconds first and watch the latency in the feedback.

Results and reasons​

OutcomeThe robotResume with
FINISHEDUsed up duration_s, then stopped (below)—
REJECTEDRefused before the run started its motion. first_target_ignored cannot rule out a move under 1 mm or 0.01 radFix the cause, send again
STOPPEDEnded early without a protective stopSend again once the cause is gone
BRAKEDThe executor requested a protective stop. detail says when the request failed or robot_mode did not report BRAKED. Brake engagement per joint is not checkedCheck the robot, then set_mode; first reset_error if safety_mode shows PROTECTIVE_STOP (Stops and recovery)
CANCELEDCanceled by the caller—

What the executor confirms before it answers​

A goal that ends before the executor asks jog for the session returns at once, with nothing stopped or checked, because nothing was armed: a bad config, a refused check, a cancel or shutdown during the checks, or arm_refused when jog is missing or says no. From the arm request on, every end first stops the path and cancels any gripper command. If another jog user armed jog during the run, the session is theirs: the executor does not release it or wait for the arm, and detail says so. Otherwise, for FINISHED, STOPPED, CANCELED and REJECTED the executor then waits for jog to confirm releasing the session and for the arm to come to rest within 3 s. If either is not confirmed, the outcome becomes BRAKED (disarm_unconfirmed, not_stopped), so a cancel can end BRAKED. For BRAKED it requests a protective stop, and asks jog to release the session unless another jog user armed it; detail notes a failed request, or robot_mode not reporting BRAKED within 2 s. Brake engagement per joint is never checked. Last, it waits up to 2 s for the canceled gripper command to end, and answers even when it has not (detail says so).

Reasons​

reason is a short stable code to branch on; detail says what happened and how to fix it.

ReasonOutcomeWhat happenedWhat to do
duration_elapsedFINISHEDThe run used up its timeJudge whether the task succeeded
canceledCANCELEDThe caller canceled the goal—
busyREJECTEDAnother goal is runningWait for it or cancel it
invalid_durationREJECTEDduration_s is not a finite number above 0Give the motion time in seconds
config_not_absoluteREJECTEDThe config path is relativeGive the absolute path on the device that runs the executor
config_invalidREJECTEDThe file does not loadplem policy check <file> lists every problem
speed_scale_below_minREJECTEDJog's speed scale is below limits.min_speed_scaleRaise it on the pendant, or lower the floor
gripper_unconfiguredREJECTEDThe config has a gripper part, but the robot has no gripper set or none is readySet the gripper in the robot's profile and check its driver, or drop the gripper parts
gripper_out_of_rangeREJECTEDopen_width_m or force_n is outside what the gripper can doUse a gripper that can reproduce the training values
frame_unavailableREJECTEDNo robot base transform, or jog's TCP in another frameCheck that the robot description is published
server_unreachableREJECTEDThe policy server did not answerStart the server, check server:
camera_missingREJECTEDA camera topic published no fresh frameCheck the camera driver and topic
camera_unsupportedREJECTEDA frame the executor cannot read (encoding, row padding)Publish rgb8 or bgr8 without row padding
arm_mismatchREJECTEDThe config's arm is in joint positions, but the executor has no arm_joints parameter, or joints is not the robot arm's joint countLaunch with the executor on (the default, above), which sets arm_joints; run a model trained on this arm
joints_missingREJECTEDThe config's arm is in joint positions, and no joint_states with every arm joint came within 5 sCheck that the robot stack is running (its joint_state_broadcaster)
session_unsettledREJECTEDAn earlier run's jog session was not confirmed released, and it still does not releaseCheck that jog is running (jog/status) and what holds the robot, then send again
arm_refusedREJECTEDJog did not take the session (detail says why)Release the arm from other jog users, check the mode
no_tcpREJECTEDNo measured TCP after armingCheck that jog is running
first_target_ignoredREJECTEDAfter the run's first path went out, and before the arm was seen to move (1 mm or 0.01 rad), jog counted a dropped command in this session. Jog does not say whose command it was. The robot was stopped first (detail: jog's reason)Fix jog's reason, for example a first target too far from where the arm stands; keep other jog users off the arm
warmup_failedREJECTEDThe first inference gave no chunk in timeCheck the server log; warm the model up
preflight_errorREJECTEDAn error before the executor asked jog for the session, including a client library the config's server needs that is not installedRead detail: install the library it names (Install); otherwise report it
shutdownSTOPPEDThe executor is shutting down—
jog_stoppedSTOPPEDJog stopped the run, another jog user took the session, or jog counted a dropped command in this session after the arm moved or before the run's first path went out (detail: jog's reason)Fix jog's reason; keep other jog users off the arm during a run
jog_blockedSTOPPEDA joint limit or collision pair holds the armMove the arm clear, adjust the task
invalid_targetBRAKEDThe model's arm row decodes to no pose (for example a degenerate rotation)Check the model's output
inference_starvedBRAKEDNo action for more than 10 stepsCheck the server's load and connection
latencyBRAKEDLatency over the limit 3 chunks in a rowSpeed up the server, or lower chunk.execution_horizon to leave more rows for the delay
camera_staleBRAKEDA camera stopped delivering framesCheck the camera
tcp_staleBRAKEDThe measured TCP stopped arrivingCheck jog and the robot stack
joints_staleBRAKEDThe measured joints (joint_states) stopped arrivingCheck the robot stack
policy_errorBRAKEDThe server reported an error or sent a malformed replyCheck the server log and the config's keys
gripper_failedBRAKEDA gripper command did not finish within 8 s. A gripper that refuses or fails a command ends exceptionCheck the gripper
safety_stopBRAKEDThe safety state left NORMALRecover as for any safety stop
exceptionBRAKEDAn unexpected error while running, including a gripper command the gripper refused or failedRead detail; for a gripper, check the gripper, otherwise report it
not_stoppedBRAKEDThe arm was not at rest within 3 s of the stopCheck the robot before resuming
disarm_unconfirmedBRAKEDJog did not confirm releasing the session; the brake stop asks once moreIf that was not confirmed either, the next goal releases it first (session_unsettled if it cannot)