Lab 10

Code:

// Reverse motors.

 reverse(4);

 

 // Run all motors at a constant speed of 100%, travel to mark 31.

 motorSpeed(4,100);

 goToAbsolutePosition(31);

 

 // Cut power to glide into gate.

 motorSpeed(4,0);

 goToAbsolutePosition(375);

 

 // Use servo to brake AEV.

 rotateServo(30);

 brake(4);

 goFor(7.5);

 rotateServo(-30);

 

 // Run all motors at a constant speed of 100%, travel to mark 419.

 motorSpeed(4,100);

 goToAbsolutePosition(419);

 

 // Cut power to glide into loading station.

 motorSpeed(4,0);

 goToAbsolutePosition(760);

 

 // Reverse motors and glide into loading station.

 reverse(4);

 goFor(1);

 

 // Brake motors and wait at loading station.

 brake(4);

 goFor(6);

 

 // Run all motors at a constant speed of 100% and travel to mark 701.

 motorSpeed(4,100);

 goToAbsolutePosition(701);

 

 // Cut power to glide into gate.

 motorSpeed(4,0);

 goToAbsolutePosition(443);

 

 // Use servo to brake AEV.

 rotateServo(30);

 brake(4);

 goFor(7.5);

 rotateServo(-30);

 

 // Run all motors at a constant speed of 100% to travel to rebel camp.

 motorSpeed(4,100);

 goToAbsolutePosition(335);

 

 // Cut power to glide into camp.

 motorSpeed(4,0);

 goToAbsolutePosition(15);

 

 // Use servo to brake AEV.

 rotateServo(30);

 brake(4);