In this section, you will find the extensive testing scenarios created & conducted by Team D’s diligent programmer. Please proceed with the knowledge that the technical details are only meant to be understood by experienced coders!
Note: Code is explained in the logic section!
Scenario 1:
// Run motor one at a constant speed (23% power) for 2.5 second.celerate(1,0,15,2.5); //accelerate motor 1 from 0 to 15% in 2.5 secondsgoFor(1); //runs that speed for 1 secondbrake(1); //brake motor 1celerate(2,0,27,4);goFor(2.7);celerate(2,27,15,1);brake(2);reverse(2);celerate(4,0,31,2);motorSpeed(4,35);goFor(1);brake(2);goFor(3);brake(4);delay(1000);reverse(1);celerate(1,0,19,2);motorSpeed(2,35);motorSpeed(1,19);goFor(2);motorSpeed(2,19);goFor(2);celerate(4,19,0,3);brake(4);motorSpeed(1,23);goFor(2.5);// Brake motor one.brake(1);
Reflectance Sensors Test:
motorSpeed(4,25); // Run all motors at 25% power
goFor(2); // Run all motors for 2 seconds
motorSpeed(4,20); // Run all motors at 20% power
goToAbsolutePosition(295.384615385); // Go 12 feet from initial position
reverse(4); // Reverse all motors
motorSpeed(4,30);// Run all motors at 30% power
goFor(1.5); // Run all motors for 1.5 seconds
brake(4); // Cut power to all motors
CSS1 Test:
celebrate(4,0,25,3); // Accelerate all motors from start to 25% in 3 seconds
motorSpeed(4,25); // Run all motors at a constant speed (25% power)
goFor(1); // Run this state for 1 second
motorSpeed(4,20); // Run all motors at 20% power
goFor(2); // Run this state for 2 seconds
reverse(4); // Reverse all motors
motorSpeed(4,25); // Run all motors at a constant speed (25% power)
goFor(2); // Run this state for 2 seconds
brake(4); // Brake all the motors
Propulsion testing:
75 Percent Speed test Code
celerate(2,0,75,5);goFor(2);celerate(2,75,0,5);reverse(2);celerate(2,0,75,5);goFor(2);celerate(2,75,0,5);
Step Speed Test:
celerate(2,0,25,5);goFor(5);celerate(2,25,0,5);reverse(2);celerate(2,0,25,5);goFor(5);celerate(2,25,0,5);reverse(2);celerate(2,0,35,5);goFor(3);celerate(2,35,0,5);reverse(2);celerate(2,0,35,5);goFor(3);celerate(2,35,0,5);reverse(2);celerate(2,0,55,5);goFor(3);celerate(2,55,0,5);reverse(2);celerate(2,0,55,5);goFor(3);celerate(2,55,0,5);
Final Test Code:
// initalize variables
int k(0);
int i(0);
int j(0);
int Triplecheck(0);
// Start
// AEV front wheel is placed just before tape
// tape on wheel lines up with mark on screw// AEV movement from start dock to gate.
reverse(4);
motorSpeed(4,90);
goToAbsolutePosition(296);// possibly 288
// Stop check
// breaks the AEV so that it triggers the sensor but doesnt go further then that
k = getVehiclePostion();
while(i !=1)
{
k = getVehiclePostion();
if (k > 300 ) //possibly 292
{
reverse(4);
motorSpeed(4,10);
goFor(.35);
brake(4);
reverse(4);
i = 1;
}
}
brake(4);
goFor(8.5);// code above works and the aev stops at same point everytime
// continue through the gate to the loading zone
// AEV movement to Loading dock
motorSpeed(4,90);
goToAbsolutePosition(617);
brake(4);
// reduce speed and connect with caboose
motorSpeed(4,15);
goToAbsolutePosition(636);
brake(4);
goFor(5);
reverse(4);
// code above works to pick up aev.
// AEV movement back to gate with caboose
motorSpeed(4,90);
goToAbsolutePosition(382);
brake(4);// Brake loop
// if the Aev goes past a specific position it will brake the AEV
// if not it exits the loop
i = 0;
while(i !=1 )
{
k = getVehiclePostion();
if (k < 349 )
{
reverse(4);
motorSpeed(4,13);
goFor(.42);
brake(4);
reverse(4);
i = 1;
}
// code below checks if the AEV is in the same position for an extended period of time
// if so it addes one to a counter and once the counter reaches 6 it exits the loop
if(k >= 345)
{
j = getVehiclePostion();
if(j == k )
{
Triplecheck += 1;
}
else
{
Triplecheck = 0;
}
}
if (Triplecheck >= 6)
{
i =1;
}
}brake(4);
// loops till AEV stops so then timer can begin
i = 0;
while(i != 1)
{
k = getVehiclePostion();
brake(4);
goFor(.18);
j = getVehiclePostion();
if(k == j )
{
i = 1;
}
}// extended timer to account for AEVs speed
goFor(10.0);
// AEV movement to return to starting gate
motorSpeed(4,90);
goToAbsolutePosition(28);
brake(4);
// reset break check variable
//begin brake loop
i=0;
Triplecheck = 0;
while(i !=1 )
{
k = getVehiclePostion();
// once the AEV passes this point, brake AEV
if (k < 9)
{
reverse(4);
motorSpeed(4,10);
goFor(.35);
brake(4);
reverse(4);
i = 1;
}
// loop cheek to make sure the code continues even if AEV stops before brake position
if(k >= 9)
{
j = getVehiclePostion();
if(j == k )
{
Triplecheck += 1;
}
else
{
Triplecheck = 0;
}
}
if (Triplecheck >= 6)
{
i =1;
}
}brake(4);
goFor(3);