Author Topic: How to make alogrith for a artificial intelligence line follower.....??  (Read 26008 times)

0 Members and 1 Guest are viewing this topic.

Offline RITESH29Topic starter

  • Robot Overlord
  • ****
  • Posts: 155
  • Helpful? 0
hi guys,

I have decided to make a line follower robot which sound easier but viewing the arena of it.
makes me confuse how to make control over robot for deciding the right path as give here in end.
http://www.grafest2011.com/pdf/line.pdf


any help will be appreciated,
thanks

Offline newInRobotics

  • Supreme Robot
  • *****
  • Posts: 1,015
  • Helpful? 48
  • N.I.R.
Re: How to make alogrith for a artificial intelligence line follower.....??
« Reply #1 on: October 25, 2011, 01:24:35 AM »
It is possible to use camera and image recognition to recognise T junctions. As path is known in advance, You can define where to turn when junction is approached.

Simpler approach would be to use IR Emitter/Detector sensors. Sensors on the rear of the robot would ensure that bot is on the track and sensors on the front side would be used for junction detection.
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian W

Offline RITESH29Topic starter

  • Robot Overlord
  • ****
  • Posts: 155
  • Helpful? 0
Re: How to make alogrith for a artificial intelligence line follower.....??
« Reply #2 on: October 25, 2011, 02:23:42 AM »
Quote
It is possible to use camera and image recognition to recognize T junctions. As path is known in advance, You can define where to turn when junction is approached.

I don't want to make it complex at begging...

Quote
Simpler approach would be to use IR Emitter/Detector sensors. Sensors on the rear of the robot would ensure that bot is on the track and sensors on the front side would be used for junction detection.

How pls explain and i am using parallax quick start board Spin code...


Thanks

Offline newInRobotics

  • Supreme Robot
  • *****
  • Posts: 1,015
  • Helpful? 48
  • N.I.R.
Re: How to make alogrith for a artificial intelligence line follower.....??
« Reply #3 on: October 25, 2011, 05:46:36 AM »
Quote
Simpler approach would be to use IR Emitter/Detector sensors. Sensors on the rear of the robot would ensure that bot is on the track and sensors on the front side would be used for junction detection.

How pls explain and i am using parallax quick start board Spin code...
As shown in the image below, IR Sensors can be placed next to robot corners (depends on the width of the line it has to follow). Such configuration lets robot understand if the line followed is dead under it. If robot drifts to one side or the other, sensor will be triggered sending signal to the MCU to adjust bot's position so that none of the sensors are detecting white (black) line. So, for robot steering You can use rear end sensors.

Now, for junction detection You can use front end sensors, because when junction is approached, right of left sensor will be triggered letting MCU know that there is right/left turn available.

There are many different implementations of IR Detector/Emitter pairs for line following, this is just a very rough explanation of basic principle.
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian W

Offline RITESH29Topic starter

  • Robot Overlord
  • ****
  • Posts: 155
  • Helpful? 0
Re: How to make alogrith for a artificial intelligence line follower.....??
« Reply #4 on: October 26, 2011, 02:57:41 AM »
HI again,

I want a solution regarding repeating loop and testing condition( spin code)
for eg:-
If defied inputs are matched with statement the outputs goes high in one loop but repeating this loop 2nd time the uC should again check this condition and work...

Till now i have used CASE, IF else statement and waitpeq....they only work once after this they 2nd check condition .

please reply and figure out the problem.

NOTE:- I am testing the inputs to uC with DIP not using sensors just for now and all outputs are seen on paralax QS board LED.

Offline newInRobotics

  • Supreme Robot
  • *****
  • Posts: 1,015
  • Helpful? 48
  • N.I.R.
Re: How to make alogrith for a artificial intelligence line follower.....??
« Reply #5 on: October 26, 2011, 03:38:05 AM »
I'm not sure if I understand You.

If condition in matched once --> something happens.
If same check is done and condition is matched again --> the same thing happens again.
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian W

Offline RITESH29Topic starter

  • Robot Overlord
  • ****
  • Posts: 155
  • Helpful? 0
Re: How to make alogrith for a artificial intelligence line follower.....??
« Reply #6 on: October 26, 2011, 06:47:57 AM »
Hi again,
OK, Do you know spin codes??
propeller uC??

