Code Glossary
Function Call Function
celerate(m,p1,p2,t); Accelerates (m) motors from % (p1)
speed to % (p2) speed over (t) seconds.
motorSpeed(m,p); Initializes (m) motors at % (p) power.
goFor(t); Runs initialized motors for (t) seconds.
brake(m); Stops (m) motors from spinning.
reverse(m); Reverses the direction of (m) motors.
goToRelativePosition(n); Continues the previous command for (n)
marks from the AEV’s current position.
goToAbsolutePosition(n); Continues the previous command for (n)
marks relative to the AEV’s initial position.
Codes
Code Used for Scenario 1:
%% Accelerate motor one from start to 15% power in 2.5 seconds. celerate(1,0,15,2.5); %% Run motor one at a constant speed (15% power) for 1 second. motorSpeed(1,15); goFor(1); %% Brake motor one. brake(1); %%Accelerate motor two from start to 27% power in 4 seconds.
celerate(2,0,27,4); %% Run motor two at a constant speed (27% power) for 2.7 seconds. motorSpeed(2,27); goFor(2.7); %% Decelerate motor two to 15% power in 1 second. celerate(2,27,15,1); %% Brake motor two. brake(2); %% Reverse the direction of only motor 2. reverse(2); %% Accelerate all motors from start to 31% power in 2 seconds. celerate(4,0,31,2); %% Run all motors at a constant speed of 35% power for 1 second. motorSpeed(4,35); goFor(1); %% Brake motor two but keep motor one running at a constant speed (35% power) for 3 seconds.
brake(2); motorSpeed(1,35); goFor(3); %% Brake all motors for 1 second. brake(4); motorSpeed(4,0); goFor(1); %% Reverse the direction of motor one. reverse(1); %% Accelerate motor one from start to 19% power over 2 seconds.
celerate(1,0,19,2); %% Run motor two at 35% power while simultaneously running motor one at 19% power for 2 seconds.
motorspeed(2,35); motorspeed(1,19); 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);
Code Used for Exercise 2:
%% Run all motors at a constant speed of 25% power for 2 seconds. motorSpeed(4,25); goFor(2); %%Run all motors at a constant speed of 20% and using the goToAbsolutePosition function travel a total distance of 12 feet motorSpeed(4,20); goToAbsolutePosition(295.38); %% Reverse motors. reverse(4); %% Run all motors at a constant speed of 30% power for 1.5 second. motorSpeed(4,30); goFor(1.5); %% Brake all motors. brake(4);
Code Used with Energy vs. Time and Energy vs. Distance plots:
%% Accelerate all motors from start to 25% in 3 seconds. celerate(4,0,25,3); %% Run all motors at a constant speed (25% power) for 1 second. motorSpeed(4,25); goFor(1); %% Run all motors at 20% power for 2 seconds. motorSpeed(4,20); goFor(2); %% Reverse all motors. reverse(4); %% Run all motors at a constant speed (25% power) for 2 second. motorSpeed(4,25); goFor(2); %% Brake all motors. brake(4);
aR&D Day 2 Test code Mk. 1. This scenario tested the basic idea of moving forward, pausing half way, continuing to the end, pausing, reversing the motors, pausing again at the mid point, and returning to the initial position.
%% Sets working motor speeds to 50% power motorSpeed(4,25); %% Propels AEV to gate and brakes goToAbsolutePosition(190); aevServo.write(45); %% Pauses at gate for 8 seconds motorSpeed(4,0); goFor(8); %% Resets the motor speed and disengages the brake motorSpeed(4,25); aevServo.write(90); %% Propels AEV to the caboose zone and brakes goToAbsolutePosition(380); aevServo.write(45); %% Pauses for 6 seconds motorSpeed(4,0); goFor(6); %% Reverses and resets motor speed and disengages brake reverse(4); motorSpeed(4,25); aevServo.write(90); %% Propels AEV back to gate and brakes goToAbsolutePosition(190); aevServo.write(45); %% Pauses for 8 seconds motorSpeed(4,0); goFor(8); %% Resets the motor speed and disengages the brake motorSpeed(4,25); aevServo.write(90); %% Propels AEV back to the start/end zone and brakes goToAbsolutePosition(0); aevServo.write(45);
aR&D Day 2 Test code Mk. 2. (Code used in figures). This tested the servo’s braking abilities at a longer distance and higher speed while continuing the basic path that the Mk 1 code tested.
%% Sets working motor speeds to 50% power motorSpeed(4,50); %% Propels AEV to gate and brakes goToAbsolutePosition(190); aevServo.write(45); %% Pauses at gate for 8 seconds motorSpeed(4,0); goFor(8); %% Resets the motor speed and disengages the brake motorSpeed(4,50); aevServo.write(90); %% Propels AEV to the caboose zone and brakes goToAbsolutePosition(380); aevServo.write(45); %% Pauses for 6 seconds motorSpeed(4,0); goFor(6); %% Reverses and resets motor speed and disengages brake reverse(4); motorSpeed(4,50); aevServo.write(90); %% Propels AEV back to gate and brakes goToAbsolutePosition(190); aevServo.write(45); %% Pauses for 8 seconds motorSpeed(4,0); goFor(8); %% Resets the motor speed and disengages the brake motorSpeed(4,50); aevServo.write(90); %% Propels AEV back to the start/end zone and brakes goToAbsolutePosition(0); aevServo.write(45);
PT2 Faster Code (2)
%% Reverses motor two. reverse(2); %% Runs both motors at 60% power. motorSpeed(4,60); %% Opens brake to 90° aevServo.write(90); %% Runs motors for distance of 194 marks. goToRelativePosition(-194); %% Closes brake onto wheel to 45°. aevServo.write(45); %% Stops both motors. motorSpeed(4,0); %% Pauses for 11 seconds at gate. goFor(11); %% Opens brake. aevServo.write(90); %% Runs both motors at 60% power. motorSpeed(4,60); %% Runs motors for distance of 145 marks. goToRelativePosition(-145); %% Closes brake onto wheel. aevServo.write(45); %% Reverses both motors. reverse(4); %% Stops both motors for 8.5 seconds. motorSpeed(4,0); goFor(8.5); %% Runs both motors at 80% power. motorSpeed(4,80); %% Opens brake. aevServo.write(90); %% Runs motors for distance of 100 marks. goToRelativePosition(100); %% Closes brake onto wheel. aevServo.write(45);
Final run code
%% Reverses motor two. reverse(2); %% Runs both motors at 35% power. motorSpeed(4,35); %% Opens brake to 45°. aevServo.write(45); %% Runs motors for distance of 261 marks. goToRelativePosition(-261); %% Closes brake onto track to 172°. aevServo.write(172); %% Stops both motors. motorSpeed(4,0); %% Pauses for 8 seconds at gate. goFor(8); %% Opens brake. aevServo.write(45); %% Runs both motors at 25% power. motorSpeed(4,25); %% Runs motors for distance of 130 marks. goToRelativePosition(-130); %% Stops both motors. motorSpeed(4,0); %% Coasts for distance of 189 marks. goToRelativePosition(-189); %% Closes brake onto track. aevServo.write(172); %% Reverses both motors. reverse(4); %% Keeps both motors at 0% power for 6.5 seconds. motorSpeed(4,0); goFor(6.5); %% Runes both motors at 62% power. motorSpeed(4,62); %% Opens brake. aevServo.write(45); %% Runs motors for distance of 215 marks. goToRelativePosition(215); %% Closes brake onto track. aevServo.write(172); %% Stops both motors for 8.5 seconds. motorSpeed(4,0); goFor(8.5); %% Opens brake. aevServo.write(45); %% Runs both motors at 50% power. motorSpeed(4,50); %% Runs motors for distance of 140 marks. goToRelativePosition(140); %% Stops both motors. motorSpeed(4,0); %% Reverses both motors to power break. reverse(4); %% Coasts for distance of 130 marks. goToRelativePosition(130); %% Runs both motors at 50% power. motorSpeed(4,50); %% Runs both motors for distance of 55 marks. goToRelativePosition(55); %% Stops both motors. motorSpeed(4,0); %% Closes brake onto track. aevServo.write(172);
Reflectance Sensors
The purpose of the reflectance sensors is to measure the number of rotations that the wheel next to them (behind the white hexagonal bolt in the picture) makes as the AEV moves along the track. Eight marks are detected (about 3.9 inches) by the reflectance sensors per one wheel revolution. This data is recorded by the Arduino.
Individual and Team Concept Sketches
Above is the right view of Matthew’s AEV concept design. The top and front views are omitted and are nearly redundant to include because they are essentially flat. This design has the AEV structural components completely vertical with other parts such as the Arduino, motors, and battery attached to the sides. This idea may be successful because it is cost effective (minimal components) and potentially more aerodynamic due to its narrow profile.
This is the orthographic sketch of Michael McCormick’s concept AEV design. The wheels are placed vertically above the AEV base. On the base of the AEV, the Arduino, battery, and motors are placed at the base. The motors will spin in one way to propel the AEV forward and in the reverse direction to slow the AEV. Since the motors will work in unison, the cost to move the AEV will not be overly expensive, a major priority. As well, the design is somewhat aerodynamic, which will further reduce cost.
The above sketch displays the orthographic views of Kunal Gakhar’s concept AEV design. The Arduino and the battery are placed in the center of the base, the motors are placed at the back which balances the weight in the front and the back of the AEV. The wheels are located vertically above the base. The design uses fewer components which reduces the cost.
The picture above is team member Jake Metzer’s preliminary test design for the AEV. It is a vertical build type which features two motors which will work in opposite angular directions in order to propel the AEV along the track. The Arduino and battery sit on opposite sides to balance the vehicle. The design of this prototype was meant to be as efficient as possible; both aerodynamically and economically. Minimal parts were used so that the design would be simple, less problematic, more aerodynamic, lighter, and cheaper.
The team intends to use Kunal’s AEV design going forward as it was deemed the most cost effective, aerodynamic, and dynamically efficient design. Matthew’s design will be used as a backup if the data shows that it outperforms Kunal’s design.
Data Analysis Tool Plots
Power vs. Time Graph for Scenario 4:
Power vs. Distance Graph for Scenario 4:
In the first section of each plot, the AEV is accelerating to 25% power over 3 seconds, which is why there is a large amount of power going into the AEV at that time. Since the AEV is starting from a stopped position a lot of power is being used to get the AEV moving. When the graphs are flat, the AEV motors are running at a constant power, explaining the increase in distance and time while power is unchanged. When the power spikes on both graphs, the motors are reversing, requiring a large amount of power in a short deal of time. The graphs are flat again when the motors are run at a constant power but the distance does not increase much because the speed of the AEV is decreasing when the motors run in reverse. Power becomes zero and distance no longer changes when the AEV is braked at the end if the run.
Concept Screening and Scoring
Concept Screening Matrix:
Success Criteria | Reference | Design A | Design B | Design C | Design D |
Material Usage | 0 | + | – | – | + |
Balance | 0 | 0 | + | + | – |
Durability | 0 | 0 | 0 | 0 | 0 |
Maintenance | 0 | + | – | – | + |
Safety | 0 | + | + | + | + |
Sum +’s | 0 | 3 | 2 | 2 | 3 |
Sum 0’s | 5 | 2 | 1 | 1 | 1 |
Sum -‘s | 0 | 0 | 2 | 2 | 1 |
Net Score | 0 | 3 | 0 | 0 | 2 |
Concept Scoring Matrix:
Reference | Design A | Design B | Design C | Design D | |||||||
Success Criteria | Weight | Rating | Score | Rating | Score | Rating | Score | Rating | Score | Rating | Score |
Material Usage | 20% | 3 | 0.6 | 5 | 1 | 2 | 0.4 | 2 | 0.4 | 4 | 0.8 |
Balance | 20% | 2 | 0.4 | 3 | 0.6 | 4 | 0.8 | 4 | 0.8 | 2 | 0.4 |
Durability | 20% | 3 | 0.6 | 3 | 0.6 | 2 | 0.4 | 3 | 0.6 | 3 | 0.6 |
Maintenance | 15% | 3 | 0.45 | 4 | 0.6 | 2 | 0.3 | 2 | 0.3 | 4 | 0.6 |
Safety | 25% | 3 | 0.75 | 3 | 0.75 | 3 | 0.75 | 3 | 0.75 | 4 | 1 |
Total Score | 2.8 | 3.55 | 2.65 | 2.85 | 3.4 | ||||||
Continue? | No | Yes | No | No | Yes |
During the concept screening and scoring section of the lab, it was noted that the AEV design the team chose was well balanced, however it did not move while initially accelerating. This is because it takes a large amount of power to get the AEV moving from rest. As seen in the concept screening matrix, the AEVs were tested in five categories. The spreadsheets above represent how well each design performs in different criteria categories. Material usage was defined as a category because minimal materials make the design lighter and less expensive. AEV balance is important because a balanced AEV will move more efficiently and stay on the track. Durability is a criteria because if the AEV breaks, it will be far more expensive to remake. Maintenance makes the AEV easier to build and maintain, which makes the design more time efficient. Finally, safety is important because the AEV cannot be used if it is not safe to the public. After running this lab, the team decided to move forward with designs A and D, which were Kunal and Matt’s designs.
aR&D Findings and Conclusions
The first round of advanced research and development was aimed at finding a better way to halt the AEV’s movement than coasting to a stop or reversing the propellers. The servo motor in the AEV kit, capable of rotating a plastic arm 180° was the focus of this research. The servo motor was attached with hot glue to the frame of the AEV next to the front wheel in a position that would allow its arm to rotate into the wheel. The initial design included a rubber ball to be attached onto the servo arm that would stop the wheel from turning. The brake design was a complete success, halting the AEV’s movement in a much shorter distance than other methods while using minimal power (see graphs of power vs time above and note the sharp valleys in the curve).
Due to the limitation of materials available, the second round of aR&D testing had to do with the material attached to the servo arm. The three materials were nothing (just the plastic servo arm by itself), a ball of paper, and an eraser. The eraser was closest to the intended rubber ball and performed better than the other two materials. The AEV slid when all three brake materials were tested at high speeds, but the AEV with the eraser brake slid noticeably less than when the other two materials were used. When traveling at lower speeds, the eraser also showed to be the optimal brake.
Overall, the AEV is more marketable as a result of this research because it will outperform others when it comes to stopping quickly and efficiently.
Performance Tests Findings and Results
After completing the preliminary and advanced research and development labs, Performance Test 1 was conducted. This test was conducted with designs A and D running the same control programs on the test track. The results from this test are provided above, which is a Power with Respect to Time Graph for Performance Test 1,where design D is represented by the red line and design A is represented by the blue line. Both of these Figures display that design D was more efficient with power usage for the same control program. This was not expected, since design A tested better in the concept screening and scoring labs and had better balance distribution. When Performance Test 1 was run initially, it was expected that design A would outperform design D due to the design balance and motor configuration. Since design D outperformed design A in Performance Test 1, the team has decided to select design D as the final AEV design.
Performance Test 2 was conducted after Performance Test 1. This test was conducted to determine the most efficient code for the Final Performance Test. The results from this test are provided the figure above, which is a Power with Respect to Time Graph for Performance Test 2,where the code used for Performance Test 1 is denoted in orange and adapted code for performance test two is denoted in blue. These figures display that the adapted code uses less energy, since the area beneath the lines for this code is less than that of the original test code. This was expected, as the power bursts were expected to take up a great deal of energy, but since the motors run for such a short period of time, the energy usage is low.
Since this code uses less energy, about 90 less joules for the entire run, the team’s theory was correct. Therefore, the group decided to move forward with this type of code for the final performance test.
The objective of Performance Test 3 was to complete the full scenario as stated in the MCR using the most energy efficient, consistent vehicle. To achieve this, the servo brake was moved from braking on the AEV wheel to braking on the track. The idea behind this change was to increase the consistency of the brake due to the minor slides of the wheel on the track when braked. This change can be seen in the figure below. Error occurred at times however, when the brake would clasp the AEV too hard onto the track, causing the AEV to derail. This was simply fixed by trial and error with the angle of the brake on the track. Despite the changes that had to be made to the code, such as adding distance or motor power since the wheels no longer slid, this change eventually worked consistently and braked promptly.
The Final Performance Test was completed after Performance Test 3, using the completed design. The Power with respect to Time graph for this test can be seen in the figure below. This test was completed in 48 seconds, using 239.38 J. The overall cost for this run was $601,850, which was far greater than expected. This data shows that our AEV was not as cost efficient as previously believed. This error arose from the unexpected extra cost of motor braking at the end of the run, causing extra energy consumption. This is also due to the $25,000 the team had to pay in order to run the AEV extra times, which was unexpected.