mirror of
https://gitee.com/dlmu-cone/half-steering-basic-framework
synced 2026-10-23 17:42:20 +08:00
对齐时前后左右方向正确,但底盘跟随时舵轮旋转方向错误,需要使舵轮按与这板代码相反的旋转方向转
This commit is contained in:
@@ -100,11 +100,11 @@ void ChassisInit()
|
||||
};
|
||||
// @todo: 当前还没有设置电机的正反转,仍然需要手动添加reference的正负号,需要电机module的支持,待修改.
|
||||
|
||||
chassis_motor_config.can_init_config.tx_id = 2;
|
||||
chassis_motor_config.can_init_config.tx_id = 1;
|
||||
// chassis_motor_config.controller_setting_init_config.motor_reverse_flag = MOTOR_DIRECTION_REVERSE;
|
||||
motor_rf = LKMotorInit(&chassis_motor_config);
|
||||
|
||||
chassis_motor_config.can_init_config.tx_id = 1;
|
||||
chassis_motor_config.can_init_config.tx_id = 2;
|
||||
// chassis_motor_config.controller_setting_init_config.motor_reverse_flag = MOTOR_DIRECTION_REVERSE;
|
||||
motor_lb = LKMotorInit(&chassis_motor_config);
|
||||
|
||||
@@ -287,15 +287,16 @@ static void MinmizeRotation(float *angle, const float *last_angle, float *speed)
|
||||
// arm_sqrt_f32(temp_x * temp_x + temp_y * temp_y, &vt_lf); // lf:y- , x-
|
||||
// temp_y = chassis_vy + w; // 重复利用变量,temp_x = chassis_vy - w;与上次相同因此注释
|
||||
arm_sqrt_f32(temp_x * temp_x + temp_y * temp_y, &vt_lb); // lb: y+ , x-
|
||||
temp_x = chassis_vx + w; // temp_y = chassis_vx + w;与上次相同因此注释
|
||||
temp_x = chassis_vx + w;
|
||||
temp_y = chassis_vy + w;//与上次相同因此注释
|
||||
// arm_sqrt_f32(temp_x * temp_x + temp_y * temp_y, &vt_rb); // rb: y+ , x+
|
||||
// temp_y = chassis_vy - w; // temp_x = chassis_vy + w;与上次相同因此注释
|
||||
arm_sqrt_f32(temp_x * temp_x + temp_y * temp_y, &vt_rf); // rf: y- , x+
|
||||
|
||||
// 计算角度偏移
|
||||
// offset_lf = atan2f(chassis_vy - w, chassis_vx - w) * RAD_2_DEGREE; // lf: y- , x-
|
||||
offset_rf = atan2f(chassis_vy - w, chassis_vx - w) * RAD_2_DEGREE; // rf: y- , x+
|
||||
offset_lb = atan2f(chassis_vy + w, chassis_vx + w) * RAD_2_DEGREE; // lb: y+ , x-
|
||||
offset_lb = atan2f(chassis_vy - w, chassis_vx - w) * RAD_2_DEGREE; // rf: y- , x+
|
||||
offset_rf = atan2f(chassis_vy + w, chassis_vx + w) * RAD_2_DEGREE; // lb: y+ , x-
|
||||
// offset_rb = atan2f(chassis_vy + w, chassis_vx + w) * RAD_2_DEGREE; // rb: y+ , x+
|
||||
|
||||
// at_lf = STEERING_CHASSIS_ALIGN_ANGLE_LF + offset_lf; // 此处似乎不需要加上真实角度,因为我们需要的是绝对角度而不是相对角度
|
||||
|
||||
Reference in New Issue
Block a user