Interface for DX6i RC Quadcopter controller
Embed:
(wiki syntax)
Show/hide line numbers
DX6iController.h
00001 /** 00002 * Institution: Georgia Institute of Technology - ECE Department - Senior Design II 00003 * Team: AH3 00004 * Created: 3/24/2015 00005 * Last Edit: 3/26/2015 00006 * By: Taylor Andrews, Luke Panayioto 00007 **/ 00008 00009 #ifndef _DX6I_CONTROLLER_H_ 00010 #define _DX6I_CONTROLLER_H_ 00011 00012 #include "mbed.h" 00013 00014 class DX6iController { 00015 private: 00016 DigitalOut _pwmPin; 00017 00018 /** 00019 * The signal received by the quadcopter is an array of nine PWM signals (called a PPM signal), and is 00020 * exactly 22 ms long. Each segment in the array has a specific purpose. The first four correspond to 00021 * the throttle, roll, pitch, and yaw, respectively. 00022 * 00023 * The fifth and sixth correspond to the stability and enable modes. The stability mode configures the 00024 * quadcopter's internal stabilization systems through a combination of onboard accelerometers and 00025 * gyroscopes. The stability mode has two presets, what I just label as "full" and "partial", in 00026 * addition to an "off" setting (below it is initialized with full stability enabled, and it is highly 00027 * encouraged to keep it there). The Enable mode simply allows the quadcopter to throttle, and only 00028 * has two settings "on" and "off". Obviously, this must be configured for "on", unless it is utilized 00029 * in some fashion as to prevent some sort of catastrophic collision. 00030 * 00031 */ 00032 00033 // Channels: [Remainder] [Throttle] [Roll] [Pitch] [Yaw] [Stability] [Enable] ([Extra_1] [Extra_2] 00034 00035 // delay between signals in microseconds (µSec) 00036 int pulseInterval; // 400 µSec 00037 int nChannels; //channels must be at least 7 00038 00039 // uptime of each signal in microseconds low / mid / high // Corrections to PPM signal order 00040 int Throttle_Uptime; //1 700 / 1100 / 1500 // Throttle 00041 int Roll_Uptime; //2 700 / 1100 / 1500 (R/L) // Roll 00042 int Pitch_Uptime; //3 770 / 1170 / 1550 (B/F) // Pitch 00043 int Yaw_Uptime; //4 700 / 1090 / 1500 (R/L) // Yaw 00044 int Stabilize_Uptime; //5 LLLL / MMMM / 1500 (3,2,1) 00045 int Enable_Uptime; //6 700 / ---- / 1500 (Off/On) Note: Bind I Button 00046 int Extra_Uptime; //7 LLLL / 1100 / HHHH // IDK 00047 int Extra2_Uptime; //8 LLLL / 1100 / HHHH // IDK 00048 int Remainder_Uptime; 00049 00050 // Trim values 00051 int mThrottleTrim; 00052 int mRollTrim; 00053 int mPitchTrim; 00054 int mYawTrim; 00055 00056 void updateRemainder(); 00057 00058 public: 00059 DX6iController(PinName pwmPin); 00060 ~DX6iController(); 00061 00062 void generateSignal(int externalDelay); 00063 00064 void updateThrottle(int newThrottle); 00065 void updatePitch(int newPitch); 00066 void updateRoll(int newRoll); 00067 void updateYaw(int newYaw); 00068 00069 void updateThrottleTrim(int newThrottleTrim); 00070 void updatePitchTrim(int newPitchTrim); 00071 void updateRollTrim(int newRollTrim); 00072 void updateYawTrim(int newYawTrim); 00073 }; 00074 00075 #endif // _DX6I_CONTROLLER_H_
Generated on Tue Jul 26 2022 18:14:03 by 1.7.2