etcs.h 699 B

1234567891011121314151617181920212223242526272829303132333435
  1. #ifndef _ETSC_H__
  2. #define _ETSC_H__
  3. typedef struct {
  4. bool b_etcs_en;
  5. bool b_etcs_running;
  6. float f_fvel;
  7. float f_torque_ref;
  8. float f_torque_tcs;
  9. float f_acc;
  10. u32 n_fv_ts;
  11. int n_etcs_run_cnt;
  12. float output;
  13. }etcs_t;
  14. void etcs_init(etcs_t *etcs);
  15. void etcs_set_fvel(etcs_t *etcs, float vel);//设置前轮速度
  16. float etcs_process(etcs_t *etcs);
  17. static __INLINE bool etcs_is_running(etcs_t *etcs) {
  18. return etcs->b_etcs_running;
  19. }
  20. static __INLINE void etcs_enable(etcs_t *etcs, bool enable) {
  21. if (etcs->b_etcs_en != enable) {
  22. etcs->b_etcs_en = enable;
  23. etcs->output = 1.0f;
  24. }
  25. }
  26. static __INLINE float etcs_get_output(etcs_t *etcs) {
  27. return etcs->output;
  28. }
  29. #endif /* _ETSC_H__ */