Evolution of AEV Code

See Intro. to Arduino to see basic coding functions.

Changes From Previous code are in bold.

Rough Draft (2-22-18)

Start at Loading Dock
motorSpeed(4,50); set motors to 50% power, this will be standard speed
goAbsolutePosition(147.69);  start of incline
motorSpeed(4,60);  increase power % to compensate for incline
goAbsolutePosition(246.15); end of incline
motorSpeed(4,50);   resume standard speed
goAbsolutePosition(344);   enter gate

Gate
rotateServo(90); rotate servo as manual break system
brake(4); cut all power to motors
goFor(3); sit in gate for 3 seconds for gate to open
rotateServo(0); release manual break

Toward Loading Dock
motorSpeed(4,50); resume standard speed toward loading dock
goRelativePosition(344); go until loading dock
Enter Loading Dock
rotateServo(90); engage brake
brake(4); cut power to motors
goFor(3); sit in loading dock for 3 seconds
reverse(4); reverse motor direction
rotateServo(0); release brake

Return to Gate
motorSpeed(4,50); resume standard speed in reverse
goAbsolutePosition(540.31); go until beginning of incline
motorspeed(4,55); increase speed to compensate incline, not as much as first incline
goAbsolutePosition(441.85); top of incline
motorSpeed(4,50); resume standard speed
goAbsolutePosition(344); continue until gate

Gate
rotateServo(90); engage brake
brake(4); cut power to all motors
goFor(3); sit in gate for 3 seconds
rotateServo(0); release brake

Return to Starting Loading Dock
motorSpeed(4,50); resume standard speed
goAbsolutePosition(0); return to original loading dock
rotateServo(90); engage brake
brake(4); cut power to all motors

Performance Test 1 (Reverse Function Braking)

//Starting Dock 
motorSpeed(4,40); //set all motors to 40% power
goToAbsolutePosition(206); //travel 206 marks to gate
brake(4); //cut power to all motors

//Gate 
reverse(4); //reverse all motors
motorSpeed(4,60); //set all motors to 60% power to brake at gate
goFor(1.1); //run previous function for 1.1 seconds
brake(4); //cut power to all motors
goFor(7); //wait in gate for 7 seconds

//Toward Loading Dock
reverse(4); //reverse motors in order to travel forward out of gate
motorSpeed(4,40); //set all motors to 40% power
goFor(2); //run previous task for 2 seconds
brake(4); //cut power to all motors
reverse(4); //reverse all motors to brake
motorSpeed(4,60); //set all motors to 60% power to brake
goFor(1.1); //run previous task for 1.1 seconds
brake(4); //cut power to all motors

Performance Test 1 (Servo Braking)

//Starting Dock
motorSpeed(4,40); //set motors to 40% power 
goToAbsolutePosition(195); //enter gate

//Gate
rotateServo(99);// rotate servo as manual brake system
brake(4); //cut all power to motors
goFor(8); //sit in gate for 7 seconds for gate to open, 1 sec allows for braking time
rotateServo(5); //release manual brake

//Toward Loading Dock
motorSpeed(4,35); //resume slightly slower speed toward loading dock due to decline
goToAbsolutePosition(484); //runs motors until defined distance
brake(4); //cuts power to engines, starts coast down incline

Performance Test 2

//Starting Dock
motorSpeed(4,40); //set motors to 40% power 
goToAbsolutePosition(195); //enter gate

//Gate
rotateServo(99);// rotate servo as manual brake system
brake(4); //cut all power to motors
goFor(8); //sit in gate for 7 seconds for gate to open, 1 sec allows for braking time
rotateServo(5); //release manual brake

//Toward Loading Dock
motorSpeed(4,35); //resume slightly slower speed toward loading dock due to decline
goToAbsolutePosition(484); //runs motors until defined distance
brake(4); //cuts power to engines, starts coast down incline
goToAbsolutePosition(546); //coast until gate

//Enter Loading Dock
rotateServo(99); //engage brake
goFor(7); //sit in loading dock for 7 seconds, allowing time for braking
rotateServo(5); //release brake
reverse(4); //reverse motor direction

//Depart Loading Dock with Load
motorSpeed(4,65); //resume increased speed in reverse to account for weight of load
goToAbsolutePosition(300); //continue until gate

Final Performance Test

//Starting Dock
motorSpeed(4,40); //set motors to 40% power 
goToAbsolutePosition(195); //enter gate

//Gate
rotateServo(99);// rotate servo as manual brake system
brake(4); //cut all power to motors
goFor(8); //sit in gate for 7 seconds for gate to open, 1 sec allows for braking time
rotateServo(5); //release manual brake

//Toward Loading Dock
motorSpeed(4,35); //resume slightly slower speed toward loading dock due to decline
goToAbsolutePosition(484); //runs motors until defined distance
brake(4); //cuts power to engines, starts coast down incline
goToAbsolutePosition(546); //coast until gate

//Enter Loading Dock
rotateServo(99); //engage brake
goFor(7); //sit in loading dock for 7 seconds, allowing time for braking
rotateServo(5); //release brake
reverse(4); //reverse motor direction

//Depart Loading Dock with Load
motorSpeed(4,65); //resume increased speed in reverse to account for weight of load

//Enter Gate
goToAbsolutePosition(491); //continue last command until determined distance
brake(4); //Cut power to motors begin coast into gate
goToAbsolutePosition(469); //Continue coast until determined distance
rotateServo(90); //Engage servo brake
goFor(9.5); //Sit in gate for 7 sec
rotateServo(5); //release brake

//Depart Gate for Starting Dock
motorSpeed(4,55); //Resume slightly slower speed due to weight of load
goToAbsolutePosition(260); //Continue until 260 marks out from gate

//Enter Starting Dock
brake(4); //Cut power to motors
rotateServo(90); //Engage servo brake
brake(4); //Cut all power