mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 09:18:00 +08:00
libdsp/lib_observer.c: separate angle observer from speed observer
They can be used completely independently, so they should'n be coupled. For example, a sensored motor controller in speed control mode doesn't need an angle estimator.
This commit is contained in:
+33
-24
@@ -257,25 +257,31 @@ struct openloop_data_f32_s
|
||||
float per; /* Open-loop control execution period */
|
||||
};
|
||||
|
||||
/* Common motor observer structure */
|
||||
/* Common motor speed observer structure */
|
||||
|
||||
struct motor_observer_f32_s
|
||||
struct motor_sobserver_f32_s
|
||||
{
|
||||
float angle; /* Estimated observer angle */
|
||||
float speed; /* Estimated observer speed */
|
||||
float per; /* Observer execution period */
|
||||
|
||||
float angle_err; /* Observer angle error.
|
||||
* This can be used to gradually eliminate
|
||||
* error between openloop angle and observer
|
||||
* angle
|
||||
*/
|
||||
|
||||
/* There are different types of motor observers which different
|
||||
* sets of private data.
|
||||
*/
|
||||
|
||||
void *so; /* Speed estimation observer data */
|
||||
};
|
||||
|
||||
/* Common motor angle observer structure */
|
||||
|
||||
struct motor_aobserver_f32_s
|
||||
{
|
||||
float angle; /* Estimated observer angle */
|
||||
float per; /* Observer execution period */
|
||||
|
||||
/* There are different types of motor observers which different
|
||||
* sets of private data.
|
||||
*/
|
||||
|
||||
void *ao; /* Angle estimation observer data */
|
||||
};
|
||||
|
||||
@@ -303,7 +309,7 @@ struct motor_sobserver_pll_f32_s
|
||||
|
||||
/* Motor Sliding Mode Observer private data */
|
||||
|
||||
struct motor_observer_smo_f32_s
|
||||
struct motor_aobserver_smo_f32_s
|
||||
{
|
||||
float k_slide; /* Bang-bang controller gain */
|
||||
float err_max; /* Linear mode threshold */
|
||||
@@ -323,7 +329,7 @@ struct motor_observer_smo_f32_s
|
||||
|
||||
/* Motor Nonlinear FluxLink Observer private data */
|
||||
|
||||
struct motor_observer_nfo_f32_s
|
||||
struct motor_aobserver_nfo_f32_s
|
||||
{
|
||||
float x1;
|
||||
float x2;
|
||||
@@ -529,30 +535,33 @@ void foc_vdq_mag_max_get(FAR struct foc_data_f32_s *foc, FAR float *max);
|
||||
|
||||
/* BLDC/PMSM motor observers */
|
||||
|
||||
void motor_observer_init(FAR struct motor_observer_f32_s *observer,
|
||||
FAR void *ao, FAR void *so, float per);
|
||||
float motor_observer_speed_get(FAR struct motor_observer_f32_s *o);
|
||||
float motor_observer_angle_get(FAR struct motor_observer_f32_s *o);
|
||||
void motor_sobserver_init(FAR struct motor_sobserver_f32_s *observer,
|
||||
FAR void *so, float per);
|
||||
void motor_aobserver_init(FAR struct motor_aobserver_f32_s *observer,
|
||||
FAR void *ao, float per);
|
||||
float motor_sobserver_speed_get(FAR struct motor_sobserver_f32_s *o);
|
||||
float motor_aobserver_angle_get(FAR struct motor_aobserver_f32_s *o);
|
||||
|
||||
void motor_observer_smo_init(FAR struct motor_observer_smo_f32_s *smo,
|
||||
float kslide, float err_max);
|
||||
void motor_observer_smo(FAR struct motor_observer_f32_s *o,
|
||||
FAR ab_frame_f32_t *i_ab, FAR ab_frame_f32_t *v_ab,
|
||||
FAR struct motor_phy_params_f32_s *phy, float dir);
|
||||
void motor_aobserver_smo_init(FAR struct motor_aobserver_smo_f32_s *smo,
|
||||
float kslide, float err_max);
|
||||
void motor_aobserver_smo(FAR struct motor_aobserver_f32_s *o,
|
||||
FAR ab_frame_f32_t *i_ab, FAR ab_frame_f32_t *v_ab,
|
||||
FAR struct motor_phy_params_f32_s *phy, float dir,
|
||||
float speed);
|
||||
|
||||
void motor_sobserver_div_init(FAR struct motor_sobserver_div_f32_s *so,
|
||||
uint8_t samples, float filer, float per);
|
||||
void motor_sobserver_div(FAR struct motor_observer_f32_s *o,
|
||||
void motor_sobserver_div(FAR struct motor_sobserver_f32_s *o,
|
||||
float angle, float dir);
|
||||
|
||||
void motor_observer_nfo_init(FAR struct motor_observer_nfo_f32_s *nfo);
|
||||
void motor_observer_nfo(FAR struct motor_observer_f32_s *o,
|
||||
void motor_aobserver_nfo_init(FAR struct motor_aobserver_nfo_f32_s *nfo);
|
||||
void motor_aobserver_nfo(FAR struct motor_aobserver_f32_s *o,
|
||||
FAR ab_frame_f32_t *i_ab, FAR ab_frame_f32_t *v_ab,
|
||||
FAR struct motor_phy_params_f32_s *phy, float gain);
|
||||
|
||||
void motor_sobserver_pll_init(FAR struct motor_sobserver_pll_f32_s *so,
|
||||
float pll_kp, float pll_ki);
|
||||
void motor_sobserver_pll(FAR struct motor_observer_f32_s *o,
|
||||
void motor_sobserver_pll(FAR struct motor_sobserver_f32_s *o,
|
||||
float angle, float dir);
|
||||
|
||||
/* Motor openloop control */
|
||||
|
||||
Reference in New Issue
Block a user