Arduino Forum

Topics => Robotics => Topic started by: zakirox on Jul 04, 2014, 10:49 pm

Title: artificial intelligence robot.
Post by: zakirox on Jul 04, 2014, 10:49 pm
Hi every one;
this seems to be a silly question. but any way i would like yo ask you all. what is an artificial intelligence robot?  my friends say that it is a robot which will act according to human interaction, with the knowledge of self programming :smiley-eek-blue: . now i am making an my first simple obstacle avoiding robot will it be an artificial intelligence robot  XD ? if not could you please explain me explain me a bit more about this artificial intelligence robot  :smiley-red:
thank you in advance  :smiley-sad-blue: don't think me as a fool
Title: Re: artificial intelligence robot.
Post by: steinie44 on Jul 04, 2014, 11:11 pm
Artificial intelligence robot can operate without human interaction.
Using sensors to avoid obstructions and perform or reach a goal.
A RC car is not a artificial intelligence robot, as it needs a human to operate it.
Title: Re: artificial intelligence robot.
Post by: zakirox on Jul 04, 2014, 11:15 pm
i am not going to make it rc control, its an obstacle avoidance robot with using ultra sonic sensors. so will it be an artificial intelligence robot?  :smiley-mr-green: sound like bad i think  :smiley-yell:
Title: Re: artificial intelligence robot.
Post by: steinie44 on Jul 04, 2014, 11:26 pm
Yes and No, I would call it a hybrid.
Quote

i am not going to make it rc control

