18
Home Store Products and Resources Forums Consulting About us Contact Username: Password: Remember me Home Robot navigation Follow us: Line tracking sensors and algorithms By Ibrahim Kamal Last update: 15/4/08 Table of content: Overview Number of cells in a sensor Cells spacing Building the sensor Proportional Control Algorithm Navigation in a complex grid of lines Related pages on Ikalogic: Tutorial: Closed loop speed control of DC motors Project : Small line follower robot . Movies : Robot navigation on a grid , Huge line follower robot . Overview Line tracking is a very important notion in the world of robotics as it give to the robot a precise, error-less and easy to implement navigation scheme. As you may have seen, many robotics competitions promote this concept, by adding lines on the playground for the robot to follow, or sometimes, the sole purpose of the competition is to race with other robots following a line along a track. In this tutorial, I am going to rely on the experience achieved by building the line sensors of the robots that participated to the robocon 2007 competition. 1. Number of cells in a sensor A line sensor is one that will gather information about the position of a line traced on the ground underneath the robot, to help it to navigate through an eventual grid of lines and intersections. For the software to function correctly, the sensor's electronic circuits have to provide a maximum number of information about that line.

Home

Embed Size (px)

Citation preview

Page 1: Home

Home Store Products and Resources Forums Consulting About us Contact

Username:    Password: Remember me

Home Robot navigation Follow us:

Line tracking sensors and algorithmsBy Ibrahim Kamal Last update: 15/4/08

Table of content:Overview

Number of cells in a sensor

Cells spacing

Building the sensor

Proportional Control Algorithm

Navigation in a complex grid of lines

Related pages on Ikalogic: Tutorial: Closed loop speed control of DC motors

Project : Small line follower robot.

Movies : Robot navigation on a grid, Huge line

follower robot.

Overview

Line tracking is a very important notion in the world of robotics as it give to the robot a precise, error-less and easy to implement navigation scheme.

As you may have seen, many robotics competitions promote this concept, by adding lines on the playground for the robot to follow, or sometimes, the sole purpose of the competition is to race with other robots following a line along a track.

In this tutorial, I am going to rely on the experience achieved by building the line sensors of the robots that participated to the robocon 2007 competition.

1. Number of cells in a sensor

A line sensor is one that will gather information about the position of a line traced on the ground underneath the robot, to help it to navigate through an eventual grid of lines and intersections. For the software to function correctly, the sensor's electronic circuits have to provide a maximum number of information about that line.

Page 2: Home

As you can see in figure 1, a line sensor is composed of a number cells and each cell is composed of a sender and a receiver. The particularity of this sender/receiver pair, is that it sends light that shall be reflected by the line to be detected but not by the eventually opaque background surrounding this line. Any sender/receiver pair that is able to make a difference between a line and the rest of ground (of a different color) can be used in a line sensor.

Usually, to make it easier on the designer of the sensor, there is an important contrast between the line and the ground (for example: white line on a dark blue ground), But in case there isn't enough contrast, there is a method to easily build a line sensor adapted to that specific situation, relying on old physics rules

Figure 1that states that a colored surface will absorb the light of different colors, and reflect the light of the same color. For example, If you want to build a line sensor to detect white lines drawn on a light blue floor, you can send red light, as the blue will absorb all of it, and the white line will reflect all of it. Actually this was the case in the playground of Robocon 2007 competition, there wasn't enough contrast between the white lines and the blue ground, so we had to use RED LEDs as senders instead of our preferred IR LEDs

So the first aspect that affects the precision and the quality of a line sensor, is the number of cells. Some roboticists use only 2 cells to know whether the line is at the left or at the right of the robot, but as you shall see later in the software part, this very poor source of information wont allow the controller to gradually guide the robot back on the track, instead you will notice that the robot will keep brutally turning right and left, but will never be able to smoothly follow the line. On the other hand, an 8 cells line sensor will give a spectrum of relatively rich information to the controller, indicating whether the robot is very close to the line, close, far, or very far away. This variety of information will allow the controller to take actions that are proportional to the distance between the robot and the line, resulting in a smooth line tracking system.

