Previous Versions of Code

Code 1 (Lab 1)

brake(1); 

celerate(1,0,15,2.5); //accelerate the first motor to 15% over 2.5 seconds 

motorSpeed(1,15); // set the first motor to 15% speed just to be sure 

goFor(1); //run the motor for another 1 second 

brake(1); //stop the first motor 

celerate(2,0,27,4); //accelerate the second motor to 27 speed over 4 seconds 

motorSpeed(2,27); //set the second motor to 27 speed 

goFor(2.7); //run the motor for 2.7 seconds 

celerate(2,27,15,1); //change the speed of the second motor from 27 to 15 

brake(2); //stop the second motor 

reverse(2); // reverse the second motor 

celerate(4,0,31,2); //accelerate both of the motors to 31 over 2 seconds 

brake(4); //stop all the motors 

This was used to initially test the arduino board and accompanying motors to ensure that they all were working correctly. 

 

Code 2 (Labs 2-3)

reflectanceSensorTest; // test the sensors using the serial monitor 

This is used as a basic test to determine the direction the light sensors for the wheels are facing and that the sensors are installed properly.  

 

Code 3 (Labs 4-5)

motorSpeed(4,25); //start all motors at 25% speed 

goFor(2); //wait two seconds 

motorSpeed(4,20); //set all motor speeds to 20% 

goToAbsolutePosition(254); //go for 254 marks or about 12 feet 

brake(4); //stop all motors 

reverse(4); //reverse all the motors 

motorSpeed(4, 30); //run all motors at 30 speed 

goFor(1.5); //go for 1.5 seconds 

brake(4); //stop all the motors  

The most recent code used was to run the AEV down the rail and test the structure and the data extraction capability. 

 

Performance Test One

brake(4); //stop everything
motorSpeed(4,27); //set the speed of both motors to 27%
goToAbsolutePosition(-148); //go to the first incline in the track
motorSpeed(4,30); //increase the speed to 30% to get up the incline faster
goToRelativePosition(-98); //go to the top of the incline
motorSpeed(4,23); //go at a slower pace to the stopping point
goToRelativePosition(-74); //this is the distance to the stopping point
reverse(4); //reverse the motors to brake the aev
motorSpeed(4,40); //thrust the aev backwards at 40% as makeshift braking
goFor(1.5); //this gives the aev time to stop
brake(4); //stop everything
goFor(7); //wait for the stop sign to raise
reverse(4); //reverse the motors back to normal
motorSpeed(4,27); //drive the AEV through the gate
goFor(3); //give the aev time to go through the gate
brake(4); //stop everything

This code was used to run the AEV down the track, wait at the stop sign for seven seconds, and then proceed through the gate for the first performance check.

Performance Test Two

reverse(4); //reverse everything
brake(4); //stop everything
motorSpeed(4,33); //set the speed of both motors to 33%
goToAbsolutePosition(-148); //go to the first incline in the track
motorSpeed(4,39); //increase the speed to 43% to get up the incline faster
goToRelativePosition(-98); //go to the top of the incline
motorSpeed(4,27); //go at a slower pace to the stopping point
goToRelativePosition(-30); //this is the distance to the stopping point
reverse(4); //reverse the motors to brake the aev
motorSpeed(4,40); //thrust the aev backwards at 40% as makeshift braking
goFor(1); //this gives the aev time to stop
brake(4); //stop everything
goFor(7); //wait for the stop sign to raise
reverse(4); //reverse the motors back to normal

//start of performance test 2 code

motorSpeed(4,33); //drive the AEV through the gate
goFor(1.25); //get some thrust off hte line
motorSpeed(4,29); //begin slowing down
goToAbsolutePosition(-500); //drive the AEV to the slowdown point
motorSpeed(4,15); //slow the aev down to prep for loading
goToAbsolutePosition(-573); //go to the point where motors should be cut
brake(4); //stop motors
goFor(0.5); //give a little propogation time
reverse(4); //reverse all motors
motorSpeed(4,43);// thrust the motors to stop the AEV
goFor(1); //continue the reverse for 0.75 seconds
brake(4); //stop all motors
goFor(5.5); //allow time to coast and connect
motorSpeed(4,38); //drive away at 35 speed

 

This performed the task designated in the first performance test as well as additionally going down and picking up the caboose.

Final Performance Test

reverse(4); //reverse everything
brake(4); //stop everything
motorSpeed(4,33); //set the speed of both motors to 33%
goToAbsolutePosition(-148); //go to the first incline in the track
motorSpeed(4,43); //increase the speed to 43% to get up the incline faster
goToRelativePosition(-98); //go to the top of the incline
motorSpeed(4,27); //go at a slower pace to the stopping point
goToRelativePosition(-30); //this is the distance to the stopping point
reverse(4); //reverse the motors to brake the aev
motorSpeed(4,42); //thrust the aev backwards at 40% as makeshift braking
goFor(1); //this gives the aev time to stop
brake(4); //stop everything
goFor(7); //wait for the stop sign to raise
reverse(4); //reverse the motors back to normal

//start of performance test 2 code

motorSpeed(4,33); //drive the AEV through the gate
goFor(1.25); //get some thrust off hte line
motorSpeed(4,29); //begin slowing down
goToAbsolutePosition(-500); //drive the AEV to the slowdown point
motorSpeed(4,18); //slow the aev down to prep for loading
goToAbsolutePosition(-573); //go to the point where motors should be cut
brake(4); //stop motors
goFor(0.5); //give a little propogation time
reverse(4); //reverse all motors
motorSpeed(4,35);// thrust the motors to stop the AEV
goFor(1); //continue the reverse for 0.75 seconds
brake(4); //stop all motors
goFor(5.5); //allow time to coast and connect
motorSpeed(4,47); //drive away at 38 speed

//start of test 3

goToRelativePosition(99); //go for 99 marks towards the middle
motorSpeed(4,40); //increase the speed for the incline
goToRelativePosition(105); //go to the top of the incline
motorSpeed(4,34); //slows the motors back down
goToRelativePosition(30); //go to the stopping point
brake(4); //stop all the motors
goToRelativePosition(15); //get closer to the middle for stopping
reverse(4); // reverse the motors to prep for braking
motorSpeed(4,45); //thrust bakwards to brake
goFor(1.5); //brake for that long
brake(4); //stop
goFor(7); //wait for the gate to come back up
reverse(4); //flip everything back
motorSpeed(4,41); //drive through the gate
goToAbsolutePosition(-246); //take the caboose to the top of the incline
brake(4); //cut all the motors
goToAbsolutePosition(-110); //go to the final stopping point
reverse(4); //reverse all the motors to brake the aev
motorSpeed(4,35); //thrust bakwards
goFor(2); //continue braking for two second
brake(4); //cut all the motors

This was the final performance test and it included all tasks assigned.