This commit is contained in:
ws 2025-04-30 13:20:30 +08:00
parent 2cebb50876
commit aa232e9862
3 changed files with 10 additions and 16 deletions

View File

@ -159,7 +159,7 @@ void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan)
}
#else
static osEventFlagsId_t eventReceive;
//static osEventFlagsId_t eventReceive;
static osThreadId_t thread_alert;
/**
* @brief

View File

@ -29,7 +29,7 @@ Ball ::Ball()
if(i <=3)
{
hand_Motor[i]->type = M3508;//设置电机类型
PID_init(&speed_pid[i],PID_POSITION,M3508_speed_PID,16000, 10000);//pid初始化
PID_init(&speed_pid[i],PID_POSITION,M3508_speed_PID,16000, 1000);//pid初始化
}
result[i] = 0;
speedSet[i] = 0;
@ -87,9 +87,9 @@ void Ball::ballHadling(void)
if (ball_state == 1) //读光电 有球 0 无球 1
{
osDelay(200); // 延时200ms
speedm=4500;
speedm1=4500;
osDelay(100); // 延时200ms
speedm=2500;
speedm1=2500;
currentState1 = BALL_REVERSE; // 切换到反转状态
}
@ -100,7 +100,6 @@ void Ball::ballHadling(void)
if (ball_state == 0)
{
//flag=2; //抽象的计次
speedm=0; // 停止电机
speedm1=0;
currentState1 = BALL_CLOSE; // 切换到完成状态
@ -115,15 +114,7 @@ void Ball::ballHadling(void)
HAL_GPIO_WritePin(CLOSE_GPIO_Port, CLOSE_Pin, GPIO_PIN_RESET);
currentState1 = BALL_FINISH; // 切换到完成状态
}
// if (flag == 2)
// {
// if(ball_state == 0)
// {
// HAL_GPIO_WritePin(CLOSE_GPIO_Port, CLOSE_Pin, GPIO_PIN_RESET);
// currentState1 = BALL_FINISH; // 切换到完成状态
// }
// }
break;
case BALL_FINISH:

View File

@ -37,7 +37,10 @@ void FunctionBall(void *argument)
vofa[1] = -ball.hand_Motor[0]->speed_rpm; // 发送电机角度数据
vofa[2] = ball.hand_Motor[1]->speed_rpm; // 发送电机速度数据
vofa[3] = ball.hand_Motor[2]->speed_rpm; // 发送电机速度数据
vofa[4] = ball.result[0];
vofa[5] = ball.result[1];
vofa[6] = ball.result[2];
vofa_tx_main(vofa); // 发送数据到虚拟串口
tick += delay_tick; /* 计算下一个唤醒时刻 */