UNPKG

mambo-angular-service

Version:
91 lines (90 loc) 3.47 kB
/// <reference types="web-bluetooth" /> import { Observable } from 'rxjs'; export declare class Drone { private device; private flightCommandInstructions; private flightParamsInstructions; private flightStatus; roll: number; pitch: number; yaw: number; altitude: number; private flightLoopHandle; private loopHandle; private ready; private connectionSubject; readonly connection$: Observable<boolean>; constructor(device: BluetoothDevice); connect(): Promise<any>; initialise(server: BluetoothRemoteGATTServer): Promise<void>; private prepareCharacteristics(server); private initialiseFlightDefaults(); private listenToOnDisconnected(); private onDisconnected(); /** * Convenience method for setting the drone's altitude limitation * @param {Integer} altitude the altitude in meters (2m-10m for Airborne Cargo / 2m - 25m for Mambo) */ setMaxAltitude(maxAltitude: number): Promise<any>; /** * Convenience method for setting the drone's max tilt limitation * @param {integer} tilt The max tilt from 0-100 (0 = 5° - 100 = 20°) */ setMaxTilt(maxTilt: number): Promise<any>; /** * Convenience method for setting the drone's max vertical speed limitation * @param {integer} verticalSpeed The max vertical speed from 0.5m/s - 2m/s */ setMaxVerticalSpeed(maxVerticalSpeed: number): Promise<any>; /** * Convenience method for setting the drone's max rotation speed limitation * @param {integer} tilt The max rotation speed from (50°-360° for Airborne Cargo / 50° - 180° for Mambo) */ setMaxRotationSpeed(maxRotationSpeed: number): Promise<any>; private startFlightLoop(); private stopFlightLoop(); /** * Instructs the drone to take off */ takeOff(): void; /** * Instructs the drone to land */ land(): void; /** * Instructs the drone to fire the cannon */ fire(): void; /** * Sets the roll, pitch, yaw and altitude of drone's flight params in one call * @param roll turn speed, expected value from -1 (move left) to 1 (move right) * @param pitch turn speed, expected value from -1 (move back) to 1 (move forward) * @param yaw turn speed, expected value from -1 (turn counter-clocwise) to 1 (turn clocwise) * @param altitude turn speed, expected value from -1 (move down) to 1 (move up) */ private sendFlightParams(); updateFlightParams(roll: number, pitch: number, yaw: number, altitude: number): void; /** * Sets the roll speed of drone's flight params * @param roll turn speed, expected value from -1 (move left) to 1 (move right) */ setRoll(roll: any): void; /** * Sets the pitch of drone's flight params * @param pitch turn speed, expected value from -1 (move back) to 1 (move forward) */ setPitch(pitch: any): void; /** * Sets the turn speed of drone's flight params * @param yaw turn speed, expected value from -1 (turn counter-clocwise) to 1 (turn clocwise) */ setYaw(yaw: number): void; /** * Sets the altitude of drone's flight params * @param altitude turn speed, expected value from -1 (move down) to 1 (move up) */ setAltitude(altitude: any): void; private convertToInputValue(value); private ensureBoundaries(val, min, max); private ensureBoundariesRound(val, min, max); }