Quasics2017Code/Ralph/src/Commands/TankDrive.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 TankDrive::Execute() {
	double multiplier = MediumMultiplier;
	if ((Robot::oi->getDriveStick()->GetRawButton(LeftShoulder)
			|| Robot::oi->getDriveStick()->GetRawButton(RightShoulder))
			&& !(Robot::oi->getDriveStick()->GetRawButton(LeftTrigger)
					|| Robot::oi->getDriveStick()->GetRawButton(RightTrigger)))
		multiplier = SlowMultiplier;
	else if (!(Robot::oi->getDriveStick()->GetRawButton(LeftShoulder)
			|| Robot::oi->getDriveStick()->GetRawButton(RightShoulder))
			&& (Robot::oi->getDriveStick()->GetRawButton(LeftTrigger)
					|| Robot::oi->getDriveStick()->GetRawButton(RightTrigger)))
		multiplier = TurboMultiplier;
	else
		multiplier = MediumMultiplier;
	float leftStick = -Robot::oi->getDriveStick()->GetRawAxis(LeftYAxis)
			* multiplier;
	float rightStick = -Robot::oi->getDriveStick()->GetRawAxis(RightYAxis)
			* multiplier;
	if (lastButton && !Robot::oi->getDriveStick()->GetRawButton(XButton))
		isInverted = !isInverted;
	if (!isInverted) {
		Robot::driveTrain->SetLeftPower(-leftStick);
		Robot::driveTrain->SetRightPower(-rightStick);
	} else {
		Robot::driveTrain->SetLeftPower(rightStick);
		Robot::driveTrain->SetRightPower(leftStick);
	}
	lastButton = Robot::oi->getDriveStick()->GetRawButton(XButton);
}
void TankDrive :: Execute ( ) { double multiplier = MediumMultiplier ; if ( ( Robot :: oi -> getDriveStick ( ) -> GetRawButton ( LeftShoulder ) || Robot :: oi -> getDriveStick ( ) -> GetRawButton ( RightShoulder ) ) && ! ( Robot :: oi -> getDriveStick ( ) -> GetRawButton ( LeftTrigger ) || Robot :: oi -> getDriveStick ( ) -> GetRawButton ( RightTrigger ) ) ) multiplier = SlowMultiplier ; else if ( ! ( Robot :: oi -> getDriveStick ( ) -> GetRawButton ( LeftShoulder ) || Robot :: oi -> getDriveStick ( ) -> GetRawButton ( RightShoulder ) ) && ( Robot :: oi -> getDriveStick ( ) -> GetRawButton ( LeftTrigger ) || Robot :: oi -> getDriveStick ( ) -> GetRawButton ( RightTrigger ) ) ) multiplier = TurboMultiplier ; else multiplier = MediumMultiplier ; float leftStick = - Robot :: oi -> getDriveStick ( ) -> GetRawAxis ( LeftYAxis ) * multiplier ; float rightStick = - Robot :: oi -> getDriveStick ( ) -> GetRawAxis ( RightYAxis ) * multiplier ; if ( lastButton && ! Robot :: oi -> getDriveStick ( ) -> GetRawButton ( XButton ) ) isInverted = ! isInverted ; if ( ! isInverted ) { Robot :: driveTrain -> SetLeftPower ( - leftStick ) ; Robot :: driveTrain -> SetRightPower ( - rightStick ) ; } else { Robot :: driveTrain -> SetLeftPower ( rightStick ) ; Robot :: driveTrain -> SetRightPower ( leftStick ) ; } lastButton = Robot :: oi -> getDriveStick ( ) -> GetRawButton ( XButton ) ; }
Called repeatedly when this Command is scheduled to run
Called repeatedly when this Command is scheduled to run