added gy80 dcm

Dependencies:   mbed DCM_AHRS_GY80 PID MMA8451Q

Fork of quadCommand by Greg Abdo

Revision:
56:a550127695b2
Parent:
55:bca9c9e92da6
Child:
58:983801808a94
--- a/quadCommand/quadCommand.h	Thu Jun 13 01:11:03 2013 +0000
+++ b/quadCommand/quadCommand.h	Tue Jul 02 21:03:46 2013 +0000
@@ -17,13 +17,11 @@
 #define MOTOR1              PTD4        // Pin used for motor 1.
 #define MOTOR2              PTA12       // Pin used for motor 2.
 #define MOTOR3              PTA4        // Pin used for motor 3.
-#define MOTOR4              PTC8        // Pin used for motor 4.
+#define MOTOR4              PTA5        // Pin used for motor 4.
 
 // Xbee constants.
-// Alternative Pins 
-//  RX = PTA1,  TX PTA2
-#define TXPIN               PTD3        // Pin used for xbee TX.
-#define RXPIN               PTD2        // Pin used for xbee RX.
+#define TXPIN               PTA2        // Pin used for xbee TX.
+#define RXPIN               PTA1        // Pin used for xbee RX.
 
 
 // Sensor constants.
@@ -32,50 +30,44 @@
 #define ACCSCL              PTE24       // Pin for accelerometer SCL line.
 
 // PID constants.
-#define DEFAULT_WINDUP_GUARD 20.0f
-#define PID_P 10.0
-#define PID_I 0.0
-#define PID_D 5.0
-#define MOTOR_UPDATE        50.0f
+#define DEFAULT_WINDUP_GUARD 5.0        // Integral windup.
+#define PID_P 8.0                       // Proportional gain.
+#define PID_I 0.0                       // Integral gain.
+#define PID_D 0.0                       // Derivative gain.
+#define MOTOR_UPDATE       100.0        // Motor update speed.
 
 class quadCommand 
 {
     public:
-        quadCommand();          // Constructor.
-        void run();             // The main loop.
-        void rxInput();         // Receive data from the Xbee.
-        void updateMotors();    // Send PID values to the motors.
-        void updateCurrent();   // Update the current telemetry.
-        void sendTelemetry();   // Transmit the current telemetry.
+        quadCommand();                  // Constructor.
+        void run();                     // The main loop.
+        void rxInput();                 // Receive data from the Xbee.
+        void updateMotors();            // Send PID values to the motors.
+        void updateCurrent();           // Update the current telemetry.
         
     private:
-        //Serial *pc; // tx, rx
+        motor *myMotors[4];             // Array of motor objects.
+        com *myCom;                     // The com object for Xbee communication.
+        sensors *world;                 // Sensors used to observe the world.
         
-        motor *myMotors[4];     // Array of motor objects.
-        com *myCom;             // The com object for Xbee communication.
-        sensors *world;         // Sensors used to observe the world.
+        PID pidPitch;                   // PID for pitch.
+        PID pidRoll;                    // PID for roll.
+        PID pidYaw;                     // PID for yaw.
         
-        PID pidThrottle;        // PID for throttle.
-        PID pidPitch;           // PID for pitch.
-        PID pidRoll;            // PID for roll.
-        PID pidYaw;             // PID for yaw.
+        Ticker motorProcess;            // Timer for updating the motors.
         
-        Ticker motorProcess;    // Timer for updating the motors.
-        //Ticker sensorProcess;   // Timer for getting sensor data.
-        //Ticker sendProcess;     // Timer for sending data through the Xbee.
+        float currentThrottle;          // Current throttle.
+        float currentPitch;             // Current pitch.
+        float currentRoll;              // Current roll.
+        float currentYaw;               // Current yaw.
         
-        float currentThrottle;  // Current throttle.
-        float currentPitch;     // Current pitch.
-        float currentRoll;      // Current roll.
-        float currentYaw;       // Current yaw.
+        float pitchTrim;                // Trim the pitch.
+        float rollTrim;                 // Trim the roll.
         
-        float pitchTrim;
-        float rollTrim;
-        
-        float targetThrottle;   // Desired throttle.
-        float targetPitch;      // Desired pitch.
-        float targetRoll;       // Desired roll.
-        float targetYaw;        // Desired yaw. 
+        float targetThrottle;           // Desired throttle.
+        float targetPitch;              // Desired pitch.
+        float targetRoll;               // Desired roll.
+        float targetYaw;                // Desired yaw. 
 };
 
 #endif
\ No newline at end of file