Code Archive

Exercise 2 pR&D


// Reverses all motors and sets them at 25% power for 2 seconds
reverse(4);
motorSpeed(4,25);
goFor(2);

// Runs all motors at 20% power until the AEV reaches absolute position 295 (12 ft.)
motorSpeed(4,20);
goToAbsolutePosition(295.3846);

// Reverses all motors and sets them at 30% power for 1.5 seconds
reverse(4);
motorSpeed(4,30);
goFor(1.5);
// Brakes all motors
brake(4);

 

Exercise 4 pR&D


// Accelerates all motors from 0% to 25% power over 3 seconds
// and runs all motors at 25% power for 1 second
celerate(4,0,25,3);
goFor(1);

// Sets all motors at 20% power for 2 seconds
motorSpeed(4,20);
goFor(2);

// Reverses all motors and then sets them at 25% power for 2 seconds
reverse(4);
motorSpeed(4,25);
goFor(2);

// Brakes all motors
brake(4);

 

Test Code


// Sets all motors at 40% power until the AEV reaches relative position 295 (12 ft.)
motorSpeed(4,40);
goToRelativePosition(295.38);

// Brakes all motors
brake(4);

 

Advanced R&D 2 Braking Methods (Wind Tunnel AEV)


// Reverses motor 2 and runs all motors at 40% power
// until the AEV reaches relative position 147.69 (6 ft.)
reverse(2);
motorSpeed(4,40);
goToRelativePosition(147.69);

// Reverses all motors and sets them at 40% power for 2 seconds
reverse(4);
motorSpeed(4,40);
goFor(2);

// Brakes all motors
brake(4);

 

Advanced R&D 2 Braking Methods (Servo AEV)


// Reverses motor 2 and runs all motors at 40% power 
// until the AEV reaches relative position 147.69 (6 ft.)
reverse(2);
motorSpeed(4,40);
goToRelativePosition(147.69);

// Rotates the servo 35 degrees
rotateServo(35);

// Brakes all motors
brake(4);

 

Performance Test 1 Code


// Reverses motor 1 and runs all motors at 40% power
// until the AEV reaches relative position 248
reverse(1);
motorSpeed(4,40);
goToRelativePosition(248);

// Reverses all motors and sets them at 70% power for 0.8 seconds
// to brake the AEV in front of the gate
reverse(4);
motorSpeed(4,70);
goFor(0.8);

// Sets all motors at 0% power to stop the AEV in front of the gate for 7 seconds
motorSpeed(4,0);
goFor(7);

// Reverses all motors and sets them at 40% power for 2 seconds
reverse(4);
motorSpeed(4,40);
goFor(2);

// Brakes all motors
brake(4);

 

Performance Test 2 Code


// Reverses motor 1 and runs all motors at 40% power
// until the AEV reaches relative position 248
reverse(1); 
motorSpeed(4,40); 
goToRelativePosition(248); 
 
// Reverses all motors and sets them at 70% power for 0.8 seconds
// to brake the AEV in front of the gate
reverse(4); 
motorSpeed(4,70); 
goFor(0.8); 
 
// Sets all motors at 0% power to stop the AEV in front of the gate for 7 seconds
motorSpeed(4,0); 
goFor(7); 
 
// Reverses all motors and sets them at 40% power
until the AEV reaches relative position 230
reverse(4); 
motorSpeed(4,40); 
goToRelativePosition(230); 
 
// Reverses all motors and sets them at 60% power for 1.1 seconds
// to brake the AEV enough to gently connect with the caboose
reverse(4); 
motorSpeed(4,60); 
goFor(1.1); 
 
// Sets all motors at 0% power to stop the AEV with the caboose for 8 seconds
motorSpeed(4,0); 
goFor(8); 
 
// Sets all motors at 40% power for 2 seconds to exit the loading zone
motorSpeed(4,40); 
goFor(2); 
 
// Brakes all motors
brake(4); 

 

Final Performance Test 1 Code


// Reverses motor 1 and runs all motors at 40% power
// until the AEV reaches relative position 246
reverse(1); 
motorSpeed(4,40); 
goToRelativePosition(246); 
 
// Reverses all motors and sets them at 70% power for 0.8 seconds
// to brake the AEV in front of the gate
reverse(4); 
motorSpeed(4,70); 
goFor(0.8); 
 
// Sets all motors at 0% power to stop the AEV in front of the gate for 7 seconds
motorSpeed(4,0); 
goFor(7); 
 
// Reverses all motors and sets them at 40% power
// until the AEV reaches relative position 230
reverse(4); 
motorSpeed(4,40); 
goToRelativePosition(230); 
 
// Reverses all motors and sets them at 60% power for 1.1 seconds
// to brake the AEV enough to gently connect with the caboose
reverse(4); 
motorSpeed(4,60); 
goFor(1.1); 
 
// Sets all motors at 0% power to stop the AEV with the caboose for 6 seconds
motorSpeed(4,0); 
goFor(6); 
 
// Sets all motors at 50% power until the AEV with the caboose
// reaches relative position -228
motorSpeed(4,50); 
goToRelativePosition(-228);

