Line Follower Basics Available?

Wink setup, hardware, basic programming. User to user support.
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
wclift
Posts: 32
Joined: Sun Feb 07, 2016 6:10 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Line Follower Basics Available?

Postby wclift » Thu Feb 11, 2016 6:40 pm

Does anyone have the basic information on Wink line following sensors? This information doesn't seem to be available in the standard tutorial packets yet.

Kevin
Posts: 180
Joined: Tue Jul 28, 2015 12:56 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Line Follower Basics Available?

Postby Kevin » Thu Feb 11, 2016 6:57 pm

If anyone wants a line following example, contact me through the contact form at the PG website. I'll send you what we used for the KS videos. When I get to that part in the lessons, we'll be re-writing this code to make it more clean. What we have isn't super pretty but it works and you can tune it if you're interested. I didn't want to post it outright because I didn't want it to confuse and/or scare people. :)

User avatar
sil
Posts: 40
Joined: Thu Oct 01, 2015 1:04 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Line Follower Basics Available?

Postby sil » Fri Feb 12, 2016 1:55 am

Take a look in the Ringo code area where i posted my simple line following example. I haven't adapted it for Wink yet but it should be simple to follow if you want to try it yourself. The process I used is based on Ringo which only has two IR sensors underneath.

I started by writing code to read the two sensors and output to the serial port so I could look at the values via the arduino software, now they have the serial plotter this helps immensely. I would place ringo in random locations on my running surface to see the "background" values, and I made a "pad" of the line material to similarly obtain values for the line Ringo would see. This allowed me to be confident that Ringo could "see" the line differently to the background. From this process I had a threshold value where i was confident the running surface would never return a value lower than this threshold and any value below the threshold is either the line or off the edge of the desk.

So my approach in the code loop is to read the left sensor and right sensor in turn then compare them to the threshold value, if one sensor detects the drop (ie the line) then i speed up one motor to turn ringo back to the line again. Simple but its fast and works, and i'm confident about my posted code, its been reliable on different tracks I've made. Its probable not the most elegant code and no doubt the sensor check could be reduced to a function where you call the sensor rather than duplicate the code with different variable names, but thats a future project for me or anyone wanting to play with my code.

My poor Winks are being ignored, I play with my Ringo too much. But the code I posted should work if you change the read sensor numbers the the appropriate numbers for Wink, (I believe Wink has four in a row under the front so use the numbers for the leftmost and rightmost sensors only and ignore the middle two to start with, and i think Wink should line follow happily ( I can see myself trying it this weekend).

I do recommend you have a try, line following sounds like it need complicated decisions but its really simple, I started from nothing except the Ringo guide and avoided looking at plumgeek's code so it didnt influence me and found it a simple exercise and worthwhile doing. Forget the shape of the line, its width can matter though. A piece of black electricians tape on a table top is all you need to start with. I think Wink's IR sensors are much closer than Ringo's so I dont know what width of tape would best suit to start. That also might mean line following needs to be a reversed approach to what I took for Ringo: that is treat the line value as a background and look for a change in value the indicates Wink is seeing the table surface and turn her back to the line.

There's no right or wrong way to approach line following. If you find a method that has your bot following a line thats great. Then you end up wondering why it ran off the line or how to get it to run faster or take tighter turns , let your imagination run wild and try lots of things and enjoy it all the way! :)

User avatar
sil
Posts: 40
Joined: Thu Oct 01, 2015 1:04 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Line Follower Basics Available?

Postby sil » Fri Feb 12, 2016 7:34 am

Sorry, disregard the above. I've been trying to adapt my code but failing, i think i'm not reading the sensors correctly and it seems some command have a different case between ringo and wink, eg Motors() vs motors(). Back to the drawing board for me.

wclift
Posts: 32
Joined: Sun Feb 07, 2016 6:10 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Line Follower Basics Available?

Postby wclift » Fri Feb 12, 2016 7:41 pm


User avatar
sil
Posts: 40
Joined: Thu Oct 01, 2015 1:04 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Line Follower Basics Available?

Postby sil » Sat Feb 13, 2016 3:18 am


TKLG13
Posts: 3
Joined: Wed May 02, 2018 3:43 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Line Follower Basics Available?

Postby TKLG13 » Thu May 03, 2018 5:07 pm

Thanks for the share. I am going to play with the code to see if I can get it running my little bot.


[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Who is online

Users browsing this forum: No registered users and 34 guests