删除自动播弹

This commit is contained in:
Xiaocheng 2026-01-14 17:57:03 +08:00
parent a1fe767681
commit 9046555dc8
5 changed files with 54 additions and 29 deletions

View File

@ -165,10 +165,19 @@ static const Config_Param_t config = {
// .d_cutoff_freq = 0.0f,
// .range = M_2PI
/*上面一组pid会导致电机超调可能是因为pid计算错误正在进行重新修改pid*/
// .k = 2.0f,
// .p = 5.0f,
// .i = 0.0f,
// .d = 0.0f,
// .i_limit = 1.0f,
// .out_limit = 10.0f,
// .d_cutoff_freq = 0.0f,
// .range = M_2PI
.k = 2.0f,
.p = 5.0f,
.i = 0.0f,
.d = 0.0f,
.p = 7.0f,
.i = 0.5f,
.d = 1.0f,
.i_limit = 1.0f,
.out_limit = 10.0f,
.d_cutoff_freq = 0.0f,
@ -185,8 +194,17 @@ static const Config_Param_t config = {
// .d_cutoff_freq = -1.0f,
// .range = -1.0f
// .k = 0.35f,
// .p = 0.3f,
// .i = 0.0f,
// .d = 0.0f,
// .i_limit = 1.0f,
// .out_limit = 1.0f,
// .d_cutoff_freq = -1.0f,
// .range = -1.0f
.k = 0.35f,
.p = 0.3f,
.p = 0.35f,
.i = 0.0f,
.d = 0.0f,
.i_limit = 1.0f,
@ -222,8 +240,8 @@ static const Config_Param_t config = {
.basic.extra_deceleration_ratio = 1,
.basic.ratio_multilevel[0] = 1.0f,
.basic.num_trig_tooth = 8,
.basic.shot_freq = 20.0f,
.basic.shot_burst_num = 5,
.basic.shot_freq = 5.0f,
.basic.shot_burst_num = 1,
.jamDetection.enable = true,
.jamDetection.threshold = 120.0f,
@ -253,8 +271,8 @@ static const Config_Param_t config = {
},
.trig_2006={
.k=0.5f,
.p=0.5f,
.k=0.7f,
.p=0.7f,
.i=0.5f,
.d=0.05f,
.i_limit=0.2f,

View File

@ -49,6 +49,7 @@ void Task_ai(void *argument) {
AI_Get_NUC(&ai,&ai_cmd);
osMessageQueueReset(task_runtime.msgq.gimbal.ai.g_cmd);
osMessageQueuePut(task_runtime.msgq.gimbal.ai.g_cmd, &ai_cmd, 0, 0);
osMessageQueuePut(task_runtime.msgq.shoot.ai.s_cmd, &ai_cmd, 0, 0);
/* USER CODE END */
osDelayUntil(tick); /* 运行结束,等待下一次唤醒 */
}

View File

@ -54,7 +54,8 @@ void Task_Init(void *argument) {
task_runtime.msgq.shoot.cmd = osMessageQueueNew(2u, sizeof(Shoot_CMD_t),NULL);
task_runtime.msgq.gimbal.ai.feedback = osMessageQueueNew(2u, sizeof(Gimbal_feedback_t),NULL);
task_runtime.msgq.gimbal.ai.g_cmd = osMessageQueueNew(2u, sizeof(AI_cmd_t),NULL);
task_runtime.msgq.shoot.ai.s_cmd = osMessageQueueNew(2u, sizeof(AI_cmd_t),NULL);
/* USER MESSAGE END */
osKernelUnlock(); // 解锁内核

View File

@ -44,28 +44,28 @@ Shoot_SetMode(&shoot,SHOOT_MODE_SINGLE);
tick += delay_tick; /* 计算下一个唤醒时刻 */
/* USER CODE BEGIN */
osMessageQueueGet(task_runtime.msgq.shoot.cmd, &shoot_cmd, NULL, 0);
osMessageQueueGet(task_runtime.msgq.gimbal.ai.s_cmd, &shoot_ai_cmd, NULL, 0);
osMessageQueueGet(task_runtime.msgq.shoot.ai.s_cmd, &shoot_ai_cmd, NULL, 0);
if(shoot_cmd.control_mode==SHOOT_REMOTE)
{
//do nothing使用遥控器的指令
}
else if(shoot_cmd.control_mode==SHOOT_AI)
{
shoot_cmd.mode = SHOOT_MODE_SINGLE;
if(shoot_ai_cmd.mode==0 || shoot_ai_cmd.mode==1)
{
shoot_cmd.firecmd=false;
shoot_cmd.ready=true;
// if(shoot_cmd.control_mode==SHOOT_REMOTE)
// {
// //do nothing使用遥控器的指令
// }
// else if(shoot_cmd.control_mode==SHOOT_AI)
// {
// shoot_cmd.mode = SHOOT_MODE_SINGLE;
// if(shoot_ai_cmd.mode==0 || shoot_ai_cmd.mode==1)
// {
// shoot_cmd.firecmd=false;
// shoot_cmd.ready=true;
}
else if(shoot_ai_cmd.mode==2)
{
// }
// else if(shoot_ai_cmd.mode==2)
// {
shoot_cmd.firecmd=true;
shoot_cmd.ready=true;
}
}
// shoot_cmd.firecmd=true;
// shoot_cmd.ready=true;
// }
// }
Shoot_UpdateFeedback(&shoot);
Shoot_SetMode(&shoot,shoot_cmd.mode);

View File

@ -91,13 +91,18 @@ typedef struct {
osMessageQueueId_t quat;
osMessageQueueId_t feedback;
osMessageQueueId_t g_cmd;
}ai;
/* 新增的 ai 消息队列 主要是给自瞄*/
} gimbal;
struct
{
osMessageQueueId_t cmd;
osMessageQueueId_t cmd;
struct{
osMessageQueueId_t s_cmd;
}ai;
}shoot;
} msgq;