要运两次球
This commit is contained in:
parent
7ce1231e9a
commit
e17113c679
2
MDK-ARM/.vscode/keil-assistant.log
vendored
2
MDK-ARM/.vscode/keil-assistant.log
vendored
@ -106,3 +106,5 @@
|
|||||||
|
|
||||||
[info] Log at : 2025/7/6|22:02:13|GMT+0800
|
[info] Log at : 2025/7/6|22:02:13|GMT+0800
|
||||||
|
|
||||||
|
[info] Log at : 2025/7/6|23:12:04|GMT+0800
|
||||||
|
|
||||||
|
12
MDK-ARM/.vscode/uv4.log
vendored
12
MDK-ARM/.vscode/uv4.log
vendored
@ -3,16 +3,16 @@ Build target 'R1'
|
|||||||
compiling userTask.c...
|
compiling userTask.c...
|
||||||
compiling remote_control.c...
|
compiling remote_control.c...
|
||||||
compiling initTask.c...
|
compiling initTask.c...
|
||||||
compiling main.c...
|
|
||||||
compiling djiMotor.c...
|
|
||||||
compiling nucTask.cpp...
|
compiling nucTask.cpp...
|
||||||
compiling shoot.cpp...
|
|
||||||
compiling encodeCan.cpp...
|
compiling encodeCan.cpp...
|
||||||
compiling ball.cpp...
|
|
||||||
compiling shootTask.cpp...
|
|
||||||
compiling ballTask.cpp...
|
compiling ballTask.cpp...
|
||||||
|
compiling djiMotor.c...
|
||||||
|
compiling main.c...
|
||||||
|
compiling shootTask.cpp...
|
||||||
|
compiling shoot.cpp...
|
||||||
|
compiling ball.cpp...
|
||||||
linking...
|
linking...
|
||||||
Program Size: Code=31240 RO-data=1832 RW-data=268 ZI-data=32220
|
Program Size: Code=32720 RO-data=1832 RW-data=268 ZI-data=32220
|
||||||
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/6 22:22:20
|
2025/7/6 23:29:24
|
@ -254,6 +254,7 @@ void Ball::ball_control()
|
|||||||
|
|
||||||
void Ball::ballDown(void)
|
void Ball::ballDown(void)
|
||||||
{
|
{
|
||||||
|
osThreadFlagsClear(HANDING_FINISH);
|
||||||
switch (currentState1)
|
switch (currentState1)
|
||||||
{
|
{
|
||||||
case BALL_IDLE:
|
case BALL_IDLE:
|
||||||
@ -297,6 +298,48 @@ 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()
|
void Ball::Idle_control()
|
||||||
{
|
{
|
||||||
HAL_GPIO_WritePin(CLOSE_GPIO_Port, CLOSE_Pin, GPIO_PIN_RESET); // 确保爪气缸关闭
|
HAL_GPIO_WritePin(CLOSE_GPIO_Port, CLOSE_Pin, GPIO_PIN_RESET); // 确保爪气缸关闭
|
||||||
@ -306,15 +349,25 @@ void Ball::Idle_control()
|
|||||||
|
|
||||||
if (ready_key == SIDE) // 检测是否准备好
|
if (ready_key == SIDE) // 检测是否准备好
|
||||||
{
|
{
|
||||||
xiaomi.position = WAIT_POS;
|
if(hand_thread & HANDING_FINISH)
|
||||||
if (feedback->position_deg >= WAIT_POS - 3)
|
|
||||||
{
|
{
|
||||||
|
xiaomi.position=O_ANGLE;//继续保持外伸
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xiaomi.position = WAIT_POS;
|
||||||
|
if (feedback->position_deg >= WAIT_POS - 3)
|
||||||
|
{
|
||||||
// 只在READY_TELL未置位时发送,防止重复
|
// 只在READY_TELL未置位时发送,防止重复
|
||||||
if ((osThreadFlagsGet() & READY_TELL) == 0)
|
if ((osThreadFlagsGet() & READY_TELL) == 0)
|
||||||
{
|
{
|
||||||
osThreadFlagsSet(task_struct.thread.shoot, READY_TELL);
|
osThreadFlagsSet(task_struct.thread.shoot, READY_TELL);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -336,9 +389,11 @@ void Ball::Idle_control()
|
|||||||
{
|
{
|
||||||
currentState1 = BALL_IDLE;
|
currentState1 = BALL_IDLE;
|
||||||
}
|
}
|
||||||
// xiaomi.position = I_ANGLE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int ball_state = 0;
|
int ball_state = 0;
|
||||||
int last_ball_state = 0; // 上一次的光电状态
|
int last_ball_state = 0; // 上一次的光电状态
|
||||||
|
|
||||||
@ -396,7 +451,7 @@ void Ball::ballHadling(void)
|
|||||||
|
|
||||||
case BALL_FINISH:
|
case BALL_FINISH:
|
||||||
osDelay(50); // 延时 50ms
|
osDelay(50); // 延时 50ms
|
||||||
// osThreadFlagsSet(task_struct.thread.ball, HANDING_FINISH);
|
osThreadFlagsSet(task_struct.thread.ball, HANDING_FINISH);
|
||||||
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); // 确保下气缸关闭
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user