Drone. Adapters. Sim
(ex_drone v0.1.0)
View Source
Simulator adapter for ex_drone.
The simulator adapter implements Drone.Adapter with an in-process state
machine. It requires no hardware, no network, and no external dependencies.
This is the primary adapter for development, testing, and education. It enforces the same state machine and command protocol as the Tello adapter, but uses pure Elixir state instead of UDP communication.
Usage
{:ok, drone} = Drone.connect(:sim, name: :test)
Drone.connect_sdk(drone)
Drone.takeoff(drone)
Drone.move(drone, :forward, 100)
Drone.land(drone)
Drone.disconnect(drone)Failure Injection
The simulator can be configured to inject failures for testing error handling:
{:ok, drone} = Drone.connect(:sim,
name: :test,
failure_rate: 1.0, # always fail
fail_commands: [:takeoff] # only fail takeoff
)Battery Simulation
Battery drains at configurable rates per command. Set battery: 50 to start
with 50% battery.
{:ok, drone} = Drone.connect(:sim, name: :test, battery: 30)