拨杆+码盘
This commit is contained in:
commit
94eadcfa16
4
MDK-ARM/.vscode/keil-assistant.log
vendored
4
MDK-ARM/.vscode/keil-assistant.log
vendored
@ -76,9 +76,13 @@
|
|||||||
|
|
||||||
[info] Log at : 2025/6/26|03:33:46|GMT+0800
|
[info] Log at : 2025/6/26|03:33:46|GMT+0800
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
[info] Log at : 2025/6/27|10:05:14|GMT+0800
|
[info] Log at : 2025/6/27|10:05:14|GMT+0800
|
||||||
|
|
||||||
[info] Log at : 2025/6/27|23:24:18|GMT+0800
|
[info] Log at : 2025/6/27|23:24:18|GMT+0800
|
||||||
|
|
||||||
[info] Log at : 2025/6/28|01:53:31|GMT+0800
|
[info] Log at : 2025/6/28|01:53:31|GMT+0800
|
||||||
|
=======
|
||||||
|
[info] Log at : 2025/6/26|15:46:24|GMT+0800
|
||||||
|
>>>>>>> 7b54a46bd3c69e44a04ffd669bb7d3b115fc9e9b
|
||||||
|
|
||||||
|
9
MDK-ARM/.vscode/uv4.log
vendored
9
MDK-ARM/.vscode/uv4.log
vendored
@ -1,5 +1,6 @@
|
|||||||
*** 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'
|
||||||
|
<<<<<<< HEAD
|
||||||
compiling ballTask.cpp...
|
compiling ballTask.cpp...
|
||||||
compiling ball.cpp...
|
compiling ball.cpp...
|
||||||
linking...
|
linking...
|
||||||
@ -7,3 +8,11 @@ Program Size: Code=28860 RO-data=1832 RW-data=276 ZI-data=32252
|
|||||||
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:05
|
Build Time Elapsed: 00:00:05
|
||||||
|
=======
|
||||||
|
compiling ball.cpp...
|
||||||
|
linking...
|
||||||
|
Program Size: Code=31096 RO-data=1832 RW-data=276 ZI-data=32252
|
||||||
|
FromELF: creating hex file...
|
||||||
|
"R1\R1.axf" - 0 Error(s), 0 Warning(s).
|
||||||
|
Build Time Elapsed: 00:00:04
|
||||||
|
>>>>>>> 7b54a46bd3c69e44a04ffd669bb7d3b115fc9e9b
|
||||||
|
6
MDK-ARM/.vscode/uv4.log.lock
vendored
6
MDK-ARM/.vscode/uv4.log.lock
vendored
@ -1 +1,5 @@
|
|||||||
2025/6/28 2:01:18
|
<<<<<<< HEAD
|
||||||
|
2025/6/28 2:01:18
|
||||||
|
=======
|
||||||
|
2025/6/26 4:03:58
|
||||||
|
>>>>>>> 7b54a46bd3c69e44a04ffd669bb7d3b115fc9e9b
|
||||||
|
@ -77,17 +77,14 @@ void Ball::rc_mode()
|
|||||||
extern_key=OUT;
|
extern_key=OUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (rc_ctrl.sw[5] == 200 && last_sw5 == 1800) // 只在1800->200的瞬间触发
|
if(rc_ctrl.sw[5]==1800)
|
||||||
// {
|
{
|
||||||
// rc_key = DOWN2;
|
ready_key=SIDE;
|
||||||
// }
|
}
|
||||||
// else
|
if(rc_ctrl.sw[5]==200)
|
||||||
// {
|
{
|
||||||
// rc_key = 0; // 其他情况不触发
|
ready_key=0; //默认不准备
|
||||||
// }
|
}
|
||||||
// last_sw5 = rc_ctrl.sw[5];
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ball::Send_control()
|
void Ball::Send_control()
|
||||||
@ -178,65 +175,31 @@ void Ball::ball_control()
|
|||||||
|
|
||||||
Move_Extend();
|
Move_Extend();
|
||||||
|
|
||||||
switch (currentState1)
|
switch (rc_key){
|
||||||
{
|
case MIDDLE2:
|
||||||
case BALL_IDLE:
|
|
||||||
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); // 确保下气缸关闭
|
||||||
if (rc_key == DOWN2) // 检测按键是否被按下
|
if (currentState1 == BALL_FINISH)
|
||||||
{
|
{
|
||||||
currentState1 = BALL_FORWARD;
|
currentState1 = BALL_IDLE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
currentState1 = BALL_IDLE; // 默认回到空闲状态
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BALL_FORWARD:
|
case UP2:
|
||||||
HAL_GPIO_WritePin(CLOSE_GPIO_Port, CLOSE_Pin, GPIO_PIN_SET); // 打开气缸爪子
|
ballDown();
|
||||||
osDelay(5);
|
|
||||||
HAL_GPIO_WritePin(DOWN_GPIO_Port, DOWN_Pin, GPIO_PIN_SET); // 打开下气缸
|
|
||||||
currentState1 = BALL_DROP; // 切换到球下落状态
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BALL_DROP:
|
case DOWN2:
|
||||||
osDelay(100); // 延时 100ms
|
ballHadling();
|
||||||
HAL_GPIO_WritePin(DOWN_GPIO_Port, DOWN_Pin, GPIO_PIN_RESET); // 关闭下气缸
|
//test_Handling();
|
||||||
// 一直检测有球(ball_state == 0),等球离开
|
|
||||||
if (ball_state == 1 && last_ball_state == 0) // 球离开
|
|
||||||
{
|
|
||||||
currentState1 = BALL_FLAG;
|
|
||||||
}
|
|
||||||
last_ball_state = ball_state;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BALL_FLAG:
|
|
||||||
osDelay(10); // 延时 50ms
|
|
||||||
// 等待球弹回再次检测到球
|
|
||||||
if (ball_state == 0 && last_ball_state == 1) // 球弹回
|
|
||||||
{
|
|
||||||
currentState1 = BALL_CLOSE;
|
|
||||||
}
|
|
||||||
last_ball_state = ball_state;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BALL_CLOSE:
|
|
||||||
osDelay(100);
|
|
||||||
HAL_GPIO_WritePin(CLOSE_GPIO_Port, CLOSE_Pin, GPIO_PIN_RESET); // 闭合气缸爪子
|
|
||||||
currentState1 = BALL_FINISH; // 切换到反转状态
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BALL_FINISH:
|
|
||||||
osDelay(50); // 延时 50ms
|
|
||||||
HAL_GPIO_WritePin(CLOSE_GPIO_Port, CLOSE_Pin, GPIO_PIN_RESET); // 确保气缸爪子闭合
|
|
||||||
HAL_GPIO_WritePin(DOWN_GPIO_Port, DOWN_Pin, GPIO_PIN_RESET); // 确保下气缸关闭
|
|
||||||
|
|
||||||
currentState1 = BALL_IDLE; // 回到空闲状态
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
currentState1 = BALL_IDLE; // 默认回到空闲状态
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Send_control();
|
Send_control();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user