code of robot bike
Dependencies: SDFileSystem mbed
Fork of Robot_Bicycle by
Diff: ZTC.h
- Revision:
- 3:197b748a397a
- Child:
- 4:b0967990e390
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ZTC.h Wed Jun 22 04:35:18 2016 +0000 @@ -0,0 +1,45 @@ +#ifndef ZTC_H_INCLUDED +#define ZTC_H_INCLUDED + +#include "mbed.h" +#include "SensorFusion.h" + +#define GAMMA_OFFSET 3.0 / 180.0 * 3.14159 +#define L_PD_OFFSET 7.0 / 180.0 * 3.14159 +#define DLT_GAMMA_REF 6.0 / 180.0 * 3.14159 + +#define PHI_HAT_UB 0.1745f +#define PHI_HAT_LB -PHI_HAT_UB +#define K_aw 500*pi_const + +#define S_S 0 ///state of pedaling and controller +#define L_PD 1 +#define M_PD 2 +#define M_ZTC 3 +#define H_PD 4 +#define H_ZTC 5 + +///ZTC +extern float K_h[3]; +extern float K_m[3]; +extern float K_l[3]; +extern float K_s[3]; +extern float K_hphi[3]; +extern float K_mphi[3]; +extern float u; +extern float phi_hat; +extern float phi_hat_old; +extern float phi_hat_aw; +extern float dphi_hat; +extern float roll_ref; +extern float gamma_ref; +extern float gamma_rad; +extern float gamma_rad_old; +extern int8_t gamma_degree; + +extern void calc_PD(float* K, float phi_hat_in); +extern void calc_Phi(float* K_est); +extern void calc_Gamma(float u_in, float alpha, float multr); +extern void anti_wdup(void); + +#endif // ZTC_H_INCLUDED \ No newline at end of file