2- Distance between the cells  

The second aspect the be considered when building a line sensor, is the cell spacing (or the distance between a cell and the other). To understand the effect of cells spacing, consider the differential drive robot shown in figure 2, with an 8 cells line sensor, whose cells are numbered from 1 to 8 (from the left to the right). Three different situations are shown, In the first one, the cells 4 and 5 detect the line, indicating that the robot is perfectly centered on the line. In the first situation, the spacing between the cells is not very critical, but if the robot accidentally makes a 10° turn away from the line (second situation), you will notice that only the cell number 6 detect the line, which is the only indication that the controller will have about that 10° error. This means that, most probably, an error smaller than 10° wont even be noticed.

But in the third situation, the cells are closely collated together, and you can notice that with the same 10° deviation from the line, the sensor's cells 6 and 7 detected the line, leaving some other possible states in between the perfectly centered position and the 10° deviation. In other words, the closer are the cells from each others, the more will be the resolution of the sensor.

The same effect can be observed by changing the distance between the sensor and the center of steering. In general, It is important to always try to keep the sensor as far as possible from the center of steering, which is the back of the robot in a differential steering one, because this will also help to amplify the deviation detected by the sensor, resulting in a better response

Figure 2from the controller.

Page 3: Home

3. Building the sensor

There are many electronic components that can be used to build the sender/receiver cells of a line sensor. Two of them are discussed in this article, showing the advantages and disadvantages of each one, and showing how to implement each one of them in an electronic circuit.

IR LEDs LDRs and LEDs

This method relies on our famous IR proximity sensor with some modification. It has the advantage of being cheap and easy to implement, but unfortunately need an important contrast between the line and the ground. Refer to the this tutorial for more information.

When you need to adapt to low contrast situations, as discussed before, this is the most common alternative. You chose the most suitable color of LED for sending the light, then, the LDR will pick up the reflected light, but it's slower to respond than IR LEDs.

 Figure 3.A: One cell implementation

 Figure 3.B:One cell implementation

D1: Emitter LEDD2: Receiver LED

R6: Sensitivity adjustment D1: Emitter LED R1: Sensitivity adjustment

After a lot of experiments, I personally recommend the LDR based line sensor because it can be easily adapted to many different environments by adjusting the sensitivity using the potentiometer R1 or by changing the color of the LED D1.

Here is the electronic circuit of the LDR based line sensor we used in our robots in the Robocon 2007 competition. As you can see it is composed of eight cells, each one resembling the cell in figure 3.B. There are many reasons to choose to build a sensor with exactly eight cells, no more, no less: Eight can provide enough precision, it connects directly to one port of the microcontroller, and is represented by one single Byte of data, making it easier to implement in the programming and in the memory of an 8 bit microcontroller.

Page 4: Home

Figure 3.C

The wire connections W3 to W10 are the outputs of the 8 cells of the sensor.

The value of R1 to R9 cannot be lower than 50 ohm, actually this value is very low and that's why the sensor sinks a lot of current. You may try to use larger values first, like 220 ohm, then if the intensity of the light is not en ought, reduce it gradually.

You will also notice that there are 9 sender LEDs (not 8), that's because the the LEDs and the LDRs are positioned in such a way that each LDR has one led on its right and another on its left (as you can see in figure 3.D). The purpose of this technique is to make sure all LDRs share the same reflected light intensity, and this way, only one potentiometer can be used to calibrate all of them.

Page 5: Home

Figure 3.D

4. Proportional Control Algorithms

Now that your sensor is working and is providing a correct reading of the line underneath it, you still need to develop some algorithms to use the data collected from the line sensor. The quality of those algorithms is as important - if not more important - than the quality of the sensor it self. Its those software procedures that will give to the robot the ability to smoothly and correctly track lines in a grid of lines and intersections, perform 90° turns and many others moves that can be implemented in such a lines grid.

