From 33f343eadbcbab4848edfb3bffd668582635e81b Mon Sep 17 00:00:00 2001
From: ws <1621320660@qq.com>
Date: Sun, 16 Mar 2025 15:26:21 +0800
Subject: [PATCH] =?UTF-8?q?=E8=AF=95=E4=BA=86=E7=A6=BB=E5=90=88=EF=BC=8C?=
=?UTF-8?q?=E5=8D=A1=E4=B8=8D=E4=B8=8A=EF=BC=8C=E4=B8=8D=E8=B0=83odrive?=
=?UTF-8?q?=E4=BA=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
MDK-ARM/.vscode/keil-assistant.log | 2 ++
MDK-ARM/.vscode/uv4.log | 7 ++++---
MDK-ARM/.vscode/uv4.log.lock | 2 +-
MDK-ARM/mycode1.uvoptx | 5 +++++
User/module/dji.c | 2 +-
User/module/shoot.c | 26 ++++++++++++--------------
User/module/shoot.h | 1 +
User/task/dji_task.c | 11 +++++++++--
User/task/shoot_task.c | 3 ++-
9 files changed, 37 insertions(+), 22 deletions(-)
diff --git a/MDK-ARM/.vscode/keil-assistant.log b/MDK-ARM/.vscode/keil-assistant.log
index 6fc5bab..643749d 100644
--- a/MDK-ARM/.vscode/keil-assistant.log
+++ b/MDK-ARM/.vscode/keil-assistant.log
@@ -58,3 +58,5 @@
[info] Log at : 2025/3/14|20:12:19|GMT+0800
+[info] Log at : 2025/3/16|15:24:31|GMT+0800
+
diff --git a/MDK-ARM/.vscode/uv4.log b/MDK-ARM/.vscode/uv4.log
index 9bf04b8..5b5cda4 100644
--- a/MDK-ARM/.vscode/uv4.log
+++ b/MDK-ARM/.vscode/uv4.log
@@ -1,3 +1,4 @@
-Load "mycode1\\mycode1.axf"
-Erase Done.Programming Done.Verify OK.Application running ...
-Flash Load finished at 22:03:22
+*** Using Compiler 'V5.06 update 7 (build 960)', folder: 'D:\keil\ARM\ARMCC\Bin'
+Build target 'mycode1'
+"mycode1\mycode1.axf" - 0 Error(s), 0 Warning(s).
+Build Time Elapsed: 00:00:00
diff --git a/MDK-ARM/.vscode/uv4.log.lock b/MDK-ARM/.vscode/uv4.log.lock
index 9e7cf59..bbff409 100644
--- a/MDK-ARM/.vscode/uv4.log.lock
+++ b/MDK-ARM/.vscode/uv4.log.lock
@@ -1 +1 @@
-2025/3/14 22:03:23
\ No newline at end of file
+2025/3/16 13:26:53
\ No newline at end of file
diff --git a/MDK-ARM/mycode1.uvoptx b/MDK-ARM/mycode1.uvoptx
index 1dfa59f..346003a 100644
--- a/MDK-ARM/mycode1.uvoptx
+++ b/MDK-ARM/mycode1.uvoptx
@@ -230,6 +230,11 @@
1
trigger_angle_o
+
+ 16
+ 1
+ shoot
+
diff --git a/User/module/dji.c b/User/module/dji.c
index 4160532..d1048c7 100644
--- a/User/module/dji.c
+++ b/User/module/dji.c
@@ -33,7 +33,7 @@ const motor_measure_t *trigger_motor_data;//3508电机数据
pid_type_def t_speed_pid;//2006速度环pid结构体
pid_type_def t_angle_pid;//2006位置环pid结构体
-fp32 M2006_speed_PID[3]={5.0,0.3,0.0}; //P,I,D(速度环)
+fp32 M2006_speed_PID[3]={15.0,0.3,0.0}; //P,I,D(速度环)
fp32 M2006_angle_PID[3]={25.0,0.0,1.5}; //P,I,D(角度环)
//速度环pid参数
fp32 M2006_PID[3]={4.9,0.01,0.0};
diff --git a/User/module/shoot.c b/User/module/shoot.c
index c2c01d4..b0af48a 100644
--- a/User/module/shoot.c
+++ b/User/module/shoot.c
@@ -69,24 +69,22 @@ extern volatile uint16_t last_angle ;
void shoot_odrive(int angle)
{
- // if(ball)
- // {
- // if(multi_turn_angle==8)
- // {
- // //di
- // odrive_accel_cmd(AXIS0_NODE,200,200);
- // odrive_pos_cmd(AXIS0_NODE,0);
- // }
- // else if(multi_turn_angle==0)
- // {
-
- // }
- // }
- odrive_accel_cmd(AXIS0_NODE,200,200);
+
+ odrive_accel_cmd(AXIS0_NODE,500,500);
osDelay(2);
odrive_pos_cmd(AXIS0_NODE,angle);
}
+void shoot_back(int angle)
+{
+
+ odrive_accel_cmd(AXIS0_NODE,100,100);
+ osDelay(2);
+ odrive_pos_cmd(AXIS0_NODE,angle);
+
+}
+
+
#endif
diff --git a/User/module/shoot.h b/User/module/shoot.h
index 707140d..e4386f4 100644
--- a/User/module/shoot.h
+++ b/User/module/shoot.h
@@ -23,5 +23,6 @@ typedef struct
void shooterInit(void);
void shoot_ball(int key);
void shoot_odrive(int angle);
+void shoot_back(int angle);
#endif
diff --git a/User/task/dji_task.c b/User/task/dji_task.c
index 1846b45..f55296f 100644
--- a/User/task/dji_task.c
+++ b/User/task/dji_task.c
@@ -43,12 +43,19 @@ void Task_Motor(void *argument)
// 更新编码器数据
Update_Encoder(&encoder);
m=trigger_angle_o*(8191/360);
+ trigger_angle_o=-2.5;//
if( mode == THREE )
{
+
//当最高点时进入离合
- if(encoder.round_cnt>=8)
+ if(encoder.round_cnt>=6)
{
- trigger_angle_o=2;
+ trigger_angle_o=-2.5;
+ trigger_pos(m);
+ }
+ else
+ {
+ trigger_angle_o=0;
trigger_pos(m);
}
diff --git a/User/task/shoot_task.c b/User/task/shoot_task.c
index 26911cc..bafd11e 100644
--- a/User/task/shoot_task.c
+++ b/User/task/shoot_task.c
@@ -41,6 +41,7 @@ void Task_Shoot(void *argument)
shoot_ball(0);
#elif ODRIVE_SHOOT == 1
+
if(mode == THREE)
{
shoot_odrive(SHOOT3);
@@ -49,7 +50,7 @@ void Task_Shoot(void *argument)
{
if(trigger_motor_data->total_angle ==0)//扳机已闭合
{
- shoot_odrive(BOTTOM);
+ shoot_back(DZ);
}
}