Scenario 1, 2, 3: PR&D
Scenarios 1, 2, and 3 allowed Team L to get a better understand as to how the Arduino’s coding worked, and allowed for the team to use and master the various commands.
Scenario 1:
// Accelerate motor one from start to 15% power in 2.5sec
celerate(1,0,15,2.5);
// Running at constant speed 15% for 1 second
motorSpeed(1,15);
goFor(1);
brake(1); // Brake motor 1
// motor 2 accelerate 27% in 4 seconds
celerate(2,0,27,4);
// Run motor two at constant speed 27% for 2.7 sec
motorSpeed(2,27);
goFor(2.7);
// Decelrate motor 2 to 15% power in 1 second
celerate(2,27,15,2.7);
//brake motor 2
brake(2);
//Reverse motor 2
reverse(2);
//Accelerate all motors from start to 31% in 2 seconds
celerate(4,0,31,2);
// run all motors at 35% for 1 sec
motorSpeed(4,35);
goFor(1);
//Brake motor 2, motor 1 go for 3 seconds at 35%
brake(2); //brake motor 2
motorSpeed(1,35); // motor 1 at 35%
goFor(3);
//Brake for 1 second
brake(4);
goFor(1);
// Reverse motor 1
reverse(1);
// Accelerate motor 1 19% in 2 seconds
cellerate(1,0,19,2);
// run motor 2 at 35% and motor 1 at 19% for 2 seconds
motorSpeed(2,35); // motor 2 at 35%
motorSpeed(1,19); // motor 1 at 19%
goFor(2);
// Run both motors at 19% for 2 seconds
motorSpeed(4,19);
goFor(2);
//decelerate both motors in 2 sec.
cellerate(4,19,0,2);
//Brake all motors
brake(4);
Scenario 2:
// All motors running at 25% for 4 2 seconds
motorSpeed(4,25);
goFor(2);
// Run all motors at 20% to travel 12ft
motorSpeed(4,20);
goToAbsolutePosition(295);
//reverse motors
reverse(4);
//Run all motors at 30% for 1.5 sec
motorSpeed(4,30);
goFor(1.5);
// Brake motors
brake(4);
Scenario 3:
//Accelerate all motors from start to 25% in 3 seconds
celerate(4,0,25,3);
//run all Motors at 25% for 1 sec
motorSpeed(4,25);
goFor(1);
//run all motors at 20% for 2 seconds
motorSpeed(4,20);
goFor(2);
//Reverse all motors
reverse(4);
//Run all mototrs at 25% for 2 seconds
motorSpeed(4,25);
goFor(2);
//Brake all motors
brake(4);
Code Used for Track Variance Testing:
This code was used and adjusted consistently to find the minimum threshold of power needed to get the AEV to climb the inclines of the track, allowing for more efficient energy usage.
//Reverse one of the motors
reverse(2);
//Get to bottom of the incline
motorSpeed(4,25);
goFor(3);
//Begin climbing incline
motorSpeed(4,29);
goFor(3.80);
//Slow down at the top of incline
reverse(4);
motorSpeed(4,25);
goFor(1.65);
brake(4);
Code for Battery Variance Testing
As simple as the code gets. These three lines of code were used to track the consistency of the AEV after a set amount of trials to determine if the inconsistency of distance traveled had any correlation to the battery’s voltage.
reverse(2);
motorSpeed(4,25);
goFor(5);
Final Performance Test Code
All our testing has led up to this code! This is the final code our team was able to come up with to complete the final performance test.
reverse(2);
// Towards the first incline
motorSpeed(4,25);
goFor(3);
// Climbing First Incline
motorSpeed(4,29);
goFor(4);
reverse(4);
//Slow down as approaching the gate
motorSpeed(4,25);
goFor(1.5);
brake(4);
reverse(4);
// Wait for Gate
motorSpeed(4,0);
goFor(8);
//Proceed to the decline
motorSpeed(4,26);
goFor(4.3);
brake(4);
//Coast down decline
motorSpeed(4,0);
goFor(6);
reverse(4);
brake(4);
goFor(2);
// Caboose obtained, backwards begins
motorSpeed(4,38);
goFor(3);
// Back up incline
motorSpeed(4,38);
goFor(4.2);
// Slow down
reverse(4);
motorSpeed(4,45);
goFor(1.5);
brake(4);
goFor(8);
//To Decline
reverse(4);
motorSpeed(4,35);
goFor(5.5);
// Down Decline
motorSpeed(4,0);
goFor(5);
reverse(4);
motorSpeed(4,40);
goFor(2);
motorSpeed(4,0);
goFor(6);