Codes Used

Exercise 1, Scenario 1:

//Accelerate motor one from start to 15% power in 2.5 seconds.
celerate(1,0,15,2.5);
//Run motor one at a constant speed (15% power) for 1 second.
goFor(1);
//Brake motor one
brake(1);
//Accelerate motor two from start to 27% power in 4 seconds.
celerate(2,0,27,4);
//Run motor two at a constant speed (27% power) for 2.7 seconds.
goFor(2.7);
//Decelerate motor two to 15% power in 1 second.
celerate(2,27,15,1);
//Brake motor two
brake(2);
//Reverse the direction of only motor 2.
reverse(2);
//Accelerate all motors from start to 31% power in 2 seconds.
celerate(1,0,31,2);
celerate(2,0,31,2);
//Run all motors at a constant speed of 35% power for 1 second
motorSpeed(1,35);
motorSpeed(2,35);
goFor(1);
//Brake motor two but keep motor one running at a constant speed (35% power) for 3 seconds.
brake(2);
goFor(3);
//Brake all motors for 1 second.
brake(1);
goFor(1);
//Reverse the direction of motor one
reverse(1);
//Accelerate motor one from start to 19% power over 2 seconds.
celerate(1,0,19,2);
//Run motor two at 35% power while simultaneouslyrunning motor one at 19% power for 2 seconds.
motorSpeed(1,19);
motorSpeed(2,35);
goFor(2);
//Run both motors at a constant speed (19% power) for 2 seconds.
motorSpeed(2,19);
goFor(2);
//Decelerate both motors to 0% power in 3 seconds.
celerate(1,19,0,3);
celerate(2,19,0,3);
//Brake all motors
brake(1);
brake(2);

Exercise 2:

//Run all motors at a constant speed of 25% power for 2 seconds.
motorSpeed(4,25);
goFor(2);
//Run all motors at a constant speed of 20% and using the goToAbsolutePosition function travel a total distance of 12 feet
motorSpeed(4,20);
goToAbsolutePosition(296.91);
//Reverse motors.
reverse(4);
//Run all motors at a constant speed of 30% power for 1.5 second.
motorSpeed(4,30);
goFor(1.5);
//Brake all motors.
brake(4);

 

Exercise 3

//Reverses the direction of the motors at first so the AEV starts out going forward

reverse(4);

//Accelerates motors to 25% then runs for 1 second
celerate(4,0,25,3);
goFor(1);

Sets motor speed to 20% then runs for 2 seconds
motorSpeed(4,20);
goFor(2);

//Reverses all motors
reverse(4);

//Sets motor speed to 25% then runs for 2 seconds
motorSpeed(4,25);
goFor(2);

//Breaks all motors
brake(4);

Performance Test 1 Code:

reverse(4);
celerate(4,0,30,1.5);
motorSpeed(4,30);
goToAbsolutePosition(275);
brake(4);
reverse(4);
motorSpeed(4,35);
goFor(1);
brake(4);
goFor(7);
reverse(4);
celerate(4,0,30,1.5);
motorSpeed(4,30);
goFor(3);
brake(4);

Performance Test 2 Code:

reverse(4);
celerate(4,0,30,1.5);
motorSpeed(4,30);
goToAbsolutePosition(274);
brake(4);
reverse(4);
motorSpeed(4,35); // brake 1
goFor(1);
brake(4);
goFor(7);
reverse(4);
celerate(4,0,30,1.5);
motorSpeed(4,30);
goToRelativePosition(270);
brake(4);
reverse(4);
motorSpeed(4,50);
goFor(1);
brake(4);
goFor(6);
celerate(4,0,35,1.5);
motorSpeed(4,35);
goToRelativePosition(-50);
brake(4);

Final Performance Test Code:

reverse(4);
celerate(4,0,35,1.5);
motorSpeed(4,35);
goToAbsolutePosition(259);
brake(4);
reverse(4);
motorSpeed(4,40); // brake 1
goFor(1.1);
brake(4);
goFor(7);
reverse(4);
celerate(4,0,35,1.5);
motorSpeed(4,35);
goToAbsolutePosition(555);
brake(4);
reverse(4);
motorSpeed(4,45);// brake 2
goFor(1.2);
brake(4);
goFor(6);
celerate(4,0,45,1.5);
motorSpeed(4,45);
goToAbsolutePosition(447);
brake(4);
reverse(4);
motorSpeed(4,50); //brake 3
goFor(2);
brake(4);
goFor(7);
reverse(4);
celerate(4,0,40,1.5);
motorSpeed(4,40);
goToAbsolutePosition(225);
brake(4);
goToAbsolutePosition(95);
reverse(4);
motorSpeed(4,50); //brake 4
goFor(2.4);
brake(4);