新手入门
- 积分
- 9
- 金钱
- 9
- 注册时间
- 2019-2-12
- 在线时间
- 0 小时
|
1金钱
if (RATE_DO_EXECUTE(ATTITUDE_UPDATE_RATE, tick)) /* 500Hz */
{
if(setpoint->isAltHold == false)
{
actualThrust = setpoint->thrust;
}
if(control->flipDir == CENTER)
{
attitudeDesired.yaw -= setpoint->attitude.yaw/ATTITUDE_UPDATE_RATE;
while(attitudeDesired.yaw > 180.0f)
attitudeDesired.yaw -= 360.0f;
while(attitudeDesired.yaw < -180.0f)
attitudeDesired.yaw += 360.0f;
}
attitudeDesired.roll = setpoint->attitude.roll;
attitudeDesired.pitch = setpoint->attitude.pitch;
attitudeAnglePID(&state->attitude, &attitudeDesired, &rateDesired);
if(control->flipDir != CENTER)
{
rateDesired.pitch = setpoint->attitude.pitch;
rateDesired.roll = setpoint->attitude.roll;
}
attitudeRatePID(&sensors->gyro, &rateDesired, control);
不太明白怎么实现的yaw轴转动速率的控制,尤其红色部分第一行,求解答!
|
|