Code

Performance Test 1:

reverse(4);

//accelerate all motors from 0% to 36% in 2 seconds

celerate(4,0,36,2);

//run all motors at 36% power for 6.75 seconds

motorSpeed(4,36);

goFor(6.75);

//brake all motors

brake(4);

//reverse the motor orientation to run a power brake

reverse(4);

motorSpeed(4,15);

goFor(1.5);

brake(4);

//stop in the gate zone for 7 seconds

goFor(7);

reverse(4);

//accelerate all motors from 0% to 40% in 2 seconds

celerate(4,0,40,2);

goFor(1.5);

brake(4);

For the first performance test, we decided to use time based functions to operate the AEV. We did those because our Reflector Sensors were not functioning properly. The time based approach did not work well though. We had trouble getting the vehicle to stop inside the gate and an even harder time getting it to work with consistency.

 

Performance Test 2:

reverse(4);

//accelerate all motors from 0% to 36% in 1 second

celerate(4,0,36,1);

//run all motors at 36% power until the vehicle reaches -133 mark

motorSpeed(4,36);

goToAbsolutePosition(-133);

//run all motors at 44% power until the vehicle reaches -259 mark (climbing up the incline)

motorSpeed(4,44);

goToAbsolutePosition(-259);

brake(4);

//reverse the motor orientation to run a power brake

reverse(4);

motorSpeed(4,30);

goFor(1.5);

brake(4);

//stop in the gate zone for 7 seconds

goFor(7);

reverse(4);

//accelerate all motors from 0% to 40% in 1 second (leaving gate zone)

celerate(4,0,40,1);

//run the vehicle until it goes to cargo

goToAbsolutePosition(-422);

//brake to stop in front of cargo

brake(4);

motorSpeed(4,15);

goToAbsolutePosition(-590);

brake(4);

goToAbsolutePosition(-625);

//connect to cargo

goFor(6);

//accelerate all motors from 0% to 40% in 2 seconds (returning to gate zone)

reverse(4);

celerate(4,0,40,2);

goToAbsolutePosition(-430);

brake(4);

goToAbsolutePosition(-410);

//stop in the gate zone for 7 seconds

goFor(7);

celerate(4,0,40,2);

brake(4);

The second performance test worked out much more smoothly than the first. We switched to a distance based program which reduced much of the error we were experiencing. After we switched to distance, we were able to correct performance test 2, and complete the second performance tests in one day. Using absolute distance is the best way to program the AEV.