Arduino Program Library:
(Clearer Basic Function Calls can be found on page 5 of the Preliminary R&D document:
https://osu.app.box.com/s/ter1ysxfl88vej3wezqleed30cymth1p)
Preliminary R&D Lab 1 Program:
//Run all motors at a constant speed of 25% power for 2 sec.
motorSpeed(4,25);
goFor(2);
//Run all motors at a constant speed of 20% and using the goToAbsolutePosition function travel 12 ft total
motorSpeed(4,20);
//About 12 feet = 70 marks
goToAbsolutePosition(70);
//Reverse motor
reverse(4);
//Run all motors at a constant speed of 30% for 1.5 sec.
motorSpeed(4,30)
goFor(1.5);
//Brake
brake(4);
Preliminary R&D Lab 4 Program:
reverse(4);
// accelerate all motors from 0 to 25% power in 3 seconds
celerate(4,0,25,3);
// have all motors run at 25%
motorSpeed(4,25);
// run the motors for 1 second
goFor(1);
// decrease the motor speed for all motors to run at 20%
motorSpeed(4,20);
// run the motors for 2 seconds
goFor(2);
// brake all motors
brake(4);
// reverse all motors
reverse(4);
// have all motors run at 25% once again
motorSpeed(4,25);
// run the motors for 2 seconds
goFor(2);
brake(4);
Advanced R&D – Coasting vs. Power Braking:
Coasting:
reverse(4);
// accelerate all motors from 0% to 25% power in 3 seconds
celerate(4,0,25,3);
// set all motors to run at 25% power
motorSpeed(4,25);
// have the motors run for 5 seconds
goFor(5);
// brake all motors
brake(4);
Power Breaking:
reverse(4);
// accelerate all motors from 0% to 25% power in 3 seconds
celerate(4,0,25,3);
// set all motors to run at 25% power
motorSpeed(4,25);
// have the motors run for 5 seconds
goFor(5);
// brake all motors
brake(4);
// reverse direction of all motors
reverse(4);
// set all motors to run at 25% power
motorSpeed(4,25);
// have the motors run for 5 seconds
goFor(2);
// brake all motors
brake(4);
Advanced R&D – Propeller Configuration Lab:
// Performance Test 1
// AEV is in large propeller push configuration
// Power all motors at 30%
motorSpeed(4,30);
// Have motors run for 30% until the AEV reaches 225 marks
goToAbsolutePosition(225);
// Brake all motors
brake(4);
// coast AEV for 40 marks relative to 225 marks
motorSpeed(4,0)
goToRelativePosition(40)
// reverse motors to power brake
reverse(4);
// begin power brake
// power motors for 20%
motorSpeed(4,20);
// run the power brake for 1 seconds
goFor(1);
// brake all motors
brake(4);
// reverse all motors
reverse(4);
// have the AEV pause for 7 seconds to allow the gate to open
motorSpeed(4,0);
goFor(7);
// have motors run at 25% for 4 seconds and coast to the loading dock
motorSpeed(4,25);
goFor(4);
brake(4);
Performance Test 2:
// Performance Test 2
// AEV is in large propeller push configuration
// Power all motors at 30%
reverse(4);
motorSpeed(4,30);
// Have motors run for 30% until the AEV reaches 225 marks
goToAbsolutePosition(225);
// Brake all motors
brake(4);
// coast AEV for 40 marks relative to 225 marks
motorSpeed(4,0);
goToRelativePosition(40);
// reverse motors to power brake
reverse(4);
// begin power brake
// power motors for 20%
motorSpeed(4,20);
// run the power brake for 1 seconds
goFor(1);
// brake all motors
brake(4);
// reverse all motors
reverse(4);
// have the AEV pause for 7 seconds to allow the gate to open
motorSpeed(4,0);
goFor(7);
// have motors run at 25% for 4 seconds and coast to the loading dock
motorSpeed(4,28);
goFor(4);
brake(4);
// at this point the AEV will pick up the load
// reverse motors
goFor(10);
reverse(4);
motorSpeed(4,28);
goToRelativePosition(-190);
brake(4);
Final Performance Test:
// Final Performance Test– Lecture room
// AEV is in large propeller push configuration
// Power all motors at 30%
reverse(4);
motorSpeed(4,30);
// Have motors run for 30% until the AEV reaches 225 marks
goToAbsolutePosition(223);
// Brake all motors
brake(4);
// coast AEV for 40 marks relative to 225 marks
motorSpeed(4,0);
goToRelativePosition(40);
// reverse motors to power brake
reverse(4);
// begin power brake
// power motors for 20%
motorSpeed(4,20);
// run the power brake for 1 seconds
goFor(1);
// brake all motors
brake(4);
// reverse all motors
reverse(4);
// have the AEV pause for 7 seconds to allow the gate to open
motorSpeed(4,0);
goFor(7);
// have motors run at 29% for 4 seconds and coast to the loading dock
motorSpeed(4,30);
goFor(4);
brake(4);
goFor(3);
// power brake into the loading dock
reverse(4);
motorSpeed(4,20);
goFor(1);
brake(4);
// at this point the AEV will pick up the load
// have AEV pause in the loading dock
goFor(5);
motorSpeed(4,35);
goToRelativePosition(-206);
brake(4);
// coast
motorSpeed(4,0);
goFor(0.75);
//power brake
reverse(4);
motorSpeed(4,42);
goFor(1.5);
brake(4);
// stop at gate
reverse(4);
motorSpeed(4,0);
goFor(7);
// get out of the gate
motorSpeed(4,50);
goFor(2);
brake(4);
goToRelativePosition(-185);
// power brake returning to the starting gate
reverse(4);
motorSpeed(4,47);
goFor(1);
brake(4);