![](/media/cache/profiles/1688692e577cac3d17b703f2a3b3c097.50x50_q85.jpg)
A quadcopter control Software (Still in development). achieved single axis stability!!!!! released for others benefit. if you'd like to help co-develop this code, then please let me know
Dependencies: MovingAverageFilter MyI2C PID RC mbed-rtos mbed
Currently on hold, due to the fact that i don't own a RX/TX system
Diff: DCM/DCM.h
- Revision:
- 1:e08a4f517989
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DCM/DCM.h Tue Aug 27 09:38:49 2013 +0000 @@ -0,0 +1,56 @@ +#ifndef DCM_H +#define DCM_H + +#include "mbed.h" + +#define GRAVITY 4096 +#define Kp_ROLLPITCH 1.515/GRAVITY //1.515 +#define Ki_ROLLPITCH 0.00101/GRAVITY //0.00101 + + +class DCM{ + +public: + + DCM(void); + +float G_Dt; + +float roll; + +float pitch; + +float yaw; + +void Update_DCM(float dt,float a, float b, float c, float d, float e, float f); + +float DCM_Matrix[3][3]; + +float Update_Matrix[3][3]; + +float Temporary_Matrix[3][3]; + +private: + +float Accel_Vector[3]; //Store the acceleration in a vector +float Gyro_Vector[3];//Store the gyros rutn rate in a vector +float Omega_Vector[3]; //Corrected Gyro_Vector data +float Omega_P[3];//Omega Proportional correction +float Omega_I[3];//Omega Integrator +float Omega[3]; +float errorRollPitch[3]; + + +float constrain(float x, float a, float b); + +void Normalize(void); + +void Drift_correction(void); + +void Matrix_update(float GyroX,float GyroY,float GyroZ, float AccX, float AccY, float AccZ); + +void Euler_angles(void); + +}; + +#endif \ No newline at end of file