Energy Optimization

For our final stage of optimization, we combined everything from this project to make our final design as energy efficient, safe and quick as possible on the final test run. This run was especially important because this time the AEV was required to pick up the passenger wagon from its loading zone and bring it back through the gate to the starting point.

We first decided to use Jamey’s code for the run, after comparing his and Zach’s code for the test. It was found Jamey’s code used less energy, and was quicker each pass. After deciding on Jamey’s code, we worked to refine it as much as possible. We changed marks, and when and where the motors were used.

 

rotateServo(30); // Move Servo so AEV can get put on track
goFor(6); // Time to put AEV on track
reverse(4); // Reverse polarity of both motors
motorSpeed(4,35); // Make both motors power to 35
goToAbsolutePosition(248); // Continue motor speed until it reaches 248 marks
brake(4); // Cuts motors
goToAbsolutePosition(300); // Wait until AEV reaches 300 marks
rotateServo(52); // Used to brake AEV
goFor(4); // Hold brake position for 4 seconds
rotateServo(30); // Takes the brake off the track
goFor(4); // Keep AEV in this position until gate opens
motorSpeed(4,36); // Get AEV through gate
goToAbsolutePosition(378); // Keep speed until 378 marks
brake(4); // Cuts motors
goToAbsolutePosition(540); // wait until AEV reaches 540 marks
rotateServo(12); // use front servo brake
goFor(0.7); // brake for 0.7 seconds
rotateServo(30); // stop braking
goFor(11); // connect to AEV and wait for ~5 seconds
reverse(4); // reverse motor polarity
motorSpeed(4,38); // set motor speed to 38
goToAbsolutePosition(427.5); // get AEV and Caboose up incline
brake(4); // cut motor power
goToAbsolutePosition(384); // Wait until 384 marks for next command
rotateServo(52); // Brake AEV before reaching gate
goFor(2); // Keep braking for 2 seconds
rotateServo(30); // take AEV brake off track
goFor(6); // stay in gate area for 6 seconds
motorSpeed(4,38); // used to take AEV and Caboose through gate
goToAbsolutePosition(295); // keep motor speed until 295 marks
brake(4); // cut motor power
goToAbsolutePosition(210); // wait for AEV to reach 210 marks
rotateServo(50); // brake the AEV
goFor(0.5); // brake for 0.5 seconds
rotateServo(30); // take brake off of track
goFor(.5); // wait for 0.5 seconds
goToAbsolutePosition(118.5); // wait until AEV reaches 118.5 marks
rotateServo(51); // brake AEV
goFor(0.4); // brake for 0.4 seconds
rotateServo(30); // take brake off track
goFor(0.1); // wait 0.1 seconds
goToAbsolutePosition(20); // wait for AEV to reach 20 marks
rotateServo(51); // brake AEV
goFor(1); // brake for 1 second
rotateServo(30); // take brake off track
goFor(0.8); // initialize servo position to stay at 30°

Here you can see the final lines of code that we found to make the AEV run within all of the goals and parameters we had set. Our final joules used from this code was on average 180, and it took 67 seconds to complete the run. This was the best we could achieve from our vehicle. Overall, we were about $31,245 dollars over our budget. We believe if we had more time, this would be under budget once we fixed all of our consistency issues with the reflectance sensors and battery voltage.