diff --git a/MDK-ARM/.vscode/keil-assistant.log b/MDK-ARM/.vscode/keil-assistant.log
index 62df037..8802b01 100644
--- a/MDK-ARM/.vscode/keil-assistant.log
+++ b/MDK-ARM/.vscode/keil-assistant.log
@@ -156,3 +156,9 @@
[info] Log at : 2025/7/14|07:52:29|GMT+0800
+[info] Log at : 2025/7/14|12:31:22|GMT+0800
+
+[info] Log at : 2025/7/14|13:56:03|GMT+0800
+
+[info] Log at : 2025/7/16|22:15:00|GMT+0800
+
diff --git a/MDK-ARM/.vscode/uv4.log b/MDK-ARM/.vscode/uv4.log
index ed37286..f0584ac 100644
--- a/MDK-ARM/.vscode/uv4.log
+++ b/MDK-ARM/.vscode/uv4.log
@@ -1,8 +1,4 @@
*** Using Compiler 'V5.06 update 7 (build 960)', folder: 'D:\keil\ARM\ARMCC\Bin'
Build target 'R1'
-compiling ball.cpp...
-linking...
-Program Size: Code=32056 RO-data=1832 RW-data=284 ZI-data=32268
-FromELF: creating hex file...
"R1\R1.axf" - 0 Error(s), 0 Warning(s).
-Build Time Elapsed: 00:00:05
+Build Time Elapsed: 00:00:01
diff --git a/MDK-ARM/.vscode/uv4.log.lock b/MDK-ARM/.vscode/uv4.log.lock
index 0bfbb9d..21f392d 100644
--- a/MDK-ARM/.vscode/uv4.log.lock
+++ b/MDK-ARM/.vscode/uv4.log.lock
@@ -1 +1 @@
-2025/7/14 7:54:12
\ No newline at end of file
+2025/7/16 22:18:46
\ No newline at end of file
diff --git a/MDK-ARM/R1.uvoptx b/MDK-ARM/R1.uvoptx
index 43f788a..e7b0548 100644
--- a/MDK-ARM/R1.uvoptx
+++ b/MDK-ARM/R1.uvoptx
@@ -180,6 +180,16 @@
1
and1
+
+ 5
+ 1
+ nucbuf
+
+
+ 6
+ 1
+ drop_message,0x0A
+
@@ -947,7 +957,7 @@
User/device
- 0
+ 1
0
0
0
diff --git a/User/module/ball.cpp b/User/module/ball.cpp
index e4b868d..4775184 100644
--- a/User/module/ball.cpp
+++ b/User/module/ball.cpp
@@ -314,47 +314,6 @@ void Ball::ballDown(void)
}
}
-// void Ball::Idle_control()
-// {
-// HAL_GPIO_WritePin(CLOSE_GPIO_Port, CLOSE_Pin, GPIO_PIN_RESET); // 确保爪气缸关闭
-// HAL_GPIO_WritePin(DOWN_GPIO_Port, DOWN_Pin, GPIO_PIN_RESET); // 确保下气缸关闭
-
-// osThreadFlagsClear(EXTEND_OK);
-
-// if (ready_key == SIDE) // 检测是否准备好
-// {
-// xiaomi.position = WAIT_POS;
-// if (feedback->position_deg >= WAIT_POS - 3)
-// {
-// // 只在READY_TELL未置位时发送,防止重复
-// if ((osThreadFlagsGet() & READY_TELL) == 0)
-// {
-// osThreadFlagsSet(task_struct.thread.shoot, READY_TELL);
-// }
-// }
-// }
-// else
-// {
-// xiaomi.position = I_ANGLE; // 默认回到收回位置
-// }
-
-// // 拨杆回到中间挡位时,回位并重置状态机
-// if (currentState1 == EXTEND_FINISH) // 转移后
-// {
-// xiaomi.position = I_ANGLE;
-// currentState1 = BALL_IDLE;
-// }
-// if (currentState1 == BALL_FINISH) // 运球完成
-// {
-// xiaomi.position = O_ANGLE;
-// currentState1 = BALL_IDLE;
-// }
-// else
-// {
-// currentState1 = BALL_IDLE;
-// }
-// // xiaomi.position = I_ANGLE;
-// }
void Ball::Idle_control()
{
diff --git a/User/module/gimbal.cpp b/User/module/gimbal.cpp
deleted file mode 100644
index 0d64aa3..0000000
--- a/User/module/gimbal.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-#include "TopDefine.h"
-#include "gimbal.hpp"
-#include "remote_control.h"
-#include "calc_lib.h"
-#include "FreeRTOS.h"
-#include
-
-#define KP 0.12
-#define KD 0.008
-//可活动角度
-#define ANGLE_ALLOW 1.0f
-extern RC_ctrl_t rc_ctrl;
-NUC_t nuc;
-
-const fp32 Gimbal:: Gimbal_speed_PID[3] = {50, 0.1, 0};
-const fp32 Gimbal:: Gimbal_angle_PID[3]= { 5, 0.01, 0};
-
-#if GM6020ING ==1
-Gimbal::Gimbal()
-{
- // GM6020_Motor = get_motor_point(6);
- // GM6020_Motor->type = GM6020;
- // PID_init(&speed_pid,PID_POSITION,Gimbal_speed_PID,16000, 6000);
- // PID_init(&angle_pid,PID_POSITION,Gimbal_angle_PID,5000, 2000);
-
- // result = 0;
- // angleSet = 0;
-
-}
-
-void Gimbal::gimbalFlow()
-{
- int16_t delta[1];
- //angleSet = angle1;
- delta[0] = PID_calc(&angle_pid,GM6020_Motor->total_angle,angleSet);
- result = PID_calc(&speed_pid, GM6020_Motor->speed_rpm, delta[0]);
-
- CAN_cmd_1FF(0,0,result,0,&hcan1);
- osDelay(1);
-
-}
-
-void Gimbal::gimbalZero()
-{
- angleSet=0;
- //gimbalFlow();
-
-}
-
-void Gimbal::gimbalVision(const NUC_t &nuc)
-{
- int16_t delta[1];
- angleSet = nuc.vision.x;
- delta[0] = PID_calc(&angle_pid,GM6020_Motor->total_angle,angleSet);
- result = PID_calc(&speed_pid, GM6020_Motor->speed_rpm, delta[0]);
-
- CAN_cmd_1FF(0,0,result,0,&hcan1);
- osDelay(1);
-}
-
-
-
-#else
-Gimbal::Gimbal()
-{
-
- Kp = KP;
- Kd = KD;
- allowRange = ANGLE_ALLOW;
-}
-
-void Gimbal::gimbalInit(void)
-{
- int i;
- GO_M8010_init();
- for(i = 0;i < GO_NUM;i ++)
- {
- goData[i] = getGoPoint(i);//获取电机数据指针
-
- angleSet[i] = 0;
- offestAngle[i] = 0;
- GO_M8010_send_data(&huart6, i,0,0,0,0,0,0);
- offestAngle[i] = goData[i]->Pos;
- HAL_Delay(100);
-
- }
-
-}
-
-void Gimbal::gimbalFlow(void)
-{
-
- //angleSet[0] = map_fp32((float)rc_ctrl.ch[3],-800.0f,800.0f,-allowRange,allowRange) + offestAngle[0];
- GO_M8010_send_data(&huart6, 0,0,0,angleSet[0],1,KP,KD);
- osDelay(1);
-
-
-}
-
-
-void Gimbal::gimbalZero(void)
-{
- GO_M8010_send_data(&huart6, 0,0,0,0,0,0,0);
-}
-
-void Gimbal::gimbalVision(const NUC_t &nuc)
-{
- angleSet[0] = nuc.vision.x;
- GO_M8010_send_data(&huart6, 0,0,0,angleSet[0],1,KP,KD);
- osDelay(1);
-}
-
-#endif
diff --git a/User/module/gimbal.hpp b/User/module/gimbal.hpp
deleted file mode 100644
index 5d3306f..0000000
--- a/User/module/gimbal.hpp
+++ /dev/null
@@ -1,57 +0,0 @@
-#ifndef GIMBAL_HPP
-#define GIMBAL_HPP
-
-#include "GO_M8010_6_Driver.h"
-#include "djiMotor.h"
-#include "pid.h"
-#include "nuc.h"
-
-class Gimbal
-{
-public:
- Gimbal();
- void gimbalFlow(void);//云台随遥控器转动
- void gimbalZero(void);//云台零阻尼模式
- void gimbalInit(void);//go初始化
- void gimbalVision(const NUC_t &nuc); // 接收 NUC_t 数据
-
- int16_t result;
- //暂存要发送的扭矩
- //float result[GO_NUM];
-// float Kp;
-// float Kd;
-private:
-
-#if GM6020ING == 1
-//GM6020电机数据
- motor_measure_t *GM6020_Motor;
-
- static const float Gimbal_speed_PID[3];
- static const float Gimbal_angle_PID[3];
-
- //电机速度pid结构体
- pid_type_def speed_pid;
- //位置环pid
- pid_type_def angle_pid;
-
- float angleSet;
-
-#else
- motor_measure_t *motorData[GO_NUM];
- //视觉发送的要调的角度
- float self_angleSet;
- GO_Motorfield* goData[GO_NUM];
- //暂存目标位置
- float angleSet[GO_NUM];
- float offestAngle[GO_NUM];//go数据
- float Kp;
- float Kd;
- float allowRange;
-
-#endif
-};
-
-
-
-
-#endif
diff --git a/User/module/shoot.cpp b/User/module/shoot.cpp
index 584e51c..25a7c46 100644
--- a/User/module/shoot.cpp
+++ b/User/module/shoot.cpp
@@ -39,7 +39,7 @@ const fp32 Shoot::M2006_angle_PID[3] = {15, 0.1, 0};
#define CHANEGE_POS -205
#define GO_ERROR 1.0f
#define Tigger_DO -10
-#define Tigger_ZERO 115
+#define Tigger_ZERO 125
#define Tigger_ERROR 3
float knob_increment;
@@ -273,8 +273,8 @@ void Shoot::shoot_control()
{
case VSION:
//fire_pos = distance; // 视觉拟合的力
- fire_pos =shoot_fitting(distance)+and1;
- //fire_pos = INIT_POS + knob_increment; // 根据旋钮值调整发射位置
+ //fire_pos =shoot_fitting(distance)+and1;
+ fire_pos = INIT_POS + knob_increment; // 根据旋钮值调整发射位置
switch (rc_key)
{
@@ -455,7 +455,7 @@ void Shoot::shoot_control()
switch (mode_key)
{
case VSION:
- fire_pos = shoot_fitting(distance)+and1; // 视觉拟合的力
+ fire_pos = shoot_fitting(distance)+and1;
//fire_pos = INIT_POS + knob_increment; // 根据旋钮值调整发射位置
switch (rc_key)
@@ -511,11 +511,10 @@ void Shoot::shoot_control()
switch (rc_key)
{
case MIDDLE1:
- fire_pos = pass_fitting(pass_distance)+and2;
+ fire_pos = shoot_fitting(distance)+and1;
if ((shoot_thread & READY_TELL) && !(shoot_thread & EXTEND_OK))
{
- // 只收到READY_TELL且未收到EXTEND_OK时,顶部蓄力流程
- ball_receive(); // ball_receive内部写go1.Pos
+ ball_receive();
}
else if (shoot_thread & EXTEND_OK)
{
diff --git a/User/task/gimbalTask.cpp b/User/task/gimbalTask.cpp
deleted file mode 100644
index 2b37f5c..0000000
--- a/User/task/gimbalTask.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-#include "TopDefine.h"
-#include "FreeRTOS.h"
-#include "userTask.h"
-#include
-#include "gimbalTask.hpp"
-#include "gimbal.hpp"
-#include "main.h"
-#include "remote_control.h"
-#include "nuc.h"
-Gimbal gimbal;
-// NUC_t nucData; // 用于存储从队列接收的数据
-extern RC_ctrl_t rc_ctrl;
-int cnt1=0;
-
-void FunctionGimbal(void *argument)
-{
- (void)argument; /* 未使用argument,消除警告 */
-
- const uint32_t delay_tick = osKernelGetTickFreq() / TASK_FREQ_CTRL_GIMBAL;
-
- HAL_GPIO_WritePin(LED_G_GPIO_Port,LED_G_Pin,GPIO_PIN_SET);
-
- uint32_t tick = osKernelGetTickCount();
-
- while(1)
- {
- #ifdef DEBUG
- task_struct.stack_water_mark.gimbal = osThreadGetStackSpace(osThreadGetId());
- #endif
-
- //cnt1++;
-
- // gimbal.gimbalFlow();
- // 从消息队列接收视觉数据
- // if (osMessageQueueGet(task_struct.msgq.nuc, &nucData, NULL, 0) == osOK)
- // {
- // // 使用接收到的视觉数据调整云台
- // //gimbal.gimbalVision(nucData);
- // }
-
- osDelay(1);
-
- tick += delay_tick; /* 计算下一个唤醒时刻 */
- osDelayUntil(tick);
- }
-}
-
diff --git a/User/task/gimbalTask.hpp b/User/task/gimbalTask.hpp
deleted file mode 100644
index 71998d5..0000000
--- a/User/task/gimbalTask.hpp
+++ /dev/null
@@ -1,5 +0,0 @@
-#ifndef GIMBALTASK_HPP
-#define GIMBALTASK_HPP
-
-
-#endif