AutonomyController
AutonomyController class for managing autonomous operations and mission planning.
#include <autonomy_controller.hpp>Classes
class AutonomyController
Manages autonomous operations and mission planning on a vehicle.
Lifetime is bound to the owning Vehicle. Obtain via `vehicle.GetAutonomyController()`. The returned reference is stable for the vehicle's lifetime.
Two mission families are exposed through one surface: - Named missions — catalogue-driven (circle, exploration, frontier-explore). - Task missions — free-form natural-language goals dispatched to an onboard AI planner (e.g. "scan the whole house").
Supervised missions additionally offer operator-in-the-loop navigation: fetch GetCandidates(), then confirm with GoTo()/GoToPose()/Spin().
struct Status
Snapshot of autonomy state (service `STATUS`).
| Field | Type | Description |
|---|---|---|
active |
bool |
true while a mission is running |
mission |
std::string |
name of the active mission ("" if none) |
state |
std::string |
mission-defined state string |
detail |
std::string |
human-readable detail / last event |
paused |
bool |
operator paused the mission (state kept) |
raw_json |
std::string |
auto IsAvailable() const -> boolTrue when the controller has a route to the vehicle's autonomy-service (i.e. the last command reached it). Performs a lightweight probe on the first call.
Returns: bool
auto GetAvailableMissions() const -> std::vector<std::string>Lists the named missions the vehicle's autonomy-service supports (service `LIST`).
Returns: std::vector<std::string>
auto SelectMission(const std::string& name) -> boolSelects and activates a named mission (service `SELECT `).
| Parameter | Type | Description |
|---|---|---|
name |
const std::string& |
Returns: true if the service accepted and started the mission.
auto StartTaskMission(const std::string& task) -> boolStarts a free-form, AI-planned task mission (e.g. "patrol the yard").
| Parameter | Type | Description |
|---|---|---|
task |
const std::string& |
Returns: true if accepted, false if unsupported or rejected.
auto Stop() -> voidStops / aborts the active mission and holds the vehicle in place.
auto Pause() -> voidToggles pause/resume on the active mission (where supported).
auto Resume() -> voidResume a paused mission from where it left off.
The counterpart to Pause(), and deliberately distinct from re-selecting the mission: pause keeps the mission's internal progress (a waypoint route keeps its leg index), so resuming continues rather than restarting.
auto UploadRoute(const std::string& route_json) -> boolReplaces the waypoint route in one atomic upload.
Coordinates are in map-frame metres. Rejected wholesale if any point is malformed, or if the route is currently being flown.
| Parameter | Type | Description |
|---|---|---|
route_json |
const std::string& |
Route as `{"waypoints":[{"x":…,"y":…,"agl":…}, …]}`. |
Returns: true when the service accepted it.
auto GetRoute() const -> std::stringReturns the route the service currently holds, as its raw ROUTE reply.
Includes the mission name and content hash so callers can check the held route against the authoritative one.
Returns: The ROUTE reply JSON, or empty string if the service is unreachable.
auto Reset() -> voidResets the active mission — aborts the current goal and restarts from a clean state (service `RESET`). Issued after a map change or loop-closure.
auto GetStatus() const -> StatusReturns the latest autonomy status snapshot.
Returns: Status
auto OnStatusChanged(std::function<void(const Status&)> cb) -> voidRegisters a callback fired when the autonomy status changes.
| Parameter | Type | Description |
|---|---|---|
cb |
std::function<void(const Status&)> |
Callback invoked with the new Status. Pass an empty callable to clear. |
auto GetCandidates() const -> std::vector<NavCandidate>Candidate next-hop goals for the active supervised mission (`CANDIDATES`).
Returns: std::vector<NavCandidate>
auto IsSpinSuggested() const -> boolTrue when the mission has nothing to propose and is asking the operator to confirm a look-around spin. Reflects the most recent GetCandidates() reply.
Returns: bool
auto SupportsAltitude() const -> boolTrue when this vehicle's autonomy supports altitude-aware (3D) goals. False for ground/marine robots.
Returns: bool
auto GoTo(float x, float y) -> boolConfirms a 2D navigation goal (`GOTO `). Unchanged ground contract.
| Parameter | Type | Description |
|---|---|---|
x |
float |
|
y |
float |
Returns: bool
auto GoTo(float x, float y, float z, AltitudeReference ref = AltitudeReference::RelativeToCurrentPosition) -> boolConfirms a 3D navigation goal (aerial). Emits `GOTO_3D` ONLY when SupportsAltitude() is true; otherwise returns false without sending.
| Parameter | Type | Description |
|---|---|---|
x |
float |
|
y |
float |
|
z |
float |
|
ref |
AltitudeReference |
Returns: bool
auto GoToPose(float x, float y, float yaw) -> boolConfirms a 2D goal with final heading (`GOTO_POSE `).
| Parameter | Type | Description |
|---|---|---|
x |
float |
|
y |
float |
|
yaw |
float |
Returns: bool
auto GoToPose(float x, float y, float z, float yaw, AltitudeReference ref = AltitudeReference::RelativeToCurrentPosition) -> boolConfirms a 3D goal with final heading (aerial). Emits `GOTO_POSE_3D` ONLY when SupportsAltitude() is true; otherwise returns false.
| Parameter | Type | Description |
|---|---|---|
x |
float |
|
y |
float |
|
z |
float |
|
yaw |
float |
|
ref |
AltitudeReference |
Returns: bool
auto Spin() -> boolRequests an in-place look-around rotation (`SPIN`).
Returns: bool