Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
RTOS-Threads/inc/Task2_Master.h@38:ef65533cca32, 2014-05-13 (annotated)
- Committer:
- pHysiX
- Date:
- Tue May 13 13:05:03 2014 +0000
- Revision:
- 38:ef65533cca32
- Parent:
- 36:d95e3d6f2fc4
- Child:
- 44:4be5c01c6de2
Quadcopter unstable again. ; Working on KP and KI for Rate and Attitude.; Still experimenting with frequency of Rate and Attitude loop.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| pHysiX | 27:18b6580eb0b1 | 1 | /* File: Task2_Master.h |
| pHysiX | 27:18b6580eb0b1 | 2 | * Author: Trung Tin Ian HUA |
| pHysiX | 27:18b6580eb0b1 | 3 | * Date: May 2014 |
| pHysiX | 36:d95e3d6f2fc4 | 4 | * Purpose: Thread2M: Master PID control loop (attitude) |
| pHysiX | 36:d95e3d6f2fc4 | 5 | * Functions: AHRSSample: Read MPU6050 DMP and calculate YPR |
| pHysiX | 36:d95e3d6f2fc4 | 6 | * Settings: 200Hz |
| pHysiX | 36:d95e3d6f2fc4 | 7 | */ |
| pHysiX | 27:18b6580eb0b1 | 8 | #include "mbed.h" |
| pHysiX | 27:18b6580eb0b1 | 9 | #include "rtos.h" |
| pHysiX | 27:18b6580eb0b1 | 10 | #include "tasks.h" |
| pHysiX | 27:18b6580eb0b1 | 11 | |
| pHysiX | 27:18b6580eb0b1 | 12 | #ifndef _TASK2_MASTER_H_ |
| pHysiX | 27:18b6580eb0b1 | 13 | #define _TASK2_MASTER_H_ |
| pHysiX | 27:18b6580eb0b1 | 14 | |
| pHysiX | 29:6c03b30b59ec | 15 | // ms timing: Refer to tasks.h to change frequency of Task2_Master. |
| pHysiX | 38:ef65533cca32 | 16 | #define TASK2_MASTER_PERIOD 1000/TASK2_MASTER_FREQUENCY |
| pHysiX | 27:18b6580eb0b1 | 17 | |
| pHysiX | 36:d95e3d6f2fc4 | 18 | |
| pHysiX | 36:d95e3d6f2fc4 | 19 | #ifdef ENABLE_COMPASS |
| pHysiX | 36:d95e3d6f2fc4 | 20 | extern double heading; |
| pHysiX | 36:d95e3d6f2fc4 | 21 | #endif |
| pHysiX | 36:d95e3d6f2fc4 | 22 | |
| pHysiX | 38:ef65533cca32 | 23 | extern float ypr_rad[3]; |
| pHysiX | 38:ef65533cca32 | 24 | extern volatile float ypr[3]; |
| pHysiX | 27:18b6580eb0b1 | 25 | extern volatile float adjust_attitude[3]; |
| pHysiX | 27:18b6580eb0b1 | 26 | |
| pHysiX | 27:18b6580eb0b1 | 27 | /* Thread2-Master: Attitude PID Control */ |
| pHysiX | 27:18b6580eb0b1 | 28 | void Task2_Master(void const *argument); |
| pHysiX | 27:18b6580eb0b1 | 29 | |
| pHysiX | 36:d95e3d6f2fc4 | 30 | // ======================== |
| pHysiX | 36:d95e3d6f2fc4 | 31 | // === Helper functions === |
| pHysiX | 36:d95e3d6f2fc4 | 32 | // ======================== |
| pHysiX | 36:d95e3d6f2fc4 | 33 | void AHRSSample(void); |
| pHysiX | 36:d95e3d6f2fc4 | 34 | |
| pHysiX | 27:18b6580eb0b1 | 35 | #endif |