Final Performance Test Code
Code used for the final performance test
reverse(4);//reverses both motors
motorSpeed(4,24); //initalizes both motors to 24% power
goToAbsolutePosition(227);//sets the AEV to travel 227 marks
brake(4);//brakes both motors
goFor(4);//AEV waits 4 seconds
if(getVehiclePostion() <297){// i
motorSpeed(4,27);
goToAbsolutePosition(297);
brake(4);
goFor(2);
}// if the AEV has traveled less than 297 marks the AEV will start again and move forward slightly
motorSpeed(4,0);//sets both motors to 0% power
goFor(6);//AEV waits for 6 seconds
//performance test 1
//going to gate
motorSpeed(4,22);//sets both motors to 22% power
goToAbsolutePosition(350);//makes the AEV travel to 350 marks
celerate(4,23,19,2);//the AEV declerates from 23% to 19% power in 2 seconds
brake(4);//brakes both motors
goFor(7); //AEV waits for 7 second
//performance test 2
//picking up caboose
reverse(4);//reverses the direction of both motors
motorSpeed(4,50);//sets both motors to 40% power
goToAbsolutePosition(388);//makes the AEV go to the postion 388 marks
brake(4);//brakes both motors
if(getVehiclePostion() > 425){
motorSpeed(4,40);
goToAbsolutePosition(425);
brake(4);
//goFor(2);
}//if the AEV’s position is greater than 425 marks it will move forwards slightly
reverse(4);//reverses both motors
motorSpeed(4,28);//sets both motors to 28% power
goFor(1);//runs the AEV at current power for 1 second
motorSpeed(4,0);//sets both motors to 0% power
goFor(7);//runs at 0% power for 7 seconds
//uphill
//returning to gate with caboose
reverse(4);//reverses the direction of both motors
motorSpeed(4,48);//sets both motors to 48% power
goToAbsolutePosition(220);//makes the AEV return to the position at 220 marks
brake(4);//brakes both motors
goFor(7);//AEV waits for 7 seconds
//downhill
// returns to loading dock