Proportional Control, which is usually used in line following algorithms, means that the intensity of the rotation of the robot towards the line is proportional to the distance between that robot and the line. In other words, if the center of the robot is positioned exactly on the line, the rotation of the robot will be equal to zero, but if the robot gets deviated from the center of the line, the intensity of the rotation will gradually increase, until it reaches maximum intensity if the line is completely out of reach. This proportional Algorithm will prevent the robot from oscillating to the right and to the left of the line while trying to follow it.

What I mean by the intensity of rotation, is the speed at which the wheels will turn (in a differential steering robot) or the angle of the front wheel (in a car-like steering robot).

This may be true in theory, but in practice, due to the non-linearity of the behavior of DC motors, and many others sources of error that cannot be clearly defined, the robot would still oscillate while trying to track the line, and would sometimes fail, because the error would eventually increase instead of decreasing. That's why the proportional control scheme have to be tailored for each robot, depending on it's moment of inertia, on the type of motor, on it's weight and on many other factors. After lot of testing, the graph in figure 4.A shows a control scheme that proved to work correctly on most differential steering robots.

Figure 4.A represents a relation between the speed that should be applied on the right and left wheels of a differential steering robot and the position of the line relative to the center of the robot. As you can see, for an 8 cell line sensor, the line is considered to be at the center of the robot when it reads 4.5, while it is considered to be totally at the left when the first cell of the sensor is detecting the line.

The only thing you may have to to do, is to define the value of Smax suitable to your robot. The easiest way to do this is by trial and error. You will probably notice that High values of Smax will result in very fast response, but with a lot of oscillations.

Figure 4.AAn important question is how to obtain analog readings from such a digital output line sensor? The answer is we actually don't obtain real analog signals, we just calculate an average of the position of the line, when more than one cells detect the line. For example, when cells number 4 and 5 detect the line, the average of 4 and 5 is 4.5, and we will consider this value as the reading of the line to be used in the graph of the figure 4.A. Depending on the thickness of the line being tracked, you can optain a multitude of readings between a integer and the other.

In order to precisely control the speed of the motors in a differential drive robot, you need to adapt what is called closed loop speed control of DC motors, which is explained in detail in this tutorial.

Page 6: Home

For a 8051 microcontroller programmed in C, here is an example source code of a function named follow_line() which when called, reads the value of the sensor which is connected to port 0, calculates the average then deduces the required speed of the right and left wheels to smoothly adjust the robot to the line.

follow_line(){max_speed = 8;half_speed = 4;line_to_speed_factor = (max_speed) / 4.5;

//The line sensor is connected to P0if (P0 != 0 ){ //Keep the old line reading in case the line is lostold_line = P0;}new_line = P0;l1 = P0_0; //Store the values of each cell of the 8 cells of the l2 = P0_1; //line sensor in the variables l1 to l8.l3 = P0_2;l4 = P0_3;l5 = P0_4;l6 = P0_5;l7 = P0_6;l8 = P0_7;fwd(); //Call a function that orders the robot to move forward

if (P0 == 0){ //In case the line is out of reach, rely on the last validif (old_line > 45){ //reading to decide whether to pivot right orpivot_left(); //left to reach the line again.

req_right_pulses = max_speed;req_left_pulses = max_speed;}else{pivot_right();

req_right_pulses = max_speed;req_left_pulses = max_speed;}

}else{if(old_line != new_line){//Calculate the average reading of the line.

line = (l1) + (l2*2) +(l3*3)+(l4*4)+(l5*5)+(l6*6)+(l7*7)+(l8*8);line = line / (l1+l2+l3+l4+l5+l6+l7+l8);//Calculate the required right and left speed//according to the graph.req_right_pulses_ = floor((line*line_to_speed_factor)+0.5);req_left_pulses_ = floor(((9-line)*line_to_speed_factor)+0.5);

if (req_left_pulses_ > max_speed){req_left_pulses = max_speed;

}else{req_left_pulses = req_left_pulses_;

}

if (req_right_pulses_ > max_speed){req_right_pulses = max_speed;

}else{req_right_pulses = req_right_pulses_;

}}

}}Note that this code is not stand-alone, it is a part of more complicated program that contains the the closed loop speed control and many other functions allowing the robot to navigate according to a specific path. for example, the values 'req_left_pulses' and 'req_right_pulses' have to be fed to the closed loop speed controller.

