Go Down

Topic: Linefollower, how to make it return to line? (Read 1 time) previous topic - next topic

kefirs9

Hello everyone! I am currently making linefollower based on Arduino Leonardo. I made it very fast, but it gets off the line more often than needed, so i need to know how to make it return to line, preferably near the point it got off it.
This is my current code ( sorry, comments are on Latvian, dont have time to translate )  : http://pastebin.com/vm59k2DQ
and the schematic is pretty close to this one http://www.filedropper.com/arduino only differences is - it uses Leonardo, not Uno, and theres 6 sensors, no sharp sensors. I really need to figure out how to make it return to line. Thank you for support!

PaulS

Quote
but it gets off the line more often than needed

Why? That seems to be what you need to address, rather than figuring out how to find the line again.
The art of getting good answers lies in asking good questions.

JimboZA

I'd agree with PaulS there, and perhaps the problem lies here: "I made it very fast"...... if I was a client for a follower, I would probably (probably, but not necessarily) go with a slower, surer solution than a faster, error-prone one. If the objective is to complete a track in the fastest time, it might actually be quicker in the long run to move slowly but stay on the track. Also, a slower solution might provide a better chance of completing the path at all, regardless of time.

That said, I have little experience with line followers, but thinking about how you would find your path as a human if you went off it, seems to me there are these basic approaches.


  • Reverse: simply stop and go backwards. Unless you changed direction after losing the plot, you should hit the path.

  • Search: where you have no memory of when you were last on the path nor of which was you were facing when you fell off, go look. A human in a field might adopt some kind of outward spiral motion until the path is met, and then attach oneself to that path. You could invoke more sensors than just the down-looking follower ones, perhaps have some out-lookers? There would be no guarantee it's the right path nor that you're facing the right way.

  • Navigate: This would require memory. Some kind of mental map would allow you to navigate straight back to the last known-good point in the journey. That would of course, rely on saving data as you travelled.



I'd be surprised if strategies to find your way back onto a path weren't well documented. Interesting topic....

Jim
Johannesburg hams call me: ZS6JMB on Highveld rep 145.7875 (-600 & 88.5 tone)
Dr Perry Cox: "Help me to help you, help me to help you...."
Your answer may already be here: https://forum.arduino.cc/index.php?topic=384198.0

kefirs9


Quote
but it gets off the line more often than needed

Why? That seems to be what you need to address, rather than figuring out how to find the line again.


I meant it goes off the line like once in three laps, i don't want to make it slower, because i got to compete with other linefollowers, i can still beat them with it going off the line, but returning would be nice.

JimboZA, it has 6 sensors, 3 on each side, and usually when no sensors see anything the line is between them, so it should go forward, when it goes off the line no sensors see anything, so i can't really make it go back or anything else, because it won't go forward when its needed

JimboZA


JimboZA, it has 6 sensors, 3 on each side, and usually when no sensors see anything the line is between them, so it should go forward, when it goes off the line no sensors see anything, so i can't really make it go back or anything else, because it won't go forward when its needed


Yep and you need to think through the steps up to going off.

You can't rely on all sensors seeing nothing, as you say, since you don't know if it's crashed out or going perfect. You need to keep track of the states... if the 3 left sensors all see the line in order from inner to outer you know it veered off to the right. You need to track that, to know if it crashed off or going perfect.

You could consider a central sensor.....
Johannesburg hams call me: ZS6JMB on Highveld rep 145.7875 (-600 & 88.5 tone)
Dr Perry Cox: "Help me to help you, help me to help you...."
Your answer may already be here: https://forum.arduino.cc/index.php?topic=384198.0

kefirs9



Yep and you need to think through the steps up to going off.

You can't rely on all sensors seeing nothing, as you say, since you don't know if it's crashed out or going perfect. You need to keep track of the states... if the 3 left sensors all see the line in order from inner to outer you know it veered off to the right. You need to track that, to know if it crashed off or going perfect.

You could consider a central sensor.....


i can't use more than six sensors, because arduino leonardo has only 6 analog ports, i got an idea, i could try to program something with that 3 sensors see line in order

GunnerCAF

The Leonardo had 12 analog inputs.  Reference:

http://arduino.cc/en/Main/ArduinoBoardLeonardo

Dave

Go Up