1.0
This commit is contained in:
@@ -13,9 +13,9 @@
|
||||
#define LADRC_CONTROL_DT_S 0.01f
|
||||
#define LADRC_RPM_FILTER_ALPHA 0.30f
|
||||
|
||||
#define LADRC_DEFAULT_WC 25.0f
|
||||
#define LADRC_DEFAULT_WO 60.0f
|
||||
#define LADRC_DEFAULT_B0 0.20f
|
||||
#define LADRC_DEFAULT_WC 12.0f
|
||||
#define LADRC_DEFAULT_WO 25.0f
|
||||
#define LADRC_DEFAULT_B0 0.40f
|
||||
#define LADRC_DEFAULT_OUT_MAX 1000.0f
|
||||
|
||||
/* ================== 内部辅助函数 ================== */
|
||||
|
||||
@@ -156,7 +156,7 @@ void Set_Motor_Output(Motor_ID_t id, int16_t control_out)
|
||||
hw_command = -hw_command;
|
||||
}
|
||||
|
||||
forward = (hw_command >= 0);
|
||||
forward = (hw_command < 0);
|
||||
pwm_val = Motor_ClampAbsToPwm(hw_command);
|
||||
|
||||
switch (id)
|
||||
@@ -261,10 +261,10 @@ void Motor_Update_RPM(float dt_s)
|
||||
s_last_count[MOTOR_RR] = curr_count_rr;
|
||||
|
||||
/* 左侧输入镜像修正:让“车体前进”统一表现为正脉冲 / 正 RPM。 */
|
||||
// delta[MOTOR_FL] = (int16_t)(-delta[MOTOR_FL]);
|
||||
// delta[MOTOR_RL] = (int16_t)(-delta[MOTOR_RL]);
|
||||
delta[MOTOR_FR] = (int16_t)(-delta[MOTOR_FR]);
|
||||
delta[MOTOR_RR] = (int16_t)(-delta[MOTOR_RR]);
|
||||
delta[MOTOR_FL] = (int16_t)(-delta[MOTOR_FL]);
|
||||
delta[MOTOR_RL] = (int16_t)(-delta[MOTOR_RL]);
|
||||
// delta[MOTOR_FR] = (int16_t)(-delta[MOTOR_FR]);
|
||||
// delta[MOTOR_RR] = (int16_t)(-delta[MOTOR_RR]);
|
||||
/* 用 32 位内部累加,避免偶发高速度时 16 位回绕。 */
|
||||
s_odom_acc_ticks[MOTOR_FL] += delta[MOTOR_FL];
|
||||
s_odom_acc_ticks[MOTOR_RL] += delta[MOTOR_RL];
|
||||
|
||||
Reference in New Issue
Block a user