added gy80 dcm
Dependencies: mbed DCM_AHRS_GY80 PID MMA8451Q
Fork of quadCommand by
quadCommand/quadCommand.h@8:72791d8c36b7, 2013-06-09 (annotated)
- Committer:
- dereklmc
- Date:
- Sun Jun 09 23:36:31 2013 +0000
- Revision:
- 8:72791d8c36b7
- Parent:
- 6:21ae5e53bb5f
- Child:
- 9:9e0d0ba5b6b1
- Child:
- 15:92ecb025fbc5
Pulled out update motors, set to ticker.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gabdo | 0:8681037b9a18 | 1 | /************************* quadCommand.h *********************************/ |
gabdo | 0:8681037b9a18 | 2 | /* */ |
gabdo | 0:8681037b9a18 | 3 | /*************************************************************************/ |
gabdo | 0:8681037b9a18 | 4 | |
gabdo | 0:8681037b9a18 | 5 | #ifndef QUAD_COMMAND_H |
gabdo | 0:8681037b9a18 | 6 | #define QUAD_COMMAND_H |
gabdo | 0:8681037b9a18 | 7 | |
gabdo | 0:8681037b9a18 | 8 | #include "mbed.h" |
gabdo | 0:8681037b9a18 | 9 | #include "motor.h" |
gabdo | 0:8681037b9a18 | 10 | #include "com.h" |
gabdo | 0:8681037b9a18 | 11 | #include "sensors.h" |
gabdo | 0:8681037b9a18 | 12 | |
gabdo | 0:8681037b9a18 | 13 | const PinName MOTOR1 = PTD4; // Pin used for motor 1. |
gabdo | 0:8681037b9a18 | 14 | const PinName MOTOR2 = PTA12; // Pin used for motor 2. |
gabdo | 0:8681037b9a18 | 15 | const PinName MOTOR3 = PTA4; // Pin used for motor 3. |
gabdo | 0:8681037b9a18 | 16 | const PinName MOTOR4 = PTA5; // Pin used for motor 4. |
gabdo | 0:8681037b9a18 | 17 | |
gabdo | 0:8681037b9a18 | 18 | const PinName TXPIN = PTD3; // Pin used for xbee TX. |
gabdo | 0:8681037b9a18 | 19 | const PinName RXPIN = PTD2; // Pin used for xbee RX. |
gabdo | 0:8681037b9a18 | 20 | |
dereklmc | 6:21ae5e53bb5f | 21 | #define DEFAULT_WINDUP_GUARD 20.0f |
dereklmc | 6:21ae5e53bb5f | 22 | |
gabdo | 0:8681037b9a18 | 23 | class quadCommand |
gabdo | 0:8681037b9a18 | 24 | { |
gabdo | 0:8681037b9a18 | 25 | public: |
gabdo | 0:8681037b9a18 | 26 | quadCommand(); // Constructor. |
gabdo | 0:8681037b9a18 | 27 | void run(); // Loop. |
gabdo | 0:8681037b9a18 | 28 | void rxInput(); // Deal with new input from xbee. |
dereklmc | 8:72791d8c36b7 | 29 | void updateMotors(); |
gabdo | 0:8681037b9a18 | 30 | |
gabdo | 0:8681037b9a18 | 31 | private: |
gabdo | 0:8681037b9a18 | 32 | motor *myMotors[4]; // Array of motor objects. |
gabdo | 0:8681037b9a18 | 33 | com *myCom; // The com object. |
gabdo | 0:8681037b9a18 | 34 | sensors *world; // Sensors used to observe the world. |
gabdo | 0:8681037b9a18 | 35 | |
gabdo | 1:9b90e7de6e09 | 36 | float currentThrottle; |
gabdo | 1:9b90e7de6e09 | 37 | float currentPitch; |
gabdo | 1:9b90e7de6e09 | 38 | float currentRoll; |
gabdo | 1:9b90e7de6e09 | 39 | float currentYaw; |
gabdo | 0:8681037b9a18 | 40 | |
gabdo | 1:9b90e7de6e09 | 41 | float targetThrottle; |
gabdo | 1:9b90e7de6e09 | 42 | float targetPitch; |
gabdo | 1:9b90e7de6e09 | 43 | float targetRoll; |
gabdo | 1:9b90e7de6e09 | 44 | float targetYaw; |
dereklmc | 6:21ae5e53bb5f | 45 | |
dereklmc | 6:21ae5e53bb5f | 46 | PID pidPitch(1.5,0.1,1.20,DEFAULT_WINDUP_GUARD); |
dereklmc | 6:21ae5e53bb5f | 47 | PID pidRoll(1.5,0.1,1.20,DEFAULT_WINDUP_GUARD); |
dereklmc | 6:21ae5e53bb5f | 48 | PID pidYaw(1.5,0.1,1.20,DEFAULT_WINDUP_GUARD); |
dereklmc | 8:72791d8c36b7 | 49 | |
dereklmc | 8:72791d8c36b7 | 50 | static const float MOTOR_UPDATE; |
gabdo | 0:8681037b9a18 | 51 | }; |
gabdo | 0:8681037b9a18 | 52 | |
gabdo | 0:8681037b9a18 | 53 | #endif |