Skip to main content

Vessel state

The Vessel domain reports the vessel's own navigation state: global pose (WGS-84 position with ENU orientation), body-frame velocity (FLU), and local Cartesian pose. VesselStateService provides GetVesselState (the latest known state, unary) and StreamVesselState (live updates as the state changes, server stream). Most integrations stream continuously.

Before you begin

You need an authenticated channel — see Authenticate.

StreamVesselState emits a VesselState whenever the navigation state updates; the first message carries the current state.

stream_vessel_state.py
from greenroom.vessel.v1 import vessel_service_pb2, vessel_service_pb2_grpc

client = vessel_service_pb2_grpc.VesselStateServiceStub(channel)

request = vessel_service_pb2.StreamVesselStateRequest(vessel_id="vessel_1")
for response in client.StreamVesselState(request):
state = response.state
print(
f"{state.geopose.position.latitude:.6f}, "
f"{state.geopose.position.longitude:.6f} | "
f"sog {state.twist.linear.x:.1f} m/s"
)

geopose is WGS-84 with ENU orientation; twist is body-frame (FLU) linear and angular velocity; local_pose is Cartesian relative to the odom origin.

Make the stream self-healing

On a vessel, links drop. Wrap any long-running stream in the reconnect-with-backoff pattern so it re-opens and re-converges automatically — see Streaming and reconnection.

What's next