Class: Drone

Drone

Drone Class Exposes an API for issuing commands and interfacing with the network adapter.

Constructor

new Drone(options)

Instantiates a new instance of the Drone class
Parameters:
Name Type Description
options Object Configuration options object
Properties
Name Type Description
updateMS Integer Frequency of the flight params event loop in ms, default 100ms
autoconnect Boolean Connect immediately on instantiation, default false
maxAltitude Integer The max height in meters the drone can reach (2-10)
maxTilt Integer The max tilt the drone can achieve from 0-100 (100 being the max 20° inclination the drone firmware allows)
maxVerticalSpeed Float The max vertical speed in meters/s the drone can reach (0.5 - 2)
maxRotationSpeed Integer The rotation speed in °/s the drone can reach (50 - 1000)
droneFilter String The name of the drone to restrict connection to
Author:
Source:
Fires:

Methods

animate(animation) → {undefined}

Preform the drone's animation routines
Parameters:
Name Type Description
animation String one of the following animation methods: flipFront, flipBack, flipRight, flipLeft
Source:
Returns:
Type
undefined

connect() → {undefined}

Pairs with the drone as a BTLE peripheral
Source:
Returns:
Type
undefined

emergency() → {undefined}

Perform the drone's emergency landing, kills the rotors
Source:
Returns:
Type
undefined

eventLoop() → {undefined}

The event loop that updates the drone's flight params every X ms
Source:
Returns:
Type
undefined

getBatteryLevel() → {integer}

Returns the battery level of the drone
Source:
Returns:
The battery level %
Type
integer

getRssi() → {interger}

Gets Rssi value
Source:
Returns:
Rssi value
Type
interger

isFlying() → {Boolean}

If the drone is in a flight status that is considered flying
Source:
Returns:
If the drone is flying
Type
Boolean

land() → {undefined}

Perform the drone's automated land command
Source:
Returns:
Type
undefined

onConnected() → {undefined}

Preforms some basic setup immediately after the drone is connected
Source:
Returns:
Type
undefined

setDroneFilter(name) → {undefined}

Sets the filter to connect on a specific drone based on its network name
Parameters:
Name Type Description
name String The name of the drone to connect to
Source:
Returns:
Type
undefined

setFlightParams(flightParams) → {undefined}

Sets the drone's roll, pitch, yaw and altitude
Parameters:
Name Type Description
flightParams Object object, all object keys are optional to allow partial updates
Properties
Name Type Description
roll Integer The roll value of the drone -100 to 100(optional)
pitch Integer The pitch value of the drone -100 to 100 (optional)
yaw Integer The yaw value -100 to 100 (optional)
altitude Integer Increase or decrease the altitude (overall rotor RPM) -100 to 100 (optional)
Source:
Returns:
Type
undefined

setMaxAltitude(altitude) → {undefined}

Sets the drone's Max Altitude
Parameters:
Name Type Description
altitude Integer Increase or decrease the max altitude 0.5 to 10
Source:
Returns:
Type
undefined

setMaxRotationSpeed(speed) → {undefined}

Sets the drone's MaxRotationSpeed
Parameters:
Name Type Description
speed Integer Increase or decrease rotation speed (yaw) in °/sec 0-1000 (50°/s - 360°/s)
Source:
Returns:
Type
undefined

setMaxTilt(tilt) → {undefined}

Sets the drone's Max Tilt
Parameters:
Name Type Description
tilt Integer set max tilt angle 0-100 (0 = 5° - 100 = 25°)
Source:
Returns:
Type
undefined

setMaxVerticalSpeed(speed) → {undefined}

Sets the drone's MaxVerticalSpeed
Parameters:
Name Type Description
speed Integer set max vertical speed in m/s (0.5m/s to 2m/s)
Source:
Returns:
Type
undefined

takeOff() → {undefined}

Perform the drone's automated takeoff command
Source:
Returns:
Type
undefined

takeoffOrLand() → {undefined}

Toggle the drone's takeoff or land command
Source:
Returns:
Type
undefined

takePicture() → {undefined}

Perform the drone's take a picture command
Source:
Returns:
Type
undefined

trim() → {undefined}

Perform the drone's trim command
Source:
Returns:
Type
undefined

Events

batteryStatusChange

Fires when the drone's battery status has changed
Type:
  • object
Source:

connected

Fires when the Drone successfully connected over Bluetooth
Type:
  • object
Source:

flightParamChange

Fires when a flight param command is written over the Bluetooth network
Type:
  • object
Source:

flightStatusChange

Fires when the drone's flight status has changed
Type:
  • object
Source:

maxAltitudeChange

Fires when the drone's max altitude has changed
Type:
  • object
Source:

maxRotationSpeed

Fires when the drone's max rotation speed has changed
Type:
  • object
Source:

maxTiltChange

Fires when the drone's max tilt has changed
Type:
  • object
Source:

maxVerticalSpeed

Fires when the drone's max vertical speed has changed
Type:
  • object
Source: