Codes

1. First Code to Get to Gate

2. Codes to Test Number of Motors and Efficiency Relation

  • Coasting with Two Propellers
  • Coasting with One Propeller
  • Constant Energy Input with Two Propellers
  • Constant Energy Input with One Propeller

3. Initial Code Before Power Readjustments

4. Code to Adjust for Room 308

5. Final Code

First Code to Get to Gate

reverse(4);
celerate(4,0,25,3);
goFor(1);
motorSpeed(4,20);
goFor(2);
brake(4);
reverse(4);
motorSpeed(4,25);
goFor(2);
brake(4);

Codes to Test Number of Motors and Efficiency Relation

Coasting with Two Propellers

// Coasting Two Motors

reverse(4);
motorSpeed(4, 55);        //run both motors at 55% for 2 seconds
goFor(2);
brake(4);                 //stop both motors for 16 ft
goToAbsolutePosition(447);
reverse(4);               //reverse all motors
motorSpeed(4, 32);        //run all motors at 32% for 1.5 seconds
goFor(1.5);
brake(4);                 //brake all motors

Coasting with One Propeller

// Coasting One Propellor

// reverse(4);
motorSpeed(4, 65);        //run both motors at 65% for 3 seconds
goFor(2.5);
brake(4);                 //stop both motors for 16 ft
goToAbsolutePosition(444);
reverse(4);               //reverse all motors
motorSpeed(4, 35);        //run all motors at 40% for 1.5 seconds
goFor(1.5);
brake(4);                //brake all motors

Constant Energy Input with Two Propellers

// Constant Two Motor

reverse(4);
motorSpeed(4, 30);        //run both motors at 30% for 2 seconds
goFor(2);
motorSpeed(4, 25);        //run both motors at 25% for 16 ft
goToAbsolutePosition(447);
reverse(4);               //reverse all motors
motorSpeed(4, 40);        //run all motors at 40% for 1.5 seconds
goFor(1.5);
brake(4);                 //brake all motors

Constant Energy Input with One Propeller

// Constant One Motor

reverse(4);
motorSpeed(4, 35);        //run both motors at 35% for 2 seconds
goFor(2);
motorSpeed(4, 30);        //run both motors at 30% for 16 ft
goToAbsolutePosition(447);
reverse(4);               //reverse all motors
motorSpeed(4, 45);        //run all motors at 45% for 1.5 seconds
goFor(1.5);
brake(4);                 //brake all motors

Initial Code Before Power Readjustments

// Room 224

 reverse(4);
 rotateServo(90);          // start brake for earlier deployment
 motorSpeed(4, 65);        //run both motors at 66%
 goFor(2.4);               // run for 2.4 seconds (barely makes it)
 brake(4);                 //stop both motors for 18 ft
 goToAbsolutePosition(488); //was 4867was original

 // past Gate

 rotateServo(160);
 goFor(7.5);
 rotateServo(90);
 motorSpeed(4, 60);        //run both motors at 65%
goFor(2.3);               // run for 2.3 seconds was 2.1
brake(4);                 //stop both motors for ?? ft
goToAbsolutePosition(1000);// distance to get to before waiting 6 seconds
goFor(7);                //time for AEV to reach R2 and wait 5 seconds

 // back with r2

 reverse(4);
 motorSpeed(4, 75);         //run both motors at was 74
goFor(3.8);                // run for 3.8 seconds (3.4 still too short)
brake(4);                  //stop both motors
goToAbsolutePosition(550); //was 548
rotateServo(160);
goFor(7.5);
 rotateServo(90);

 // back past gate with R2

 motorSpeed(4, 78);        //run both motors at 75%
 goFor(3.7);               // run for 3.6 seconds
brake(4);                 //stop both motors for 18 ft
goToAbsolutePosition(17); //was 14, just a tad too late
rotateServo(160);
goFor(2);

Code to Adjust for Room 308

// Room 308

 reverse(4);
 rotateServo(90);          // start brake for earlier deployment
 motorSpeed(4, 66);        //run both motors at 66%
goFor(2.2);               // run for 2.4 seconds (barely makes it)
brake(4);                 //stop both motors for 18 ft
goToAbsolutePosition(488); //was 487 was original

 // past Gate

 rotateServo(160);
 goFor(7.5);
 rotateServo(90);
motorSpeed(4, 65);        //run both motors at 65%
goFor(2.1);               // run for 2.1 seconds was 2.3 (too fast)
brake(4);                 //stop both motors for ?? ft
goToAbsolutePosition(1000);// distance to get to before waiting 6 seconds
goFor(7);                //time for AEV to reach R2 and wait 5 seconds

 // back with r2

 reverse(4);
 motorSpeed(4,78);         //run both motors at was 80
 goFor(3.8);                // run for 3.8 seconds (3.4 still too short)
brake(4);                  //stop both motors
goToAbsolutePosition(550); //was 548
rotateServo(160);
goFor(7.5);
rotateServo(90);

 // back past gate with R2

 motorSpeed(4, 78);        //run both motors at 80%
 goFor(3.7);               // run for 3.6 seconds
 brake(4);                 //stop both motors for 18 ft
 goToAbsolutePosition(14); //was 12, just a tad too late
 rotateServo(160);
 goFor(2);

Final Code

// before gate
reverse(4);
rotateServo(90); //start brake for earlier deployment
motorSpeed(4, 60); //run motor at 60%
goFor(2.6); //run for 2.6 seconds
brake(4); //stop motor
goToAbsolutePosition(488); //go until gate

// past Gate
rotateServo(150); //activate brake
goFor(7.5); //wait for gate to open
rotateServo(90); //disengage brake
motorSpeed(4, 60); //run motor at 60%
goFor(2.3); // run for 2.3 seconds
brake(4); //stop motor
goToAbsolutePosition(1000);// distance to get to before waiting
goFor(7); //time for AEV to reach R2 and wait at least 5 seconds

// back with r2
reverse(4); //switch direction
motorSpeed(4, 60); //run both motors at 60%
goFor(5.3); // run for 5.3 seconds
brake(4); //stop motor
goToAbsolutePosition(550); //go until first sensor
rotateServo(160); //activate brake
goFor(7.5); //wait for brake
rotateServo(90); //disengage brake

// back past gate with R2
motorSpeed(4, 60); //run motor at 60%
goFor(5); // run for 5 seconds
brake(4); //stop motor
goToAbsolutePosition(17); //go until just before the start point
rotateServo(160); //engage brake
goFor(2);