The task for Final Testing was to bring the AEV up an incline, stop seven seconds for the gate to open, travel past the gate and to the loading dock, secure the load by pausing for five seconds, and then travel back to the starting dock [1]. The team was given three runs to complete this. The two best runs were averaged for a final grade. The test earned full points on the last run. The code for the last run is provided.
—
// Reverse all motors, pushes forward
reverse(4);
// Accelerate from 0 to 40% power in 1 second
celerate(4, 0, 40, 1);
// Motors at 40% power til 6.4 ft mark (160 on full battery, 165 for used battery), midpoint of incline
motorSpeed(4,40);
goToAbsolutePosition(165);
// Brake to cut power
brake(4);
// Reverse all motors to pull AEV to stop, accelerate form 0% power to 45% within in a half-second, for 1 second
reverse(4);
celerate(4, 0, 45, .5);
goFor(.9);
// Break to stop pull-back-brake before gate, pause for 8 seconds for gate to open
brake(4);
delay(8000);
// Reverse all motors to push forward through gate
reverse(4);
// Motor speed 35% until 16.2 ft mark
motorSpeed(4, 35);
goToAbsolutePosition(405);
// Brake to cut power
brake(4);
// Reverse all motors to pull AEV to stop, accelerate from 0% power to 40% within 1/4th of a second, for .8 second
reverse(4);
celerate(4, 0, 40, .25);
goFor(.8);
// Break to stop pull-back brake before loading dock, pause for 6 seconds to secure load
brake(4);
delay(6000);
// Increase motor speed 0% to 45% for 1 second. then 47% power in 1 second
celerate(4, 0, 47, 1);
// Move back until up incline before gate
goToRelativePosition(-240);
// Break to cut power
brake(4);
// Reverse all motors to push AEV to stop, accelerate form 0% power to 48% within a half-second, for 1 second
reverse(4);
celerate(4, 0, 40, .5);
goFor(1);
// Break before gate, pause for 8 seconds for gate to open
brake(4);
delay(8000);
// Reverse to pull AEV through gate, increase motor speed form 0% power to 45% in 1 sec
reverse(4);
celerate(4, 0, 45, 1);
// Move through gate and to starting dock
goToRelativePosition(-160);
// Brake to cut power
brake(4);
// Reverse all motors to push AEV to stop, accelerating from 0% to 47% within a half-second, for 1 second
reverse(4);
celerate(4, 0, 47, .5);
goFor(1);
// Brake before starting dock
brake(4);
—
The energy vs. time graph for the Final Testing shows that the amount of energy used increased while the AEV ran. A reason for the energy levels being so high is the use of the reverse() command so many times.
—
The power vs. time graph shows the power sporadically changing over the course of the AEV running. This is because of the brake() command and the reverse() command. When the AEV’s motors are turned off, the power goes to zero.