#ifndef _LADRC_OBSERVER_H__
#define _LADRC_OBSERVER_H__
#include "os/os_types.h"


typedef struct {
	float z1,z2;
}zStats;
#define ANGLE_BUF_NUM 16
typedef struct {
	//扩张状态观测器
	zStats alpha, beta;
	float B1,B2;
	float ts;
	float Wo; //初始带宽
	float max_eVel; //最大的电角速度
	float vel_min; //初始带宽对应的角频率
	float ld, lq, r, poles;
	float Ealpha, Ebeta;
	float Vel_El;
	float Vel_El_filter;
	float lpf_ceof; //低通滤波器系数(截止频率 x 2 x pi / Fs)
	float angle_atan;
	float angle_out;
	float angle_array[ANGLE_BUF_NUM];
	int   angle_idx;
	float angle_sum;
	float max_z1, max_z2;
}ladrc_observer;

void ladrc_observer_init(float Wo, float vel_min, float lpf_cut_off);
float ladrc_observer_update(float va, float vb, float ia, float ib);
float ladrc_observer_angle(void);
float ladrc_observer_vel(void);
ladrc_observer *ladrc_observer_get(void);

#endif /* _LADRC_OBSERVER_H__ */

