code of robot bike

Dependencies:   SDFileSystem mbed

Fork of Robot_Bicycle by Chris LU

Revision:
0:830ddddc129f
Child:
3:197b748a397a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SensorFusion.h	Thu Jun 09 09:46:38 2016 +0000
@@ -0,0 +1,44 @@
+#ifndef SENSORFUSION_H_INCLUDED
+#define SENSORFUSION_H_INCLUDED
+
+#include <math.h>
+
+#define FTimer          250.0f             ///Hz
+#define sample_time     1.0f/FTimer
+#define LOOP_TIME_MS    1000.0f/FTimer
+#define Alpha           FTimer/25.0f
+#define pi_const        3.1416f
+
+extern float axm, aym, azm, u1, u2, u3, mx, my, mz;
+extern float Ac[3];
+
+extern float axm_f, axm_f_old, u3aym_f, u3aym_f_old, u2azm_f, u2azm_f_old;
+extern float aym_f, aym_f_old, u3axm_f, u3axm_f_old, u1azm_f, u1azm_f_old;
+extern float azm_f, azm_f_old, u2axm_f, u2axm_f_old, u1aym_f, u1aym_f_old;
+
+extern float x1_hat, x2_hat, x3_hat;
+extern float sinroll, cosroll, roll_angle, droll_angle, droll_angle_old;
+extern float sinpitch, cospitch, yaw_ref, yaw_angle, yaw_angle_old, dyaw_angle, dyaw_angle_old;
+
+extern float mx_f, mx_f_old, u3my_f, u3my_f_old, u2mz_f, u2mz_f_old;
+extern float my_f, my_f_old, u3mx_f, u3mx_f_old, u1mz_f, u1mz_f_old;
+extern float mz_f, mz_f_old, u2mx_f, u2mx_f_old, u1my_f, u1my_f_old;
+
+extern float mx1_hat, mx2_hat, mx3_hat, m_sinyaw, m_cosyaw, m_yaw_angle;
+
+extern void get_9axis_data(unsigned char speed_state);
+
+extern float lpf(float input,float input_old,float frequency);
+extern void x1_hat_estimat(float a_xm,float a_ym,float a_zm,float u_3,float u_2,float alpha);
+extern void roll_fusion(float a_xm,float a_ym,float a_zm,float u_3,float u_1,float alpha);
+extern void x3_hat_estimat(float a_xm,float a_ym,float a_zm,float u_2,float u_1,float alpha);
+extern void m_x1_hat(float m_x, float m_y,float m_z,float u_3,float u_2,float alpha);
+extern void m_x2_hat(float m_x,float m_y,float m_z,float u_3,float u_1,float alpha);
+extern void m_x3_hat(float m_x,float m_y,float m_z,float u_2,float u_1,float alpha);
+extern void m_yaw_fusion(void);
+extern float Determinant(float x11, float x12, float x21, float x22);
+extern float absolute(float value);
+
+extern void Reset_data(void);
+
+#endif // SENSORFUSION_H_INCLUDED