You will also notice that the speed is calculated in two steps, the first result is stored in 'req_right_pulses_' then the final result is stored in 'req_right_pulses'. This is because the graph in figure 4.A is composed of two independent linear relations, the first is for the readings from 1 to 4.5, and the other relation is for the rest of the readings, 4.5 to 8, (and the same applies to the 'req_left_pulses' variable). This is just an example, there are many ways to implement such a graph into a microcontroller program, it's up to you to see the most suitable method according to the architecture and organization of your program.

Page 7: Home

5- Navigation through lines and intersections

Now that you know how to make your robot follow a line, you can use that same sensor to allow it navigate through a grid of horizontal and vertical lines as the one in figure 5.A, using the same 8 cells sensor.

The main clue to an errorless navigation in such a maze, is to be able to precisely detect intersections. To do that, first you have to analyze the nature of those lines, the angle of intersections, and the different readings of the line sensor when crossing intersections. Actually, you have to adapt your code to each and every playground you expect you robot to navigate on.

After a lot of testing we developed this simple technique to detect intersections, whatever the way the robot crosses it.

Figure 5.A

As you can see in figure 5.B, three different situations are shown, in each one of them, the robot crosses an intersection, coming from a different angle. The cells of the line sensor that detect the line are designated by bright red spots, while cells that don't detect it are designated by dark red spots.

What we tried to do is to find what is common between those 3 different possibilities, and the following rule was developed to detect intersections:

'If one of the end cells (1 or 8) detects the line while one or more of the last 4 cells at the other end also detect the line, then the sensor is crossing over an intersection'

In other words, for an intersection to be validated, the reading of the sensor must be as follow:

Cell number 1 detect the line AND one or more of the cells 5 to 8 detect the line

OR

Cell number 8 detect the line AND one or more of the cells 1 to 4 detect the line

Then you have to develop the code that will analyze the readings of the sensor, count intersection, and guide your robot through

Figure 5.Bthe desired path, which can be done with a multitudes of methods. The choice of the method to guide a robot, and precisely localize it in a map can be very difficult task, even if you are using line following algorithms. Some methods will even involve a combination of dead reckoning and line following to achieve more accurate results. Generally, it's your job to design the navigation scheme which is most suited to the environment of the robot. It's important to note that robot navigation is subject to many research and is still in an intensive development phase in the robotics labs around the world.

I hope this article covered the main aspects required to construct

Page 8: Home

a simple robot navigation system based on line following algorithms and helped to introduce some of the scientific principle behind the operation of such a system.

Discussion (Last 15 posts preview...)

Preview of the last 15 messages discussing this page. Messages are sorted from the newest to the oldest.

Follow this discussion in the Full-featured forum

Posted by:

ikalogic on: 28 Feb 2008

