Part 1
//Test code used when getting data for AEV
reverse(4); //switches motor direction, propeller blades are backwards us
celerate(4, 0, 25, 3); //accelerate to 25% power on all motors over 3 seconds
goFor(1); //maintain speed for 1 second
motorSpeed(4, 20); //run at 20% power on all motors
goFor(2); //maintain speed for 1 second
reverse(4); //reverse all motor direction, trying to slow down AEV now
motorSpeed(4, 25); //run motors add 25% power
goFor(2); //run for 2 seconds
brake(4); //stop motors
Part 2
//run at start of every meeting with AEV
reflectanceSensorTest(); //runs reflectance sensors for testing
Part 3
//uncomment desired test power, comment all others
reverse(4); //reverse motor direction to go forward
//motorSpeed(4,20); //run at 20% power for all motors
motorSpeed(4,25); //run at 25% power for all motors
//motorSpeed(4,30); //run at 30% power for all motors
//motorSpeed(4,35); //run at 35% power for all motors
goFor(3); //run for 3 seconds
Part 4
//brake testing and room 224 performance testing
reverse(4);
//1 mark = .4875 inches
motorSpeed(4,25);
goToAbsolutePosition(258); //run for 258 marks from start
motorSpeed(4, 0);
reverse(4); //reverse motor direction
motorSpeed(4,25); //slow down AEV
goFor(1.9);
brake(4); //stop all motors
Part 5
//Room 308 performance test 1
reverse(4);
//1 mark = .4875 inches
motorSpeed(4,25);
goToAbsolutePosition(226); //run for 226 marks from start
motorSpeed(4, 0);
reverse(4); //switch direction of motors
motorSpeed(4,25); //stop the AEV
goFor(2.5);
brake(4);
goFor(7); //wait for 7 seconds
reverse(4);
motorSpeed(4,25); //proceed through gate
goToRelativePosition(100); //go 100 marks from current position
motorSpeed(4,0);
reverse(4); //switch direction of motors
motorSpeed(4,30); //stop the AEV
goFor(3);
brake(4);
Part 6
//Performance Test 2 room 224
reverse(4);
//1 mark = .4875 inches
int ourSpeed = 30; //sets base speed for AEV
int timer = 0; //timer for acceleration
while(getVehiclePostion() < 225){ //go until 225 marks are passed
motorSpeed(4, ourSpeed); //run motors at set speed
if(timer > 10000 && ourSpeed < 35){ //increase speed by 1% after set time, cap at 35%
ourSpeed++;
timer = 0;
}
timer++;
}
motorSpeed(4, 0);
reverse(4);
while(getVehicleDirection() == 1){ //stop AEV
motorSpeed(4, 30);
}
reverse(4);
while(getVehiclePostion() < 300){ //run AEV a little further if not far enough
motorSpeed(4, 30);
goFor(1);
brake(4);
goFor(2);
}
brake(4);
goFor(7); //wait at gate
motorSpeed(4,30);
goToRelativePosition(210); //move 210 marks from current position
motorSpeed(4,0);
reverse(4);
motorSpeed(4, 30); //stop AEV, this time using time
goFor(2.5);
brake(4);
goFor(5); //wait 5 seconds before leaving docking area
motorSpeed(4, 35); //leave area with caboose
goFor(2);
Part 7
//Servo testing
reverse(4);
//1 mark = .4875 inches
int ourSpeed = 30; //sets base speed for AEV
int timer = 0;
while(getVehiclePostion() < 230){ //accelerate AEV over time until at mark 230
motorSpeed(4, ourSpeed);
if(timer > 10000 && ourSpeed < 35){
ourSpeed++;
timer = 0;
}
timer++;
}
motorSpeed(4, 0); //stop motors
rotateServo(35); //move servo 35 degrees to stop wheel
goFor(3); //run for 3 seconds to ensure AEV stops
rotateServo(0); //release servo from wheel
while(getVehiclePostion() < 296){ //run AEV further if not far enough
motorSpeed(4, 30);
goFor(.5);
brake(4);
goFor(1.5);
}
brake(4);
goFor(7);
Part 8
//Perfomrance Test 3 room 224
reverse(4);
//1 mark = .4875 inches
int ourSpeed = 30; //base AEV speed
int timer = 0;
while(getVehiclePostion() < 235){
motorSpeed(4, ourSpeed);
if(timer > 10000 && ourSpeed < 35){
ourSpeed++;
timer = 0;
}
timer++;
}
brake(4);
rotateServo(35);
goFor(3);
rotateServo(0);
while(getVehiclePostion() < 300){
motorSpeed(4, 30);
goFor(.5);
brake(4);
goFor(2);
}
goFor(7);
//pausing at gate
motorSpeed(4,30);
goToAbsolutePosition(547);
brake(4);
while(getVehiclePostion < 667){
brake(4);
}
rotateServo(35);
goFor(2);
rotateServo(0);
while(getVehiclePostion < 700){
motorSpeed(4, 35);
goFor(.5);
brake(4);
goFor(1);
}
goFor(5);
//pausing with caboose
reverse(4);
motorSpeed(4,52); //need a lot of power to make it up hill
goToAbsolutePosition(381); //run to mark 381
brake(4);
rotateServo(35); //stop AEV
goFor(3);
rotateServo(0);
goFor(6);
//pausing at gate again
motorSpeed(4, 50);
goToAbsolutePosition(220); //go to top of hill
brake(4);
goFor(3); //allow AEV to roll down hill
rotateServo(35); //stop AEV
goFor(2);
rotateServo(0); //done