mirror of
https://gitee.com/dlmu-cone/half-steering-basic-framework
synced 2026-10-24 01:52:20 +08:00
no.firsr
This commit is contained in:
@@ -144,10 +144,10 @@ void ChassisInit()
|
||||
.motor_type = GM6020,
|
||||
};
|
||||
|
||||
chassis_motor_steering_config.can_init_config.tx_id = 1;
|
||||
chassis_motor_steering_config.can_init_config.tx_id = 2;
|
||||
motor_steering_rf = DJIMotorInit(&chassis_motor_steering_config);
|
||||
|
||||
chassis_motor_steering_config.can_init_config.tx_id = 2;
|
||||
chassis_motor_steering_config.can_init_config.tx_id = 1;
|
||||
motor_steering_lb = DJIMotorInit(&chassis_motor_steering_config);
|
||||
|
||||
PID_Init_Config_s chassis_follow_pid_conf = {
|
||||
@@ -299,8 +299,8 @@ static void MinmizeRotation(float *angle, const float *last_angle, float *speed)
|
||||
|
||||
// 计算角度偏移
|
||||
// offset_lf = atan2f(chassis_vy - w, chassis_vx - w) * RAD_2_DEGREE; // lf: 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_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; // 此处似乎不需要加上真实角度,因为我们需要的是绝对角度而不是相对角度
|
||||
|
||||
@@ -15,7 +15,7 @@ static Subscriber_t *gimbal_sub; // cmd控制消息订阅者
|
||||
static Gimbal_Upload_Data_s gimbal_feedback_data; // 回传给cmd的云台状态信息
|
||||
static Gimbal_Ctrl_Cmd_s gimbal_cmd_recv; // 来自cmd的控制信息
|
||||
static float last_yaw_angle = 0.0f; // 保护模式前的yaw角度
|
||||
static float last_pitch_angle = 0.0f; // 保护模式前的pitch角度
|
||||
// static float last_pitch_angle = 0.0f; // 保护模式前的pitch角度
|
||||
uint8_t in_protection_mode = 0; // 是否在保护模式
|
||||
void GimbalInit()
|
||||
{
|
||||
@@ -85,9 +85,9 @@ void GimbalInit()
|
||||
// },
|
||||
.controller_param_init_config = {
|
||||
.angle_PID = {
|
||||
.Kp = 1, //0.90
|
||||
.Kp = 0.75, //0.55
|
||||
.Ki = 0.05,//0.05
|
||||
.Kd = 0.03,//0.02
|
||||
.Kd = 0.02,//0.02
|
||||
.CoefA =0.5,//0.5
|
||||
.CoefB = 0.6,//0.6
|
||||
.Output_LPF_RC = 0.01,
|
||||
@@ -98,8 +98,8 @@ void GimbalInit()
|
||||
.MaxOut = 600,
|
||||
},
|
||||
.speed_PID = {
|
||||
.Kp = 800,//22000
|
||||
.Ki = 0.05,//
|
||||
.Kp = 500,//22000
|
||||
.Ki = 0,//
|
||||
.Kd =0.0005,
|
||||
// .CoefA = 0.8,
|
||||
// .CoefB = 0.1,
|
||||
@@ -148,7 +148,7 @@ void GimbalTask()
|
||||
// 进入保护模式时记录当前角度
|
||||
if (!in_protection_mode) {
|
||||
last_yaw_angle = gimba_IMU_data->YawTotalAngle;
|
||||
last_pitch_angle = gimba_IMU_data->Pitch;
|
||||
// last_pitch_angle = gimba_IMU_data->Pitch;
|
||||
in_protection_mode = 1;
|
||||
}
|
||||
DJIMotorStop(yaw_motor);
|
||||
|
||||
@@ -35,8 +35,8 @@
|
||||
// #define CHASSIS_OMNI_WHEEL // 是否为全向轮底盘
|
||||
// #define CHASSIS_MCNAMEE_WHEEL // 是否为麦克纳姆轮底盘
|
||||
#define CHASSIS_STEERING_WHEEL // 是否为舵轮
|
||||
#define STEERING_CHASSIS_ALIGN_ECD_RF 7367 // 舵电机 A 编码器值,若有机械改动需要修改
|
||||
#define STEERING_CHASSIS_ALIGN_ECD_LB 1195 // 舵电机 D 编码器值,若有机械改动需要修改
|
||||
#define STEERING_CHASSIS_ALIGN_ECD_RF 7330 // 舵电机 A 编码器值,若有机械改动需要修改
|
||||
#define STEERING_CHASSIS_ALIGN_ECD_LB 5099 // 舵电机 D 编码器值,若有机械改动需要修改
|
||||
|
||||
#define STEERING_CHASSIS_ALIGN_ANGLE_RF STEERING_CHASSIS_ALIGN_ECD_RF / 8192.f * 360.f // 舵轮 A 对齐角度
|
||||
#define STEERING_CHASSIS_ALIGN_ANGLE_LB STEERING_CHASSIS_ALIGN_ECD_LB / 8192.f * 360.f // 舵轮 D 对齐角度
|
||||
|
||||
Reference in New Issue
Block a user