Line tracking sensors and algorithms ['Quote ]

Quote: Good tut..but i still didnt get that if there is an intersection of more than 4 lines say 7 to 8 lines all in different angles, how the robot will decide in which direction should i go????????

Well in that situation, you would have to develope a special sensor, the one in this tutorial wont work for such complex intersections.. it is usually rare to see intersection between 8 lines, becuase usually a grid of perpendicular is drawn on the ground.. but in the case of an 8 lines intersection, a bigger more adapted line sensor could be developed...

Posted by:

ikalogic on: 28 Feb 2008

Re: Line tracking sensors and algorithms ['Quote ]

Quote: thats great...exactly what i need.but since recevier is photosensor(LDR), why IR used there instead of sharp led light...i know IR's reflectivity is better but it has some problem in daylight...

For the following reason, stated in the article above, section 1, 3rd paragraph: "...relying on old physics rules that states that a colored surface will absorb the light of different colors, and reflect the light of the same color. For example, If you want to build a line sensor to detect white lines drawn on a light blue floor, you can send red light, as the blue will absorb all of it, and the white line will reflect all of it."

Posted by:

ikalogic on: 28 Feb 2008

Re: Line tracking sensors and algorithms ['Quote ]

Quote: Great job, Ibrahim clearly you have used HLL C to program your robot. Have you thought of using any other programming techniques like RTOS, Assembly as they are common approaches to embedded enviroment pgoramming. And the other question is if i am using a different PIC Microcontroller the code will then need to be altered and some other header files will need to be included in the source code to build correctly is that true if so can you let me know what might be critical to changes if i am using PIC 18F243. Let me know if possible the reason you choose to program in C other than any other programming technique.

hello, As for the choice of programming language, well, C is more advanced, and allows more sophisticated programming, that would be very difficult to conceive in a low lever language like assembly. For example, a simple task like making calculations with

16 bit variables on an 8-bit processor such as the 8051 is very complicated.. imagine the rest of the code!

Now about migrating to PIC18F, for the simple codes provided on this page, it should not be big problem. The main issue will be to change the ports and pins names, otherwize, it should be ok.

Posted by:moody_sh2006 on: 01 Mar 2008

Re: Line tracking sensors and algorithms ['Quote ]

hi eng.Ibrahime this is a very smart Line tracking sensors i did it on test board(two line test board)

Page 9: Home

it was very diffecult to put all component on it but i face some problem!!!1st the leds (i use high intensity white led to follow black line)it make the ldr less senstive to light and changing on the lineso i surrounded it by small paper(the leds) so i canceled interferance of light whith LDRthen it work good2nd the LDR it selfi found two parts big circle and small cirlce i use small by luck3rd the voltage entered to op-amp have small diffrance and i adjust it many time4th Are their a scientfic calculation for this circuit to improve their effciency5th the leds and op-amps and resistor make a high power consumingwhat can i do to impove the o/p volt which will enter the i/p ports for micro controller?

thats all

and thanks for ur patience

Posted by:

ikalogic on: 01 Mar 2008

Re: Line tracking sensors and algorithms ['Quote ]

Quoting moody_sh2006: hi eng.Ibrahime this is a very smart Line tracking sensors i did it on test board(two line test board)

it was very diffecult to put all component on it but i face some problem!!!1st the leds (i use high intensity white led to follow black line)it make the ldr less senstive to light and changing on the lineso i surrounded it by small paper(the leds) so i canceled interferance of light whith LDRthen it work good2nd the LDR it selfi found two parts big circle and small cirlce i use small by luck3rd the voltage entered to op-amp have small diffrance and i adjust it many time

This is probably due to the fact that not all the LDRs behave the same way, sometimes, an LDR will be much more sensitive than the others, sometimes, the nearby emitting LEDs will be more powerfull than the others (this happens to bad quality LEDs). The solution i found was to put some transmarent paper on the LDR that is too sensitive, to reduce its sensitivity.

I agree it is dificult to get it well configured, but once it is configured correctly, it functions very well. this line sensor functioned in Egypt, and In vietnam, without changing the configuration or even touching a potentiometer.

Quoting moody_sh2006: 4th Are their a scientfic calculation for this circuit to improve their effciency

There nothing more than calculations in electronics.. but for that sensor.. the best you can do is to calculate the best value of the resistor, to provide just the current needed by the LEDs

Quoting moody_sh2006: 5th the leds and op-amps and resistor make a high power consumingwhat can i do to impove the o/p volt which will enter the i/p ports for micro controller?

thats all

and thanks for ur patience

I don't understand this last question...

good luck

Posted by:phuanon on: 04 Apr 2008

Line tracking sensors and algorithms ['Quote ]

Page 10: Home

hi ikalogic i doing a project of line following robot use pic 16f84a or pic . I find google but dont find . It is good if u can send for me 1 complete project of a Line following robot

Tk u

Posted by:phuanon on: 04 Apr 2008

Re: Line tracking sensors and algorithms ['Quote ]

EMAIL of me : [email protected]

Posted by:

ikalogic on: 04 Apr 2008

Re: Line tracking sensors and algorithms ['Quote ]

dear phuanon

If i had a line follower project ready, it would have been online and there would be no need nor reason to send it to you by mail!!

Did you take a look at this project: [link]

Please don't ask me to send stuff over mail, there nothing that justifies that, this forum is made for SHARING, and CONTRIBUTION, helping and getting helped! and this is for all members that send me mails every day too! please ask your questions on the forum, and wait for the answer on the forum!

Posted by:phuanon on: 05 Apr 2008

Line tracking sensors and algorithms ['Quote ]

Hi ikalogi i just design 1 circuit about line follower use AT89CC2051 I Try to run but it more error i think to u can help methis is code C use Keil and circuit (design by PROTEUS)

#include<AT892051.h>sbit m1 = P1^0;/*m=motor , s= sensor*/sbit m2 = P1^1;sbit s1 = P3^0;sbit s2 = P3^1;sbit s3 = P3^2;sbit s4 = P3^3;

void main(){while(1){if (( s2 ==1 )&& (s3 ==1)){ straight();

} if(s1==1){ unsigned int x=1;while(x==1){ left();

if((s2==1 )&&(s3==1));x=0;}}if (s4==1){ unsigned int y=1;

Page 11: Home

while(y==1){right();

if ((s2==1)&&(s3==1));y=0;}}

}}

straight(){m1=20;m2=20; return;}left(){m1=0;m2=10;return;}right(){m1=10;m2=0;return;}

and circiuthttp://rapidshare.de/files/39024752/my_robot.DSN.html

I wish u will help

Posted by:

ikalogic on: 05 Apr 2008

Re: Line tracking sensors and algorithms ['Quote ]

Quoting phuanon: Hi ikalogi i just design 1 circuit about line follower use AT89CC2051 I Try to run but it more error i think to u can help methis is code C use Keil and circuit (design by PROTEUS)

I wish u will help

Hello, I cannot open the proteus file, can't you post a screen shot of the schematic?

Anyway the problem seem to be from the code, using nested IF blocks, one inside the other, is the best way to end doing anything but what you wanted in the beginning. If you don't want to use the method described in this tutorial, and want to use only simple if blocks, you can always use this method:

if ((s1 = 0)&(s2 = 0)&(s3 = 0)&(s4 = 0)){..put some code..}else if ((s1 = 1)&(s2 = 0)&(s3 = 0)&(s4 = 0)){..put some code..

Page 12: Home

}else if ((s1 = 0)&(s2 =1)&(s3 = 0)&(s4 = 0)){..put some code..}else if ((s1 = 1)&(s2 = 1)&(s3 = 0)&(s4 = 0)){..put some code..}else if ((s1 = 0)&(s2 = 0)&(s3 =1)&(s4 = 0)){..put some code..}else if((s1 = 0)&(s2 = 0)&(s3 = 0)&(s4 = 0)){.........}

And continue this example code, tryying to cover all the possible readings of the line with that method. Sure, a reading like "((s1 = 1)&(s2 = 0)&(s3 = 0)&(s4 = 1))" is impossible, so you don't need to implement it.

and by the way, tell me what is the problem of the robot exactly? what is its behavior while following a line? if you give more

information, i'll be able to help you more.

Posted by:phuanon on: 05 Apr 2008

Re: Line tracking sensors and algorithms ['Quote ]

today I try to post circuitI need complete my project in tomorowU can see image here i try post image but dont it becase it too wide to posthttp://i211.photobucket.com/albums/bb31 ... tled-1.jpg

Posted by:

ikalogic on: 05 Apr 2008

Re: Line tracking sensors and algorithms ['Quote ]

Quoting phuanon: today I try to post circuitI need complete my project in tomorowU can see image here i try post image but dont it becase it too wide to posthttp://i211.photobucket.com/albums/bb31 ... tled-1.jpg

you still didn't tell me, what is the problem of the robot exactly? what is its behavior while following a line? did you try to modify the code as i suggested?

by the way, if there is any good results, post them here! and share your results and experience..

Posted by:viccram on: 16 Apr 2008

Line tracking sensors and algorithms ['Quote ]

hie...i used the proportional algorithm in linetracking

i used six lineracking sensors (phototransistors) and modified the algorithm as required.the problem i faced was when the distance between the sensors and wheel was 30cm the algorithm works fine but when i had to use the same algorithm in the robot that has 19cm distance between sensor and the wheels the algorithm is not effective the there is oscillation in the motion of the robot

could u possibly suggest how can i solve this problem?what is the minimum distance between the wheels and the sensors?

and also...i have been doing linetracking using sensors in front of the wheel

Page 13: Home

but can linetracking be possible when the sensors are behind the wheels??

here is the lintracking subroutine of the code i used:

//Some Variables Used//as_per_point -> dutycycle required (required speed)//el,lt,cl, extreme left, left,central left sensors//and similar for er,rt,cr

void linetrack() {temp=output& 0x0F;if(temp==0x00)return;else if(temp==0x0F)return;else{if(!(el|lt|cl|cr|rt|er)){} else{elx=el;ltx=lt;clx=cl;crx=cr;rtx=rt;erx=er;}

output=RIGHT_F_LEFT_F; value=(10*elx+20*ltx+30*clx+40*crx+50*rtx+60*erx);

deviation=(value/(elx+ltx+clx+crx+rtx+erx)-35)/5;

correction_l=as_per_point+deviation*as_per_point/5; correction_r=as_per_point-deviation*as_per_point/5;

if(correction_l>=255) lval=255;else if(correction_l<=0)lval=0;else lval=correction_l;

if(correction_r>=255) rval=255;else if(correction_r<=0) rval=0;else rval=correction_r;

}

}

Posted by:

ikalogic on: 16 Apr 2008

Re: Line tracking sensors and algorithms ['Quote ]

Quoting viccram: hie...i used the proportional algorithm in linetracking

i used six lineracking sensors (phototransistors) and modified the algorithm as required.the problem i faced was when the distance between the sensors and wheel was 30cm the algorithm works fine but when i had to use the same algorithm in the robot that has 19cm distance between sensor and the wheels the algorithm is not effective the there is oscillation in the motion of the robot

could u possibly suggest how can i solve this problem?what is the minimum distance between the wheels and the sensors?

and also...i have been doing linetracking using sensors in front of the wheelbut can linetracking be possible when the sensors are behind the wheels??

here is the lintracking subroutine of the code i used:

Page 14: Home

As i explain in this tutorial: [link] It is always better to put the sensor as far as possible from the wheels. This has the effect of amplifying the detected error.

I case you cannot put the sensor that far from the wheels, you should try to find some mean of reorganizing the cells so that the smallest deviation angle cause the extreme left or extreme right cells to detect the line. In other words you should minimize the distance between the cells, If that's not enough, you can try the following configuration (see attached file)

Good luck and keep us posted with the results!

EDIT:I forgot to answer your last question.. YES it is possible to put the line sensor at the back of the robot, but you would simple

have to invert the line directions of the robot (but i guess that's obvious!) See attached file(s)

Posted by:viccram on: 16 Apr 2008

Re: Line tracking sensors and algorithms ['Quote ]

the third figure which is supposed to be the best one looks like has a little less range of sensors to detect the line... this may cause the robot to leave the track easilyis that the case or wat?and is it possible to use a PID control for linetracking using the only 6 tracking sensors...i hav port deficiency to add more linetracking sensors and also i am not clear at what angle should i align the sensors(as shown in fig. you suggested)

thanx for your reply!!!

You have to be a member to post replies.

Username:    Password: Remember me Register now! it only takes an instant.

Forgot your password?

Home | Forums | Store | contact | Check mail | About Ibrahim KAMAL

All content on this site is provided as is and without any guarantee of any kind. We cannot be held responsible for any errors, omissions, or damages arising out of use of information available on this web site.

IMPORTANT COPYRIGHT NOTE: Electronics and Robotics Articles by Ibrahim KAMAL are licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States License.