![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
added gy80 dcm
Dependencies: mbed DCM_AHRS_GY80 PID MMA8451Q
Fork of quadCommand by
Diff: quadCommand/quadCommand.h
- Revision:
- 50:197a18e49eb4
- Parent:
- 49:f202fb0d4128
- Child:
- 51:60258b84ebab
--- a/quadCommand/quadCommand.h Mon Jun 10 04:43:30 2013 +0000 +++ b/quadCommand/quadCommand.h Mon Jun 10 05:04:53 2013 +0000 @@ -12,29 +12,27 @@ #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. +#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 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. +#define TXPIN PTD3 // Pin used for xbee TX. +#define 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. - -#define SENSSORDELAY 10.0f -#define SENDDELAY 10.0f +#define ACCSDA PTE25 // Pin for accelerometer SDA line. +#define ACCSCL PTE24 // Pin for accelerometer SCL line. +#define SENSSOR_DELAY 500.0f // PID constants. #define DEFAULT_WINDUP_GUARD 20.0f -#define MOTOR_UPDATE 10.0f +#define MOTOR_UPDATE 500.0f class quadCommand { @@ -48,27 +46,26 @@ private: motor *myMotors[4]; // Array of motor objects. - com *myCom; // The com object. + com *myCom; // The com object for Xbee communication. sensors *world; // Sensors used to observe the world. - Ticker sensorProcess; - Ticker sendProcess; - Ticker motorProcess; // Control timer + PID pidThrottle; // PID for throttle. + PID pidPitch; // PID for pitch. + PID pidRoll; // PID for roll. + PID pidYaw; // PID for yaw. - float currentThrottle; - float currentPitch; - float currentRoll; - float currentYaw; + Ticker sensorProcess; // Timer for getting sensor data. + Ticker motorProcess; // Timer for updating the motors. - float targetThrottle; - float targetPitch; - float targetRoll; - float targetYaw; + float currentThrottle; // Current throttle. + float currentPitch; // Current pitch. + float currentRoll; // Current roll. + float currentYaw; // Current yaw. - PID pidThrottle; - PID pidPitch; - PID pidRoll; - PID pidYaw; + float targetThrottle; // Desired throttle. + float targetPitch; // Desired pitch. + float targetRoll; // Desired roll. + float targetYaw; // Desired yaw. }; #endif \ No newline at end of file