Preliminary R&D 1: Programming Basics

Deliverables:

Glossary: This is a glossary of  function calls used to program the AEV to help those who are unfamiliar with programming.

celerate(m,p1,p2,t);  has motor(s)  m go from starting power p1 to final power p2 in t seconds

motorSpeed(m,p); runs motor(s) m at power p

goFor(t); runs motors at set condition for t seconds

brake(m); shuts of power to motor(s) m

reverse(m); reverses direction of motor(s) m

goToRelativePosition(n); moves the AEV to distance n from position at start of the command

goToAbsolutePosition(n); moves the AEV to distance n from starting position

Key:
m – motors: 1 is first motor, is second motor, and 4 is all motors
p –  percent power: p1 is initial power, p2 is final power
– time in second
n – number of marks (1 mark = 0.4875 inches)
Code:

celerate(1,0,15,2.5);   // accelerate motor 1 from 0 to 12 in 2.5 seconds

motorspeed(1,15); goFor(1);    // run motor one at 15 for 1 second

brake(1);   // brake motor 1

celerate(2,0,27,4);   // accelerate motor 2 from 0 to 27 in 4 seconds

motorspeed(2,15); goFor(1);   // run motor 2 at 15 for 1 second

brake(2); // brake motor 2

reverse(2);   // reverse motor 2

celerate(4,0,31,2);   // accelerate all motors from 0 to 31 in 2 seconds

motorspeed(4,35); goFor(1);   // run all motors at 35 for 1 second

brake(2);   // brake motor 2

motorspeed(1,35); goFor(3); // run motor 1 at 35 for 3 seconds

brake(4); goFor(1);   // brake all motors for 1 second

reverse(1);   // reverse motor 1

celerate(1.0,19,2);   // accelerate motor 1

motorspeed(2,35);

motorspeed(1,19); goFor(2);   // run motor 1 at 19 and motor 2 at 35 for 2 seconds

motorspeed(4,19); goFor(2);   // run all motors at 19 for 2 seconds

celerate(4,19,0,3);   // decelerate all motors from 19 to 0 in 3 seconds

brake(4);   // brake all motors