mirror of
https://gitee.com/dlmu-cone/bf_original_balance_chassis
synced 2026-07-24 11:37:45 +08:00
修复HT电机解算bug,待添加零位校准。修复bsp_can module id未初始化问题
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
// PID 优化环节使能标志位
|
||||
typedef enum
|
||||
{
|
||||
NONE = 0b00000000, // 0000 0000
|
||||
PID_IMPROVE_NONE = 0b00000000, // 0000 0000
|
||||
Integral_Limit = 0b00000001, // 0000 0001
|
||||
Derivative_On_Measurement = 0b00000010, // 0000 0010
|
||||
Trapezoid_Intergral = 0b00000100, // 0000 0100
|
||||
|
||||
@@ -52,13 +52,14 @@ typedef enum
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MODE_AIM = 0,
|
||||
MODE_SMALL_BUFF = 1,
|
||||
MODE_BIG_BUFF = 2
|
||||
VISION_MODE_AIM = 0,
|
||||
VISION_MODE_SMALL_BUFF = 1,
|
||||
VISION_MODE_BIG_BUFF = 2
|
||||
} Work_Mode_e;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
BULLET_SPEED_NONE = 0,
|
||||
BIG_AMU_10 = 10,
|
||||
SMALL_AMU_15 = 15,
|
||||
BIG_AMU_16 = 16,
|
||||
|
||||
@@ -50,14 +50,14 @@ static void HTMotorDecode(CANInstance *motor_can)
|
||||
measure->last_angle = measure->total_angle;
|
||||
|
||||
tmp = (uint16_t)((rxbuff[1] << 8) | rxbuff[2]);
|
||||
measure->total_angle = RAD_2_ANGLE * uint_to_float(tmp, P_MAX, P_MIN, 16);
|
||||
measure->total_angle = RAD_2_ANGLE * uint_to_float(tmp, P_MIN, P_MAX, 16);
|
||||
|
||||
tmp = (uint16_t)((rxbuff[3] << 4) | (rxbuff[4] >> 4));
|
||||
measure->speed_aps = RAD_2_ANGLE * SPEED_SMOOTH_COEF * uint_to_float(tmp, V_MAX, V_MIN, 12) +
|
||||
measure->speed_aps = RAD_2_ANGLE * SPEED_SMOOTH_COEF * uint_to_float(tmp, V_MIN, V_MAX, 12) +
|
||||
(1 - SPEED_SMOOTH_COEF) * measure->speed_aps;
|
||||
|
||||
tmp = (uint16_t)(((rxbuff[4] & 0x0f) << 8) | rxbuff[5]);
|
||||
measure->real_current = CURRENT_SMOOTH_COEF * uint_to_float(tmp, T_MAX, T_MIN, 12) +
|
||||
measure->real_current = CURRENT_SMOOTH_COEF * uint_to_float(tmp, T_MIN, T_MAX, 12) +
|
||||
(1 - CURRENT_SMOOTH_COEF) * measure->real_current;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ typedef enum
|
||||
/* 反馈来源设定,若设为OTHER_FEED则需要指定数据来源指针,详见Motor_Controller_s*/
|
||||
typedef enum
|
||||
{
|
||||
MOTOR_FEED,
|
||||
MOTOR_FEED=0,
|
||||
OTHER_FEED,
|
||||
} Feedback_Source_e;
|
||||
|
||||
@@ -94,11 +94,12 @@ typedef struct
|
||||
/* 电机类型枚举 */
|
||||
typedef enum
|
||||
{
|
||||
GM6020 = 0,
|
||||
M3508 = 1,
|
||||
M2006 = 2,
|
||||
LK9025 = 3,
|
||||
HT04 = 4,
|
||||
MOTOR_TYPE_NONE = 0,
|
||||
GM6020,
|
||||
M3508,
|
||||
M2006,
|
||||
LK9025,
|
||||
HT04,
|
||||
} Motor_Type_e;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user