[EDIT]
Sorry I misread your post. Yes, It will be a artificial intelligence robot.
Title: Re: artificial intelligence robot.
Post by: zakirox on Jul 04, 2014, 11:45 pm
=( i am bit confused with this. i want's to do some more research on this topic. if you would like to help me post some links if possible. thank you   
Title: Re: artificial intelligence robot.
Post by: keeper63 on Jul 05, 2014, 08:28 am

what is an artificial intelligence robot?  


Well - let's look at a couple of definitions, shall we?

http://en.wikipedia.org/wiki/Artificial_intelligence

"Artificial intelligence (AI) is the intelligence exhibited by machines or software."

"John McCarthy, who coined the term in 1955, defines it as 'the science and engineering of making intelligent machines'..."

"The central problems (or goals) of AI research include reasoning, knowledge, planning, learning, natural language processing (communication), perception and the ability to move and manipulate objects."

Ok - so basically, for a system to exhibit "artificial intelligence", it needs to be a system which exhibits "intelligence", through the application of "reasoning, knowledge, planning, learning, natural language processing (communication), perception and the ability to move and manipulate objects" - that's the basics. If you system does not do that, it cannot be said to embody "artificial intelligence".

http://en.wikipedia.org/wiki/Robot

"A robot is a mechanical...agent, usually an electro-mechanical machine that is guided by a computer program or electronic circuitry."

So a robot is a machine, guided by a computer (generally, but not always) running a stored program that controls and guides it.

So - what would be an "artificial intelligence robot"? Well, I would say (mashing up these definitions):

"...is an electro-mechanical agent, guided by a computer program and/or electronic circuitry which exhibits intelligence via the application of reasoning, knowledge, planning, learning, natural language processing (communication), perception and the ability to move and manipulate objects..."


my friends say that it is a robot which will act according to human interaction, with the knowledge of self programming


Well - not "according to human interaction", but rather "separate or without human interaction" (maybe something got lost in translation, though); in other words, such a robot does not depend upon human interaction (with the exception of turning it on) to be able to navigate, explore, map, understand, interact with, etc - it's environment. In other words, it is an intelligent agent that exists and is aware of it's environment; it doesn't need direction or control from a human to make decisions about how to navigate or otherwise understand that environment. The program which controls the robot keeps track of what it has seen in the past, how it has handled past problems, and/or what the best methods were to solve such problems (such as an obstacle in its way, for instance).

To that end, such a program controlling the robot is "self programming" - it is constantly updating it's understanding of the environment based on the continuous monitoring of sensors versus what it's commands to it's "effectors" were. For instance, if it commands it's arm to move near an object to grab it, it needs to know whether it was successful at grabbing the object, and if not, why - so that next time it tries it will have more knowledge about the situation to try something slightly different (and hopefully be more successful).


now i am making an my first simple obstacle avoiding robot will it be an artificial intelligence robot?


If it just has a simple loop that says "if I sense the object over here, turn in the opposite direction"; then no - that isn't "artificial intelligence".

If instead, you had sensors to detect collisions, and you wrote the code to say "I sense an object in front of me, make a random decision to turn n-degrees in a random amount and continue to drive forward - did I make it? If yes, add that value (plus others - speed, distance to object, etc) to an array, plus a 'success factor' - a number between 0 and 10; the higher the number, the better the success. If not, add that to the array, plus the factor. Next time, look at the array, try something with a high score that matches something close to what you are sensing this time - if it works, increase the value of the factor, if it doesn't, decrease it. If you can't find a match, try another "random" direction selection".

Ok - now that is a lot more complex (and I have probably left some stuff out - but I hope you understand what I am getting at with it) - basically, the system knows nothing about its environment, but over time, by trying random combinations (only after consulting it's "memory" of past successful moves that matched within a certain percentage of the "current" sensing) - it builds up a knowledge base of what and how it most successfully avoided an obstacle.

Something really similar could be done to build up a "map" of the environment the robot is in (this is really complex, by the way - it goes by the acronym of "SLAM" - Simultaneous Localization And Mapping); don't think about trying to implement something like SLAM on an Arduino Uno - while you could implement something extremely simplified, it might also be an exercise in frustration. A better platform for such experimentation (if you wanted to stick with an Arduino, that is) would probably be a Mega2560 with a SRAM expansion board.


if not could you please explain me explain me a bit more about this artificial intelligence robot


I hope the above helps you understand the difference between a robot that is simply programmed by its builder, and one that - while it has a program - is capable of learning about its environment by trial and error, building up a knowledge representation map of these interactions. From there, things can get complicated very quickly.
Title: Re: artificial intelligence robot.
Post by: JimboZA on Jul 05, 2014, 09:09 am
Quote
If it just has a simple loop that says "if I sense the object over here, turn in the opposite direction"; then no - that isn't "artificial intelligence".

If instead.... you wrote the code to say <sense stuff, make "random" decisions, store the result and try the best results next time>.


So what's artificial about that? It's no more artificial than the first part.  It's code that instructs the robot to do what you think it ought to do. Why a score between 0 and 10?- that's your intelligence, not the robot's. The notion of comparing things and choosing better ones is merely your intelligence, in code.

Even if a robot....

Quote
is capable of learning about its environment by trial and error, building up a knowledge representation map of these interactions


.... that's your intelligence, not the robot's.

I'm not sure there's any such thing as "artificial" intelligence.

Title: Re: artificial intelligence robot.
Post by: vffgaston on Jul 05, 2014, 10:22 am
Hi all,

cr0sh post is, in my opinion, a master one. ¡Congratulations! (Yes, whith the two exclamation simbols; it deserves them).

Just to explore other way: mathematicians say that a machine has AI if you can chat with it an you don't notice it's not human (HAL?. Of course, the term robot is used here in a more general way).

Regards
Title: Re: artificial intelligence robot.
Post by: JimboZA on Jul 05, 2014, 01:26 pm

cr0sh post is, in my opinion, a master one. ¡Congratulations! (Yes, whith the two exclamation simbols; it deserves them).


What cr0sh puts forward is an expert system: it relies on an algorithm based on how an expert would handle the circumstances. The algorithm is turned into code, and then the device behaves as the expert would have.
Title: Re: artificial intelligence robot.
Post by: steinie44 on Jul 05, 2014, 01:27 pm
Quote

Just to explore other way: mathematicians say that a machine has AI if you can chat with it an you don't notice it's not human (HAL?. Of course, the term robot is used here in a more general way).

And so is artificial intelligence robot used here in a more general way.
Title: Re: artificial intelligence robot.
Post by: zakirox on Jul 05, 2014, 02:04 pm
hi cr0sh ;

Quote
If it just has a simple loop that says "if I sense the object over here, turn in the opposite direction"; then no - that isn't "artificial intelligence".


then if a loop that says "if I sense the object over here, turn left and turn right" then find the best direction where to turn. So what you thing about this ?  will it be an intelligent
Title: Re: artificial intelligence robot.
Post by: JimboZA on Jul 05, 2014, 02:20 pm

then if a loop that says "if I sense the object over here, turn left and turn right" then find the best direction where to turn. So what you thing about this ?  will it be an intelligent


It's expert, because you had to code into it how to "solve" the problem, based on your expert opinion.
Title: Re: artificial intelligence robot.
Post by: steinie44 on Jul 05, 2014, 02:38 pm
Quote

Quote from: zakirox on Today at 08:04:04 am
then if a loop that says "if I sense the object over here, turn left and turn right" then find the best direction where to turn. So what you thing about this ?  will it be an intelligent

It's expert, because you had to code into it how to "solve" the problem, based on your expert opinion.

Are we talking 'artificial intelligence' or 'intelligence'?
There is a big difference.
Title: Re: artificial intelligence robot.
Post by: zakirox on Jul 05, 2014, 03:01 pm
hi JimboZA;
Quote
It's expert, because you had to code into it how to "solve" the problem, based on your expert opinion.

i am preparing my coding now onward. i just ordered a robot chassis on ebay and i am waiting till it arrive  ;). here is a piece of my code below.

Code: [Select]
//If object detected < 5 cm, check for new course
       if (distance < 5){
            digitalWrite(redLed, HIGH);
            digitalWrite(greenLed, LOW);
            tone(speaker, 1000);  //Speaker on
            //First Stop the robot:
            digitalWrite(motorPin1, LOW);digitalWrite(motorPin2, LOW);
            digitalWrite(motorPin3, LOW);digitalWrite(motorPin4, LOW);
            //Now, check space for obstacles:
            for(pos = 10; pos < 170; pos += 1){  // goes from 10 degrees to 170 degrees
                myservo.write(pos);              // tell servo to go to position in variable 'pos'
                delay(10);                       // waits 10ms for the servo to reach the position
            }
            checkLeft = sensor.Ranging(CM);
            for(pos = 170; pos>=11; pos-=1){     // goes from 170 degrees to 10 degrees                           
                myservo.write(pos);              // tell servo to go to position in variable 'pos'
                delay(10);                       // waits 10ms for the servo to reach the position   
            }
            checkRight= sensor.Ranging(CM);
            myservo.write(90);                   // Sensor "look" forward
            //Finally, take the right decision, turn left or right?
            if (checkLeft < checkRight){
               digitalWrite(motorPin1, LOW) ;digitalWrite(motorPin2, HIGH);
               digitalWrite(motorPin3, HIGH);digitalWrite(motorPin4, LOW);
               delay(1200); // delay, change value if necessary to make robot turn.           

            }
            else if (checkLeft > checkRight){
               digitalWrite(motorPin1, HIGH);digitalWrite(motorPin2, LOW);
               digitalWrite(motorPin3, LOW) ;digitalWrite(motorPin4, HIGH);
               delay(1200); // delay, change value if necessary to make robot turn.
            }
           
       }
       //No object detected? Ok... all crear to move forward! 
       else {
        digitalWrite(motorPin1, HIGH); digitalWrite(motorPin2, LOW);
            digitalWrite(motorPin3, HIGH); digitalWrite(motorPin4, LOW);
            digitalWrite(redLed, LOW);
            digitalWrite(greenLed, HIGH);
            noTone(speaker); //Speaker off
       }
           delay(50); //small delay to read a new distance value from sensor
    }


