|
|
View previous topic :: View next topic |
Author |
Message |
Cable Guy
Joined: 09 Jan 2008 Posts: 4 Location: Malaysia
|
Need code for a line follower robot. |
Posted: Sat Jan 12, 2008 1:07 am |
|
|
Can someone posts me CCS code for line follower robot using PIC 16F877A?
I use two LDR sensor for my mobile robot... _________________ Lets Rock n' Roll |
|
|
Ttelmah Guest
|
|
Posted: Sat Jan 12, 2008 9:41 am |
|
|
You are going to have to write this yourself, since it is not a 'generic' solution. The code needed will vary, with how the sensors respond, and how your motors a controlled. The basic flow chart is simple:
Code: |
If right hand sensor seing more line than left hand sensor, then steer right
If left hand sensor seeing more line than right hand sensor, then steer left.
|
If your motors support variable speed, then the 'steer', can be to just change the speed a little. For an improved ability to track sudden turns, then in each direction, you can also check for an 'extreme' change in the light, and in this case, steer much harder, by stopping one motor.
Any 'example' codes around, will be for specific hardware combinations.
Really efficient algorithms, will also respond to the rate of change of the signals, to help avoid overcorrection.
Best Wishes |
|
|
John P
Joined: 17 Sep 2003 Posts: 331
|
|
Posted: Sat Jan 12, 2008 11:19 am |
|
|
Here's an article in the Seattle Robotics Society newsletter by a guy who built a line-following robot, and he even includes some code! Trouble is, it's for one of those disgusting Atmel processors. He also used 6 (yes, six) sensors, for reasons I don't understand. It looks as if he's calculating a "position of robot relative to line" as if there were a TV camera attached; maybe this is more than you really need.
http://www.seattlerobotics.org/encoder/200610/article2/index.php |
|
|
Ttelmah Guest
|
|
Posted: Sun Jan 13, 2008 10:57 am |
|
|
There are several CCS projects to do this, but the problem is that you basically _must_ have the same hardware for them to work.
A google search for 'Ed Waugh track following robot", will find an 'oldie'. The 'hyperembedded' blog, also had some stuff on this.
At the end of the day, the way to make this work, is to write code to drive your motors. First a simple 'go ahead' routine, then turn left/right routines. Then work out what values your sensors give for 'on line', 'right', and 'left', and then put these together. The work, is in these parts, rather than the line folowing...
Best Wishes |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|