Ian Hua / Quadcopter-mbedRTOS
Committer:
pHysiX
Date:
Wed May 14 12:42:39 2014 +0000
Revision:
39:02782ad251db
Parent:
32:7a9be7761c46
Child:
48:9dbdc4144f00
PID tuned; Frequency of Attitude and Rate PID decreased; ESC frequency decreased; RTOS back to stable; Increased stick gains

Who changed what in which revision?

UserRevisionLine numberNew contents of line
pHysiX 22:ef8aa9728013 1 /* File: setup.h
pHysiX 22:ef8aa9728013 2 * Author: Trung Tin Ian HUA
pHysiX 22:ef8aa9728013 3 * Date: May 2014
pHysiX 22:ef8aa9728013 4 * Purpose: Setup code to initialise all devices.
pHysiX 22:ef8aa9728013 5 */
pHysiX 30:d9b988f8d84f 6 //#define TIME_TASK1
pHysiX 30:d9b988f8d84f 7 //#define TIME_TASK2M
pHysiX 30:d9b988f8d84f 8 //#define TIME_TASK2S
pHysiX 30:d9b988f8d84f 9 //#define TIME_TASK3
pHysiX 30:d9b988f8d84f 10 //#define TIME_TASK4
pHysiX 22:ef8aa9728013 11
pHysiX 1:43f8ac7ca6d7 12 #include "mbed.h"
pHysiX 1:43f8ac7ca6d7 13 #include "MPU6050_6Axis_MotionApps20.h"
pHysiX 3:605fbcb54e75 14 #include "PID.h"
pHysiX 12:953d25061417 15 #include "MPL3115A2.h"
pHysiX 12:953d25061417 16
pHysiX 39:02782ad251db 17 #include "config.h"
pHysiX 39:02782ad251db 18
pHysiX 12:953d25061417 19 #ifdef ENABLE_COMPASS
pHysiX 12:953d25061417 20 #include "HMC5883L.h"
pHysiX 12:953d25061417 21 #endif
pHysiX 1:43f8ac7ca6d7 22
pHysiX 1:43f8ac7ca6d7 23 #ifndef _SETUP_H_
pHysiX 1:43f8ac7ca6d7 24 #define _SETUP_H_
pHysiX 1:43f8ac7ca6d7 25
pHysiX 22:ef8aa9728013 26 /* PID Gains: */
pHysiX 20:b193a50a2ba3 27 extern float KP_YAW_RATE;
pHysiX 20:b193a50a2ba3 28 extern float KP_PITCH_RATE;
pHysiX 20:b193a50a2ba3 29 extern float KP_ROLL_RATE;
pHysiX 32:7a9be7761c46 30 extern float TI_YAW_RATE;
pHysiX 32:7a9be7761c46 31 extern float TI_PITCH_RATE;
pHysiX 32:7a9be7761c46 32 extern float TI_ROLL_RATE;
pHysiX 39:02782ad251db 33
pHysiX 39:02782ad251db 34 extern float KP_PITCH_ATTITUDE;
pHysiX 39:02782ad251db 35 extern float KP_ROLL_ATTITUDE;
pHysiX 39:02782ad251db 36 extern float TI_PITCH_ATTITUDE;
pHysiX 39:02782ad251db 37 extern float TI_ROLL_ATTITUDE;
pHysiX 21:b642c18eccd1 38
pHysiX 22:ef8aa9728013 39 /* Sensors and devices: */
pHysiX 1:43f8ac7ca6d7 40 extern Serial BT;
pHysiX 1:43f8ac7ca6d7 41 extern DigitalOut BT_CMD;
pHysiX 1:43f8ac7ca6d7 42 extern MPU6050 imu;
pHysiX 1:43f8ac7ca6d7 43 extern uint16_t packetSize;
pHysiX 22:ef8aa9728013 44 extern MPL3115A2 altimeter;
pHysiX 22:ef8aa9728013 45 extern PwmOut ESC[4];
pHysiX 12:953d25061417 46
pHysiX 22:ef8aa9728013 47 /* PID Devices: */
pHysiX 39:02782ad251db 48 extern PID pitchPIDattitude;
pHysiX 39:02782ad251db 49 extern PID rollPIDattitude;
pHysiX 3:605fbcb54e75 50 extern PID yawPIDrate;
pHysiX 3:605fbcb54e75 51 extern PID pitchPIDrate;
pHysiX 3:605fbcb54e75 52 extern PID rollPIDrate;
pHysiX 1:43f8ac7ca6d7 53
pHysiX 22:ef8aa9728013 54 /* Setup routines: */
pHysiX 3:605fbcb54e75 55 bool setupALLdevices(void);
pHysiX 2:ab967d7b4346 56 bool setup_ESC(void);
pHysiX 1:43f8ac7ca6d7 57 bool setup_bt(void);
pHysiX 3:605fbcb54e75 58 bool setup_PID(void);
pHysiX 1:43f8ac7ca6d7 59 bool setup_mpu6050(void);
pHysiX 22:ef8aa9728013 60 bool setup_altimeter(void);
pHysiX 22:ef8aa9728013 61
pHysiX 12:953d25061417 62 #ifdef ENABLE_COMPASS
pHysiX 22:ef8aa9728013 63 extern HMC5883L compass;
pHysiX 12:953d25061417 64 bool setup_compass(void);
pHysiX 12:953d25061417 65 #endif
pHysiX 1:43f8ac7ca6d7 66
pHysiX 1:43f8ac7ca6d7 67 #endif