Constructor
new Drone(options)
Instantiates a new instance of the Drone class
Parameters:
Name | Type | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Configuration options object
Properties
|
Fires:
- Drone#event:connected
- Drone#event:batteryStatusChange
- Drone#event:flightStatusChange
- Drone#event:batteryStatusChange
- Drone#event:maxAltitudeChange
- Drone#event:maxTiltChange
- Drone#event:maxVerticalSpeedChange
- Drone#event:maxRotationSpeedChange
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 |
Returns:
- Type
- undefined
connect() → {undefined}
Pairs with the drone as a BTLE peripheral
Returns:
- Type
- undefined
emergency() → {undefined}
Perform the drone's emergency landing, kills the rotors
Returns:
- Type
- undefined
eventLoop() → {undefined}
The event loop that updates the drone's flight params every X ms
Returns:
- Type
- undefined
getBatteryLevel() → {integer}
Returns the battery level of the drone
Returns:
The battery level %
- Type
- integer
getRssi() → {interger}
Gets Rssi value
Returns:
Rssi value
- Type
- interger
isFlying() → {Boolean}
If the drone is in a flight status that is considered flying
Returns:
If the drone is flying
- Type
- Boolean
land() → {undefined}
Perform the drone's automated land command
Returns:
- Type
- undefined
onConnected() → {undefined}
Preforms some basic setup immediately after the drone is connected
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 |
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
|
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 |
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) |
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°) |
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) |
Returns:
- Type
- undefined
takeOff() → {undefined}
Perform the drone's automated takeoff command
Returns:
- Type
- undefined
takeoffOrLand() → {undefined}
Toggle the drone's takeoff or land command
Returns:
- Type
- undefined
takePicture() → {undefined}
Perform the drone's take a picture command
Returns:
- Type
- undefined
trim() → {undefined}
Perform the drone's trim command
Returns:
- Type
- undefined
Events
batteryStatusChange
Fires when the drone's battery status has changed
Type:
- object
connected
Fires when the Drone successfully connected over Bluetooth
Type:
- object
flightParamChange
Fires when a flight param command is written over the Bluetooth network
Type:
- object
flightStatusChange
Fires when the drone's flight status has changed
Type:
- object
maxAltitudeChange
Fires when the drone's max altitude has changed
Type:
- object
maxRotationSpeed
Fires when the drone's max rotation speed has changed
Type:
- object
maxTiltChange
Fires when the drone's max tilt has changed
Type:
- object
maxVerticalSpeed
Fires when the drone's max vertical speed has changed
Type:
- object