Performance Test 2 (P)

 

Performance test 2 tasked the AEV with moving through the gate, picking up the payload at the end of the track, and moving the payload out of the docking station. Numerous track positions were added to the code for performance test 2 resulting in additional fail-safes because of the multiple stops the AEV needed to reach. A fail-safe was needed for connecting to the payload to avoid any recoil, thus giving the passengers a safer and more comfortable ride.

1. Track Position Calculations

void myCode()

// Positions on the track

// Sensor locations on either side of the gate

// Gate Right 150 RM 224

// Gate Right 152 RM 308

int gateRight = (152*8/3.902);

int gateLeft = (174*8/3.902);

int returnhill = (206*8/3.902);  

// Point to start coasting

// When going towards the gate

int gateStopLeft = (125*8/3.902);

// When going away from gate

int gateStopRight = (86*8/3.902);

// Coasting while backing up with caboose

int backingUpBrakePoint = (7.5*12*8/3.902);

// Location of end point

int endPoint = (7*12*8/3.902);

 

2. Forward Movement Towards Gate and Gate Fail-safes

// Starting to move

motorSpeed(4,40);

goToAbsolutePosition(gateStopLeft);

// Coasting to a stop

reverse(4);

motorSpeed(4,40);

goFor(1);

// Waiting for fail safe to kick in if needed

brake(4);

goFor(1);

// Fail-safe

// 27% for 308

// 25% for 224

// Revised edition:

// 25% for 308

// ?? for 224

if(getVehiclePostion() < gateRight){

 reverse(4);

 motorSpeed(4,27);

 goToAbsolutePosition(gateRight);

 brake(4);

}else{

 reverse(4);

}

// Waiting at the gate for 7 seconds

brake(4);

goFor(7);

// Going the loading dock

motorSpeed(4,40);

goToRelativePosition(gateStopRight);

 

3. Movement Towards Payload

// Coasting to a stop

reverse(4);

motorSpeed(4,40);

goFor(1);

// Fail-safe 2

brake(4);

goFor(2);

int finalDock = (25.5*12*8/3.902);

if(getVehiclePostion() < finalDock){

 reverse(4);

 motorSpeed(4,27);

 goToAbsolutePosition(finalDock);

 brake(4);

}else{

 reverse(4);

}

// Waiting

brake(4);

goFor(5);

 

4. Backwards Movement Towards Gate With Payload

// Going back to the gate

reverse(4);

motorSpeed(4,45);

goToRelativePosition(-backingUpBrakePoint);

// Coasting to a stop

reverse(4);

motorSpeed(4,40);

goFor(1);

// Fail-safe 3

brake(4);

goFor(2);

if(getVehiclePostion() > gateLeft){

 reverse(4);

 motorSpeed(4,45);

 goToAbsolutePosition(gateLeft);

 brake(4);

}else{

 reverse(4);

}

// Waiting for 7 seconds for gate

brake(4);

goFor(7);

 

5. Final Destination

// Going back to the initial position

motorSpeed(4,45);

goToRelativePosition(-endPoint);

// Coasting to a stop

reverse(4);

motorSpeed(4,45);

goFor(1);

} // DO NOT REMOVE. end of void myCode()

 

(Go back to Team P’s code page)