Skip to content

Search guides, algorithms and the platform.

PlatformReal hardware

Real hardware

About 2 minutes to read

A robot can be a platform environment. It runs at wall-clock speed and cannot be seeded or snapshotted, and it needs limits and a way to stop.

This layer is not a substitute for the robot's own safety system. It runs in the environment's process, so it cannot act if that process is killed or the machine loses power. Keep a hardware watchdog and a physical emergency stop.

Declare it

Write a gymnasium.Env and add these three methods:

python
class MyRobot(gym.Env):
    def platform_capabilities(self):
        return {"realtime_only": True}  # implies no seeding and no snapshots

    def platform_safety(self):
        return {
            "action_low": -0.5,
            "action_high": 0.5,
            "max_action_delta": 0.05,
            "observation_low": [-2.8, -1.7],
            "observation_high": [2.8, 1.7],
            "command_timeout_s": 0.2,
            "safe_action": [0.0, 0.0],
        }

    def platform_stop(self, reason):
        self.driver.hold()

step should block for one control period, since nothing else paces a real-time environment. A real-time environment that leaves out platform_stop or command_timeout_s is refused at startup.

platform_stop is called from another thread while step may be running. It must keep the actuators stopped until the next reset, even if step is called again.

Add the environment to the catalog with realtime = true:

toml
[[environment]]
id = "my-robot"
title = "My robot"
factory = "my_package:make_robot"
realtime = true

The platform then starts it only for a user's session, and only one session at a time. It takes no preview, which would mean random actions, and keeps no warm instance.

Limits

Limit What happens
action_low, action_high Commands are clamped into range. One number, or one per dimension.
max_action_delta Each command is clamped to within this of the last one. Starts from safe_action.
observation_low, observation_high Leaving the range stops the robot (limit).
command_timeout_s No new command for this long stops it (stale). The clock starts at the first command after a reset.

A clamped step reports info["safety"]["clamped"], and held_back says what was limited, e.g. "action 0 changing faster than allowed: sent the nearest allowed command". The session counts these; GET /v0/sessions/{id}/safety returns held_back (how many), held_back_at (when the latest was, Unix seconds) and held_back_detail. Limits apply to continuous actions and flat observations.

A session can pass its own safety argument of the same form. It can tighten what the environment declares but never loosen it. On a simulator, which declares nothing, the limits apply as given, so an agent can train under the limits of the robot it will run on.

Stops

Stop What clears it
stale, limit A reset. The step that notices reports truncated and info["safety"]["stopped"], and moves nothing.
emergency An operator clears it, then a reset. Steps and resets are refused until then.

The Emergency stop button is at the top of the session page, and Esc presses it from anywhere on that page. Anyone who can see the session can press it, and a member can clear it. Releasing it asks first: the robot can move again as soon as a command arrives, so Release stop stays disabled until you tick that the cell is clear of people and loose objects. Over HTTP:

Code
POST   /v0/sessions/{id}/emergency-stop
DELETE /v0/sessions/{id}/emergency-stop
GET    /v0/sessions/{id}/safety

The stop does not queue behind a step in progress. If it cannot reach the environment, the request fails and the session page says so.

After a safety stop, an agent run ends with an error rather than resetting, and the session page waits for a person. On real hardware the session page never starts the next episode by itself.

The robot also stops when the session closes or the environment server shuts down.

On the session page

A session with a safety layer shows a Safety layer line under its banners: running or stopped, how many commands were held back, and whether the page is connected.

A robot session: a stale stop, and a command held back

  • Held back an action. When the layer clamps a command, an amber banner says when and what was limited, for 20 seconds after the latest one. The robot got the nearest allowed command and the agent keeps running.
  • Stopped. A red banner names the stop (stale, limit or emergency) and what clears it.
  • Lost the connection. If the page loses its connection to the session, a red banner says so, the status reads Holding still and the video shows NO SIGNAL · holding: commands from the page have stopped. It reconnects by itself (up to 8 tries) and resumes from the same step; Reconnect now tries at once, and End session closes it.

Check it

Terminal
platform-check --factory my_package:make_robot

This reads the spec and moves nothing. To run the rest, including the emergency stop and the stale stop, add --actuate. It sends only safe_action, so declare one first, and be ready at the physical stop.

Updated Nov 20, 2026