code of robot bike

Dependencies:   SDFileSystem mbed

Fork of Robot_Bicycle by Chris LU

Committer:
YCTung
Date:
Sun Jul 10 06:23:02 2016 +0000
Revision:
6:bd469c945e41
Parent:
4:b0967990e390
add SDFileSystem library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
YCTung 3:197b748a397a 1 #ifndef ZTC_H_INCLUDED
YCTung 3:197b748a397a 2 #define ZTC_H_INCLUDED
YCTung 3:197b748a397a 3
YCTung 3:197b748a397a 4 #include "mbed.h"
YCTung 3:197b748a397a 5 #include "SensorFusion.h"
YCTung 3:197b748a397a 6
YCTung 4:b0967990e390 7 #define GAMMA_OFFSET 1.0 / 180.0 * 3.14159
YCTung 6:bd469c945e41 8 #define L_PD_OFFSET 5.0 / 180.0 * 3.14159
YCTung 3:197b748a397a 9 #define DLT_GAMMA_REF 6.0 / 180.0 * 3.14159
YCTung 3:197b748a397a 10
YCTung 3:197b748a397a 11 #define PHI_HAT_UB 0.1745f
YCTung 3:197b748a397a 12 #define PHI_HAT_LB -PHI_HAT_UB
YCTung 3:197b748a397a 13 #define K_aw 500*pi_const
YCTung 3:197b748a397a 14
YCTung 3:197b748a397a 15 #define S_S 0 ///state of pedaling and controller
YCTung 3:197b748a397a 16 #define L_PD 1
YCTung 3:197b748a397a 17 #define M_PD 2
YCTung 3:197b748a397a 18 #define M_ZTC 3
YCTung 3:197b748a397a 19 #define H_PD 4
YCTung 3:197b748a397a 20 #define H_ZTC 5
YCTung 3:197b748a397a 21
YCTung 3:197b748a397a 22 ///ZTC
YCTung 3:197b748a397a 23 extern float K_h[3];
YCTung 3:197b748a397a 24 extern float K_m[3];
YCTung 3:197b748a397a 25 extern float K_l[3];
YCTung 3:197b748a397a 26 extern float K_s[3];
YCTung 3:197b748a397a 27 extern float K_hphi[3];
YCTung 3:197b748a397a 28 extern float K_mphi[3];
YCTung 3:197b748a397a 29 extern float u;
YCTung 3:197b748a397a 30 extern float phi_hat;
YCTung 3:197b748a397a 31 extern float phi_hat_old;
YCTung 3:197b748a397a 32 extern float phi_hat_aw;
YCTung 3:197b748a397a 33 extern float dphi_hat;
YCTung 3:197b748a397a 34 extern float roll_ref;
YCTung 3:197b748a397a 35 extern float gamma_ref;
YCTung 3:197b748a397a 36 extern float gamma_rad;
YCTung 3:197b748a397a 37 extern float gamma_rad_old;
YCTung 3:197b748a397a 38 extern int8_t gamma_degree;
YCTung 3:197b748a397a 39
YCTung 3:197b748a397a 40 extern void calc_PD(float* K, float phi_hat_in);
YCTung 3:197b748a397a 41 extern void calc_Phi(float* K_est);
YCTung 3:197b748a397a 42 extern void calc_Gamma(float u_in, float alpha, float multr);
YCTung 3:197b748a397a 43 extern void anti_wdup(void);
YCTung 3:197b748a397a 44
YCTung 3:197b748a397a 45 #endif // ZTC_H_INCLUDED