Quasics2016Code/SimpleRobot/src/Commands/FPSDriveLogarithmic.cpp
// Called repeatedly when this Command is scheduled to run

Called repeatedly when this Command is scheduled to run
Called repeatedly when this Command is scheduled to run
void FPSDriveLogarithmic::Execute() {
    float multiplier;
    if ((Robot::oi->getPilotStick()->GetRawButton(5)
            || Robot::oi->getPilotStick()->GetRawButton(6))
            && !(Robot::oi->getPilotStick()->GetRawButton(7)
                 || Robot::oi->getPilotStick()->GetRawButton(8))) {
        multiplier = 0.25;
    }
    else if (!(Robot::oi->getPilotStick()->GetRawButton(5)
               || Robot::oi->getPilotStick()->GetRawButton(6))
             && (Robot::oi->getPilotStick()->GetRawButton(7)
                 || Robot::oi->getPilotStick()->GetRawButton(8))) {
        multiplier = 0.625;
    }
    else {
        multiplier = .5;
    }
    if ((Robot::oi->getPilotStick()->GetRawAxis(0)) >= 0) {
        float yAxis;
        float xAxis;
        if (fabs(Robot::oi->getPilotStick()->GetRawAxis(3)) >= .05) {
            yAxis = Robot::oi->getPilotStick()->GetRawAxis(3);
        }
        else {
            yAxis = 0;
        }
        if (fabs(Robot::oi->getPilotStick()->GetRawAxis(0)) >= .05) {
            xAxis = Robot::oi->getPilotStick()->GetRawAxis(0);
        }
        else {
            xAxis = 0;
        }
        Robot::driveSystem->MoveLeft((yAxis) * 100 * multiplier);
        Robot::driveSystem->MoveRight(
            yAxis * 100 * (-2 * (xAxis * xAxis) + 1) * multiplier);
    }
    else {
        float yAxis;
        float xAxis;
        if (fabs(Robot::oi->getPilotStick()->GetRawAxis(3)) >= .05) {
            yAxis = Robot::oi->getPilotStick()->GetRawAxis(3);
        }
        else {
            yAxis = 0;
        }
        if (fabs(Robot::oi->getPilotStick()->GetRawAxis(0)) >= .05) {
            xAxis = Robot::oi->getPilotStick()->GetRawAxis(0);
        }
        else {
            xAxis = 0;
        }
        Robot::driveSystem->MoveRight((yAxis) * 100 * multiplier);
        Robot::driveSystem->MoveLeft(
            yAxis * 100 * (-2 * (xAxis * xAxis) + 1) * multiplier);
    }
}
void FPSDriveLogarithmic :: Execute ( ) { float multiplier ; if ( ( Robot :: oi -> getPilotStick ( ) -> GetRawButton ( 5 ) || Robot :: oi -> getPilotStick ( ) -> GetRawButton ( 6 ) ) && ! ( Robot :: oi -> getPilotStick ( ) -> GetRawButton ( 7 ) || Robot :: oi -> getPilotStick ( ) -> GetRawButton ( 8 ) ) ) { multiplier = 0.25 ; } else if ( ! ( Robot :: oi -> getPilotStick ( ) -> GetRawButton ( 5 ) || Robot :: oi -> getPilotStick ( ) -> GetRawButton ( 6 ) ) && ( Robot :: oi -> getPilotStick ( ) -> GetRawButton ( 7 ) || Robot :: oi -> getPilotStick ( ) -> GetRawButton ( 8 ) ) ) { multiplier = 0.625 ; } else { multiplier = .5 ; } if ( ( Robot :: oi -> getPilotStick ( ) -> GetRawAxis ( 0 ) ) >= 0 ) { float yAxis ; float xAxis ; if ( fabs ( Robot :: oi -> getPilotStick ( ) -> GetRawAxis ( 3 ) ) >= .05 ) { yAxis = Robot :: oi -> getPilotStick ( ) -> GetRawAxis ( 3 ) ; } else { yAxis = 0 ; } if ( fabs ( Robot :: oi -> getPilotStick ( ) -> GetRawAxis ( 0 ) ) >= .05 ) { xAxis = Robot :: oi -> getPilotStick ( ) -> GetRawAxis ( 0 ) ; } else { xAxis = 0 ; } Robot :: driveSystem -> MoveLeft ( ( yAxis ) * 100 * multiplier ) ; Robot :: driveSystem -> MoveRight ( yAxis * 100 * ( -2 * ( xAxis * xAxis ) + 1 ) * multiplier ) ; } else { float yAxis ; float xAxis ; if ( fabs ( Robot :: oi -> getPilotStick ( ) -> GetRawAxis ( 3 ) ) >= .05 ) { yAxis = Robot :: oi -> getPilotStick ( ) -> GetRawAxis ( 3 ) ; } else { yAxis = 0 ; } if ( fabs ( Robot :: oi -> getPilotStick ( ) -> GetRawAxis ( 0 ) ) >= .05 ) { xAxis = Robot :: oi -> getPilotStick ( ) -> GetRawAxis ( 0 ) ; } else { xAxis = 0 ; } Robot :: driveSystem -> MoveRight ( ( yAxis ) * 100 * multiplier ) ; Robot :: driveSystem -> MoveLeft ( yAxis * 100 * ( -2 * ( xAxis * xAxis ) + 1 ) * multiplier ) ; } }
Called repeatedly when this Command is scheduled to run
Called repeatedly when this Command is scheduled to run