//Checks to see if the motors are functional
void checkMotors() {
//Motor check
LCD.WriteRC("Initiating Motor Check ", 1, 0);
Sleep(HALF_SECOND);
LCD.WriteRC(".", 1, 22);
Sleep(HALF_SECOND);
LCD.WriteRC(".", 1, 23);
Sleep(HALF_SECOND);
LCD.WriteRC(".", 1, 24);
Sleep(HALF_SECOND);
LCD.Clear( FEHLCD::Black );
LCD.WriteLine("Moving Wrench Servo!");
wrenchServo.SetDegree(100);
Sleep(HALF_SECOND);
wrenchServo.SetDegree(50);
Sleep(FULL_SECOND);
LCD.WriteLine("Moving Fuel Servo!");
fuelServo.SetDegree(100);
Sleep(HALF_SECOND);
fuelServo.SetDegree(50);
Sleep(FULL_SECOND);
LCD.WriteLine("Ok! Testing Forward!");
rightMotor.SetPercent(LOW_FORWARD);
leftMotor.SetPercent(LOW_FORWARD);
Sleep(FULL_SECOND);
rightMotor.Stop();
leftMotor.Stop();
Sleep(HALF_SECOND);
LCD.WriteLine("Now testing backwards!");
rightMotor.SetPercent(-1 * LOW_FORWARD);
leftMotor.SetPercent(-1 * LOW_FORWARD);
Sleep(FULL_SECOND);
rightMotor.Stop();
leftMotor.Stop();
Sleep(HALF_SECOND);
LCD.WriteLine("Alright, going right now!");
leftMotor.SetPercent(MID_FORWARD);
Sleep(FULL_SECOND);
leftMotor.Stop();
Sleep(HALF_SECOND);
LCD.WriteLine("And finally, left!");
rightMotor.SetPercent(MID_FORWARD);
Sleep(FULL_SECOND);
rightMotor.Stop();
Sleep(HALF_SECOND);
rightMotor.Stop();
LCD.Clear( FEHLCD::Black );
return;
}
Algorithm for checkMotors:
- Output that motor check is being initiated.
- Output that wrench servo is being tested.
- Move wrench servo up and down.
- Output the fuel servod is being tested.
- Move fuel servo left and right.
- Output that the robot will test moving forward.
- Drive forward slowly.
- Output that the robot will now test driving backward.
- Drive backward slowly.
- Output that the robot will test turning right.
- Turn right slowly.
- Output that the robot will test turning left.
- Turn left slowly.
- End function.