And If i want to add a PID controller to my robots what shouldi do for that??

Offline newInRobotics

  • Supreme Robot
  • *****
  • Posts: 1,015
  • Helpful? 48
  • N.I.R.
Re: How to make alogrith for a artificial intelligence line follower.....??
« Reply #7 on: October 26, 2011, 07:06:20 AM »
I know Propeller uC as of now, because I've just finished reading Wiki about it  ;D No matter that, controll algorithms are programing language independent, so it does not matter what language You use.

I still don't follow You as first You asked something related to if statements and now You are talking about PID.
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian W

Offline RITESH29Topic starter

  • Robot Overlord
  • ****
  • Posts: 155
  • Helpful? 0
Re: How to make alogrith for a artificial intelligence line follower.....??
« Reply #8 on: October 26, 2011, 07:20:10 AM »
Quote
I still don't follow You as first You asked something related to if  statements and now You are talking about PID.

OK, please forget of PID at the movement.

I was testing my code in uC board itself.....
I was trying to write code with dozen of case or if else statement and waitpeq ( wait for pin too go as per logic it pause the up i.e. Cog) these all are syntax.

The code was working well on first attempt mean 1st loop ..after continuing second loop it forget the condition and run on previous value.

I am using DIP switch which are  taking position of LDR sensors just for testing code.!!
So, problem is that the code should check the condition in every loop and process the output not blind outputs.



Offline newInRobotics

  • Supreme Robot
  • *****
  • Posts: 1,015
  • Helpful? 48
  • N.I.R.
Re: How to make alogrith for a artificial intelligence line follower.....??
« Reply #9 on: October 26, 2011, 07:55:33 AM »
code was working well on first attempt mean 1st loop ..after continuing second loop it forget the condition and run on previous value.
Here we go, now I get it  :) To be perfectly honest, I have never done anything related to Spin code or Parallax, so probably I'll be of little use for You. If You run same code in a loop and code is set to read value of the pin every time it is executed, then it should do that. By any chance You could post Your code here, or at least the part of code which implements the loop and pin reading.
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian W

Offline RITESH29Topic starter

  • Robot Overlord
  • ****
  • Posts: 155
  • Helpful? 0
Re: How to make alogrith for a artificial intelligence line follower.....??
« Reply #10 on: October 26, 2011, 09:18:46 AM »
It is something like this:-
VAR
 BYTE A                                                    ' DECLARING A  VARIABLE NAME

PUB LINE                 
A:=INA[16..20]                                           '16 17 18 19 20 AS INPUTS PINS
DIRA[16..22]:= % 0000011              '  0 FOR INPUTS 1 FOR     % FOR BINARY DIGIT

CASE A
        00100: OUTA[21..22]                ' MOVE STRAIGHT
        00010: OUTA[21]                      ' MOVE RIGHT


LIKE THIS.........................
...................
           

Offline newInRobotics

  • Supreme Robot
  • *****
  • Posts: 1,015
  • Helpful? 48
  • N.I.R.
Re: How to make alogrith for a artificial intelligence line follower.....??
« Reply #11 on: October 26, 2011, 04:25:50 PM »
So where is the actual loop which You use to read the pin?
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian W

Offline RITESH29Topic starter

  • Robot Overlord
  • ****
  • Posts: 155
  • Helpful? 0
Re: How to make alogrith for a artificial intelligence line follower.....??
« Reply #12 on: October 26, 2011, 10:31:52 PM »
Hello again,


I am taking help from parallax forum for code help...
so, please help me to design a good mechanical structure which don't exceed 24cm x 24cm.


Offline newInRobotics

  • Supreme Robot
  • *****
  • Posts: 1,015
  • Helpful? 48
  • N.I.R.
Re: How to make alogrith for a artificial intelligence line follower.....??
« Reply #14 on: October 27, 2011, 01:40:50 AM »
It is something like this:-
VAR
 BYTE A                                                    ' DECLARING A  VARIABLE NAME

PUB LINE                  
A:=INA[16..20]                                           '16 17 18 19 20 AS INPUTS PINS
DIRA[16..22]:= % 0000011              '  0 FOR INPUTS 1 FOR     % FOR BINARY DIGIT

