正赛!!!

This commit is contained in:
ws 2025-07-14 09:19:40 +08:00
parent c39c03c3e5
commit 8f3afcdba5
6 changed files with 72 additions and 29 deletions

View File

@ -152,3 +152,7 @@
[info] Log at : 2025/7/13|16:42:25|GMT+0800
[info] Log at : 2025/7/13|22:38:15|GMT+0800
[info] Log at : 2025/7/14|07:52:29|GMT+0800

View File

@ -1,18 +1,8 @@
*** Using Compiler 'V5.06 update 7 (build 960)', folder: 'D:\keil\ARM\ARMCC\Bin'
Build target 'R1'
compiling userTask.c...
compiling remote_control.c...
compiling initTask.c...
compiling main.c...
compiling shootTask.cpp...
compiling djiMotor.c...
compiling nucTask.cpp...
compiling encodeCan.cpp...
compiling ballTask.cpp...
compiling ball.cpp...
compiling shoot.cpp...
linking...
Program Size: Code=32032 RO-data=1832 RW-data=284 ZI-data=32268
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:09
Build Time Elapsed: 00:00:05

View File

@ -1 +1 @@
2025/7/13 17:07:34
2025/7/14 7:54:12

View File

@ -154,6 +154,33 @@
</SetRegEntry>
</TargetDriverDllRegistry>
<Breakpoint/>
<WatchWindow1>
<Ww>
<count>0</count>
<WinNumber>1</WinNumber>
<ItemText>rc_ctrl,0x0A</ItemText>
</Ww>
<Ww>
<count>1</count>
<WinNumber>1</WinNumber>
<ItemText>shoot,0x0A</ItemText>
</Ww>
<Ww>
<count>2</count>
<WinNumber>1</WinNumber>
<ItemText>ball</ItemText>
</Ww>
<Ww>
<count>3</count>
<WinNumber>1</WinNumber>
<ItemText>and1</ItemText>
</Ww>
<Ww>
<count>4</count>
<WinNumber>1</WinNumber>
<ItemText>and1</ItemText>
</Ww>
</WatchWindow1>
<MemoryWindow4>
<Mm>
<WinNumber>4</WinNumber>

View File

@ -16,7 +16,7 @@
#endif
#define ONE_CONTROL 0
#define ONE_CONTROL 1
//是否使用大疆DT7遥控器
#ifndef DT7

View File

@ -171,6 +171,9 @@ int Shoot::GO_SendData(float pos, float limit)
// sw[5] 👆 200 👇1800
// 左旋 sw[7] 200 --1800
float and1=0.0f;
void Shoot::rc_mode()
{
// 底部光电检测假设0为到位1为未到位根据实际硬件调整
@ -222,23 +225,44 @@ void Shoot::rc_mode()
{
ready_key = DEFENSE;
}
//400--640为1 730--860为2 900到1200为3档中间 1300--1500为4
if(rc_ctrl.sw[7]<=300)
{
and1=0.0f;
}
if(rc_ctrl.sw[7]>=400&&rc_ctrl.sw[7]<=640)
{
and1=-2.0f;
}
if(rc_ctrl.sw[7]>=730&&rc_ctrl.sw[7]<=860)
{
and1=-1.0f;
}
if(rc_ctrl.sw[7]>=900&&rc_ctrl.sw[7]<=1200)
{
and1=0.0f;
}
if(rc_ctrl.sw[7]>=1300&&rc_ctrl.sw[7]<=1500)
{
and1=1.0f;
}
// 旋钮映射部分不变
const int knob_min = 200;
const int knob_max = 1800;
const float map_min = 130.0f;
const float map_max = -60.0f;
int current_knob_value = rc_ctrl.sw[7];
if (current_knob_value < knob_min)
current_knob_value = knob_min;
if (current_knob_value > knob_max)
current_knob_value = knob_max;
knob_increment = map_min + (map_max - map_min) * (current_knob_value - knob_min) / (knob_max - knob_min);
// // 旋钮映射部分不变
// const int knob_min = 200;
// const int knob_max = 1800;
// const float map_min = 130.0f;
// const float map_max = -60.0f;
// int current_knob_value = rc_ctrl.sw[7];
// if (current_knob_value < knob_min)
// current_knob_value = knob_min;
// if (current_knob_value > knob_max)
// current_knob_value = knob_max;
// knob_increment = map_min + (map_max - map_min) * (current_knob_value - knob_min) / (knob_max - knob_min);
}
#if ONE_CONTROL == 0
float and1=0.0f;
void Shoot::shoot_control()
{
@ -415,8 +439,6 @@ void Shoot::RemoveError()
#if ONE_CONTROL
//float and1=-1.5f;
float and1=0;
float and2=0;
void Shoot::shoot_control()
@ -618,7 +640,7 @@ void Shoot ::ball_receive()
break;
case BAKC:
control_pos = BOTTOM_POS;
limit_speed = TO_BOTTOM; // 慢速下来
limit_speed = 8.0f; // 慢速下来
if (feedback.fd_gopos >= BOTTOM_POS - 1.0f && feedback.fd_gopos <= BOTTOM_POS + 1.0f)
{