示例#1
0
void updateBehavior(void)
{
    if (current_orientation == F_INVERTED)
    {
        if (canStabilizeHover() && rmat[7] < -14000)
        {
            current_orientation = F_HOVER;
        }
        else if (canStabilizeInverted() && rmat[8] < 6000)
        {
            current_orientation = F_INVERTED;
        }
        else
        {
            current_orientation = F_NORMAL;
        }
    }
    else if (current_orientation == F_HOVER)
    {
        if (canStabilizeHover() && rmat[7] < -8000)
        {
            current_orientation = F_HOVER;
        }
        else if (canStabilizeInverted() && rmat[8] < -6000)
        {
            current_orientation = F_INVERTED;
        }
        else
        {
            current_orientation = F_NORMAL;
        }
    }
    else
    {
        if (canStabilizeInverted() && rmat[8] < -6000)
        {
            current_orientation = F_INVERTED;
        }
        else if (canStabilizeHover() && rmat[7] < -14000)
        {
            current_orientation = F_HOVER;
        }
        else
        {
            current_orientation = F_NORMAL;
        }
    }
    if (flags._.pitch_feedback && !flags._.GPS_steering)
    {
        desired_behavior.W = current_orientation;
    }
    dcm_enable_yaw_drift_correction(current_orientation != F_HOVER);

}
示例#2
0
void yawCntrl(void)
{
	if (canStabilizeHover() && current_orientation == F_HOVER)
	{
		hoverYawCntrl();
	}
	else
	{
		normalYawCntrl();
	}
}
示例#3
0
void pitchCntrl(void)
{
	if (canStabilizeHover() && desired_behavior._.hover)
	{
		hoverPitchCntrl();
	}
	else
	{
		normalPitchCntrl();
	}
}
示例#4
0
void rollCntrl(void)
{
    if (canStabilizeHover() && current_orientation == F_HOVER)
    {
        hoverRollCntrl();
    }
    else
    {
        normalRollCntrl();
    }
}