The objective of this lab was to program function calls for the external sensors (or the reflective sensors) on the AEV to understand how the external sensor hardware functions. The figure below is a pictorial representation of the reflectance sensor and the wheel with reflective tape.
The reflective sensor counts the number of marks on the wheel to determine the position of the AEV and distance traveled. The wheel has 8 marks and a circumference of 3.9 inches, corresponding to 0.4875 inches per mark.
We received two new codes to implement our understanding of the reflectance sensor and the mark count system.
goToRelativePosition(c): The variable c is the number of wheel counts from the current position. If we want the AEV to travel a certain amount of marks from its current position, we would substitute c with however many marks we want the AEV to go.
goToAbsolutePosition(c): The variable c is the number of wheel counts from the starting position. If we want the AEV to travel a certain amount of marks from its starting position, we would substitute c with however many marks we want the AEV to go.
This lab was critical to programming the code for the AEV. It offered an entirely whole new method of programming the AEV. Instead of programming the AEV to go a certain direction for a set amount of time, the AEV can now be programmed by a sensor to record the revolutions of the wheels. By utilizing this information, the AEV’s distance can be calculated and reworked into a code to determine when the AEV will stop at specific points on the track, such as the points prior to the gates. Proper understanding and mastery of the external sensors will lead to a safe, effective AEV to complete the Jurassic Park scenario.