Development of a Prototype Lego NXT Location Tracking Robot by Jordan Zink Gahanna Lincoln High School 140 S Hamilton Road Gahanna, Ohio 43230 jordanzink@gmail.com (614) 307-3669 Prepared for Columbus Technical Council March 23, 2011 2 Development of a Prototype Lego NXT Location Tracking Robot Jordan Zink Gahanna Lincoln High School, 140 S Hamilton Road, Gahanna, Ohio 43230 The purpose of this project was to develop a system not based on optics or signals that allow a robot to track its change in location as it drives from one place to another. Such a system would be ideal for certain applications of robotics such as space exploration. The system developed involved using a rotation sensor and a compass sensor to keep track of changes in location. A Lego NXT robot was constructed to test this system. Initial testing found that the Lego HiTechnic Compass Sensor suffered from interference caused by magnetic noise produced by wires in the floors of the lab where the robot was tested. This interference rendered the system unusable, requiring the development of a countermeasure method. Three methods were tested: wrapping the sensor in aluminum foil, wrapping the sensor in copper foil, and covering the sensor with a copper pipe. Each method served as a makeshift Faraday cage meant to smooth out noise. However, extensive testing found that none of these methods effectively reduced noise to acceptable levels; however, it was shown that location had an effect on noise level. A program was developed to keep track of location and was tested in an environment with low magnetic noise. When tested, it was found that when driven approximately one to two meters out and back, the robot missed its mark by 0.17 meters on average (n=10). This error is considered too high for practical use. It can be concluded that the system developed is highly problematic and not practical. This conclusion applies only to the use of the HiTechnic Lego Compass Sensor and not to the concept in general. 3 Table of Contents I. Introduction…………………………………………………………………………….……….4 II. Review of Literature………………………………………………………………...…...…….5 III. Methods………………………………………………………………………………...…….6 IV. Results & Analysis…………………………………………………………………….…….11 V. Conclusion………………………………………………………………………………...….14 VI. Acknowledgments………………………………………………………………………..….15 VII. Works Cited……………………………………………………………………...………….16 VIII. Appendix………………………………………………………………………………...…17 4 Introduction As the world of robotics progresses, more and more applications are conceived for the use of robotics. Many of these robots will serve mobile uses, such as robots that move around from place to place. These robots must be able to keep track of their location to effectively function. Multiple methods for keeping track of location exist, such as optical and signal based methods. Optical methods function much the same way as in biological organisms. The “eye” (or in this case a sensor) takes in visual data and uses reference points and lines to keep track of its location. However, optical based systems are highly complex, expensive, and hard to implement, and in environments with few significant features, such as in a desert or on the surface or a planet or moon, optical system could have problems keeping track of overall locations. Signal based systems work by using the time it takes for a signal to travel from a transmitter to a receiver to calculate location. Signal based systems are limited by the need for transmitters. On Earth, this can be accomplished by radio towers or satellites (like the GPS system) to limited accuracy, but on other planets or moons, signal based systems may not be practical because it would require satellites to be taken to a planet as well as an exploring robot. The purpose of this project is to create a system capable of keeping track of location and design a prototype robot to provide a proof of concept test. The ideal system would be relatively simple, inexpensive, and be able to function independently without the need for other tools (like satellites). Such a system, if effective, would be a system best suited for space exploration and other robotic tasks not suited for signal or optical based location tracking systems. 5 Review of Literature Earth’s Magnetic Field and Compasses A compass is a tool used to measure direction. A compass, in its simplest form, is a magnet suspended in a liquid or on a frictionless bearing that is allowed to freely rotate. When allowed to freely rotate, the compass points towards the strongest magnetic field nearby, which in the case of most compasses is the Earth (“Compass”, 2011). The Earth acts as a giant bar magnet, creating a large magnetic field. This field is most likely generated by the rotation of the iron core. Compasses align with this magnetic field, causing them to point north (Brian, 2000). One problem that can occur with a compass is magnetic deviation. Magnetic deviation is when the compass needle points in a direction different that the Earth’s magnetic field due to local magnetic fields. This problem was first encountered on ships with iron whose hulls became partially magnetized by the Earth’s magnetic field. Such deviations are usually accounted for by placing a permanent magnet near the compass to cancel out any deviations (D., 2009). HiTechnic Compass Sensor The HiTechnic company produces a compass sensor. The sensor is housed in a standard NXT sensor housing to allow for easy instillation on a robot. The sensor digitally measures the Earth’s magnetic field and outputs the reading on a scale of 0 degrees to 359 degrees. The sensor is accurate up to 1 degree and refreshes 100 times per second. The sensor is compatable with the RobotC programming language (“NXT Compass Sensor”, 2011). Faraday Cage A Faraday cage is a device named after Michael Faraday (and believed to have been invented by him as well). Michael Faraday was a 19th century scientist who discovered many key breakthroughs in the field of electricity, including the close connection between electricity and magnetism (“Michael Faraday (1791-1867)”, 2011). A faraday’s cage is an enclosed space 6 covered with a conductive material that prevents charges from entering. This cage also prevents charges and field from exiting the area (Rubin, 2011). An important thing to note is that a Faraday cage will not stop a static or low varying magnetic field, meaning a compass will still work inside a Faraday cage and point towards the Earth’s magnetic field (“Faraday Cage”, 2011). Methods Development of the Prototype (Initial concept to Mark HK) The initial idea that was to be tested was using the rotation sensors that are built into the Lego NXT motors to keep track of tire rotation and, through math, the ultimate location of the robot. In following this idea, a robot required development that would allow such programming to be implemented. The first concept devised was very simple. 4 wheels placed in a rigid rectangular pattern with one motor powering both tires on one side and another motor powering the other side. While ultimately the simplest, the concept presented problems. Due to the rigidity of the wheels (in another words the fat that they could not rotate perpendicular to the ground) turning would be inaccurate. Turning could be achieved by running one motor forwards and one motor backwards (or any other combination of varying power levels), but in doing so the tires would slip on the ground and the robot would have the potential to move in unpredictable ways, making accounting for such location changes to be considered hard to impossible. Because of this key flaw, this first concept was scrapped. The second concept was the first concept to be constructed out of Legos and was dubbed the Mark BBT. This concept was designed to eliminate the weaknesses of the previous system as well as account for other factors that were intended to be avoided, such as having a swivel wheel (swivel wheels can cause unforeseen changes in direction; this problem was encountered on 7 other Lego robotics projects constructed by the author). The Mark BBT contained a unique tripod system with three “points of contact” that formed a half circle. Two of the points of contact, which formed a diameter of the circle, were simply free rotating wheels with no motors or sensors attached to them. The third point of contact was located radially perpendicular to the diameter formed by the other two wheels and contained the drive system. The drive system consisted of two wheels, each powered by their own motor, placed closely together and attached to a turntable that allowed the entire drive system to rotate freely relative to the rest of the robot around the point halfway between the two wheels. When the drive system is pointed forwards, both motors can be activated in the forward direction, causing the robot to move forward. To steer, the motors could be activated with different power levels to turn the steering system while the rest of the robot remained in the same orientation. Then, both motors could be activated, allowing the robot to turn. A key aspect of this design was the placement of the drive system relative to the other two points of contact. Because the drive system forms a perfect half circle with the other two wheels, if the drive system is rotated ninety degrees relative to the robot, it can perform a zero-point turn, or a turn on the spot. This allows for turns to be made without the location changing, which would make programming much easier. After the Mark BBT was developed, preliminary tests were run to prove its effectiveness. During these tests, the system was proven to work as design in general, but only with constant oversight and care from an operator in controlled situations. This lack of effectiveness ultimately resulted in the conclusion that any programming system would not be able to keep track of location effectively. In order to counter this, two additions were made to the Mark BBT. The first was a wheel located in the center of the circle formed by the three points of contact. This wheel was itself attached to a free-spinning rotation sensor (the rotation sensor used was designed for the Lego RCX system, but is also combatable with the NXT). Using this rotation sensor, the 8 robot could keep track of any movements the robot had, and since it was located in the center of the circle, it would be unaffected by any zero-point rotations. The second addition was the addition of a compass sensor to the robot. The compass sensor was a HiTechnic brand compass sensor capable of reading the heading of the robot from zero to three-hundred and fifty-nine degrees. With the rotation and the compass sensor added, the two pieces of information necessary for determining location, direction of travel and distance traveled, could now accurately be collected easily. Because of these sensors, a more complex system of mathematically determining location based on rotation of the motors could be avoided. Also, after these sensors were installed, there was no more need for the overly complex drive system of the Mark BBT. To remove this complexity, the Mark BBT was overhauled into the Mark HK. The front two wheels and added sensors were preserved from the Mark BBT, but the two wheels were directly connected to motors, giving them the power to drive the robot, and the back drive system was replaced by a simple tail with a swivel wheel on the bottom (a swivel wheel was used here because its mathematically unpredictable behavior is accounted for by the two sensors). The final robot resembled a T from above, with wheels at the three edge points and the rotation sensor wheel located at the intersection. With the robot developed, testing of the system began. Distance Calibration The first test run was to determine the distance traveled based on rotation sensor data. Since the rotation sensor measures the rotation of the middle wheel, the middle wheel’s circumference could easily have just been measured to determine the calibration, but to ensure high levels of accuracy, field tests were preformed. The procedure involved running the Mark HK in a straight line for a set amount of time. Five trials were run at ten, fifteen, twenty, twentyfive, and thirty seconds. After each trial, the distance covered by the robot was physically 9 measured with meter sticks and the number of rotation units (or RUs) measured by the robot was recorded. Each rotation unit represents a 1/6th rotation of the middle wheel (which is how the rotation sensor outputs its readings). It was ensured that the robot was driving straight during each trial by synchronizing the two drive motors and each trial was observed by the experimenter to make sure the robot remained on a straight path. Countermeasures to Magnetic Noise Distortions in the Compass Sensor Initial testing of a location tracking system led to the discovery of a problem with the HiTechnic compass sensor. Magnetic noise caused by wires located in the floors of the lab as well as magnetic fields produced by the motors and NXT brick was causing the compass sensor to deviate from the Earth’s magnetic field, making location tracking systems unreliable. To determine the amount of deviation as well as assess the effectiveness of certain countermeasures, many tests were run. The basic idea of a countermeasure to this magnetic noise is very similar to the idea of a Faraday cage; by surrounding the compass sensor with such a cage, external magnetic noise would, theoretically, be unable to enter, while the Earth’s magnetic field would remain unaffected. Three countermeasure system were tested, aluminum foil, copper foil, and copper pipe. Also, a control system (uncovered magnetic sensor) was tested. The aluminum foil system consisted of a generic brand aluminum foil being wrapped around the sensor six times. Copper foil consisted of .005 inch thick copper foil being wrapped around the sensor once. The copper pipe consisted of a modified copper pipe (similar to ones used for pluming) that was shaped to fit around the sensor. Since the location of the compass sensor on the robot would also affect the amount of noise received, three different locations were tested for each countermeasure system. One was located between the motors above the middle wheel. Another was located on the tail, above the 10 swivel wheel and as far away from the motors as possible. The final location was in an elevated position on the tail (approx. 0.1 m above the “on tail” position). Three tests were performed for each countermeasure system and location: static test, straight test, and rotation test. The static test was meant to determine the effect of the motors and NXT brick on the compass sensor readings. The static test consisted of the Mark HK being placed on a table approx. 0.7 meters above the ground and far away from any electrical wiring. During the test, the compass sensor reading was recorded every 50 milliseconds for 150 data points. During the first 50 data points, no motors were running. During the next 50 data points, both motors were activated. During the last 50 data points, both motors were shut off. Data was then uploaded from the NXT for analysis. The straight test consisted of the Mark HK driving in a straight line (via synchronizing the motors; the straight path was confirmed by the experimenter) while compass sensor readings were recorded. Readings were taken every 25 milliseconds until 200 data points were gathered, which equated to roughly 1.5 meters of travel. The rotation test was identical to the straight test but the motors were run in opposite directions, causing the robot to spin on the spot. All tests were conducted at full power and half power. Also, every test was preformed twice. To ensure most of the disturbances were caused by magnetic noise generated from wires in the floor of the lab, a straight test was also conducted in the basement of the lab, where the floor were poured concrete with no electrical wiring. Implementation of a Location Tracking System To ultimately see if the Mark HK could keep track of its location, a program was written to implement the location tracking system. The program was written in RobotC (a C-like NXT programming language) and can be found in Figure 1.1. The general idea of the program is that 11 there is a background function that constantly runs regardless of what else the robot is doing. This background function waits for the rotation sensor to “click” (turn 1/6th of a rotation, or one RU) and then uses the compass sensor value to translate the vector into a change in X and Y. This change in X and Y position is added to a cumulative X and Y position that ultimately keeps track of the robots position. These cumulative values can then be used to calculate the heading of the robot from its original location as well as the distance form the original location. To test the effectiveness of the location tracking system, two precision tests were run in the basement of the lab (the location with the least magnetic noise). The first test consisted of the robot driving forward for 9 second (approx. 2 meters). At this point, the robot angled towards what it believed was the point of origin and drove forward for three seconds. This was repeated two more times until the robot came back near the point of origin. The distance between the starting point and finish point was measured. The second test had the robot travel an arbitrary path consisting of driving straight, turning about 100 degrees, driving straight, then driving a curved path (taking the robot approx. 1.5 meters from the start point). The robot then went through two iterations of angling and driving until it believed it was at the point of origin. The distance that separated the start point and finish point was then recorded. Both precision tests were run five times (in different locations and starting at different angles), and all tests were with the compass on the tail with no countermeasures. 12 Results & Analysis Distance Calibration Data from the distance calibration test can be found in Figure 2.1. The five tests yielded an average rate of 91.43 rotational units per meter. Using this information, the robot could be modified to output its distances in meters rather than rotational units, allowing for operators to more easily understand the output of the robot. Countermeasures to Magnetic Noise Distortions in the Compass Sensor A total of 144 tests were run with over 25,000 data points collected. In order to translate the raw data into useful information about the variance in the compass sensor, the data went through lots of processing. Static test data was standardized so that whatever angle the data started at was changed to zero, with the rest of the data changed accordingly. To measure variance, the standard deviation for the data was then taken. Straight test data was processed much the same way as static test data, but the first 25 data points were thrown out because they tended to be altered by the swivel wheel orienting to the straight path. Ultimately, this processing also produce a standard deviation to measure the variation in compass readings as well as the overall change in readings during the test. Rotation test data was first modified so that the data showed the overall change in rotation from the initial orientation. A regression line was then calculated for this data (the theoretical rotation rate that should be constant) and the residuals for the data (the difference between the recorded values and predicted values) were calculated. The standard deviation of these residuals was then used to measure the variance. A table of the calculated standard deviations can be found in Figure 2.2. When looking at location of the sensor, the amount of variance in the static test significantly drops ad the compass is moved away from the motors (1.408 between the motors, 0.243 on the tail, and 0.135 on the elevated tail). This means that moving the compass away from the motors will decrease the 13 amount of variation caused by magnetic noise produced by the motors and NXT brick. However, with the straight and rotation test, no significant change exist between any of the different locations (except between “between motors” and “elevated tail” data from the rotation test, which is significantly different with a p-value of 0.0322). So while location can be effective in reducing variation from motors, it is not effective in reducing variation from other magnetic noise. When looking at the different countermeasures, it is seen that none of the countermeasures is distinctly better than another. In general, none of the methods are much better than the control method of no covering. Also, almost all of the standard deviations for the straight and rotation tests are above 10. This means that the compass sensor data is nowhere near as accurate as it needs to be to be effective in keeping track of location regardless of compass sensor location or countermeasure method (it is estimated by the experimenter that the standard deviation would have to be less than 1 to be considered accurate enough for practical use). This idea is highlighted by strange graphs produced by some tests. Figure 2.3 shows a graph from a rotation test. Theoretically, the graph should so several straight diagonal lines (and most test produced a graph that generally appeared this way). However, the graph shows very different data, data that would indicate that the robot was angling back and froth rather than spinning completely around. Another strange graph can be found in Figure 2.4. This graph, taken from a straight test, shows a wildly wavy pattern that deviates from the original reading up to 80 degrees when it should be reading a straight line (constant compass sensor value). To make sure that these wild variations were due to the environment (magnetic noise caused by wires in the floor of the lab) rather than faults with the compass sensor, control tests were run in a basement with poured concrete floors and no wiring in the floors. The control tests consisted of two straight tests run in the “between motors” setup and two in the “on tail” setup 14 (all four tests had no countermeasures in place). The between motors test yielded an average standard deviation of 2.24 while the on tail test yielded an average standard deviation of 2.97. These results indicate that the high amount of variation seen in previous test was indeed caused by magnetic noise in the environment. Implementation of a Location Tracking System Initial testing of the program indicated that the location tracking portion of the program function properly. The angles and distances that the program calculated appeared to be correct (although it was never actually confirmed that such measurements were indeed correct). However, a problem occurred when the robot attempted to rotate itself to drive back to the point of origin. It failed to correctly angle itself, causing it to drive in the wrong direction. The first theory to why this problem occurred was that the compass sensor’s output follows the Earth’s rotational system rather than the rotational system of a Cartesian plane that all trig functions are built off of. To correct for this, a function was added to the program to convert compass sensor values to Cartesian values by taking 450 and subtracting the compass sensor values. After this was implemented, however, the robot still failed to correctly angle. To see how it should be angling, a test was run where the robot drove the arbitrary path but then stopped at the point where it would turn back towards origin. The calculated angle that the robot traveled was recorded as well as the angle that the robot should travel to get back to the starting point (this was deduced by manually turning the robot until it pointed back towards the start and then recording the compass sensor value). Four tests were run under the old and new system and all the data can be found in Figure 2.5. In the original programming, it was assumed that the angle back was calculated by simply subtracting 180 from the calculated angle, therefore turning around. However, as the data in Figure 2.5 shows, this seems to not be the case. Further analysis 15 found a programming error that accounted for the failure of the new system, confirming that the new system was working properly. Results of the two precision tests can be found in Figure 2.6. While there was one perfect test where the robot found its way back to the point of origin perfectly, the average error was 0.17 meters. This error shows that the relatively small amount of magnetic noise found in preliminary testing ultimately causes disturbances in the robot’s ability to track its location. Considering the range of one to two meters of the precision tests, an error of 0.17 meters is far too high. If noise in the sensor is able to create an average error of 0.17 meters on a three to four meter round trip, long drives spanning entire rooms would be completely impossible. The error would need to be much smaller to prove the system effective. Conclusion The purpose of this project was to create an effective, simple location tracker that could function on its own without the need of other equipment. The concepts tested in this project, while theoretically sound, were shown to be highly flawed in practice. The main problem stemmed from the magnetic noise that goes unnoticed in everyday environments. Wires under floors create magnetic fields that don’t affect people at all but will cause a compass sensor to deviate to the point where it is essentially rendered ineffective. While many countermeasures were tested, none of the countermeasures were able to successfully smooth out the noise. And even when the robot was run in an environment with low magnetic noise, the little magnetic noise that remained was able to create enough disturbance to cause the system to be useless on large scales. Based on these conclusions, it would not be recommended that a compass sensor be used in environments like buildings where there is lots of magnetic noise. A better compass sensor may be able to ignore such noise, but the HiTechnic Lego Compass Sensor tested is not of a high 16 enough grade to be considered useful. Even though this project appears to disprove the concept developed, it does not disprove the concept entirely; merely this method of implementation (meaning the HiTechnic Compass Sensor). If such a system could be developed and perfected, it would be highly advantageous in certain areas of robotics like space exploration where other systems may not be feasible. Continuations of this project will work towards developing more definitive countermeasures to magnetic noise and hopefully prove this concept of location tracking effective. If an effective system can be developed, it would open the door to countless other applications of robotics, including robots designed to survey areas, search for fire or materials, and swarm robotics. Ethical Considerations While this specific system of location tracking was found to not be effective, any system of location tracking would still be highly advantageous. Robots that are able to keep track of their location would be able to perform a host of functions that a “blind” robot would not or could not effectively do. These functions include mapping environments like rooms, seeking objects of interest, and much more. Even more functionality is unlocked when other systems of location tracking are included, like satellite based tracking system. Using systems like these, or even combinations of system, possibilities for applications would be endless. For instance, robots could be created to drive on roads based on a preplanned path to an incredible precision. Another more ethically challenging application is defense. Location tracking would give war robots another tool to allow them to carry out their function. Some functions would be peaceful, like using a robot to sweep a room for IEDs or other explosives, or using a robot to drive supplies autonomously through a war zone. Other functions would be more deadly, like having a robot that could carry out complex combat objective in close quarters. With the ability 17 to keep track of location, robots could operate with deadly precision and become efficient soldiers. Applications like the last one mentioned are the dangers of any advancements in robots. This danger is not in the sense of a Hollywood style computer rebellion like Terminator or the Matrix, but more in the sense of how robot will give us an even greater ability to kill, and any advancement in robotics will be a further development in this tool of death. However, it must be remembered that almost all developments of technology have applications of destruction, but as a race it is the job of humanity to find ways to use such technologies for good, helpful purposes. No doubt exists in anyone’s mind that robots are a useful development of technology that will provide much benefit, and advancements like location tracking will further the field and bring us closer to the positive benefits posed by robots. Acknowledgements I’d like to thank Mr. Donelson for mentoring me on this project. I would also like to thank the Gahanna Jefferson Educational Foundation whose funds paid for the Lego NXT kits and compass sensors used in this project. 18 Works Referenced Brain, Marshall. "How Compasses Work" 01 April 2000. HowStuffWorks.com. <http://adventure.howstuffworks.com/outdoor-activities/hiking/compass.htm> 15 February 2011. ______. “Compass”. Wikipedia, from <http://en.wikipedia.org/wiki/Compass> D., Ron. “Magnetic Deviation: Comprehension, Compensation and Computation (Part I)”. Dead Reckonings. 18 April 2009. <http://myreckonings.com/wordpress/2009/04/18/magnetic-deviation-comprehensioncompensation-and-computation-part-i/> 15 February 2011. ______. “Faraday Cage”. Wikipedia, from <http://en.wikipedia.org/wiki/Faraday_cage> ______. “Magnetic Deviation”. Wikipedia, from <http://en.wikipedia.org/wiki/Magnetic_deviation> ______. “Michael Faraday (1791-1867)”. BBC. <http://www.bbc.co.uk/history/historic_figures/faraday_michael.shtml> 15 February 2011. ______. “NXT Compass Sensor”. HiTechnic. <www.hitechnic.com> 15 February 2011. Rubin, Julian. “The Invention of Faraday Cage”. January 2011. <http://www.juliantrubin.com/bigten/faradaycageexperiments.html> 15 February 2011. 19 Appendix Figure 1.1 #pragma config(Sensor, S1, rotation, sensorRotation) #pragma config(Sensor, S2, compass, sensorI2CHiTechnicCompass) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*// float absx; float absy; float absdist; float absangle; int changeangle(int angle) // function added to adjust for differences between the Earth’s angle system and a Cartesian plane’s angle system { angle=450-angle; if(angle>360) angle=angle-360; return angle; } task loctrak() /main background location tracking function { int tempr; int temp2; tempr= SensorValue[rotation]; while(true){ if (SensorValue[rotation]!=tempr) { temp2=tempr- SensorValue[rotation]; //this is backwards because the negative direction is "forward" tempr= SensorValue[rotation]; absx=absx+cosDegrees(changeangle(SensorValue(compass)))*temp2; if(absx==0) absx=0.01; //to avoid divide by zero absy=absy+sinDegrees(changeangle(SensorValue(compass)))*temp2; //use the cumulative x and y values to get the ultimate angle and distance absdist=sqrt(absx*absx+absy*absy); absangle=radiansToDegrees(atan(abs(1000*.001*absy/absx))); if(absx<0) { if(absy<0) absangle=180+absangle; else absangle=180-absangle; } else { if(absy<0) absangle=360-absangle; } } } } task main() { 20 float temp1; absx=0.01; absy=0.01; StartTask(loctrak); //start keeping track of location //Arbitrary path starts here--------------------nSyncedMotors=synchAC; nSyncedTurnRatio=100; motor[motorA]=-50; wait1Msec(4000); motor[motorA]=0; wait1Msec(300); nSyncedTurnRatio=-100; motor[motorA]=50; wait1Msec(800); motor[motorA]=0; wait1Msec(300); nSyncedTurnRatio=100; motor[motorA]=-50; wait1Msec(1200); motor[motorA]=0; wait1Msec(300); nSyncedTurnRatio=60; motor[motorA]=-50; wait1Msec(3000); motor[motorA]=0; wait1Msec(300); //Arbitrary path ends here--------------------//re-angle robot towards point of origin temp1=absangle; if(temp1>359)temp1=temp1-360; nSyncedTurnRatio=-100; motor[motorA]=15; wait1Msec(200); while(changeangle(SensorValue(compass))!=temp1){} motor[motorA]=0; wait1Msec(1000); //go to point of origin nSyncedTurnRatio=100; motor[motorA]=-50; while(absdist>10){} motor[motorA]=0; while(true){} StopTask(loctrak); //terminate } 21 Figure 2.1 Time (S) 10 15 20 25 30 Total Dist (m) 3.74 5.61 7.46 9.34 11.14 RUs 341 511 683 858 1022 RU/m 91.07 91.02 91.50 91.86 91.71 Figure 2.2 Note: Each value is the average standard deviation of four tests: two full power tests and two half power tests Between Motors On Tail Elevated Tail Static Straight Rotation Static Straight Rotation Static Straight Rotation Nothing 2.202 18.975 17.808 0.233 20.518 25.772 0.061 17.889 12.931 Al Foil 1.109 13.934 11.943 0.182 14.814 20.229 0.231 17.337 8.925 Cu Foil 1.178 20.598 20.628 0.189 27.493 13.445 0.171 8.497 10.155 Cu Pipe 1.144 13.423 18.873 0.368 14.297 14.019 0.078 16.652 15.564 Average 1.408 16.733 17.313 0.243 19.281 18.366 0.135 15.094 11.894 Figure 2.3 Figure 2.4 Odd Rotation Test Graph Odd Straight Test Graph 400 100 80 300 Compass Sensor Value Compass Sensor Value 350 250 200 150 100 60 40 20 0 0 50 50 100 150 200 -20 0 0 50 100 150 200 -40 250 Data Points Data Points Figure 2.5 Without Angle Correction With Angle Correction Test 1 Test 2 Test 3 Test 4 Test 1 Test 2 Test 3 Test 4 Calculated Angle 76 311 357 270 320 22 281 196 Angle Back to Start 311 73 202 25 15 70 300 128 250 22 Figure 2.6 Average Error: 0.17 meters 1 Error (meters) 0.38 2 0.17 3 0.25 4 0.00 5 1 0.12 Error (meters) 0.33 2 0.08 3 0.12 4 0.14 5 0.11 Trial Straight Path Trial Random Path