dear steinie44;
Quote
Are we talking 'artificial intelligence' or 'intelligence'?
There is a big difference.


i am sorry, i am talking about artificial intelligence
Title: Re: artificial intelligence robot.
Post by: keeper63 on Jul 06, 2014, 01:24 am

What cr0sh puts forward is an expert system: it relies on an algorithm based on how an expert would handle the circumstances. The algorithm is turned into code, and then the device behaves as the expert would have.


No - I am not postulating on an "expert system":

http://en.wikipedia.org/wiki/Expert_system

"In artificial intelligence, an expert system is a computer system that emulates the decision-making ability of a human expert. Expert systems are designed to solve complex problems by reasoning about knowledge, represented primarily as if-then rules rather than through conventional procedural code."

Those "if-then" rules are also typically represented in a "fuzzy logic" manner; the output of an expert system is typically given in percentages - that is, when the solution of the expert system is arrived at, via the user answering a series of questions presented by the expert system - the solution will be something like "...with 97.32 percent certainty" - or similar output.

What I was proposing was more akin to a machine learning algorithm - and I was trying to simplify the explanation of the process in such a manner without having to get into some of the more esoteric areas of artificial intelligence research - which I admit that I am not an expert on myself - but I have studied the topic at a hobbyist level, and I also took the following courses and passed them (both were very fun and informative):

