Is it possible to program the movement of a line tracing robot depending on the color it will sense? For example, the robot sensed the color red, it will follow a specific line going to a certain place. If it sensed green, it will follow another line and go to another place. If yes, how? i have been trying to do it for weeks but i just can't =(
Are you talking about a line-following robot that can be set to follow a particular color of line so that different robots on the same surface could be following different lines?
No sir, i mean one robot just following a black line. For example, the robots sensed red, it will move forward and then right. If green, forward then left. If blue, forward then stop. Is it possible?
Yes, but you will need a sensor that can differentiate between colours.
There is a relatively checap color sensor you can use as long as you shroud the sensor and keep it close to the line. It is a TCS230 and is available in many places (try eBay) mounted on a breakout board. I happen to just have finished writing a library for it (see the link in my signature block) in the last few days :).
The sensor is quite good at detecting color and I have written code to color match (once it has learned a table of colors) that is part of the examples in the library. The bigger the difference the better the discrimination(clearly), so for a couple of colors (say red, green and blue) you should be pretty ok.
There is a PDF in the library download that discusses the sensor and how it works.
weRyoung:
No sir, i mean one robot just following a black line. For example, the robots sensed red, it will move forward and then right. If green, forward then left. If blue, forward then stop. Is it possible?
Are the colors going to be inserted in the black line? Next to the black line? At the end of the black line?
After after the robot performs the desired action does it go back to looking for a black line to follow?
johnwasser:
weRyoung:
No sir, i mean one robot just following a black line. For example, the robots sensed red, it will move forward and then right. If green, forward then left. If blue, forward then stop. Is it possible?Are the colors going to be inserted in the black line? Next to the black line? At the end of the black line?
After after the robot performs the desired action does it go back to looking for a black line to follow?
No sir, the colors are not part of the line track. The line track has three destination points from 1 starting point. If i put something red in front of the color sensor, it will follow the line going to destination 1. If i put something green in front of the color sensor, it will follow the line going to destination 2. And if i put something green in front of the color sensor, it will follow the line going to destination 3. (All lines are just black)
OK, so the color sensor is just a switch.
The hard part will be deciding which part of the black line to follow. How is the black line drawn to get to the three destinations? Is the line split into two twice or is there a three-way split? I think two-way splits would be easier: right, left then right, left then left. With a three-way split it might be hard to follow the middle path.
johnwasser:
OK, so the color sensor is just a switch.The hard part will be deciding which part of the black line to follow. How is the black line drawn to get to the three destinations? Is the line split into two twice or is there a three-way split? I think two-way splits would be easier: right, left then right, left then left. With a three-way split it might be hard to follow the middle path.
So it is better to use line track2 than line track1? (Pics of the line tracks are below)
Yes
Each destination can be reached by following a set of rules that could be set by reading a colour sensor
weRyoung:
So it is better to use line track2 than line track1?
Yes, but I would use gradual splits and gentle curves. It's harder to make a line follower work with sharp turns in the path.