CASE A
        00100: OUTA[21..22]                ' MOVE STRAIGHT
        00010: OUTA[21]                      ' MOVE RIGHT


LIKE THIS.........................
...................
          
But seriously where is the loop, all I see is Case that gets executed once. If it's a mock-up code - I don't need it, what I need is actual code from Your project.

please help me to design a good mechanical structure which don't exceed 24cm x 24cm.
Robot in the image above is 240mm x 240mm, so it fits the specs. It is driven by 4 motors (servos), so some feedback is necessary to make sure all 4 wheels keep the same speed. What sort of drive do You have in mind yourself? Is it the one You've sketched?
« Last Edit: October 27, 2011, 02:00:16 AM by newInRobotics »
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian W

Offline RITESH29Topic starter

  • Robot Overlord
  • ****
  • Posts: 155
  • Helpful? 0
Re: How to make alogrith for a artificial intelligence line follower.....??
« Reply #15 on: October 27, 2011, 05:17:21 AM »
Code: [Select]
VAR

  BYTE A ' DECLARING A VARIABLE NAME

PUB LINE

  DIRA[16..22]:= %0000011 ' 0 FOR INPUTS 1 FOR % FOR BINARY DIGIT

  REPEAT
    A := INA[16..20] '16 17 18 19 20 AS INPUTS PINS
    CASE A
      %00100: OUTA[21..22] := %11 ' MOVE STRAIGHT
      %00010: OUTA[21] := 0 ' MOVE RIGHT

I have got it from here http://forums.parallax.com/showthread.php?135399-How-to-make-alogrith-for-a-artificial-intelligence-line-follower.&p=1046929#post1046929


Quote
Robot in the image above is 240mm x 240mm, so it fits the specs. It is driven by 4 motors (servos), so some feedback is necessary to make sure all 4 wheels keep the same speed. What sort of drive do You have in mind yourself? Is it the one You've sketched?

The sketch is drawn by me the robot size can be small also but not exceed.....

I am using 2 motors only given in above link.


Offline newInRobotics

  • Supreme Robot
  • *****
  • Posts: 1,015
  • Helpful? 48
  • N.I.R.
Re: How to make alogrith for a artificial intelligence line follower.....??
« Reply #16 on: October 27, 2011, 07:34:21 AM »
Code: [Select]
VAR

  BYTE A ' DECLARING A VARIABLE NAME

PUB LINE

  DIRA[16..22]:= %0000011 ' 0 FOR INPUTS 1 FOR % FOR BINARY DIGIT

  REPEAT
    A := INA[16..20] '16 17 18 19 20 AS INPUTS PINS
    CASE A
      %00100: OUTA[21..22] := %11 ' MOVE STRAIGHT
      %00010: OUTA[21] := 0 ' MOVE RIGHT

I have got it from here http://forums.parallax.com/showthread.php?135399-How-to-make-alogrith-for-a-artificial-intelligence-line-follower.&p=1046929#post1046929
This code is different from what You've posted before. In this one I see the loop in which pin is checked constantly.

The sketch is drawn by me the robot size can be small also but not exceed.....

I am using 2 motors only given in above link.
Well, if You have rough sketch already - then start working on dimensions and material of the robot. Using CAD software would help You big time.
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian W

Offline RITESH29Topic starter

  • Robot Overlord
  • ****
  • Posts: 155
  • Helpful? 0
Re: How to make alogrith for a artificial intelligence line follower.....??
« Reply #17 on: October 27, 2011, 07:39:53 AM »
Quote
This code is different from what You've posted before. In this one I see the loop in which pin is checked constantly.

Yes, off course these are right code.....


Quote
Well, if You have rough sketch already - then start working on dimensions and material of the robot. Using CAD software would help You big time.

OK, I am new to CAD please tell any link to download and start it as i am Electrical and Electronics student....
and will this 2 motors will be alright??
http://www.google.co.in/search?client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&channel=s&hl=en&source=hp&biw=1440&bih=668&q=freee+download+Cad+software&btnG=Google+Search]
[url]http://www.google.co.in/search?client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&channel=s&hl=en&source=hp&biw=1440&bih=668&q=freee+download+Cad+software&btnG=Google+Search
[/url]