https://www.coursera.org/course/ml

https://www.udacity.com/course/cs373

BTW - here's an example of self-learning robotic car (namely a neural network) that came out of the ML course (which I originally took when it was presented by Stanford in the Fall of 2011 - the Coursera version of the class came later, but it's the same course):

http://blog.davidsingleton.org/nnrccar/

Anyhow - my point is that what I was trying to describe was an algorithm that attempts to learn which direction to turn best, based on input parameters. Those parameters could be numerous, but imagine a system where the robot "scans" (with an ultrasonic sensor) the area in front of it. It could potentially have multiple obstacles in front of it, at different locations and distances. Now - when it scans, it could build up a "knowledge map" of where things were and how far away they were, then use that information to try to look up in its past knowledge map of what it did in the past, and how successful it was. If it finds something in that map, it could try it out. If it works - then great, update the map to say that it worked again, with a greater probability (my number was "0-10" - 0 being least likely, 10 being most likely; you could easily use a number between 0 and 1 if you would rather work with floating point values, but I was again simplifying things). If it doesn't, lower the probability, then try something else (either re-select out of the knowledge map, or try a random choice of direction, and update the map with that new choice and it's outcome for future tries).

BTW - I am using "knowledge map" here meaning something akin to an array list - not any actual "map" or anything, just to be a bit more clear.

You should be able to see that there isn't any explicit "if this, then turn this way, else turn that way" logic. At first (because the knowledge map is empty) - it's a random choice based on the inputs (what the robot senses); then as the knowledge map is built up, and there exist potential matches (notice I say "potential" - all of this stuff is based on probability matches - not -exact- matches) - those may be tried instead, and depending on how things work out (ie - does the robot get unstuck or does it collide with the object it was trying to avoid?) - the knowledge map is updated (ie - the probability scores for the selected action), etc.

I can't really make it any more clear, only to say it isn't an expert system, it's not a set of rules, and that the program in the computer (controller, mcu, etc) updates it's internal set of states (ie - it's knowledge map of what to potentially try and do based on it's sensor readings) in a continuous fashion as it explores the world. Initially that "map" is empty, but over time it builds it up - hopefully improving as it goes along.
Title: Re: artificial intelligence robot.
Post by: keeper63 on Jul 06, 2014, 01:32 am

i am preparing my coding now onward. i just ordered a robot chassis on ebay and i am waiting till it arrive  ;). here is a piece of my code below.


What you coded is not artificial intelligence - it's also not an expert system. It is merely a simplified decision tree of sorts to potentially avoid obstacles based on what the sensor(s) report.

There is no self-learning involved in the decision tree; it will always make the same decisions given the same inputs.

I am not saying that such code can't work - I am just saying it is not artificial intelligence. An artificial intelligence algorithm - if it were implemented - would actually behave quite poorly at first. The robot would blunder into things, wouldn't be able to get "un-stuck", etc. But over time, it should be able to learn how to avoid obstacles (with only the occasional blunder).

Now - that isn't to say that eventually, it wouldn't "evolve" the same rules that you (as a programmer) could hard code into the system in the beginning. What it might do, though, is come up with a far better set of rules that would work for most cases. Then again, it might not - it might actually evolve a set of rules that are sub-optimal (this is called "getting stuck in a local minima").

