Quasics2017Code/Ralph/src/Commands/PixyAutoFineTuning.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 PixyAutoFineTuning::Execute() {
	bool gotData = Robot::arduino->GetCameraData(isFarLeft, isAligned,
			isTooFar);
	if (gotData) {
		if (isTooFar) {
			if (isAligned) {
				Robot::driveTrain->SetLeftPower(.25);
				Robot::driveTrain->SetRightPower(.25);
			} else {
				if (isFarLeft) {
					Robot::driveTrain->SetLeftPower(.375);
					Robot::driveTrain->SetRightPower(.25);
				} else {
					Robot::driveTrain->SetLeftPower(.25);
					Robot::driveTrain->SetRightPower(.375);
				}
			}
		} else {
			if (isAligned) {
				Robot::driveTrain->SetLeftPower(0);
				Robot::driveTrain->SetRightPower(0);
			} else {
				if (isFarLeft) {
					Robot::driveTrain->SetLeftPower(.25);
					Robot::driveTrain->SetRightPower(-.25);
				} else {
					Robot::driveTrain->SetLeftPower(-.25);
					Robot::driveTrain->SetRightPower(.25);
				}
			}
		}
	}
	timer++;
}
void PixyAutoFineTuning :: Execute ( ) { bool gotData = Robot :: arduino -> GetCameraData ( isFarLeft , isAligned , isTooFar ) ; if ( gotData ) { if ( isTooFar ) { if ( isAligned ) { Robot :: driveTrain -> SetLeftPower ( .25 ) ; Robot :: driveTrain -> SetRightPower ( .25 ) ; } else { if ( isFarLeft ) { Robot :: driveTrain -> SetLeftPower ( .375 ) ; Robot :: driveTrain -> SetRightPower ( .25 ) ; } else { Robot :: driveTrain -> SetLeftPower ( .25 ) ; Robot :: driveTrain -> SetRightPower ( .375 ) ; } } } else { if ( isAligned ) { Robot :: driveTrain -> SetLeftPower ( 0 ) ; Robot :: driveTrain -> SetRightPower ( 0 ) ; } else { if ( isFarLeft ) { Robot :: driveTrain -> SetLeftPower ( .25 ) ; Robot :: driveTrain -> SetRightPower ( -.25 ) ; } else { Robot :: driveTrain -> SetLeftPower ( -.25 ) ; Robot :: driveTrain -> SetRightPower ( .25 ) ; } } } } timer ++ ; }
Called repeatedly when this Command is scheduled to run
Called repeatedly when this Command is scheduled to run