AEV Project Codes

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:

//Accelerate motor one from stat to 15% power in 2.5 seconds
celerate(1,0,15,2.5);
//Run motor for 15% power for 1 second
goFor(1);
//Brake motor 1
brake(1);
//Run motor 2 from start to 27% in 4 seconds
celerate(2,0,27,4);
//Run motor 2 for 2.7 seconds
goFor(2.7);
//Decelerate motor to to 15% in 1 second
celerate(2,27,15,1);
//Break motor 2
brake(2);
//reverse motor 2
reverse(2);
//accelerate all motors to 31% in 2 seconds
celerate(4,0,31,2);
//run all motors at 35% for 1 second
motorSpeed(4,35);
goFor(1);
//break motor 2 and continue to run motor 1
brake(2);
goFor(3);
//Brake all motors
brake(4);
goFor(1);
//reverse motor 1
reverse(1);
//accelerate motor 1 to 19% in 2 seconds
celerate(1,0,19,2);
//run motor 2 at 35% while running motor 1 at 19%
motorSpeed(2,35);
goFor(2);
//Run both motors at a constant speed (19% power) for 2 seconds.
motorSpeed(4,19);
goFor(2);
// Decelerate both motors to 0% power in 3 seconds.
celerate(4,19,0,3);
// brake all motors
brake(4);

 

Preliminary R&D Lab 2 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:

reverse(4);
//accelerate all motors for 0% to 25% power in 1 second
celerate(4,0,25,1);
//keep motor speed at a constant 25% power for 3 seconds
motorSpeed(4,25);
goFor(3);
//brake and coast to a stop
brake(4);

 

Performance Test 1:

// 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);