jks253
Features
Lab 4 Goal
The Final gauntlet has arrived; this lab will prepare Jerry for the final demonstration. Elements to be updated include:
adding the RF antennae
correcting the code to be non-blocking
directly coding analog reading
finalizing the FFT
installing an override button
implementing the navigation algorithm
implementing PID control
and rigging the base station's display.
Lab notes
Code to control these antennae set the transmitor and receptor frequencies to the 46 and 47 channels, respectively, as per the formula in the handout.
The next step involved replacing parts of the code with non-blocking equivalents, so as to allow every calculation to occur without waiting on the block-involved delays.
Given the possibility of the starting frequency not going off when played, a start-override button was implemented, which, when pressed, will perform the same function as though the start frequency was in fact heard.
The Navigational Algorithm
Our navigational algorithm, initally designed to utilize the principle of depth-first-search (DFS), had to be changed dramatically. The servo-motors, being unreiable and inconsistent in their rotaional speed, could not guarantee that Jerry would move at regular intervals, a requirement for the calculations and system required to utilize DFS.
Instead, we devised a clever work around:
Given the information that the maze would NOT be navigable via a simple wall following algorithm, we devised a complex algorithm instead.
Upon startup, Jerry would navigate the maze by 'hugging' the right wall, turning at intersections to the right when available, adjusting the PID to slightly prefer the right wall, etc.
Given the complexity of the maze, however, this would not guarantee a full exploration. So, after a set period of time, Jerry would swap to following the left wall.
And then swap again.
Then again.
And so forth.
This method, charmingly dubbed by the esteemed Benjamin Kogan as the Pinball Method, would, ideally guarantee that over time the robot would navigate the entire maze.
A possible exception to this postulate would be a maze which contains a loop that takes some multiple of 5 (in minutes) to naviagte. However, due to the inconsistency of the motors, the very problem necessitating the Pinball Method, we are still guaranteed an eventual escape from such a loop.
Other small navigation details, particularly regarding the ability to 'unstuck' Jerry from any of the walls (as we observed during various testing cases) were also added. These included:
backing up when too close to a wall in the front of Jerry
reverse-parallel-parking when lodged up right against a wall
moving forward just a little bit after an intersection is detected to avoid the rear-end of Jerry getting stuck against any of the walls of the intersection
and, hardware-wise, installing a sizable weight to the back of Jerry's frame to ensure a steady state of traction between the servo-wheels and the ground.
Pictured here is the rear viw of Jerry, clearly showing the attached weight.

PID
The onboard PID calculator ensured that Jerry travelled as close to the center of the corridors of the maze as possible.
This proved particularly difficult given the very frequent spikes in measurements given by the ultrasonic sensors pointing at the side walls, but by taking the median of the previous five recorded values, a more effective result was strongly observed.
The PID, given the servo-motors' inability to operate as expected, was especially encessary for Jerry to navigate, and, in addition to other details controlling Jerry's navigation of the maze, proved for a much smoother operation.
Frequency
Upon detecting a light of given frequency, f, Jerry will anaylze said frequency to determine its most likely value. It will proceed to send this signal over the RF channel.
Accordingly, the base station, upon receiving this signal, will send it to be displayed on the 7-segment 3-digit display.
After Jerry has detected two separate frequency treasures (which must be seperated across a gap of at least five seconds, as to ensure no repeat detection) the navigation code will terminate, the motors will stop and a blinking LED will flash to indicate completion.


Final Demonstration

As pictured is the maze which Jerry was tasked to travel through for the final demonstration. Note that the starting point as at the mark of 'J.'
The Treasures were located at the left walls of (2,3) and (4,0) (the 0,0 coord being at the top left corner of the diagram).
TO see the results of the demonstration, see the video below!
The organizational structure of Jerry's breadboard.

Pictured below is the end state of the maze. Needless to say, there is much room for improvement, though it should be noted that the servo-motors did glitch out considerably over the course of the maze, and began to act independently of any input from Jerry.

Photo Gallery





