Drone.Vehicle (ex_drone v0.1.0)

View Source

Supervised GenServer that manages a single drone connection.

Each Drone.Vehicle process represents one drone. It holds the adapter state, safety policy, and vehicle state. All commands flow through the safety pipeline before reaching the adapter.

Drivers should not call Drone.Vehicle directly. Use the Drone public API module instead.

Summary

Functions

Returns a specification to start this module under a supervisor.

Types

state()

@type state() :: %{
  name: atom(),
  adapter_module: module(),
  adapter_state: term(),
  safety_policy: Drone.Safety.Policy.t(),
  vehicle_state: %{
    x: integer(),
    y: integer(),
    z: integer(),
    yaw: integer(),
    battery: integer(),
    speed: integer(),
    flying: boolean(),
    mode: :idle | :sdk_mode | :flying | :emergency,
    last_command: Drone.Command.t() | nil,
    command_history: [Drone.Command.t()]
  }
}

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(opts)

@spec start_link(keyword()) :: GenServer.on_start()

via_tuple(name)

@spec via_tuple(atom()) :: {:via, Registry, {Drone.Vehicle.Registry, atom()}}

whereis(name)

@spec whereis(atom()) :: pid() | nil