I am not sure what it is you are wanting to implement; a simple set of rules for obstacle avoidance, like you have coded (note - I didn't review the code enough to know if your code will actually work as you intend it to) - or if you are wanting a robot to self-learn those rules by blundering around and figuring out the rules itself...
Title: Re: artificial intelligence robot.
Post by: zakirox on Jul 06, 2014, 01:00 pm
yes  cr0sh i agree you but could you please post me an better link to know more about AI. even though i search in google i am unable to find a proper one  :smiley-eek-blue:
Title: Re: artificial intelligence robot.
Post by: keeper63 on Jul 07, 2014, 02:51 am

yes  cr0sh i agree you but could you please post me an better link to know more about AI. even though i search in google i am unable to find a proper one  :smiley-eek-blue:


The thing is, your not going to find much on simply googling "artificial intelligence" - it would be like expecting to learn how to program in C++ by googling "computer science" (not the greatest analogy, but good enough for now I think).

If you really want to learn about artificial intelligence - you'll need a foundation to work from, and you'll need to put in the work. I posted a couple of links to courses via Coursera and Udacity. Take a look at those, and maybe also other coursework those organizations offer. Neither course will be easy (although I found the Coursera ML Class to be easier than the Udacity class) - you will need to have good grounding in statistics, probabilities, and linear algebra to make headway and understanding. Each course takes about 6 to 8 weeks to complete (working a few hours each evening, plus some extra on weekends).

Once you have that understanding, then you can start looking into machine learning concepts outside that scope, plus topics on neural networks and such. I have to also say that the Udacity course, while the more difficult of the two, will give better understanding on how to relate artificial intelligence and machine learning concepts to a robot - since that is the point of the course, to teach you how to "build" a self-driving vehicle - it is after all taught by the guy behind google's self-driving car.

There is so much information out there on such a vast and wide array of topics under the "artificial intelligence" umbrella; many of them relate to robotics, but you have to understand and have that foundation to know how they relate. Also - much information is only available in book form, so you may want to build your library.

Also - you may want to check out this Udacity course as well:

https://www.udacity.com/course/cs271

It was first released as a Stanford class back in 2011 as well (I took it but had to drop out about halfway through due to personal issues). When it was taught then, you had to get this book for the class - which is a great book to learn from (it's a textbook, though - so realize that if you get a recent edition, expect to pay a lot of money):

"Artificial Intelligence: A Modern Approach"

http://aima.cs.berkeley.edu/

Finally - though these books should be considered "dated" - I like to recommend them; they are mainly an example of something now known as "subsumption architecture". At the time (late 1970s - early 1980s) which was before Rodney Brook's machines - the author was just playing around with some interesting "homebrew" technology of sorts. In the end, his machine that he named "Rodney" became this robot, which was sold for a while for educational purposes:

http://www.rbrobotics.com/Products/RB5X.htm

Anyhow - the author's name is "David L. Heiserman" - his books are:

Build Your Own Working Robot - #841 (ISBN 0-8306-6841-1), HB, © 1976
How to Build Your Own Self-Programming Robot - #1241, (ISBN 0-8306-9760-8), HB, © 1979
Robot Intelligence...with experiments - #1191, (ISBN 0-8306-9685-7), HB, © 1981
How to Design & Build Your Own Custom Robot - #1341, (ISBN 0-8306-9629-6), HB, © 1981
Projects in Machine Intelligence For Your Home Computer - #1391, (ISBN 0-8306-0057-4), HB, © 1982
Build Your Own Working Robot - The Second Generation - #2781, (ISBN 0-8306-1181-9), HB, © 1987

Note that all of these are long out-of-print - if you want to read them, you'll have to purchase them used or find another source. They are very interesting to read, and give a great idea about the "state-of-the-art" in hobbyist robotics for the time period. Virtually all the examples contained in those books could be easily re-created using an Arduino and a simple robotics platform (heck, you could probably do most of it with the Arduino Robot). But again, they shouldn't be thought of as teaching "modern techniques of artificial intelligence" - they need to be looked at and understood with hindsight from today's understanding and knowledge (that's also one of the problems with AI - being able to know what "old stuff" is still relevant, and what isn't).

Title: Re: artificial intelligence robot.
Post by: zakirox on Jul 07, 2014, 01:24 pm
You are an awesome buddy thanks a lot man  ;) ;) ;) ;) ;) ;) ;)
Title: Re: artificial intelligence robot.
Post by: oric_dan on Jul 11, 2014, 01:58 am
Subsumption architecture, that cr0sh mentioned, is probably the most popular programming scheme for small robots. There are 2 classic books on this by Joe Jones. The first one has much material on both building the hardware and also writing subsumption code [it's all in C], and although a little old it's still the best introductory book, AFAIAC. Things haven't changed a lot since then, in regards small hobbyist robots, except that now you can buy a lot more hardware kits. The 2nd book goes more deeply into software and sensor issues.

http://www.amazon.com/Mobile-Robots-Inspiration-Implementation-Second/dp/1568810970

http://www.amazon.com/Robot-Programming-Practical-Behavior-Based-Robotics/dp/0071427783

The single most important aspect to building a successful robot is to have several different kinds of sensors that complement each other, as single sensors tend to be too unreliable.