For this experiment, team D focused on optimizing the code for our AEV so we can minimize the amount of energy used per run. This is especially important moving into our final design test, as the final test involves picking up a passenger wagon and bringing it back to the original loading zone. This is going to require a significant amount of extra power to make sure the AEV is able to transverse the incline back to the gate.
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 |
The first test we ran was using the motor speed command to move the AEV. The code was similar to the design optimization but included going through the gate to the opposite loading zone where the passenger vehicle will be in our final design run. Here you can see it used up to about 60 joules of energy in its run.
rotateServo(30); | // Move Servo so AEV can get put on track |
goFor(10); | // Time to put AEV on track |
reverse(4); | // Reverse polarity of both motors |
celerate(4,0,30,13); | Accelerates all motors to 30% over 13 seconds |
goToAbsolutePosition(245); | Continue until |
brake(4); | Cuts power to the motors |
goToAbsolutePosition(300); | Goes to 300 marks |
brake(4); | Cut power to motors |
rotateServo(50); | Applies the servo brake |
goFor(2); | Applies for 2 seconds |
rotateServo(30); | Disengages the brake |
goFor(3); | Applies for 3 seconds |
celerate(4,0,30,7); | Accelerates all motor to 30% over 7 seconds |
goToAbsolutePosition(380); | Goes to 380 marks |
brake(4); | Cuts power to the motors |
Here, for test 2, you can see we used the celerate command instead of motorspeed. The two lines of code are identical other than the code used to make the AEV move, this time using celerate. This was to ensure that there were as little variables as possible in our two runs to make sure we had accurate graphs to compare.
Here are our results from running the celerate command. As you can see it used about 90 Joules of energy on its run. This is about 30% more energy demanding than the motorspeed command. The celerate command is also less consistent because it is based on time. The functions that are based on time have shown high inconsistency rates throughout all of the activities performed. From this, we have decided that it is better to use the motor speed command to ensure we are being as energy efficient as possible but ensuring the AEV is able to maintain a high level of safety.