?
This commit is contained in:
parent
2cebb50876
commit
aa232e9862
@ -159,7 +159,7 @@ void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan)
|
|||||||
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static osEventFlagsId_t eventReceive;
|
//static osEventFlagsId_t eventReceive;
|
||||||
static osThreadId_t thread_alert;
|
static osThreadId_t thread_alert;
|
||||||
/**
|
/**
|
||||||
* @brief 自定义大疆电机回调函数
|
* @brief 自定义大疆电机回调函数
|
||||||
|
@ -29,7 +29,7 @@ Ball ::Ball()
|
|||||||
if(i <=3)
|
if(i <=3)
|
||||||
{
|
{
|
||||||
hand_Motor[i]->type = M3508;//设置电机类型
|
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;
|
result[i] = 0;
|
||||||
speedSet[i] = 0;
|
speedSet[i] = 0;
|
||||||
@ -87,9 +87,9 @@ void Ball::ballHadling(void)
|
|||||||
|
|
||||||
if (ball_state == 1) //读光电 有球 0 无球 1
|
if (ball_state == 1) //读光电 有球 0 无球 1
|
||||||
{
|
{
|
||||||
osDelay(200); // 延时200ms
|
osDelay(100); // 延时200ms
|
||||||
speedm=4500;
|
speedm=2500;
|
||||||
speedm1=4500;
|
speedm1=2500;
|
||||||
currentState1 = BALL_REVERSE; // 切换到反转状态
|
currentState1 = BALL_REVERSE; // 切换到反转状态
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,7 +100,6 @@ void Ball::ballHadling(void)
|
|||||||
if (ball_state == 0)
|
if (ball_state == 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
//flag=2; //抽象的计次
|
|
||||||
speedm=0; // 停止电机
|
speedm=0; // 停止电机
|
||||||
speedm1=0;
|
speedm1=0;
|
||||||
currentState1 = BALL_CLOSE; // 切换到完成状态
|
currentState1 = BALL_CLOSE; // 切换到完成状态
|
||||||
@ -115,15 +114,7 @@ void Ball::ballHadling(void)
|
|||||||
HAL_GPIO_WritePin(CLOSE_GPIO_Port, CLOSE_Pin, GPIO_PIN_RESET);
|
HAL_GPIO_WritePin(CLOSE_GPIO_Port, CLOSE_Pin, GPIO_PIN_RESET);
|
||||||
currentState1 = BALL_FINISH; // 切换到完成状态
|
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;
|
break;
|
||||||
|
|
||||||
case BALL_FINISH:
|
case BALL_FINISH:
|
||||||
|
@ -37,7 +37,10 @@ void FunctionBall(void *argument)
|
|||||||
vofa[1] = -ball.hand_Motor[0]->speed_rpm; // 发送电机角度数据
|
vofa[1] = -ball.hand_Motor[0]->speed_rpm; // 发送电机角度数据
|
||||||
vofa[2] = ball.hand_Motor[1]->speed_rpm; // 发送电机速度数据
|
vofa[2] = ball.hand_Motor[1]->speed_rpm; // 发送电机速度数据
|
||||||
vofa[3] = ball.hand_Motor[2]->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); // 发送数据到虚拟串口
|
vofa_tx_main(vofa); // 发送数据到虚拟串口
|
||||||
|
|
||||||
tick += delay_tick; /* 计算下一个唤醒时刻 */
|
tick += delay_tick; /* 计算下一个唤醒时刻 */
|
||||||
|
Loading…
Reference in New Issue
Block a user