Ian Hua / Quadcopter-mbedRTOS
Committer:
pHysiX
Date:
Mon May 12 13:20:06 2014 +0000
Revision:
32:7a9be7761c46
Parent:
30:d9b988f8d84f
Child:
39:02782ad251db
Increased PID and ESC update frequency.; ; Thread1: Only services ypr telemetry output; Thread2: Cascaded PI-PI control; Thread3: Changed UART control; Thread4: Changed calibration output and throttle, removed ESCpower output

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 12:953d25061417 17 #ifdef ENABLE_COMPASS
pHysiX 12:953d25061417 18 #include "HMC5883L.h"
pHysiX 12:953d25061417 19 #endif
pHysiX 1:43f8ac7ca6d7 20
pHysiX 1:43f8ac7ca6d7 21 #ifndef _SETUP_H_
pHysiX 1:43f8ac7ca6d7 22 #define _SETUP_H_
pHysiX 1:43f8ac7ca6d7 23
pHysiX 22:ef8aa9728013 24 /* PID Gains: */
pHysiX 22:ef8aa9728013 25 extern float KP_PITCH_STABLE;
pHysiX 22:ef8aa9728013 26 extern float KP_ROLL_STABLE;
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 21:b642c18eccd1 33 extern float PID_TI_STABLE;
pHysiX 21:b642c18eccd1 34
pHysiX 22:ef8aa9728013 35 /* Sensors and devices: */
pHysiX 1:43f8ac7ca6d7 36 extern Serial BT;
pHysiX 1:43f8ac7ca6d7 37 extern DigitalOut BT_CMD;
pHysiX 1:43f8ac7ca6d7 38 extern MPU6050 imu;
pHysiX 1:43f8ac7ca6d7 39 extern uint16_t packetSize;
pHysiX 22:ef8aa9728013 40 extern MPL3115A2 altimeter;
pHysiX 22:ef8aa9728013 41 extern PwmOut ESC[4];
pHysiX 12:953d25061417 42
pHysiX 22:ef8aa9728013 43 /* PID Devices: */
pHysiX 21:b642c18eccd1 44 extern PID pitchPIDstable;
pHysiX 21:b642c18eccd1 45 extern PID rollPIDstable;
pHysiX 3:605fbcb54e75 46 extern PID yawPIDrate;
pHysiX 3:605fbcb54e75 47 extern PID pitchPIDrate;
pHysiX 3:605fbcb54e75 48 extern PID rollPIDrate;
pHysiX 1:43f8ac7ca6d7 49
pHysiX 22:ef8aa9728013 50 /* Setup routines: */
pHysiX 3:605fbcb54e75 51 bool setupALLdevices(void);
pHysiX 2:ab967d7b4346 52 bool setup_ESC(void);
pHysiX 1:43f8ac7ca6d7 53 bool setup_bt(void);
pHysiX 3:605fbcb54e75 54 bool setup_PID(void);
pHysiX 1:43f8ac7ca6d7 55 bool setup_mpu6050(void);
pHysiX 22:ef8aa9728013 56 bool setup_altimeter(void);
pHysiX 22:ef8aa9728013 57
pHysiX 12:953d25061417 58 #ifdef ENABLE_COMPASS
pHysiX 22:ef8aa9728013 59 extern HMC5883L compass;
pHysiX 12:953d25061417 60 bool setup_compass(void);
pHysiX 12:953d25061417 61 #endif
pHysiX 1:43f8ac7ca6d7 62
pHysiX 1:43f8ac7ca6d7 63 #endif