feat: add direction flag to feedforward controller with init config struct

- add DM_Feedforward_Init_Config_s with Kp and dir fields
- replace plain DM_Feedforward_Kp in DM_Motor_Init_Config_s
- apply direction flag in DMMotorControl to negate feedforward when reverse
- set yaw feedforward: Kp=0.9, dir=REVERSE
This commit is contained in:
2026-06-07 16:22:16 +08:00
parent 89aa777d5c
commit ed6d509c72
3 changed files with 18 additions and 5 deletions
+9 -1
View File
@@ -56,6 +56,7 @@ typedef struct
typedef struct{
float Kp;
Output_Reverse_Flag_e dir;
float feed_input;
} DM_Feedforward_Controller_s;
@@ -76,12 +77,19 @@ typedef struct
} DMMotorInstance;
/* Feedforward controller init config */
typedef struct
{
float Kp;
Output_Reverse_Flag_e dir;
} DM_Feedforward_Init_Config_s;
/* DM motor init config */
typedef struct
{
Motor_Init_Config_s motor_config; // generic motor PID and setting config
DM_Motor_Ctrl_Mode_e ctrl_mode; // default control mode
float DM_Feedforward_Kp;
DM_Feedforward_Init_Config_s feedforward_config;
float mit_kp; // MIT mode KP (only for MIT mode)
float mit_kd; // MIT mode KD (only for MIT mode)
} DM_Motor_Init_Config_s;