Run a mission
Build a plan, load it, start it, and watch its progress.
Before you begin
You need an authenticated channel — see Authenticate. Running a mission moves a physical vessel: confirm control authority and mode first (Control).
Build and load the plan
SetMissionPlan validates the plan on the server and returns any errors.
run_mission.py
from greenroom.mission.v1 import (
mission_service_pb2,
mission_service_pb2_grpc,
mission_plan_pb2,
steps_pb2,
primitives_pb2,
)
client = mission_service_pb2_grpc.MissionServiceStub(channel)
plan = mission_plan_pb2.MissionPlan(
name="Patrol A",
version="1.0.0",
steps=[
steps_pb2.Step(waypoint=steps_pb2.Waypoint(
id="wp1",
point=primitives_pb2.Point(latitude=-33.85, longitude=151.21),
speed=4.0,
)),
steps_pb2.Step(station_keep=steps_pb2.StationKeep(
id="hold",
speed=2.0,
inner_radius=5.0,
outer_radius=20.0,
)),
],
)
resp = client.SetMissionPlan(
mission_service_pb2.SetMissionPlanRequest(vessel_id="vessel_1", plan=plan)
)
if not resp.success:
raise RuntimeError(resp.message) # server validation errors
Plans must end with a terminal step
A plan must finish with a terminal step — station-keep, trail-target, or disarm — or server-side
validation rejects it and SetMissionPlan returns success=false.
Start the mission
client.StartMissionPlan(
mission_service_pb2.StartMissionPlanRequest(vessel_id="vessel_1") # step_id empty = from the top
)
Observe progress
request = mission_service_pb2.StreamMissionStateRequest(vessel_id="vessel_1")
for response in client.StreamMissionState(request):
state = response.state
print(mission_state := state.state) # overall MissionStatus
for run in state.steps:
print(f" {run.step.WhichOneof('step')}: {run.state}")
StopMissionPlan, ResetMissionPlan, and ClearMissionPlan control execution without rebuilding
the plan. StreamWithinGeofence and StreamMissionRunning provide quick boolean views for UIs.
What's next
- Keep the state stream alive across link drops: Streaming and reconnection.
- Handle validation and transport failures: Error handling.