This lab is an introduction to the AEV. The codes used in the lab are provided as shown in the deliverables below.
Progress Report Questions:
- The propeller begins to rotate at a low speed. It then started to rotate, then stopped and delayed to start up again. Its response throughout the rest of the program seemed to be delayed.
Deliverables:
Arduino Codes for Lab 1:
- acelerate(1,20,45,2);
- Accelerate motor 1 from
20% to 45% power in a time of 2
seconds
- Accelerate motor 1 from
- motorSpeed(2,16);
- Set motor 2 speed to 16%
power
- Set motor 2 speed to 16%
- goFor(5);
- Runs both motors for 5 seconds
- brake(4);
- Brakes all motors
- reverse(1);
- Reverses polarity of motor 1
- motorSpeed(4,20);
goToRelativePosition(30);- Sets all motots to 20%
power, and will continue
to run them at 20% power until the
AEV moves 30 marks from
its current position
- Sets all motots to 20%
- motorSpeed(4,20);
goToAbsolutePosition(300);- All motors are set to 20%
power, and will continue
to run at 20% power until the
AEV moves 300 marks from
its starting position
- All motors are set to 20%
Arduino function calls:
Function Call |
Function |
Example |
celerate(m,p1,p2,t); |
Accelerates or decelerates motor(s) m from start speed (%) p1 to end speed (%) p2 over a duration of t seconds |
celerate(1,20,45,2); Accelerates motor 1 from 20% to 45% power in 2 seconds |
motorSpeed(m,p); |
Initializes motor(s) m at percent power p |
motorSpeed(2,16); Sets motor 2 speed to 16% power |
goFor(t); |
Runs the motor(s) at their initialized state for t seconds |
goFor(5); Runs the motor(s) at their initialized state for 5 seconds |
brake(m); |
Brakes motor(s) m. Note: This does NOT brake the AEV, just stops the motors from spinning |
brake(4); Cuts the power to all motors |
reverse(m); |
Reverses the polarity of motor(s) m |
reverse(1); Reverses polarity of motor 1 |
goToRelativePosition(n); |
Continues the previous command for n marks from the vehicle’s current position. n can be positive or negative, with positive meaning the vehicle is moving forward, negative meaning the vehicle is moving backward |
motorSpeed(4,20); goToRelativePosition(30); All motors are set to 20% power, and they will continue to run at 20% power until the AEV reaches 30 marks from its current position |
goToAbsolutePosition(n); |
Continues the previous command for n marks relative to the overall starting position of the AEV |
motorSpeed(4,20); goToAbsolutePosition(300); All motors are set to 20% power, and they will continue to run at 20% power until the AEV reaches 300 marks from its starting position |
Reference: