added gy80 dcm

Dependencies:   mbed DCM_AHRS_GY80 PID MMA8451Q

Fork of quadCommand by Greg Abdo

quadCommand/quadCommand.h

Committer:
dereklmc
Date:
2013-06-09
Revision:
6:21ae5e53bb5f
Parent:
1:9b90e7de6e09
Child:
8:72791d8c36b7

File content as of revision 6:21ae5e53bb5f:

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

#ifndef QUAD_COMMAND_H
#define QUAD_COMMAND_H

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

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.

const PinName TXPIN     =   PTD3;   // Pin used for xbee TX.
const PinName RXPIN     =   PTD2;   // Pin used for xbee RX.

#define DEFAULT_WINDUP_GUARD 20.0f

class quadCommand 
{
    public:
        quadCommand();          // Constructor.
        void run();             // Loop.
        void rxInput();         // Deal with new input from xbee.
        void updatePosition();  
        void txPosition();
    
    private:
        motor *myMotors[4];     // Array of motor objects.
        com *myCom;             // The com object.
        sensors *world;         // Sensors used to observe the world.
        
        float currentThrottle;
        float currentPitch;
        float currentRoll;
        float currentYaw;
        
        float targetThrottle;
        float targetPitch;
        float targetRoll;
        float targetYaw;
        
        PID pidPitch(1.5,0.1,1.20,DEFAULT_WINDUP_GUARD);
        PID pidRoll(1.5,0.1,1.20,DEFAULT_WINDUP_GUARD);
        PID pidYaw(1.5,0.1,1.20,DEFAULT_WINDUP_GUARD);
};

#endif