From 100b21b730cbeb7c1decf6276382d2de91d9e7bf Mon Sep 17 00:00:00 2001 From: ws <1621320660@qq.com> Date: Thu, 10 Jul 2025 23:57:54 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9D=A0=E6=88=91=E5=8F=88=E8=B7=B3=E5=B0=BA?= =?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 | 16 +++++++++++ MDK-ARM/.vscode/uv4.log | 41 ++++++++++++++++++++++++---- MDK-ARM/.vscode/uv4.log.lock | 2 +- MDK-ARM/R1.uvoptx | 16 ++++++++--- User/bsp/TopDefine.h | 2 +- User/module/ball.cpp | 8 +++--- User/module/shoot.cpp | 43 +++++++++++++++++------------- 7 files changed, 95 insertions(+), 33 deletions(-) diff --git a/MDK-ARM/.vscode/keil-assistant.log b/MDK-ARM/.vscode/keil-assistant.log index e3974da..de28053 100644 --- a/MDK-ARM/.vscode/keil-assistant.log +++ b/MDK-ARM/.vscode/keil-assistant.log @@ -122,3 +122,19 @@ [info] Log at : 2025/7/8|20:39:07|GMT+0800 +[info] Log at : 2025/7/9|08:39:28|GMT+0800 + +[info] Log at : 2025/7/9|11:36:02|GMT+0800 + +[info] Log at : 2025/7/9|16:01:34|GMT+0800 + +[info] Log at : 2025/7/9|23:48:02|GMT+0800 + +[info] Log at : 2025/7/10|01:59:23|GMT+0800 + +[info] Log at : 2025/7/10|15:33:45|GMT+0800 + +[info] Log at : 2025/7/10|17:26:59|GMT+0800 + +[info] Log at : 2025/7/10|22:12:10|GMT+0800 + diff --git a/MDK-ARM/.vscode/uv4.log b/MDK-ARM/.vscode/uv4.log index 4e685d4..d3613a4 100644 --- a/MDK-ARM/.vscode/uv4.log +++ b/MDK-ARM/.vscode/uv4.log @@ -1,8 +1,39 @@ *** Using Compiler 'V5.06 update 7 (build 960)', folder: 'D:\keil\ARM\ARMCC\Bin' Build target 'R1' -compiling shoot.cpp... linking... -Program Size: Code=32032 RO-data=1832 RW-data=284 ZI-data=32252 -FromELF: creating hex file... -"R1\R1.axf" - 0 Error(s), 0 Warning(s). -Build Time Elapsed: 00:00:05 +R1\R1.axf: Error: L6200E: Symbol __asm___6_main_c_main____REV16 multiply defined (by main.o and main.o). +R1\R1.axf: Error: L6200E: Symbol __asm___6_main_c_main____REVSH multiply defined (by main.o and main.o). +R1\R1.axf: Error: L6200E: Symbol __asm___6_main_c_main____RRX multiply defined (by main.o and main.o). +R1\R1.axf: Error: L6200E: Symbol __asm___9_shoot_cpp_24247dc0___Z7__REVSHs multiply defined (by shoot.o and shoot.o). +R1\R1.axf: Error: L6200E: Symbol __asm___10_djiMotor_c_0818c4ba____REV16 multiply defined (by djimotor.o and djimotor.o). +R1\R1.axf: Error: L6200E: Symbol __asm___10_djiMotor_c_0818c4ba____REVSH multiply defined (by djimotor.o and djimotor.o). +R1\R1.axf: Error: L6200E: Symbol __asm___10_djiMotor_c_0818c4ba____RRX multiply defined (by djimotor.o and djimotor.o). +R1\R1.axf: Error: L6200E: Symbol __asm___16_remote_control_c_d71f1673____REV16 multiply defined (by remote_control.o and remote_control.o). +R1\R1.axf: Error: L6200E: Symbol __asm___16_remote_control_c_d71f1673____REVSH multiply defined (by remote_control.o and remote_control.o). +R1\R1.axf: Error: L6200E: Symbol __asm___16_remote_control_c_d71f1673____RRX multiply defined (by remote_control.o and remote_control.o). +R1\R1.axf: Error: L6200E: Symbol __asm___8_ball_cpp_a168e0ee___Z7__REV16j multiply defined (by ball.o and ball.o). +R1\R1.axf: Error: L6200E: Symbol __asm___8_ball_cpp_a168e0ee___Z7__REVSHs multiply defined (by ball.o and ball.o). +R1\R1.axf: Error: L6200E: Symbol __asm___8_ball_cpp_a168e0ee___Z5__RRXj multiply defined (by ball.o and ball.o). +R1\R1.axf: Error: L6200E: Symbol __asm___9_shoot_cpp_24247dc0___Z7__REV16j multiply defined (by shoot.o and shoot.o). +R1\R1.axf: Error: L6200E: Symbol __asm___9_shoot_cpp_24247dc0___Z5__RRXj multiply defined (by shoot.o and shoot.o). +R1\R1.axf: Error: L6200E: Symbol __asm___10_initTask_c_1acb3ba9____REV16 multiply defined (by inittask.o and inittask.o). +R1\R1.axf: Error: L6200E: Symbol __asm___10_initTask_c_1acb3ba9____REVSH multiply defined (by inittask.o and inittask.o). +R1\R1.axf: Error: L6200E: Symbol __asm___10_initTask_c_1acb3ba9____RRX multiply defined (by inittask.o and inittask.o). +R1\R1.axf: Error: L6200E: Symbol __asm___12_ballTask_cpp_ball___Z7__REV16j multiply defined (by balltask.o and balltask.o). +R1\R1.axf: Error: L6200E: Symbol __asm___12_ballTask_cpp_ball___Z7__REVSHs multiply defined (by balltask.o and balltask.o). +R1\R1.axf: Error: L6200E: Symbol __asm___12_ballTask_cpp_ball___Z5__RRXj multiply defined (by balltask.o and balltask.o). +R1\R1.axf: Error: L6200E: Symbol __asm___13_encodeCan_cpp_dca83ed4___Z7__REV16j multiply defined (by encodecan.o and encodecan.o). +R1\R1.axf: Error: L6200E: Symbol __asm___13_encodeCan_cpp_dca83ed4___Z7__REVSHs multiply defined (by encodecan.o and encodecan.o). +R1\R1.axf: Error: L6200E: Symbol __asm___13_encodeCan_cpp_dca83ed4___Z5__RRXj multiply defined (by encodecan.o and encodecan.o). +R1\R1.axf: Error: L6200E: Symbol __asm___11_nucTask_cpp_3f7e051c___Z7__REV16j multiply defined (by nuctask.o and nuctask.o). +R1\R1.axf: Error: L6200E: Symbol __asm___11_nucTask_cpp_3f7e051c___Z7__REVSHs multiply defined (by nuctask.o and nuctask.o). +R1\R1.axf: Error: L6200E: Symbol __asm___11_nucTask_cpp_3f7e051c___Z5__RRXj multiply defined (by nuctask.o and nuctask.o). +R1\R1.axf: Error: L6200E: Symbol __asm___13_shootTask_cpp_shoot___Z7__REV16j multiply defined (by shoottask.o and shoottask.o). +R1\R1.axf: Error: L6200E: Symbol __asm___13_shootTask_cpp_shoot___Z7__REVSHs multiply defined (by shoottask.o and shoottask.o). +R1\R1.axf: Error: L6200E: Symbol __asm___13_shootTask_cpp_shoot___Z5__RRXj multiply defined (by shoottask.o and shoottask.o). +Not enough information to list image symbols. +Not enough information to list load addresses in the image map. +Finished: 2 information, 0 warning and 30 error messages. +"R1\R1.axf" - 30 Error(s), 0 Warning(s). +Target not created. +Build Time Elapsed: 00:00:02 diff --git a/MDK-ARM/.vscode/uv4.log.lock b/MDK-ARM/.vscode/uv4.log.lock index 15ae3a8..e3043fd 100644 --- a/MDK-ARM/.vscode/uv4.log.lock +++ b/MDK-ARM/.vscode/uv4.log.lock @@ -1 +1 @@ -2025/7/9 7:17:12 \ No newline at end of file +2025/7/10 17:27:12 \ No newline at end of file diff --git a/MDK-ARM/R1.uvoptx b/MDK-ARM/R1.uvoptx index 2f15476..533a043 100644 --- a/MDK-ARM/R1.uvoptx +++ b/MDK-ARM/R1.uvoptx @@ -190,6 +190,16 @@ 1 a,0x0A + + 7 + 1 + and1,0x0A + + + 8 + 1 + test_distance + @@ -957,7 +967,7 @@ User/device - 1 + 0 0 0 0 @@ -1049,7 +1059,7 @@ User/module - 0 + 1 0 0 0 @@ -1081,7 +1091,7 @@ User/task - 1 + 0 0 0 0 diff --git a/User/bsp/TopDefine.h b/User/bsp/TopDefine.h index 9524760..9d74009 100644 --- a/User/bsp/TopDefine.h +++ b/User/bsp/TopDefine.h @@ -16,7 +16,7 @@ #endif -#define ONE_CONTROL 1 +#define ONE_CONTROL 0 //是否使用大疆DT7遥控器 #ifndef DT7 diff --git a/User/module/ball.cpp b/User/module/ball.cpp index 14a5e52..e27b6db 100644 --- a/User/module/ball.cpp +++ b/User/module/ball.cpp @@ -10,11 +10,11 @@ extern RC_ctrl_t rc_ctrl; extern int ball_exit; // 伸缩 -//外死点132 外130 中119.12 内92 限位90 +//外死点89 外85 中75 内49 限位46 -#define I_ANGLE 92 -#define O_ANGLE 130 -#define WAIT_POS 119 +#define I_ANGLE 49 +#define O_ANGLE 85 +#define WAIT_POS 75 // PE11 气缸git stash apply diff --git a/User/module/shoot.cpp b/User/module/shoot.cpp index 626a795..e01e204 100644 --- a/User/module/shoot.cpp +++ b/User/module/shoot.cpp @@ -15,7 +15,7 @@ extern RC_ctrl_t rc_ctrl; NUC_t nuc_v; float vofa[8]; -double test_distance; +double test_distance=4.0; // sw[7]👆 1694 中 1000 👇306 // sw[2]👆 1694 👇306 @@ -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 0 -#define Tigger_ZERO 138 +#define Tigger_ZERO 125 #define Tigger_ERROR 3 float knob_increment; @@ -99,7 +99,7 @@ float shoot_fitting(float x) float pass_fitting(float x) { - return 1.1790172f * x * x + 15.983755f * x + -172.04664f + 1.6f; + return 1.1790172f * x * x + 15.983755f * x + -172.04664f + 1.6f -2.0f; } void Shoot::distanceGet(const NUC_t &nuc_v) @@ -231,6 +231,8 @@ void Shoot::rc_mode() #if ONE_CONTROL == 0 +//float and1=-1.0f; +float and1=0; void Shoot::shoot_control() { @@ -241,7 +243,7 @@ void Shoot::shoot_control() { case VSION: //fire_pos = distance; // 视觉拟合的力 - fire_pos =shoot_fitting(distance)+2.0f; + fire_pos =shoot_fitting(test_distance)+2.0f+and1; //fire_pos = INIT_POS + knob_increment; // 根据旋钮值调整发射位置 switch (rc_key) @@ -284,7 +286,7 @@ void Shoot::shoot_control() case PASS: // 实时可调蓄力位置 //fire_pos = INIT_POS + knob_increment; // 根据旋钮值调整发射位置 - fire_pos =pass_fitting(pass_distance)+2.0f; + fire_pos =pass_fitting(pass_distance); switch (rc_key) { case DOWN1: @@ -407,6 +409,10 @@ void Shoot::RemoveError() #if ONE_CONTROL +//float and1=-1.5f; +float and1=0; +float and2=0; + void Shoot::shoot_control() { @@ -421,7 +427,7 @@ void Shoot::shoot_control() switch (mode_key) { case VSION: - fire_pos = shoot_fitting(4); // 视觉拟合的力 + fire_pos = shoot_fitting(distance)+and1; // 视觉拟合的力 //fire_pos = INIT_POS + knob_increment; // 根据旋钮值调整发射位置 switch (rc_key) @@ -439,8 +445,8 @@ void Shoot::shoot_control() if (feedback.fd_gopos >= fire_pos - GO_ERROR && feedback.fd_gopos <= fire_pos + GO_ERROR) { shoot_wait = 1; - BSP_Buzzer_Start(); - BSP_Buzzer_Set(1, 500); + //BSP_Buzzer_Start(); + //BSP_Buzzer_Set(1, 500); } } @@ -453,7 +459,7 @@ void Shoot::shoot_control() if (feedback.fd_tpos >= Tigger_ZERO - 20) { - BSP_Buzzer_Stop(); + //BSP_Buzzer_Stop(); currentState = SHOOT_IDLE; osThreadFlagsClear(EXTEND_OK); osThreadFlagsClear(READY_TELL); // 蓄力标志位 @@ -477,8 +483,7 @@ void Shoot::shoot_control() switch (rc_key) { case MIDDLE1: - //fire_pos = pass_fitting(distance); - fire_pos = pass_fitting(pass_distance); + fire_pos = pass_fitting(pass_distance)+and2; if ((shoot_thread & READY_TELL) && !(shoot_thread & EXTEND_OK)) { // 只收到READY_TELL且未收到EXTEND_OK时,顶部蓄力流程 @@ -493,8 +498,8 @@ void Shoot::shoot_control() if (feedback.fd_gopos >= fire_pos - GO_ERROR && feedback.fd_gopos <= fire_pos + GO_ERROR) { shoot_wait = 1; - BSP_Buzzer_Start(); - BSP_Buzzer_Set(1, 500); + // BSP_Buzzer_Start(); + // BSP_Buzzer_Set(1, 500); } } // 没收到READY_TELL不做任何蓄力 @@ -509,7 +514,7 @@ void Shoot::shoot_control() if (feedback.fd_tpos >= Tigger_ZERO - 20) { - BSP_Buzzer_Stop(); + //BSP_Buzzer_Stop(); currentState = SHOOT_IDLE; osThreadFlagsClear(EXTEND_OK); osThreadFlagsClear(READY_TELL); // 蓄力标志位 @@ -539,7 +544,7 @@ void Shoot::shoot_control() control_pos = WAIT_POS; //-209 go1.Pos = control_pos; limit_speed = TO_TOP; // 快速上去 - if(feedback.fd_gopos < -149) + if(feedback.fd_gopos < WAIT_POS) { t_posSet = Tigger_ZERO; // 扳机松开 //osThreadFlagsSet(task_struct.thread.ball, DEF_READY); @@ -571,7 +576,7 @@ void Shoot::shoot_control() trigger_control(); } -int a=0; + // 配合运球到发射 void Shoot ::ball_receive() { @@ -586,12 +591,12 @@ void Shoot ::ball_receive() { control_pos = TOP_POS; limit_speed = TO_TOP; // 快速上去 - a++; + } if (feedback.fd_gopos < -209) { - a++; + currentState = GO_TOP; // 切换到准备发射状态 } } @@ -636,7 +641,7 @@ void Shoot::RemoveError() control_pos = INIT_POS; BSP_Buzzer_Stop(); } - limit_speed = 3.0f; // 慢慢送上去 + limit_speed = 5.0f; // 慢慢送上去 go1.Pos = control_pos; }