// Reverses all motors and sets them at 70% power for 1.5 seconds
// to brake the AEV with the caboose in front of the gate
reverse(4); 
motorSpeed(4,70); 
goFor(1.5);

// Sets all motors at 0% power to stop the AEV with the caboose for 7 seconds
motorSpeed(4,0); 
goFor(7);

// Reverses all motors and sets them at 50% power
// until the AEV with the caboose reaches relative position -72
reverse(4); 
motorSpeed(4,50); 
goToRelativePosition(-72);

// Sets all motors at 0% power until the AEV with the caboose
// reaches relative position -255
motorSpeed(4,0); 
goToRelativePosition(-255);

// Reverses all motors and sets them at 55% power for 1 second
// to brake the AEV with the caboose in the starting dock
reverse(4); 
motorSpeed(4,55); 
goFor(1);
 
// Brakes all motors
brake(4);

 

Final Performance Test 2 Code


// Reverses motor 1 and runs all motors at 40% power
// until the AEV reaches relative position 246
reverse(1); 
motorSpeed(4,40); 
goToRelativePosition(246); 
 
// Reverses all motors and sets them at 70% power for 0.8 seconds
// to brake the AEV in front of the gate
reverse(4); 
motorSpeed(4,70); 
goFor(0.8); 
 
// Sets all motors at 0% power to stop the AEV in front of the gate for 7 seconds
motorSpeed(4,0); 
goFor(7); 
 
// Reverses all motors and sets them at 40% power
// until the AEV reaches relative position 230
reverse(4); 
motorSpeed(4,40); 
goToRelativePosition(230); 
 
// Reverses all motors and sets them at 60% power for 1.1 seconds
// to brake the AEV enough to gently connect with the caboose
reverse(4); 
motorSpeed(4,60); 
goFor(1.1); 
 
// Sets all motors at 0% power to stop the AEV with the caboose for 6 seconds
motorSpeed(4,0); 
goFor(6); 
 
// Sets all motors at 50% power until the AEV with the caboose
// reaches relative position -228
motorSpeed(4,50); 
goToRelativePosition(-228);

// Reverses all motors and sets them at 70% power for 1.5 seconds
// to brake the AEV with the caboose in front of the gate
reverse(4); 
motorSpeed(4,70); 
goFor(1.5);

// Sets all motors at 0% power to stop the AEV with the caboose for 7 seconds
motorSpeed(4,0); 
goFor(7);

// Reverses all motors and sets them at 50% power
// until the AEV with the caboose reaches relative position -72
reverse(4); 
motorSpeed(4,50); 
goToRelativePosition(-72);

// Sets all motors at 0% power until the AEV with the caboose
// reaches relative position -250
motorSpeed(4,0); 
goToRelativePosition(-250);

// Reverses all motors and sets them at 55% power for 1 second
// to brake the AEV with the caboose in the starting dock
reverse(4); 
motorSpeed(4,55); 
goFor(1);
 
// Brakes all motors
brake(4);

 

Final Performance Test 3 and Wind Tunnel Test Code


// Reverses motor 1 and runs all motors at 40% power
// until the AEV reaches relative position 246
reverse(1); 
motorSpeed(4,40); 
goToRelativePosition(246); 
 
// Reverses all motors and sets them at 70% power for 0.8 seconds
// to brake the AEV in front of the gate
reverse(4); 
motorSpeed(4,70); 
goFor(0.8); 
 
// Sets all motors at 0% power to stop the AEV in front of the gate for 7 seconds
motorSpeed(4,0); 
goFor(7); 
 
// Reverses all motors and sets them at 40% power
// until the AEV reaches relative position 225
reverse(4); 
motorSpeed(4,40); 
goToRelativePosition(225); 
 
// Reverses all motors and sets them at 60% power for 1.1 seconds
// to brake the AEV enough to gently connect with the caboose
reverse(4); 
motorSpeed(4,60); 
goFor(1.1); 
 
// Sets all motors at 0% power to stop the AEV with the caboose for 6 seconds
motorSpeed(4,0); 
goFor(6); 
 
// Sets all motors at 50% power until the AEV with the caboose
// reaches relative position -228
motorSpeed(4,50); 
goToRelativePosition(-228);

// Reverses all motors and sets them at 70% power for 1.4 seconds
// to brake the AEV with the caboose in front of the gate
reverse(4); 
motorSpeed(4,70); 
goFor(1.4);

// Sets all motors at 0% power to stop the AEV with the caboose for 8 seconds
motorSpeed(4,0); 
goFor(8);

// Reverses all motors and sets them at 50% power
// until the AEV with the caboose reaches relative position -72
reverse(4); 
motorSpeed(4,50); 
goToRelativePosition(-72);

// Sets all motors at 0% power until the AEV with the caboose
// reaches relative position -250
motorSpeed(4,0); 
goToRelativePosition(-250);

// Reverses all motors and sets them at 57% power for 1 second
// to brake the AEV with the caboose in the starting dock
reverse(4); 
motorSpeed(4,57); 
goFor(1);
 
// Brakes all motors
brake(4);