diff --git a/MDK-ARM/R2.uvoptx b/MDK-ARM/R2.uvoptx index 0a52c45..6aef15d 100644 --- a/MDK-ARM/R2.uvoptx +++ b/MDK-ARM/R2.uvoptx @@ -200,6 +200,11 @@ 1 \\R2\../User/task/chassis_task.c\chassis.param->M3508_param.d + + 10 + 1 + \\R2\../User/task/nuc_task.c\cmd_fromnuc + 0 diff --git a/MDK-ARM/R2/R2.axf b/MDK-ARM/R2/R2.axf index 8b58b3a..d886012 100644 Binary files a/MDK-ARM/R2/R2.axf and b/MDK-ARM/R2/R2.axf differ diff --git a/User/Module/Chassis.c b/User/Module/Chassis.c index 76573aa..40c1642 100644 --- a/User/Module/Chassis.c +++ b/User/Module/Chassis.c @@ -42,9 +42,11 @@ int8_t Chassis_init(Chassis_t *c, const Chassis_Param_t *param, float target_fre if (c == NULL) return CHASSIS_ERR_NULL; c->param = param; - for (int i = 0; i < 4; i++) { + for (int i = 0; i < 3; i++) { PID_init(&(c->pid.chassis_3508VecPID[i]), PID_POSITION_D, &(c->param->M3508_param)); } + PID_init(&(c->pid.chassis_3508VecPID[3]), PID_POSITION_D, &(c->param->M3508_param_other)); + PID_init(&(c->pid.chassis_PICKWzPID_HIGN), PID_POSITION, &(c->param->chassis_PICKWzPID_HIGN_param)); PID_init(&(c->pid.chassis_PICKWzPID_LOW), PID_POSITION, &(c->param->chassis_PICKWzPID_LOW_param)); /*sick*/ diff --git a/User/Module/Chassis.h b/User/Module/Chassis.h index 30e89b1..3148035 100644 --- a/User/Module/Chassis.h +++ b/User/Module/Chassis.h @@ -72,7 +72,9 @@ typedef struct /*该部分决定PID的参数整定在config中修改*/ - pid_param_t M3508_param; + pid_param_t M3508_param; + pid_param_t M3508_param_other; + pid_param_t chassis_PICKWzPID_HIGN_param; pid_param_t chassis_PICKWzPID_LOW_param; diff --git a/User/Module/config.c b/User/Module/config.c index b95bed2..bef7c04 100644 --- a/User/Module/config.c +++ b/User/Module/config.c @@ -75,11 +75,11 @@ static const ConfigParam_t param ={ /*投球*/ .LaunchCfg = { - .m2006_init = -130.0f, // M2006初始角度 + .m2006_init = -140.0f, // M2006初始角度 .m2006_trig = 0.0f, // M2006触发角度 .go_pull_pos = -210.0f, // go上升去合并扳机,扳机位置 - .go_up_speed = 12.0f, // 上升速度 - .go_down_speed = 10.0f, // 下降速度 + .go_up_speed = 15.0f, // 上升速度 + .go_down_speed = 12.0f, // 下降速度 .Pitch_angle = 58, //俯仰角 .go_init = -50 }, @@ -117,7 +117,18 @@ static const ConfigParam_t param ={ // .i_limit = 200.0f, // .out_limit =6000.0f, .p = 20.5f, - .i = 0.00011f, + .i = 0.00005f, + .d = 3.2f, + .i_limit = 200.0f, + .out_limit =6000.0f, + + + }, + + .M3508_param_other= { + + .p = 16.5f, + .i = 0.00001f, .d = 3.2f, .i_limit = 200.0f, .out_limit =6000.0f, diff --git a/User/Module/up.c b/User/Module/up.c index a15f93d..e2561c7 100644 --- a/User/Module/up.c +++ b/User/Module/up.c @@ -132,7 +132,7 @@ int8_t ALL_Motor_Control(UP_t *u,CAN_Output_t *out) { /*目标值限位*/ abs_limit_min_max_fp(&u->motor_target.go_shoot ,-215.0f,0.0f); - abs_limit_min_max_fp(&u->motor_target.Pitch_angle ,48.0f,67.0f); + abs_limit_min_max_fp(&u->motor_target.Pitch_angle ,48.0f,71.5f); @@ -423,10 +423,10 @@ int8_t UP_AUTO_Control(UP_t *u,CAN_Output_t *out,CMD_t *c){ /*俯仰角度,力度转换,加数值限位*/ if(u->MID360Context.Curve==CURVE_58){ - MID360Cfg->go_release_pos=CurveChange(LowPassFilter2p_Apply(&u->filled[0],c->cmd_MID360.dis)+0.1f,3.3,4.3,&u->MID360Context.Curve); + MID360Cfg->go_release_pos=CurveChange(LowPassFilter2p_Apply(&u->filled[0],c->cmd_MID360.dis)+0.25f,3.3,4.3,&u->MID360Context.Curve); } else { - MID360Cfg->go_release_pos=CurveChange(LowPassFilter2p_Apply(&u->filled[0],c->cmd_MID360.dis),3.3,4.3,&u->MID360Context.Curve); + MID360Cfg->go_release_pos=CurveChange(LowPassFilter2p_Apply(&u->filled[0],c->cmd_MID360.dis)+0.1f,3.3,4.3,&u->MID360Context.Curve); } if (u->MID360Context.Curve == CURVE_58) { diff --git a/User/device/can_use.c b/User/device/can_use.c index b00a8d4..007bddd 100644 --- a/User/device/can_use.c +++ b/User/device/can_use.c @@ -88,7 +88,7 @@ void CAN_Encoder_Decode(CAN_EncoderFeedback_t *feedback, const uint8_t *raw) { if (feedback == NULL || raw == NULL) return; switch(raw[1])//判断编码器id - { + { case 0x01: switch(raw[2])//判断指令id