code of robot bike

Dependencies:   SDFileSystem mbed

Fork of Nucleo_ZTC_20160607_never_touched by Chris LU

Committer:
cpul5338
Date:
Wed Feb 22 09:49:44 2017 +0000
Revision:
12:60593247555d
Parent:
3:197b748a397a
robot bike

Who changed what in which revision?

UserRevisionLine numberNew contents of line
YCTung 0:830ddddc129f 1 #ifndef SENSORFUSION_H_INCLUDED
YCTung 0:830ddddc129f 2 #define SENSORFUSION_H_INCLUDED
YCTung 0:830ddddc129f 3
YCTung 0:830ddddc129f 4 #include <math.h>
YCTung 0:830ddddc129f 5
YCTung 0:830ddddc129f 6 #define FTimer 250.0f ///Hz
YCTung 0:830ddddc129f 7 #define sample_time 1.0f/FTimer
YCTung 0:830ddddc129f 8 #define LOOP_TIME_MS 1000.0f/FTimer
YCTung 0:830ddddc129f 9 #define Alpha FTimer/25.0f
YCTung 3:197b748a397a 10 #define pi_const 3.14159f
YCTung 0:830ddddc129f 11
YCTung 0:830ddddc129f 12 extern float axm, aym, azm, u1, u2, u3, mx, my, mz;
YCTung 0:830ddddc129f 13 extern float Ac[3];
YCTung 0:830ddddc129f 14
YCTung 0:830ddddc129f 15 extern float axm_f, axm_f_old, u3aym_f, u3aym_f_old, u2azm_f, u2azm_f_old;
YCTung 0:830ddddc129f 16 extern float aym_f, aym_f_old, u3axm_f, u3axm_f_old, u1azm_f, u1azm_f_old;
YCTung 0:830ddddc129f 17 extern float azm_f, azm_f_old, u2axm_f, u2axm_f_old, u1aym_f, u1aym_f_old;
YCTung 0:830ddddc129f 18
YCTung 0:830ddddc129f 19 extern float x1_hat, x2_hat, x3_hat;
YCTung 0:830ddddc129f 20 extern float sinroll, cosroll, roll_angle, droll_angle, droll_angle_old;
YCTung 0:830ddddc129f 21 extern float sinpitch, cospitch, yaw_ref, yaw_angle, yaw_angle_old, dyaw_angle, dyaw_angle_old;
YCTung 0:830ddddc129f 22
YCTung 0:830ddddc129f 23 extern float mx_f, mx_f_old, u3my_f, u3my_f_old, u2mz_f, u2mz_f_old;
YCTung 0:830ddddc129f 24 extern float my_f, my_f_old, u3mx_f, u3mx_f_old, u1mz_f, u1mz_f_old;
YCTung 0:830ddddc129f 25 extern float mz_f, mz_f_old, u2mx_f, u2mx_f_old, u1my_f, u1my_f_old;
YCTung 0:830ddddc129f 26
YCTung 0:830ddddc129f 27 extern float mx1_hat, mx2_hat, mx3_hat, m_sinyaw, m_cosyaw, m_yaw_angle;
YCTung 0:830ddddc129f 28
YCTung 0:830ddddc129f 29 extern void get_9axis_data(unsigned char speed_state);
YCTung 0:830ddddc129f 30
YCTung 0:830ddddc129f 31 extern float lpf(float input,float input_old,float frequency);
YCTung 0:830ddddc129f 32 extern void x1_hat_estimat(float a_xm,float a_ym,float a_zm,float u_3,float u_2,float alpha);
YCTung 0:830ddddc129f 33 extern void roll_fusion(float a_xm,float a_ym,float a_zm,float u_3,float u_1,float alpha);
YCTung 0:830ddddc129f 34 extern void x3_hat_estimat(float a_xm,float a_ym,float a_zm,float u_2,float u_1,float alpha);
YCTung 0:830ddddc129f 35 extern void m_x1_hat(float m_x, float m_y,float m_z,float u_3,float u_2,float alpha);
YCTung 0:830ddddc129f 36 extern void m_x2_hat(float m_x,float m_y,float m_z,float u_3,float u_1,float alpha);
YCTung 0:830ddddc129f 37 extern void m_x3_hat(float m_x,float m_y,float m_z,float u_2,float u_1,float alpha);
YCTung 0:830ddddc129f 38 extern void m_yaw_fusion(void);
YCTung 0:830ddddc129f 39 extern float Determinant(float x11, float x12, float x21, float x22);
YCTung 0:830ddddc129f 40 extern float absolute(float value);
YCTung 0:830ddddc129f 41
YCTung 0:830ddddc129f 42 extern void Reset_data(void);
YCTung 0:830ddddc129f 43
YCTung 0:830ddddc129f 44 #endif // SENSORFUSION_H_INCLUDED