180 likes | 298 Views
Line Tracking. Team Geek-- Team Leader – Earl Limbers Hardware Specialist – Jason Tompkins Software Specialist – Erin Beaver Team Assistant – George Copetas. Overview. Problem Statement Hardware Software Centroid Weighting Code Problems Summary References Q&A. Problem Statement.
E N D
Line Tracking Team Geek-- Team Leader – Earl Limbers Hardware Specialist – Jason Tompkins Software Specialist – Erin Beaver Team Assistant – George Copetas
Overview • Problem Statement • Hardware • Software • Centroid • Weighting • Code • Problems • Summary • References • Q&A
Problem Statement • Line Tracking • Know where line is ahead of car • Control steering to be centered over line IR Data from Line Sensor MCU Power Steering Servo Motor
Hardware • Pololu QTR-8RC Reflectance Sensor Array • Professor Sumey • Futaba FUTM0043 • Team TBD
Centroid Center of mass Balancing point from any end Assuming uniform weighting at all points Used to find center of line
Centroid • New global variable • int centroid = 0; • Ideal center • Sum of bit weights/# of bits on Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Centroid
Weighting • How do we use these bits to find centroid? • Assign weights • Help determine in-between values Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Centroid
Weighting • Not zero • Does not contribute any weight • Equal distances • Points in between bits will be uniform 80 70 60 50 40 30 20 10
Function • Function Name intLineTracking(byte data) • Initialization BoolnoiseFlag = FALSE; int sum = 0; int count = 0; int weight = 0; inttempsum = 0; inttempcount = 0; int cent = 0;
Error Checking • Lost line • Go back to how you were last turning • Intersection • Continue going straight
Function • All black or white? if(data == 0xFF) return 45; // only in case of intersection, check if in air if(data == 0) return (centroid+45); 80 70 60 50 40 30 20 10 80 70 60 50 40 30 20 10
Error Checking Speck of dust? Target 80 70 60 50 40 30 20 10
Function for(int i = 0; i<=7; i++) { weight+=10; if(BITTST(i, data)) { if(noiseFlag) { tempcount= count; tempsum= sum; count = 0; sum = 0; noiseFlag= FALSE; } sum+=weight; count++; } else { noiseFlag= TRUE; } if(count > tempcount) cent = sum/count; else cent = tempsum/tempcount; }
Main Code //calculate centroid for pulse width centroid = (LineTracking(irdata) - 45); //makes 0 center servopw= (1500 - ((80/7)*centroid));//get value between 1100 & 1900 Average of 40 & 50 1500 = middle pulse width
Problems Faced • Binding to one direction • Delete or comment out servopw = (word)(1000 + constrain(ADCR, 100, 900)); • Located in main
Summary • Problem Statement • Hardware • Software • Centroid • Weighting • Code • Problems
References Sumey, Jeff. “CET Microprocessor Engineering.” California University of Pennsylvania. Web. 23 Mar 2014. http://aet.calu.edu/~jsumey. “QTR-8RC Reflectance Sensor Array." Pololu-N.p., n.d. Web. 23 Mar 2014. http://www.pololu.com/catalog/product/961. “Futaba Analog Servos.” Web. 23 Mar 2014. http://www.futaba-rc.com/servos/analog.html. Weisstein, Eric W. "Geometric Centroid." Mathworld. Web. 23 Mar 2014. http://mathworld.wolfram.com/GeometricCentroid.html