Quickstart
This walks through fetching a vessel's current state — the smallest end-to-end call.
Install the SDK
Add the generated gRPC client for your language. See Install the SDK for the full per-language commands.
Create an authenticated channel
Set PLATFORM_ENDPOINT and PLATFORM_TOKEN, then open a secure channel as shown in
Authenticate.
Fetch the vessel state
Call GetVesselState with a vessel ID and read the position off the response.
- Python
- C++
- TypeScript
from greenroom.vessel.v1 import vessel_service_pb2, vessel_service_pb2_grpc
channel = create_channel() # from the Authenticate guide
client = vessel_service_pb2_grpc.VesselStateServiceStub(channel)
response = client.GetVesselState(
vessel_service_pb2.GetVesselStateRequest(vessel_id="vessel_1")
)
state = response.state
print(
f"{state.vessel_id}: "
f"{state.geopose.position.latitude:.6f}, "
f"{state.geopose.position.longitude:.6f}"
)
#include "greenroom/vessel/v1/vessel_service.grpc.pb.h"
auto channel = CreateChannel(); // from the Authenticate guide
auto stub = greenroom::vessel::v1::VesselStateService::NewStub(channel);
greenroom::vessel::v1::GetVesselStateRequest request;
request.set_vessel_id("vessel_1");
greenroom::vessel::v1::GetVesselStateResponse response;
grpc::ClientContext context;
grpc::Status status = stub->GetVesselState(&context, request, &response);
if (status.ok()) {
const auto& pos = response.state().geopose().position();
std::cout << response.state().vessel_id() << ": "
<< pos.latitude() << ", " << pos.longitude() << "\n";
}
import { createClient } from "@connectrpc/connect";
import { VesselStateService } from "@buf/greenroom-robotics_platform-sdk.bufbuild_es/greenroom/vessel/v1/vessel_service_pb";
import { transport } from "./auth"; // from the Authenticate guide
const client = createClient(VesselStateService, transport);
const { state } = await client.getVesselState({ vesselId: "vessel_1" });
const pos = state?.geopose?.position;
console.log(`${state?.vesselId}: ${pos?.latitude}, ${pos?.longitude}`);
Where to next
- Stream live data: Stream vessel state, Stream tracks.
- Command the vessel: Control overview, Run a mission.
- Browse every service and message in the Reference.