# Performance Test 2

Figure 1: Final Code for Testing Design for Performance Test 2

For Performance Test 2, we used the control-time method (goFor) instead of the control-distance method (goToRelativePosition) based on our findings in Performance Test 1.  We tested two types of code – the majority two codes are the same with the only difference being the final braking distance after the AEV picks up the caboose.

Figure 2: Comparing Code for Performance Test 2

It can be easily observed that the behavior of the two runs was almost identical, showing the code had consistent control and repeatability, even after the AEV picked up the caboose. It also verifies the braking method and time-control method were more efficient ways to control the AEV. The differences between the red curve and blue curve is the red curve used less motor power to brake the AEV compared. Although the red curve consumed less energy, it did not yield as consistent results. The red curve made the AEV run out of the sensored distance at the gate, while the the blue curve stopped the AEV within the sensored distance of the gate. It is also important to note that after the caboose is picked up, more motor power is needed to generate a forward motion.

Code for Figure 2 Red Curves ( which is the initial code used for Performance Test 2):

// Setup motors, go to the gate
motorSpeed(4,43);
goFor(3.8);
//Reverse the motors for braking to contole the sliding distance
reverse(4);
motorSpeed(4,55);
goFor(1);
reverse(4);

// Stop motors, wait for 7 seconds
motorSpeed(4,0);
goFor(10);

//Run the AEV
motorSpeed(4,32);
goFor(4);
brake(4);

//Brakeing for stopping the AEV
reverse(4);
motorSpeed(4,32);
goFor(0.9);
brake(4);

//Stop 5 seconds
motorSpeed(4,0);
goFor(10);

//Keep going
motorSpeed(4,60);
goFor(2.3);

//Braking the AEV
reverse(4);
motorSpeed(4,30);
goFor(2);
brake(4);

//Reverse the direction of AEV motors for next step
reverse(4);

Code for Figure 1 ( which is the final code used for Performance Test 2):

// Setup motors, go to the gate
motorSpeed(4,43);
goFor(3.8);
//Reverse the motors for braking to contole the sliding distance

reverse(4);
motorSpeed(4,54);
goFor(1);
reverse(4);

// Stop motors, wait for 7 seconds
motorSpeed(4,0);
goFor(10);

//Run the AEV
motorSpeed(4,32);
goFor(4);
brake(4);

//Brakeing for stopping the AEV
reverse(4);
motorSpeed(4,32);
goFor(0.9);
brake(4);

//Stop 5 seconds
motorSpeed(4,0);
goFor(10);

//Keep going
motorSpeed(4,60);
goFor(2.3);

//Braking the AEV
reverse(4);
motorSpeed(4,42);
goFor(2);
brake(4);

// Reverse the direction for backing
reverse(4);