CoDrone LINK Communication Bluetooth Low Energy Updated in April 14th, 2016
Contents 1. 2. 3.
1. Introduction CoDrone uses Bluetooth Low Energy (BLE) technology. DRONE_SERVICE DRONE_DATA DRONE_CONF Name UUID Purpose DRONE_SERVICE "C320DF00-7891-11E5-8BCF-FEFF819CDC9F" Service DRONE_DATA "C320DF01-7891-11E5-8BCF-FEFF819CDC9F" CoDrone -> Device(Notify) DRONE_CONF "C320DF02-7891-11E5-8BCF-FEFF819CDC9F" Device -> CoDrone (Write) 2. Data Link CoDrone takes data from a device through DRONE_CONF. CoDrone sends data to a device through DRONE_DATA.
enum DataType { None = 0, // system information Ping, Ack, Error, Request, Passcode, // control, command Control = 0x10, Command, Command2, Command3, } ///< check communication(reserved) ///< response to receiving data ///< error(reserved) ///< data request ///< reset password for pairing ///< control ///< command ///< multiple command (command 1, 2) ///< multiple command (command 1, 2, 3) // LED LedMode = 0x20, LedMode2, LedModeCommand, LedModeCommandIr, LedModeColor, LedModeColor2, ///< set single LED
3. Data Structure typedef typedef typedef int32_t int16_t int8_t s32; s16; s8; typedef typedef typedef uint32_t uint16_t uint8_t u32; u16; u8; 3.1. Base 3.1.1. CommandBase struct CommandBase { u8 u8 }; commandType; option; ///< command type ///< option for command(use the defined value in System.h) CommandBase is a basic structure to ask CoDrone for something, using in structures of Command, Command2, Command3, LedModeCommand, LedModeCommandIr, LedEventCommand, LedEventCommandIr 3.1.1.1.
Please check the option value of ModePetrone, Coordinate, Trim, FlightEvent or DriveEvent in CommandType. 3.1.1.2.1. ModePetrone { None = 0, Flight = 0x10, FlightNoGuard, FlightFPV, Drive = 0x20, DriveFPV, Test = 0x30, ///< flight mode with guards ///< flight mode without guards ///< flight mode (FPV) ///< drive mode ///< drive mode(FPV) ///< test mode EndOfType }; 3.1.1.2.2. Coordinate enum Coordinate { None = 0, Absolute, Relative, }; ///< fixed coordinate ///< relative coordinate EndOfType 3.1.1.2.
Stop, Landing, Reverse, ///< stop ///< landing ///< turtle turn Shot, UnderAttack, Square, CircleLeft, CircleRight, Rotate180, ///< motion when shooting ///< motion under attack ///< square flight ///< circle flight(left) ///< circle flight(right) ///< rotate 180 degrees EndOfType }; 3.1.1.2.5.
ArmFlicker, ArmFlickerDouble, ArmDimming, ArmFlow, ArmFlowReverse, ///< flicker ///< flicker ///< control brightness and dimming ///< front to rear ///< rear to front EndOfType }; 3.1.2.2.
3.1.3. ColorBase ColorBase is a basic structure to control the brightness of R, G or B LED respectively. The range is 0 ~ 255. struct ColorBase { u8 u8 u8 }; r; g; b; ///< LED Red ///< LED Green ///< LED Blue 3.1.4. LedModeColorBase LedModeColorBase is a basic structure to change the mode of LEDs with controlling the brightness of R, G or B LED respectively. struct LedModeColorBase { u8 ColorBase color; u8 }; mode; interval; ///< LED mode ///< LED color(R, G, B) ///< LED interval 3.1.4.1.
Refer to 3.1.2.3. interval 3.1.5.4. repeat The range is 1~255. 3.1.6. LedEventColorBase struct LedEventColorBase { u8 ColorBase u8 u8 }; event; color; interval; repeat; ///< LED event ///< LED event color(R, G, B) ///< LED event interval ///< LED event repeat 3.1.6.1. event Refer to 3.1.2.1. mode 3.1.6.2. color Refer to 3.1.3. ColorBase 3.1.6.3. interval Refer to 3.1.2.3. interval 3.1.6.4. repeat The range is 1~255. 3.1.7. MotorBase struct MotorBase { s16 s16 }; forward; reverse; 3.2. Structures 3.2.1.
Request is used when you want to get data from CoDrone. Refer to 3.1.1.2.5. Request. struct Request { u8 }; dataType; ///< datatype to be requested 3.2.3. Control Control is information about CODRONE’s movement.
Refer to 3.1.2. LedModeBase. struct LedMode { LedModeBase }; ledMode; 3.2.8. LedMode2 Refer to 3.1.2. LedModeBase. struct LedMode2 { LedModeBase LedModeBase }; ledMode1; ledMode2; 3.2.9. LedModeCommand Refer to 3.1.2. LedModeBase and 3.1.1. CommandBase. struct LedModeCommand { LedModeBase CommandBase }; ledMode; command; 3.2.10. LedModeCommandIr Refer to 3.1.2. LedModeBase and 3.1.1. CommandBase. The size of irData is 32bits(4bytes).
Refer to 3.1.5. LedEventBase. struct LedEvent { LedEventBase }; ledEvent; 3.2.14. LedEvent2 Refer to 3.1.5. LedEventBase. struct LedEvent2 { LedEventBase LedEventBase }; ledEvent1; ledEvent2; 3.2.15. LedEventCommand Refer to 3.1.5. LedEventBase and 3.1.1. CommandBase. struct LedEventCommand { LedEventBase CommandBase }; ledEvent; command; 3.2.16. LedEventCommandIr Refer to 3.1.5. LedEventBase and 3.1.1. CommandBase.
{ LedModeColorBase }; ledModeColor; 3.2.20. LedModeDefaultColor2 Refer to 3.1.4. LedModeColorBase. struct LedModeDefaultColor2 { LedModeColorBase LedModeColorBase }; ledModeColor1; ledModeColor2; 3.2.21. Address CODRONE’s MAC Address. struct Address { u8 }; address[6]; 3.2.22.
enum ModeFlight { None = 0, Ready, ///< ready to fly TakeOff, Flight, Flip, Stop, Landing, Reverse, ///< take off ///< flight ///< flip ///< emergency stop ///< landing ///< turtle turn Accident, Error, ///< convert into ready mode ///< error EndOfType }; 3.2.22.4. ModeDrive enum ModeDrive { None = 0, }; Ready, ///< ready to drive Start, Drive, Stop, ///< start ///< drive ///< emergency stop Accident, Error, ///< convert into ready mode ///< error EndOfType 3.2.22.5.
{ s16 s16 s16 roll; pitch; yaw; }; Range Name Type Note roll s16 -180 ~ 180 tilting angle of left/right pitch s16 -180 ~ 180 tilting angle of front/rear yaw s16 0 ~ 360 Heading angle Name Type Range Note roll s16 -32768 ~ 32767 slope value of left/right pitch s16 -32768 ~ 32767 slope value of front/rear yaw s16 -32768 ~ 32767 Heading value 3.2.24. GyroBias Checking the gyro bias value. Refer to 3.2.23. Attitude. 3.2.25.
struct IrMessage { u8 u32 }; direction; irData; 3.2.28.1. Direction IR receivers are in front and rear of CODRONE. enum Direction { None = 0, Left, Front, Right, Rear, }; EndOfType 3.2.28.2. irData IR transfer data. The size is 4 byte. 3.2.29. ImuRawAndAngle struct ImuRawAndAngle { s16 s16 s16 s16 s16 s16 s16 s16 s16 }; accX; accY; accZ; gyroRoll; gyroPitch; gyroYaw; angleRoll; anglePitch; angleYaw; 3.2.30. Pressure struct Pressure { s32 s32 s32 s32 }; d1; d2; temperature; pressure; 3.2.31.
}; u8 button; 3.2.33. Battery struct Battery { s16 s16 s16 s16 u8 v30; v33; gradient; yIntercept; flagBatteryCalibration; s32 s8 batteryRaw; batteryPercent; s16 voltage; }; 3.2.34. Motor struct Motor { MotorBase motor[4]; }; 3.2.35.