| 84 | |
| 85 | == gradfollower.py == |
| 86 | |
| 87 | This algorithm uses the gradient calculated from three points to attempt to hill climb towards the access point. Again it was not very successful because it has no mechanism to account for noisy data. The second generation of this algorithm, ''bigtri.py'', attempted to account for noise by surveying nine points in groups of three, averaging each group, and using the averages to compute the gradient. This method was much more successful than the original. The final iteration of this algorithm is ''lsbigtri.py'', which takes the averaging a step farther and computes a least-squared-regression plane using all nine points. To introduce the least squared process we began using the packages scipy and numpy. The functions which make use of the scipy libraries are located in ''datafit.py''. |
| 88 | |
| 89 | == v3.py == |
| 90 | |
| 91 | This final and most successful of our algorithms is based on the method of trilateration. It is located (along with all the files it requires) in ~/own/bigarray/ |
| 92 | |
| 93 | We notice that beyond a certain range (~200cm) signal strength varies approximately linearly with distance. At each point the robot surveys, it guesses the distance, d1, between itself and the access point. This indicates that the access point is located along a circle centered at the robot of radius d1. The robot then moves to another point and measures the distance, d2, from itself to the access point. This indicates a second circle on which the access point must lie. The correct location of the access point is now limited to at most two points; it must lie on the intersection of the two circles. A third measurement resolves the unique location of the access point. |
| 94 | |
| 95 | In practice, it never works quite that way. Signal strength is a very noisy measurement. However, after taking many measurements and using a least squares fit, the location of the access point can be guessed quite accurately. The main function of this algorithm is located in ''circles.py''. |
| 96 | |
| 97 | All of the config information this program uses is located in ''datafit.py''. |
| 98 | |
| 99 | Before this algorithm can be used, the relation between signal strength and distance must be known. A script in the home directory, ''coldata.py'' is an easy way to infer this. (This script was one of the earliest we wrote, its original intention was just to write something that moved and calculated the signal strength). Place the robot immediately beneath the access point and do the following: |
| 100 | {{{ |
| 101 | $ python coldata.py |
| 102 | [robot will move forward 8 meters] |
| 103 | $ octave |
| 104 | >> plotcoldata(100) |
| 105 | }}} |
| 106 | |
| 107 | A graph of the data and its best fit line will appear, along with a histogram of the risiduals. You want the residuals to be approximately Gaussian. The parameter of plotcoldata.m is the starting point of the best fit line. Adjust it to achieve the best possible fit, then copy the corresponding values of acal and bcal into ''datafit.py''. |
| 108 | |