Before 12-19/Autonomous/autonomous.c
void driveTranslateDistance(int angle, int power, int distance) {
	// Reset encoders
	nMotorEncoder[motorDrive1] = 0;
	nMotorEncoder[motorDrive2] = 0;
	nMotorEncoder[motorDrive3] = 0;
	nMotorEncoder[motorDrive4] = 0;
	
	// Begin translating
	driveTranslateStart(angle, power);
	
	// Calculate individual motor encoder targets
	int targetMotor1 = motor[motorDrive1] * ((float) distance / (float) power) * ENCODER_1_COUNTS_PER_CM;
	int targetMotor2 = motor[motorDrive2] * ((float) distance / (float) power) * ENCODER_2_COUNTS_PER_CM;
	int targetMotor3 = motor[motorDrive3] * ((float) distance / (float) power) * ENCODER_3_COUNTS_PER_CM;
	int targetMotor4 = motor[motorDrive4] * ((float) distance / (float) power) * ENCODER_4_COUNTS_PER_CM;
	
	// Whether or not each motor has met its encoder target
	bool targetMetMotor1 = false;
	bool targetMetMotor2 = false;
	bool targetMetMotor3 = false;
	bool targetMetMotor4 = false;
	
	// Stop each motor as respective encoder targets are met
	while (!targetMetMotor1 || !targetMetMotor2 || !targetMetMotor3 || !targetMetMotor4) {
		if (!targetMetMotor1 && nMotorEncoder[motorDrive1] >= targetMotor1) {
			motor[motorDrive1] = 0;
			targetMetMotor1 = true;
		}
		if (!targetMetMotor2 && nMotorEncoder[motorDrive2] >= targetMotor2) {
			motor[motorDrive2] = 0;
			targetMetMotor2 = true;
		}
		if (!targetMetMotor3 && nMotorEncoder[motorDrive3] >= targetMotor3) {
			motor[motorDrive3] = 0;
			targetMetMotor3 = true;
		}
		if (!targetMetMotor4 && nMotorEncoder[motorDrive4] >= targetMotor4) {
			motor[motorDrive4] = 0;
			targetMetMotor4 = true;
		}
	}
}
// Translates the robot through the given angle at the given power over the given distance
Translates the robot through the given angle at the given power over the given distance
Translates the robot through the given angle at the given power over the given distance
void driveTranslateDistance(int angle, int power, int distance) {
	nMotorEncoder[motorDrive1] = 0;
	nMotorEncoder[motorDrive2] = 0;
	nMotorEncoder[motorDrive3] = 0;
	nMotorEncoder[motorDrive4] = 0;
	driveTranslateStart(angle, power);
	int targetMotor1 = motor[motorDrive1] * ((float) distance / (float) power) * ENCODER_1_COUNTS_PER_CM;
	int targetMotor2 = motor[motorDrive2] * ((float) distance / (float) power) * ENCODER_2_COUNTS_PER_CM;
	int targetMotor3 = motor[motorDrive3] * ((float) distance / (float) power) * ENCODER_3_COUNTS_PER_CM;
	int targetMotor4 = motor[motorDrive4] * ((float) distance / (float) power) * ENCODER_4_COUNTS_PER_CM;
	bool targetMetMotor1 = false;
	bool targetMetMotor2 = false;
	bool targetMetMotor3 = false;
	bool targetMetMotor4 = false;
	while (!targetMetMotor1 || !targetMetMotor2 || !targetMetMotor3 || !targetMetMotor4) {
		if (!targetMetMotor1 && nMotorEncoder[motorDrive1] >= targetMotor1) {
			motor[motorDrive1] = 0;
			targetMetMotor1 = true;
		}
		if (!targetMetMotor2 && nMotorEncoder[motorDrive2] >= targetMotor2) {
			motor[motorDrive2] = 0;
			targetMetMotor2 = true;
		}
		if (!targetMetMotor3 && nMotorEncoder[motorDrive3] >= targetMotor3) {
			motor[motorDrive3] = 0;
			targetMetMotor3 = true;
		}
		if (!targetMetMotor4 && nMotorEncoder[motorDrive4] >= targetMotor4) {
			motor[motorDrive4] = 0;
			targetMetMotor4 = true;
		}
	}
}
void driveTranslateDistance ( int angle , int power , int distance ) { nMotorEncoder [ motorDrive1 ] = 0 ; nMotorEncoder [ motorDrive2 ] = 0 ; nMotorEncoder [ motorDrive3 ] = 0 ; nMotorEncoder [ motorDrive4 ] = 0 ; driveTranslateStart ( angle , power ) ; int targetMotor1 = motor [ motorDrive1 ] * ( ( float ) distance / ( float ) power ) * ENCODER_1_COUNTS_PER_CM ; int targetMotor2 = motor [ motorDrive2 ] * ( ( float ) distance / ( float ) power ) * ENCODER_2_COUNTS_PER_CM ; int targetMotor3 = motor [ motorDrive3 ] * ( ( float ) distance / ( float ) power ) * ENCODER_3_COUNTS_PER_CM ; int targetMotor4 = motor [ motorDrive4 ] * ( ( float ) distance / ( float ) power ) * ENCODER_4_COUNTS_PER_CM ; bool targetMetMotor1 = false ; bool targetMetMotor2 = false ; bool targetMetMotor3 = false ; bool targetMetMotor4 = false ; while ( ! targetMetMotor1 || ! targetMetMotor2 || ! targetMetMotor3 || ! targetMetMotor4 ) { if ( ! targetMetMotor1 && nMotorEncoder [ motorDrive1 ] >= targetMotor1 ) { motor [ motorDrive1 ] = 0 ; targetMetMotor1 = true ; } if ( ! targetMetMotor2 && nMotorEncoder [ motorDrive2 ] >= targetMotor2 ) { motor [ motorDrive2 ] = 0 ; targetMetMotor2 = true ; } if ( ! targetMetMotor3 && nMotorEncoder [ motorDrive3 ] >= targetMotor3 ) { motor [ motorDrive3 ] = 0 ; targetMetMotor3 = true ; } if ( ! targetMetMotor4 && nMotorEncoder [ motorDrive4 ] >= targetMotor4 ) { motor [ motorDrive4 ] = 0 ; targetMetMotor4 = true ; } } }
Translates the robot through the given angle at the given power over the given distance
Translates the robot through the given angle at the given power over the given distance
// Reset encoders // Begin translating // Calculate individual motor encoder targets // Whether or not each motor has met its encoder target // Stop each motor as respective encoder targets are met