Exemplo n.º 1
0
int mainControlLoop(void)
{
    if (control_params.line_follow_state == TRUE)
    {
        lineFollowControlLoop();
        control_params.position_state = FALSE;
        control_params.wall_follow_state = FALSE;

//		control_params.wall_follow_state = TRUE;
        control_params.position_state = FALSE;
    }
    else if (control_params.wall_follow_state == TRUE)
    {
        wallFollowControlLoop();
//		control_params.position_state = FALSE;
        control_params.position_state = TRUE;
    }
    else
    {
        control_params.position_state = TRUE;
    }
    if (control_params.speed_state == TRUE)
        speedControlLoop();
    if (control_params.position_state == TRUE)
        positionControlLoop();

    transfertFunctionLoop();

    return MAIN_CONTROL_E_SUCCESS;
}
Exemplo n.º 2
0
int mainControl_IT(void)
{
    int rv;
    if (pid_loop.start_state == FALSE)
    {
        return MAIN_CONTROL_E_SUCCESS;
    }

    if (control_params.line_follow_state == TRUE)
    {
        rv = lineFollowControlLoop();
        if (rv != LINE_FOLLOW_CONTROL_E_SUCCESS)
            return rv;
        rv = speedControlLoop();
        if (rv != SPEED_CONTROL_E_SUCCESS)
            return rv;
        rv = transfertFunctionLoop();
        if (rv != TRANSFERT_FUNCTION_E_SUCCESS)
            return rv;
        return MAIN_CONTROL_E_SUCCESS;
    }
    else if (control_params.wall_follow_state == TRUE)
    {
        rv = wallFollowControlLoop();
        if (rv != WALL_FOLLOW_CONTROL_E_SUCCESS)
            return rv;
    }
    rv = positionControlLoop();
    if (rv != POSITION_CONTROL_E_SUCCESS)
        return rv;
    rv = speedControlLoop();
    if (rv != SPEED_CONTROL_E_SUCCESS)
        return rv;
    rv = transfertFunctionLoop();
    if (rv != TRANSFERT_FUNCTION_E_SUCCESS)
        return rv;

    return MAIN_CONTROL_E_SUCCESS;
}