Drone. Command
(ex_drone v0.1.0)
View Source
Command struct and helpers for drone operations.
Every command sent through the ex_drone pipeline is represented as a
Drone.Command struct. This provides a unified representation regardless
of which adapter handles the command.
Summary
Functions
Creates an emergency stop command.
Checks if a command is an emergency command.
Creates a flip command.
Creates a hover command.
Creates a land command.
Creates a movement command.
Checks if a command is a movement command.
Creates a new command struct.
Creates a query command.
Checks if a command is a query command.
Checks if a command requires the drone to be flying.
Creates a rotation command.
Checks if a command is a safe (retryable) command.
Creates an SDK mode activation command.
Creates a speed setting command.
Creates a stop command (hover in place).
Creates a takeoff command.
Returns all valid command types.
Types
@type command_type() ::
:sdk_mode
| :takeoff
| :land
| :emergency
| :move
| :rotate
| :flip
| :hover
| :speed
| :stop
| :query
@type direction() :: :up | :down | :left | :right | :forward | :back
@type flip_direction() :: :left | :right | :forward | :back
@type query_type() ::
:battery | :height | :speed | :time | :wifi | :sdk_version | :serial_number
@type rotation() :: :cw | :ccw
@type t() :: %Drone.Command{ args: keyword(), raw: String.t() | nil, type: command_type() }
Functions
@spec emergency() :: t()
Creates an emergency stop command.
Checks if a command is an emergency command.
@spec flip(flip_direction()) :: t()
Creates a flip command.
Direction must be one of: :left, :right, :forward, :back.
@spec hover(pos_integer()) :: t()
Creates a hover command.
Seconds must be a positive integer.
@spec land() :: t()
Creates a land command.
@spec move(direction(), pos_integer()) :: t()
Creates a movement command.
Direction must be one of: :up, :down, :left, :right, :forward, :back.
Distance must be between 20 and 500 cm.
Checks if a command is a movement command.
@spec new( command_type(), keyword() ) :: t()
Creates a new command struct.
@spec query(query_type()) :: t()
Creates a query command.
Query type must be one of: :battery, :height, :speed, :time,
:wifi, :sdk_version, :serial_number.
Checks if a command is a query command.
Checks if a command requires the drone to be flying.
@spec rotate(rotation(), pos_integer()) :: t()
Creates a rotation command.
Direction must be :cw (clockwise) or :ccw (counter-clockwise).
Degrees must be between 1 and 3600.
Checks if a command is a safe (retryable) command.
@spec sdk_mode() :: t()
Creates an SDK mode activation command.
@spec speed(pos_integer()) :: t()
Creates a speed setting command.
Speed must be between 10 and 100 cm/s.
@spec stop() :: t()
Creates a stop command (hover in place).
@spec takeoff() :: t()
Creates a takeoff command.
@spec types() :: [command_type()]
Returns all valid command types.