Attitude estimation using IMU (3-DoF ver.)
Fork of ATTITUDE_ESTIMATION by
ATTITUDE_ESTIMATION.h
- Committer:
- benson516
- Date:
- 2016-04-28
- Revision:
- 1:edc7ccfc5562
- Parent:
- 0:8126c86bac2a
- Child:
- 2:46d355d7abaa
File content as of revision 1:edc7ccfc5562:
#ifndef _ATTITUDE_ESTIMATION_H_ #define _ATTITUDE_ESTIMATION_H_ #include "mbed.h" // Class class ATTITUDE{ public: // Variables float alpha; // Convergent rate, rad/sec. float Ts; // Sampling time, sec. float EulerAngle[3]; float ys[3]; // Sensor output float omega[3]; // Rotation speed in body-fixed frame // Constructor: // Initialize the estimator ATTITUDE(float alpha_in, float Ts_in); // alpha in rad/sec., Ts in sec. // Methods // Transformations //float* Vector_to_SkewSymmetry(float v_in[]); //float* SkewSymmetry_to_Vector(float M_in[3][]); void gVector_to_EulerAngle(float v_out[],float v_in[]); //float* EulerAngle_to_gVector(float Eu_in[]); // vector operation void Get_CrossProduct3(float v_c[],float v_a[], float v_b[]); // v_c = v_a X v_b float Get_Vector3Norm(float v_in[]); // Estimator void Init_Estimator(float y_in[]); // Let _x_est = y_in void Run_Estimator(float y_in[], float omega_in[]); // Main alogorithm void Get_Estimation(float v[]); void Get_Attitude_Euler(float v[]); private: float _unit_nk[3]; // (-k) direction [0;0;-1] float _zero3[3]; // Zero vector [0;0;0] // int8_t _init_flag; // Flag for displaying initialization status float _x_est[3]; // Estimated state // float _omega_x[3][3]; // Skew symmetric matrix of omega float _L1_diag[3]; // Diagonal vector of gain matrix L1 // Method void Set_vector3(float v_a[], float v_b[]); // Vectors in R^3. Let the values of v_b be set to v_a void Set_L1_diag(float alpha); // set diagnal element of gain matrix }; #endif // _ATTITUDE_ESTIMATION_H_