Skip to main content

Command mode and arming

Arming and mode are set with unary calls that return a success flag and a message. Observe the matching state streams to confirm the change took effect.

Before you begin

You need an authenticated channel — see Authenticate.

These commands move a physical vessel

Confirm control authority and mode before arming, and verify each change on its state stream rather than assuming the call alone took effect.

command_mode.py
from greenroom.control.v1 import (
control_service_pb2,
control_service_pb2_grpc,
mode_pb2,
)

client = control_service_pb2_grpc.ControlServiceStub(channel)

# Arm the vessel.
resp = client.SetArm(
control_service_pb2.SetArmRequest(vessel_id="vessel_1", arm=True)
)
assert resp.success, resp.message

# Set autonomous control mode and a transit speed envelope.
client.SetModeControl(
control_service_pb2.SetModeControlRequest(
vessel_id="vessel_1", mode=mode_pb2.CONTROL_MODE_AUTONOMOUS
)
)
client.SetModeSpeed(
control_service_pb2.SetModeSpeedRequest(
vessel_id="vessel_1", mode=mode_pb2.SPEED_MODE_SAFE_TRANSIT
)
)

Confirm with the state streams (StreamArmState, StreamModeControl, StreamModeSpeed) rather than assuming success from the call alone.

What's next