Quasics2017Code/Nike-2018/src/Commands/BaseCommands/Teleop/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)) {
		isReversed = !isReversed;
	}
	if (isReversed) {
		Robot::driveBase->SetLeftPower(-rightStick);
		Robot::driveBase->SetRightPower(-leftStick);
	} else {
		Robot::driveBase->SetLeftPower(leftStick);
		Robot::driveBase->SetRightPower(rightStick);
	}
}
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 ) ) { isReversed = ! isReversed ; } if ( isReversed ) { Robot :: driveBase -> SetLeftPower ( - rightStick ) ; Robot :: driveBase -> SetRightPower ( - leftStick ) ; } else { Robot :: driveBase -> SetLeftPower ( leftStick ) ; Robot :: driveBase -> SetRightPower ( rightStick ) ; } }
Called repeatedly when this Command is scheduled to run
Called repeatedly when this Command is scheduled to run
// lastButton = Robot::oi->getDriveStick()->GetRawButton(XButton);