Skip to navigation

Send manual control frames

You can now drive an asset in real time while it executes a manual control task. The new SendManualControlFrame API, available in preview, sends a single frame of control input, such as a joystick movement, for a task in STATUS_EXECUTING. Call it repeatedly as the operator’s input changes. Lattice forwards each frame to the agent executing the task, which receives it through StreamManualControlFrames.

Manage the control session

Your client owns the control session. Each frame carries the following fields:

  • sessionEpochMicros: A Unix timestamp in microseconds that identifies the session. Generate it once when you take control, and send the same value with every frame.
  • sequence: The frame’s position in the session. Increase it with each frame so the agent can detect out-of-order delivery, and reset it to 1 when you start a new session.
  • specification: The control instructions, as a google.protobuf.Any in a format specific to the task. Lattice passes it to the agent without inspecting it.

A frame with a higher epoch replaces the current session, which lets another operator take over control. Lattice rejects frames with a lower epoch as stale with an HTTP 409 Conflict, which the SDKs surface as a ConflictError. Agents receive the epoch and sequence on each ManualControlFrame, so they can ignore frames from a stale session.

Send a frame

The following example starts a control session and sends its first frame:

import time
from anduril import GoogleProtobufAny
# Generate the epoch once per control session and reuse it for every frame.
session_epoch_micros = str(time.time_ns() // 1_000)
client.tasks.send_manual_control_frame(
task_id=task_id,
session_epoch_micros=session_epoch_micros,
sequence="1", # Increase with each frame.
specification=GoogleProtobufAny(
type="type.googleapis.com/org.example.control.v1.JoystickInput",
pitch=0.25,
yaw=-0.5,
),
)

Over gRPC, call the SendManualControlFrame RPC with the same fields. It rejects a stale epoch with an ABORTED error.

To get started, install the SDK for REST. The API is available starting in Python 5.4.0, Go v5.4.0, Java 6.4.0, TypeScript 5.4.0, and Rust 2.5.0.