正赛流程跑过了
This commit is contained in:
parent
665de4aef4
commit
c39c03c3e5
2
MDK-ARM/.vscode/keil-assistant.log
vendored
2
MDK-ARM/.vscode/keil-assistant.log
vendored
@ -150,3 +150,5 @@
|
|||||||
|
|
||||||
[info] Log at : 2025/7/13|16:33:17|GMT+0800
|
[info] Log at : 2025/7/13|16:33:17|GMT+0800
|
||||||
|
|
||||||
|
[info] Log at : 2025/7/13|16:42:25|GMT+0800
|
||||||
|
|
||||||
|
12
MDK-ARM/.vscode/uv4.log
vendored
12
MDK-ARM/.vscode/uv4.log
vendored
@ -1,8 +1,18 @@
|
|||||||
*** Using Compiler 'V5.06 update 7 (build 960)', folder: 'D:\keil\ARM\ARMCC\Bin'
|
*** Using Compiler 'V5.06 update 7 (build 960)', folder: 'D:\keil\ARM\ARMCC\Bin'
|
||||||
Build target 'R1'
|
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...
|
compiling shoot.cpp...
|
||||||
linking...
|
linking...
|
||||||
Program Size: Code=31396 RO-data=1832 RW-data=276 ZI-data=32260
|
Program Size: Code=32032 RO-data=1832 RW-data=284 ZI-data=32268
|
||||||
FromELF: creating hex file...
|
FromELF: creating hex file...
|
||||||
"R1\R1.axf" - 0 Error(s), 0 Warning(s).
|
"R1\R1.axf" - 0 Error(s), 0 Warning(s).
|
||||||
Build Time Elapsed: 00:00:09
|
Build Time Elapsed: 00:00:09
|
||||||
|
2
MDK-ARM/.vscode/uv4.log.lock
vendored
2
MDK-ARM/.vscode/uv4.log.lock
vendored
@ -1 +1 @@
|
|||||||
2025/7/13 16:34:35
|
2025/7/13 17:07:34
|
@ -154,18 +154,6 @@
|
|||||||
</SetRegEntry>
|
</SetRegEntry>
|
||||||
</TargetDriverDllRegistry>
|
</TargetDriverDllRegistry>
|
||||||
<Breakpoint/>
|
<Breakpoint/>
|
||||||
<WatchWindow1>
|
|
||||||
<Ww>
|
|
||||||
<count>0</count>
|
|
||||||
<WinNumber>1</WinNumber>
|
|
||||||
<ItemText>shoot,0x0A</ItemText>
|
|
||||||
</Ww>
|
|
||||||
<Ww>
|
|
||||||
<count>1</count>
|
|
||||||
<WinNumber>1</WinNumber>
|
|
||||||
<ItemText>ball,0x0A</ItemText>
|
|
||||||
</Ww>
|
|
||||||
</WatchWindow1>
|
|
||||||
<MemoryWindow4>
|
<MemoryWindow4>
|
||||||
<Mm>
|
<Mm>
|
||||||
<WinNumber>4</WinNumber>
|
<WinNumber>4</WinNumber>
|
||||||
|
@ -217,7 +217,7 @@ void Ball::ballHadling(void)
|
|||||||
void Ball::ball_control()
|
void Ball::ball_control()
|
||||||
{
|
{
|
||||||
hand_thread = osThreadFlagsGet(); // 获取任务通知标志位
|
hand_thread = osThreadFlagsGet(); // 获取任务通知标志位
|
||||||
ball_state = HAL_GPIO_ReadPin(up_ball_GPIO_Port, up_ball_Pin); // 读取光电状态(有球 1,无球 0)
|
ball_state = HAL_GPIO_ReadPin(up_ball_GPIO_Port, up_ball_Pin); // 读取光电状态(有球 0,无球 1)
|
||||||
|
|
||||||
|
|
||||||
// 进攻
|
// 进攻
|
||||||
@ -257,6 +257,8 @@ void Ball::ball_control()
|
|||||||
osThreadFlagsClear(READY_TELL); // 蓄力标志位
|
osThreadFlagsClear(READY_TELL); // 蓄力标志位
|
||||||
osThreadFlagsClear(HANDING_FINISH);
|
osThreadFlagsClear(HANDING_FINISH);
|
||||||
|
|
||||||
|
haveball=0;//变为空球状态
|
||||||
|
|
||||||
currentState1 = BALL_IDLE;
|
currentState1 = BALL_IDLE;
|
||||||
|
|
||||||
Send_control();
|
Send_control();
|
||||||
@ -356,7 +358,20 @@ void Ball::ballDown(void)
|
|||||||
|
|
||||||
void Ball::Idle_control()
|
void Ball::Idle_control()
|
||||||
{
|
{
|
||||||
HAL_GPIO_WritePin(CLOSE_GPIO_Port, CLOSE_Pin, GPIO_PIN_RESET); // 确保爪气缸关闭
|
if(ball_state==1 && haveball==0)// 读取光电状态(有球 0,无球 1)
|
||||||
|
{
|
||||||
|
HAL_GPIO_WritePin(CLOSE_GPIO_Port, CLOSE_Pin, GPIO_PIN_SET); // 确保爪气缸张开
|
||||||
|
|
||||||
|
}
|
||||||
|
if(ball_state==0)
|
||||||
|
{
|
||||||
|
haveball=1;//变为持球状态
|
||||||
|
osDelay(500);
|
||||||
|
HAL_GPIO_WritePin(CLOSE_GPIO_Port, CLOSE_Pin, GPIO_PIN_RESET); // 确保爪气缸闭合
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// HAL_GPIO_WritePin(CLOSE_GPIO_Port, CLOSE_Pin, GPIO_PIN_RESET); // 确保爪气缸关闭
|
||||||
HAL_GPIO_WritePin(DOWN_GPIO_Port, DOWN_Pin, GPIO_PIN_RESET); // 确保下气缸关闭
|
HAL_GPIO_WritePin(DOWN_GPIO_Port, DOWN_Pin, GPIO_PIN_RESET); // 确保下气缸关闭
|
||||||
|
|
||||||
osThreadFlagsClear(EXTEND_OK);
|
osThreadFlagsClear(EXTEND_OK);
|
||||||
|
@ -74,11 +74,10 @@ public:
|
|||||||
int16_t extern_key;
|
int16_t extern_key;
|
||||||
int16_t ready_key; //准备按键
|
int16_t ready_key; //准备按键
|
||||||
//用于传接球,运球后通知
|
//用于传接球,运球后通知
|
||||||
volatile BallState_t ballStatus;//是否有球
|
|
||||||
volatile uint32_t hand_thread;//接收传回的线程通知
|
volatile uint32_t hand_thread;//接收传回的线程通知
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool haveball;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -32,7 +32,7 @@ const fp32 Shoot::M2006_angle_PID[3] = {15, 0.1, 0};
|
|||||||
#define TO_TOP 13.0f
|
#define TO_TOP 13.0f
|
||||||
#define TO_BOTTOM 6.0f
|
#define TO_BOTTOM 6.0f
|
||||||
|
|
||||||
#define INIT_POS -135
|
#define INIT_POS -120
|
||||||
#define TOP_POS -211
|
#define TOP_POS -211
|
||||||
#define BOTTOM_POS 0
|
#define BOTTOM_POS 0
|
||||||
#define WAIT_POS -170
|
#define WAIT_POS -170
|
||||||
@ -86,16 +86,23 @@ void Shoot::trigger_control()
|
|||||||
CAN_cmd_200(result, 0, 0, 0, &hcan1);
|
CAN_cmd_200(result, 0, 0, 0, &hcan1);
|
||||||
}
|
}
|
||||||
|
|
||||||
float shoot_fitting(float x)
|
//好使老拟合
|
||||||
{
|
// float shoot_fitting(float x)
|
||||||
return 0.67076341f * x * x + 20.212423f * x + -154.53966f + 1.0f;
|
// {
|
||||||
}
|
// return 0.67076341f * x * x + 20.212423f * x + -154.53966f + 1.0f;
|
||||||
|
// }
|
||||||
|
|
||||||
// float shoot_fitting(float x)
|
// float shoot_fitting(float x)
|
||||||
// {
|
// {
|
||||||
// return 1.4255807f * x * x + 12.138447f * x + -136.35306f;
|
// return 1.4255807f * x * x + 12.138447f * x + -136.35306f;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
float shoot_fitting(float x)
|
||||||
|
{
|
||||||
|
return 1.2143736f * x * x + 14.733786f * x + -133.3627f;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
float pass_fitting(float x)
|
float pass_fitting(float x)
|
||||||
{
|
{
|
||||||
@ -231,7 +238,7 @@ void Shoot::rc_mode()
|
|||||||
|
|
||||||
#if ONE_CONTROL == 0
|
#if ONE_CONTROL == 0
|
||||||
|
|
||||||
float and1=2.0f;
|
float and1=0.0f;
|
||||||
void Shoot::shoot_control()
|
void Shoot::shoot_control()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -242,8 +249,7 @@ void Shoot::shoot_control()
|
|||||||
{
|
{
|
||||||
case VSION:
|
case VSION:
|
||||||
//fire_pos = distance; // 视觉拟合的力
|
//fire_pos = distance; // 视觉拟合的力
|
||||||
// fire_pos =shoot_fitting(distance)+and1;
|
fire_pos =shoot_fitting(distance)+and1;
|
||||||
fire_pos =shoot_fitting(distance)+2.0f-2.3f;
|
|
||||||
//fire_pos = INIT_POS + knob_increment; // 根据旋钮值调整发射位置
|
//fire_pos = INIT_POS + knob_increment; // 根据旋钮值调整发射位置
|
||||||
|
|
||||||
switch (rc_key)
|
switch (rc_key)
|
||||||
@ -330,7 +336,7 @@ void Shoot::shoot_control()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
abs_limit_min_max_fp(&go1.Pos, -210.0f, 2.0f);
|
abs_limit_min_max_fp(&go1.Pos, -210.0f, 8.0f);
|
||||||
// 发送数据到蓄力电机
|
// 发送数据到蓄力电机
|
||||||
GO_SendData(go1.Pos, limit_speed);
|
GO_SendData(go1.Pos, limit_speed);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user