Skip to main content

Connect your robot policy

This walkthrough builds a robot policy that repeats each arm's observed joint position. By the end, you will have an importable JobRequest that runs three episodes on a station.

1. Prepare your environment​

Complete the first evaluation tutorial. Use the same SDK environment, station ID, and relay address. The operator must confirm that zero joint angles with open grippers are appropriate for the station.

2. Implement the policy​

Save the following as my_policy.py in your working directory:

import numpy as np

from se3labs.interface.eval.arm import (
)
from se3labs.interface.eval.job import JobRequest
from se3labs.interface.eval.policy import Policy
from se3labs.interface.eval.station import Station_ActionChunk, Station_JointPose
from se3labs.sdk.examples.hold_still import HOLD_STILL_TASK


class HoldPosition(Policy):
def initialize(self, station, task):
np.zeros(arm.n_arm_dof, dtype=np.float32),
np.ones(arm.n_gripper_dof, dtype=np.float32),
)
for name, arm in station.arms.items()
})

def infer(self, observation):
timestamp=max(arm.timestamp for arm in observation.arms.values()),
rate=10.0,
arms={
np.repeat(arm.joint_angle_q[None, :], 4, axis=0),
np.repeat(arm.gripper_pos[None, :], 4, axis=0),
)
for name, arm in observation.arms.items()
},
)

def reset(self):
pass


REQUEST = JobRequest(task=HOLD_STILL_TASK, policy=HoldPosition(), episodes=3)

initialize() selects the starting pose. Each infer() call repeats the observed joint and gripper positions into four target rows at 10 Hz. The chunk uses the observation's station-clock timestamp. reset() has no state to clear in this example.

REQUEST combines this policy with the bundled five-second hold-still task and requests three episodes. The policy contract defines the array shapes, timing, and task fields.

3. Run the request​

From the directory containing my_policy.py, run the following with your station ID and relay address. Use --secure for TLS; omit it for a local plaintext connection.

se3labs eval run \
--station yam-1 --address relay.example.com:7443 --secure \
--request my_policy:REQUEST

4. Check the result​

After the station completes the session, the CLI prints its close reason, episode count, and step count. Check these against the three requested episodes and review any reported policy errors. This release does not export result JSON or include terminal state and score sheets in SessionReport.

Next, try the bundled examples, or replace the repeated joint targets in infer() with outputs from your model. Keep its outputs consistent with the station's action contract.