Quasics2018Code/Hedy/src/Commands/Primitives/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() {
	std::shared_ptr<Joystick> joystick = Robot::oi->getdriveStick();
	const bool highBoost = Robot::oi->isHighBoostSignaled();
	const bool lowToggle = Robot::oi->isLowToggled();
	const bool switchDirection = Robot::oi->isSwitchDirectionSignaled();
	const double leftTrackPower = Robot::oi->getLeftTrackPower();
	const double rightTrackPower = Robot::oi->getRightTrackPower();
	double mult = .6;
	if(lowToggle){
		lowCount = lowCount + 1;
	}
	if(lowCount % 2 != 0){
		mult = .4;
	}
	else if(highBoost){
		mult = 1;
	}
	if(switchDirection){
		counter = counter + 1;
	}
	if(counter % 2 == 0) {
		Robot::driveBase->SetPowerToMotors(leftTrackPower * -mult, rightTrackPower * mult);
	}
	else {
		Robot::driveBase->SetPowerToMotors(rightTrackPower * mult, leftTrackPower * -mult);
	}
}
void TankDrive :: Execute ( ) { std :: shared_ptr < Joystick > joystick = Robot :: oi -> getdriveStick ( ) ; const bool highBoost = Robot :: oi -> isHighBoostSignaled ( ) ; const bool lowToggle = Robot :: oi -> isLowToggled ( ) ; const bool switchDirection = Robot :: oi -> isSwitchDirectionSignaled ( ) ; const double leftTrackPower = Robot :: oi -> getLeftTrackPower ( ) ; const double rightTrackPower = Robot :: oi -> getRightTrackPower ( ) ; double mult = .6 ; if ( lowToggle ) { lowCount = lowCount + 1 ; } if ( lowCount % 2 != 0 ) { mult = .4 ; } else if ( highBoost ) { mult = 1 ; } if ( switchDirection ) { counter = counter + 1 ; } if ( counter % 2 == 0 ) { Robot :: driveBase -> SetPowerToMotors ( leftTrackPower * - mult , rightTrackPower * mult ) ; } else { Robot :: driveBase -> SetPowerToMotors ( rightTrackPower * mult , leftTrackPower * - mult ) ; } }
Called repeatedly when this Command is scheduled to run
Called repeatedly when this Command is scheduled to run
//const bool lowBoost = Robot::oi->isLowBoostSignaled();
 //const bool highToggle = Robot::oi->isHighToggled();
 /*
	double mult = .6;
	if(highBoost && lowBoost){
		mult = 1;
	}
	else if(highBoost && !lowBoost){
		mult = .6;
	}
	else if(lowBoost && !highBoost){
		mult = .4;
	}
	*/ /*
	if(highToggle){
		highCount = highCount + 1;
	}
	if(highCount % 2 != 0){
			mult = 1;
		}
	*/