Codes

Lab 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.

motorSpeed(1,15);

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.

motorSpeed(2,27);

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(4,0,31,2);

//Run all motors at a constant speed of 35% power for 1 second.

motorSpeed(4,35);

goFor(1);

//Brake motor two but keep motor one running at a constant speed (35% power) for 3 seconds.

brake(2);

motorSpeed(1,35);

goFor(3);

//Brake all motors for 1 second.

brake(4);

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 simultaneously running motor one at 19% power for 2 seconds.

motorSpeed(2,35);

goFor(2);

motorSpeed(1,19);

goFor(2);

//Run both motors at a constant speed (19% power) for 2 seconds.

motorSpeed(4,19);

goFor(2);

//Decelerate both motors to 0% power in 3 seconds.

celerate(4,19,0,3);

//Brake all motors.

brake(4);

Lab 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 (from the starting point)

motorSpeed(4,20);

goToAbsolutePosition(295);

//Reverse motors.

reverse(4);

//Run all motors at a constant speed of 30% power for 1.5 second.

motorSpeed(30);

goFor(1.5);

//Brake all motors.

brake(4);

Lab 3:

//Accelerate all motors from start to 25% in 3 seconds.

celerate(4,0,25,3);

//Run all motors at a constant speed (25% power) for 1 second.

motorSpeed(4,25);

goFor(1);

//Run all motors at 20% power for 2 seconds.

motorSpeed(20);

goFor(2);

Advanced R&D #1:

//Reverse all motors.

reverse(4);

//Run all motors at a constant speed (25% power) for 2 second.

motorSpeed(4,25);

goFor(2);

//Brake all motors.

brake(4);

// Reverse all motors

reverse(4);

// Accelerate AEV to 30% power in 2 seconds

celerate(4,0,30,2);

// Run motors at speed of 30% for 4 seconds

motorSpeed(4,30);

goFor(4);

// Brake all motors

brake(4);

// Reverse all motors

reverse(4);

// Accelerate AEV to 40% power in 2 seconds

celerate(4,0,40,2);

// Run motors at speed of 40% for 4 seconds

motorSpeed(4,40);

goFor(4);

// Brake all motors

brake(4);

Advanced R&D #2:

// reverse all motors

reverse(4);

// accelerate motors to 25% power in 2 seconds

celerate(4,0,25,2);

// set motor speed at 25% for 3 seconds

motorSpeed(4,25);

goFor(3);

// brake all motors

brake(4);

Performance Test #1:

// reverse all motors

reverse(4);

// run motors at 27% power for 10 feet

motorSpeed(4,27);

goToAbsolutePosition(246);

// brake all motors for 10 seconds

brake(4);

goFor(10)

// run motors at 26% power for 3.5 seconds

motorSpeed(4,26);

goFor(3.5);

Performance Test #2:

// reverse all motors

reverse(4);

// run motors at 27% power for 10 feet

motorSpeed(4,27);

goToAbsolutePosition(246);

// brake all motors for 10 seconds

brake(4);

goFor(10);

// run motors at 24% power for 3 seconds

motorSpeed(4,20);

goFor(4.5);

// brake all motors for 8 seconds

brake(4);

goFor(11);

// reverse all motors

reverse(4);

// run motors at 30% power for 4 seconds

motorSpeed(4,35);

goFor(4);

Advanced R&D #3:

// reverse all motors

reverse(4);

// run all motors at 30% power for 10 feet

motorSpeed(4,29);

goToAbsolutePosition(269);

// rotate servo 90 degrees

rotateServo(90);

// brake all motors for 8 seconds

brake(4);

Final Performance Test:

// reverse all motors

reverse(4);

// run all motors at 30% power for 10 feet

motorSpeed(4,29);

goToAbsolutePosition(269);

// rotate servo 90 degrees

rotateServo(90);

// brake all motors for 8 seconds

brake(4);

goFor(8);

// rotate servo to 0 degrees

rotateServo(0);

// run all motors at 25.5% power for 3 seconds

motorSpeed(4,25.5);

goFor(3);

// brake all motors until 635 marks

brake(4);

goToAbsolutePosition(635);

// rotate servo 90 degrees

rotateServo(90);

// brake all motors for 6 seconds

brake(4);

goFor(6);

// rotate servo to 0 degrees

rotateServo(0);

// reverse all motors

reverse(4);

// run all motors at 40% power for -262 marks

motorSpeed(4,40);

goToRelativePosition(-262);

// rotate servo to 90 degrees

rotateServo(90);

// brake all motors for 8 seconds

brake(4);

goFor(8);

// rotate servo to 0 degrees

rotateServo(0);

// run all motors at 40% power for 5 seconds

motorSpeed(4,40);

goFor(5.5);

// brake all motors until the AEV reaches the starting dock

brake(4);

goToAbsolutePosition(54);

// rotate servo to 90 degrees

rotateServo(90);