added gy80 dcm

Dependencies:   mbed DCM_AHRS_GY80 PID MMA8451Q

Fork of quadCommand by Greg Abdo

quadCommand/quadCommand.h

Committer:
dereklmc
Date:
2013-06-10
Revision:
47:adc1a438aa33
Parent:
45:088885f4a13d
Parent:
46:f1eb22f41ebc
Child:
48:75d06c707414

File content as of revision 47:adc1a438aa33:

/************************* quadCommand.h *********************************/
/*                                                                       */
/*************************************************************************/

#ifndef QUAD_COMMAND_H
#define QUAD_COMMAND_H

#include "mbed.h"
#include "motor.h"
#include "com.h"
#include "sensors.h"
#include "PID.h"

// Motor constants.
const PinName MOTOR1    =   PTD4;   // Pin used for motor 1.
const PinName MOTOR2    =   PTA12;  // Pin used for motor 2.
const PinName MOTOR3    =   PTA4;   // Pin used for motor 3.
const PinName MOTOR4    =   PTA5;   // Pin used for motor 4.

// Xbee constants.
// Alternative Pins 
//  RX = PTA1,  TX PTA2
const PinName TXPIN     =   PTD3;   // Pin used for xbee TX.
const PinName RXPIN     =   PTD2;   // Pin used for xbee RX.


// Sensor constants.
#define MMA8451_I2C_ADDRESS (0x1d<<1)   // Address of I2C accelerometer.
const PinName ACCSDA    =   PTE25;  // Pin for accelerometer SDA line.
const PinName ACCSCL    =   PTE24;  // Pin for accelerometer SCL line.

const float SENSSORDELAY = .2;

// PID constants.
#define DEFAULT_WINDUP_GUARD 20.0f  

class quadCommand 
{
    public:
        quadCommand();          // Constructor.
        void run();             // Loop.
        void rxInput();         // Deal with new input from xbee.
        void updateMotors();
        void updateCurrent();
        void sendTelemetry();
         
        static const float MOTOR_UPDATE;
        
    private:
        motor *myMotors[4];     // Array of motor objects.
        com *myCom;             // The com object.
        sensors *world;         // Sensors used to observe the world.
        
        Ticker sensorProcess;
        
        float currentThrottle;
        float currentPitch;
        float currentRoll;
        float currentYaw;
        
        float targetThrottle;
        float targetPitch;
        float targetRoll;
        float targetYaw;
        
        PID pidThrottle;
        PID pidPitch;
        PID pidRoll;
        PID pidYaw;
        
        Ticker sensorProcess;
};

#endif