一次运球完自动放球
This commit is contained in:
parent
bf3d376b60
commit
8ea27c8620
@ -236,6 +236,10 @@ void Ball::ball_control()
|
|||||||
|
|
||||||
case DOWN2:
|
case DOWN2:
|
||||||
ballHadling();
|
ballHadling();
|
||||||
|
if(hand_thread & HANDING_FINISH)
|
||||||
|
{
|
||||||
|
ballDown();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,7 +263,7 @@ void Ball::ballDown(void)
|
|||||||
{
|
{
|
||||||
switch (currentState1)
|
switch (currentState1)
|
||||||
{
|
{
|
||||||
case BALL_IDLE:
|
case BALL_FINISH:
|
||||||
xiaomi.position = I_ANGLE; // 保持收回
|
xiaomi.position = I_ANGLE; // 保持收回
|
||||||
if (feedback->position_deg >= I_ANGLE - 0.8 && feedback->position_deg <= I_ANGLE + 0.8)
|
if (feedback->position_deg >= I_ANGLE - 0.8 && feedback->position_deg <= I_ANGLE + 0.8)
|
||||||
{
|
{
|
||||||
@ -306,6 +310,7 @@ void Ball::Idle_control()
|
|||||||
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);
|
||||||
|
osThreadFlagsClear(HANDING_FINISH);
|
||||||
|
|
||||||
if (ready_key == SIDE) // 检测是否准备好
|
if (ready_key == SIDE) // 检测是否准备好
|
||||||
{
|
{
|
||||||
@ -399,11 +404,11 @@ 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;
|
||||||
default:
|
default:
|
||||||
currentState1 = BALL_IDLE; // 默认回到空闲状态
|
currentState1 = BALL_IDLE; // 默认回到空闲状态
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user