PID control

3 replies [Last post]
ashish.master2
User offline. Last seen 4 weeks 5 days ago. Offline
Joined: 07/09/2009
bOt Points: 78

how to implement PID control algorithm in a line follower

robo.genius
User offline. Last seen 5 weeks 4 days ago. Offline
Joined: 04/12/2009
bOt Points: 253
check out this - Line

check out this - Line Follower with PID

aamiraarfi
aamiraarfi's picture
User offline. Last seen 1 day 52 min ago. Offline
Joined: 11/02/2009
bOt Points: 417
about: how to implement PID..

 

First read about PID theory.
How to implement PID in line follower?
We will first try to co-relate the variables as given in the PID theory with actual bot sensor values and its environment.. think of your bot as a system which has been kept in a real situation and we have to know how our bot is goin to behave(output) according to set of inputs..
lets first start with only P ie proportioanal control: (simplest)
say, you  first place (initialize) your robot with 8 bit IR sensor in forward position. Now when you switch on the power supply, your circuit becomes active and suppose the first reading that your sensor reads is the desired value (plus minus some error) which the bot should receive as input to keep itself in a straight line right ! Now the real analysis starts on how to write a code for this..
Imagine your bot is initialized on a straight line:(see the image below)
while standing in straight position sensors receive inputs from say four IR pairs(red) and a value is set at initial position as desired value for making the robot move straight "here it is 60, convert it from 8 bit binary value into decimal value ". Now if the bot faces a turn or any other situation on the track, the idea is to compare the value of inputs from sensor "at the turns or while moving on the track" with  desired input we want to receive(60) and align the bot to forward position.. we take the difference (see image below)
which we can call as an error wrt to proportion P ..
say e(error)=current input value - desired value(60)
and according to error e calculated we can tweak "change" the motion of the robot, for eg. if error is there, then make the bot move left or right till the error becomes zero. But to achieve zero error is not advisable so allow plus minus five/ten percent error wrt initialised value so that the robot is able to keep a track of the course and  moves smoothly..
 
This is just the begining with Proportional approach.
if one is able to implement P effectively its enough to work out with the crossover issue..what ever I have written is not a complete solution but an attempt to make you understand how we can actually implement PID.. I and D is definitely the later part which one can add to minimise errors..
keep updating this thread or post so that we can help you on PID implementation in line follower.
Hope it helps

 

Note:- This post has been edited by aamiraarfi at Thu, 01/28/2010 - 20:55.

aamiraarfi
aamiraarfi's picture
User offline. Last seen 1 day 52 min ago. Offline
Joined: 11/02/2009
bOt Points: 417
Video: Amazing Line follower using only Proportional control

simple track

www.youtube.com/watch

 

complex track

www.youtube.com/watch 

 

Make your own line follower and post your video here ..

 

Note:- This post has been edited by aamiraarfi at Thu, 01/28/2010 - 21:14.