Offline newInRobotics

  • Supreme Robot
  • *****
  • Posts: 1,015
  • Helpful? 48
  • N.I.R.
Re: How to make alogrith for a artificial intelligence line follower.....??
« Reply #18 on: October 27, 2011, 07:49:22 AM »
Yes, off course these are right code.....
If this is the right code, why did You post wrong code before?

OK, I am new to CAD please tell any link to download and start it as i am Electrical and Electronics student....
Well, Google is a good start  ;)

and will this 2 motors will be alright??
I don't know weight of Your bot and radius of it's wheels, hence i cannot know.
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian W

Offline RITESH29Topic starter

  • Robot Overlord
  • ****
  • Posts: 155
  • Helpful? 0
Re: How to make alogrith for a artificial intelligence line follower.....??
« Reply #19 on: October 27, 2011, 08:24:18 AM »
Quote
If this is the right code, why did You post wrong code before?

Hi again,
Because i was not aware of the instuction some people on another forum have figure out the syntax error.

Quote
I don't know weight of Your bot and radius of it's wheels, hence i cannot know.

Bot Specifications
Dimensions and Fabrication
Autonomous bot -
1. Only one autonomous bots per team are allowed. A team may enter with only 1 autonomous bot.
2. The top view of each autonomous bot must fit within a square of dimensions 240mm x 240mm (l x b).
3. Bot must be started individually by only 1 on board switch. However, a team may have a separate on board switch for restart.
4. The autonomous bot(s) must be stable and must stand on its own at the beginning of the run when put in the starting point. Bots not fulfilling this criterion will be disqualified.
5. During the run, the autonomous bot can expand itself provided it does not damage the arena in anyway. However, it is not allowed to leave anything behind or make any marks while traversing the arena. Bot found damaging the arena will be immediately disqualified. The final decision is at the discretion of the organizers.
6. The autonomous bot should not separate or split into two or more units. All bot/units which are touching each other or are in the starting point will be considered as one bot.
The teams are allowed to use ready-made micro-controller boards/ready-made sensor kits. However they are not allowed to use lego kits or any similar assemblies.


I have give the link of motor in above post it has images of motor and tire and battery also.
the size of Tyre is 6cm diameter and .5cm width...

Offline newInRobotics

  • Supreme Robot
  • *****
  • Posts: 1,015
  • Helpful? 48
  • N.I.R.
Re: How to make alogrith for a artificial intelligence line follower.....??
« Reply #20 on: October 27, 2011, 11:20:16 AM »
I have give the link of motor in above post it has images of motor and tire and battery also.
the size of Tyre is 6cm diameter and .5cm width...
OK, so wheel radius is 3cm, however, I still don't know weight of the robot to answer the question about motor suitability.
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian W

Offline RITESH29Topic starter

  • Robot Overlord
  • ****
  • Posts: 155
  • Helpful? 0
Re: How to make alogrith for a artificial intelligence line follower.....??
« Reply #21 on: October 27, 2011, 10:14:16 PM »
Quote
OK, so wheel radius is 3cm, however, I still don't know weight of the robot to answer the question about motor suitability.


Hi again,

I have again the link which tell mooter wt. and battery wt.

the total wt. will be around 500-800gm i think.

Offline newInRobotics

  • Supreme Robot
  • *****
  • Posts: 1,015
  • Helpful? 48
  • N.I.R.
Re: How to make alogrith for a artificial intelligence line follower.....??
« Reply #22 on: October 28, 2011, 12:35:23 AM »
the total wt. will be around 500-800gm i think.
If:
  • Wheel radius = 3cm
  • Bot weight = 0.8kg
then torque of the motor should be around 0.53kgf.cm. Motors You've chosen are rated @ 1.9kgf.cm - so they are all right. Motor seller states that motors are rated @ 375rpm, this gives You 4.23km/h (3.85feet/s), if that is satisfactory - You are good to go.
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian W

Offline RITESH29Topic starter

  • Robot Overlord
  • ****
  • Posts: 155
  • Helpful? 0
