setFuel(); moveForward(HIGH_FORWARD, 10); moveToY(22.5); turnRight(-75); turnTo(358); moveForward(HIGH_FORWARD, 17); moveToX(25.5); pressButton(isBlue()); moveForward(HIGH_FORWARD, 13); //moveToX(16); turnRight(-35); //turnTo(240); //THE WRENCH wrenchServo.SetDegree(140); // Set the servos moveForward(50, 10); moveToY(18.5); showInfo(); Sleep(FULL_SECOND); // Line up with wrench turnRight(30); turnTo(180); showInfo(); Sleep(FULL_SECOND); // Turn towards wrench moveForward(LOW_FORWARD, 17); showInfo(); // Approach wrench wrenchServo.SetDegree(40); Sleep(HALF_SECOND); moveForward(-50, 6); showInfo(); // Back off from wrench turnRight(-66); showInfo(); // Turn to approach jack moveForward(50, 12); moveToY(11); showInfo(); // Approach jack area turnRight(-92); showInfo(); // Turn to jack moveForward(50, 10); showInfo(); // Push the jack moveForward(-50, 5); showInfo(); // Back off turnRight(85); showInfo(); // Turn to ramp moveForward(-50, 15); moveToY(21); showInfo(); // Move to ramp turnRight(-42); turnTo(315); showInfo(); // Adjust on ramp moveForward(-50, 10); moveToX(4); showInfo(); // Move to ramp turnRight(35); turnTo(274); showInfo(); // Adjust on ramp bool deadzone; deadzone = (RPS.IsDeadzoneActive() != 2); // UP TOP moveForward(-1 * HIGH_FORWARD, 52); if(!deadzone) { moveToY(48); } turnRight(43); if(!deadzone) { turnTo(226); } moveForward(-1 * HIGH_FORWARD, 20); if(!deadzone) { turnTo(226); } moveForward(-1 * HIGH_FORWARD, 20); if(!deadzone) { turnTo(226); } moveForward(-1 * HIGH_FORWARD, 10); turnFuel(); // FUEL STUFF moveForward(HIGH_FORWARD, 17); if(!deadzone) { moveToX(17); } turnRight(80); moveForward(HIGH_FORWARD, 25); wrenchServo.SetDegree(150); // Place wrench in garage Sleep(FULL_SECOND); moveForward(-1 * FAST, 45); // Go to the ramp again wrenchServo.SetDegree(40); turnRight(47); // Turn to ramp moveForward(-1 * FAST, 17); // Down we go turnRight(105); moveForward(-1 * HIGH_FORWARD, 20); turnRight(105); moveForward(-1 * HIGH_FORWARD, 30); break;
Algorithm for Individual Competition
- Check fuel direction, and turn the fuel servo accordingly
- Move forward, then correct the Y position
- Turn left, then correct heading
- Move forward, then correct the X position
- Read the color of the light and press the corresponding button
- Move forward
- Turn right
- Lower wrench servo
- Move forward, then correct Y position
- Turn right, then correct heading
- Move forward at a low speed
- Raise wrench servo
- Move backwards
- Turn left
- Move forward, then correct Y position
- Turn left
- Move forward, pushing jack
- Move backwards
- Turn right
- Move backwards, then correct Y position
- Turn left, then correct heading
- Move backwards, then correct X position
- Turn right, then correct heading
- Store whether or not the deadzone is active
- If the deadzone is active, ignore all RPS checks on the upper level
- Move backwards, then correct Y position
- Turn right, the correct heading
- Move backwards, correcting heading during movement
- Turn the fuel crank in the correct direction
- Move forward, then correct X position
- Turn right
- Move forward
- Lower wrench servo
- Move backwards
- Raise wrench servo
- Turn right
- Move backwards down the ramp
- Turn right
- Move backwards
- Turn right
- Move backwards into final button