Drone. Mission
(ex_drone v0.1.0)
View Source
Mission DSL for scripting drone command sequences.
A mission is an ordered list of commands that can be validated and replayed against a drone or simulator.
Example
mission =
Drone.Mission.new()
|> Drone.Mission.sdk_mode()
|> Drone.Mission.takeoff()
|> Drone.Mission.hover(seconds: 3)
|> Drone.Mission.move(:up, 40)
|> Drone.Mission.move(:forward, 100)
|> Drone.Mission.rotate(:cw, 90)
|> Drone.Mission.land()
Drone.Mission.run(mission, drone)
Summary
Functions
Returns the list of commands in the mission in execution order.
Adds an emergency stop command to the mission.
Adds a flip command to the mission.
Adds a hover command to the mission.
Adds a land command to the mission.
Returns the number of commands in the mission.
Adds a movement command to the mission.
Creates a new empty mission.
Adds a query command to the mission.
Adds a rotation command to the mission.
Runs a mission against a drone process.
Adds an SDK mode activation command to the mission.
Adds a speed setting command to the mission.
Adds a stop command to the mission.
Adds a takeoff command to the mission.
Types
@type t() :: %Drone.Mission{commands: [Drone.Command.t()], name: String.t() | nil}
Functions
@spec commands(t()) :: [Drone.Command.t()]
Returns the list of commands in the mission in execution order.
Adds an emergency stop command to the mission.
@spec flip(t(), Drone.Command.flip_direction()) :: t()
Adds a flip command to the mission.
Adds a hover command to the mission.
Adds a land command to the mission.
@spec length(t()) :: non_neg_integer()
Returns the number of commands in the mission.
@spec move(t(), Drone.Command.direction(), pos_integer()) :: t()
Adds a movement command to the mission.
Creates a new empty mission.
@spec query(t(), Drone.Command.query_type()) :: t()
Adds a query command to the mission.
@spec rotate(t(), Drone.Command.rotation(), pos_integer()) :: t()
Adds a rotation command to the mission.
@spec run(t(), atom()) :: {:ok, [term()]} | {:error, Drone.Command.t(), term()}
Runs a mission against a drone process.
Each command is sent sequentially. If any command fails, the mission stops and returns the error.
Returns {:ok, results} with a list of results for each command,
or {:error, command, reason} with the failing command and error.
Adds an SDK mode activation command to the mission.
@spec speed(t(), pos_integer()) :: t()
Adds a speed setting command to the mission.
Adds a stop command to the mission.
Adds a takeoff command to the mission.