Re: How to make alogrith for a artificial intelligence line follower.....??
« Reply #23 on: October 28, 2011, 02:32:22 AM »
Quote
Motor seller states that motors are rated @ 375rpm

The 375 RPM is of no load so it will decrease.....
if the speed create a problem we will add some series resistance, etc.... 
please give me a good design so that today i can ordered it in my local market ( they don't make robot only boxes of etc uses)

One more question how should i charge my lithium  battery, i have not buy any ready made charger for it.

Offline newInRobotics

  • Supreme Robot
  • *****
  • Posts: 1,015
  • Helpful? 48
  • N.I.R.
Re: How to make alogrith for a artificial intelligence line follower.....??
« Reply #24 on: October 28, 2011, 03:06:04 AM »
The 375 RPM is of no load so it will decrease.....
According to details you've provided - each motor has almost 4x more torque than it's required; You are going to use 2x motors, hence ~8x more torque than it's required. Knowing that - RPM will not fall much.

if the speed create a problem we will add some series resistance, etc....
Bad idea, as voltage drop created by resistor will not only decrease RPM, it will also reduce torque. As You'll be using microcontroller (unless You hope to build beam bot line follower which can make decisions on every junction (which would be really difficult to achieve (if possible at all))), it's a good idea to drive motors using PWM; that way You can controll motor speed without sacrificing torque.

please give me a good design so that today i can ordered it in my local market ( they don't make robot only boxes of etc uses)
Completing design stage is homework that has to be done by You and only You, because You and only You know exactly what You want to achieve and implement. There are many line follower designs online to assist You. Start by using Your best friend Google  ;) Also, good design takes long time to develop, hence do not expect other people to do it for You. When You have primary design ready, specific question can be asked in forum in order to perfect it.

One more question how should i charge my lithium  battery, i have not buy any ready made charger for it.
You cannot charge Li-Ion battery without a proper charger. Charging Li-Ion without setting something on fire is art in its own right. Charging single Li-Ion cell is relatively difficult, when it comes to battery packs, one has to employ witchcraft  ;D So, either You have to buy ready made charger, or be really competent in electronics to build one Yourself.
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian W

Offline RITESH29Topic starter

  • Robot Overlord
  • ****
  • Posts: 155
  • Helpful? 0
Re: How to make alogrith for a artificial intelligence line follower.....??
« Reply #25 on: October 28, 2011, 03:16:41 AM »
Quote
You cannot charge Li-Ion battery without a proper charger. Charging Li-Ion without setting something on fire is art in its own right. Charging single Li-Ion cell is relatively difficult, when it comes to battery packs, one has to employ witchcraft  Grin So, either You have to buy ready made charger, or be really competent in electronics to build one Yourself.

So, what should I do for charging battery without any hazard??

Offline newInRobotics

  • Supreme Robot
  • *****
  • Posts: 1,015
  • Helpful? 48
  • N.I.R.
Re: How to make alogrith for a artificial intelligence line follower.....??
« Reply #26 on: October 28, 2011, 03:21:17 AM »
Buy an approved LI-Ion charger that is rated for the battery You want to charge.
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian W

Offline RITESH29Topic starter

  • Robot Overlord
  • ****
  • Posts: 155
  • Helpful? 0
Re: How to make alogrith for a artificial intelligence line follower.....??
« Reply #27 on: October 28, 2011, 03:33:57 AM »
OK< please tell me circuit or some link will that link will work that i have give robotkits.co.in

Offline newInRobotics

  • Supreme Robot
  • *****
  • Posts: 1,015
  • Helpful? 48
  • N.I.R.
Re: How to make alogrith for a artificial intelligence line follower.....??
« Reply #28 on: October 28, 2011, 03:43:58 AM »
Mate, You have to do decent amount of research before You start any project. Previously You've posted a link to battery pack You are willing to use, go to that page and You will find compatible chargers.
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian W

Offline RITESH29Topic starter

  • Robot Overlord
  • ****
  • Posts: 155
  • Helpful? 0
Re: How to make alogrith for a artificial intelligence line follower.....??
« Reply #29 on: October 28, 2011, 04:17:10 AM »
OK, you suggest me to buy which chargers
http://robokits.co.in/shop/index.php?main_page=index&cPath=13
Thanks

 


data_list