Asked — Edited

## If You Want Your Robot To Have More A.I.

All you professional programmers. This is a Chalenge to you.

The algorythm below is what I am trying to accomplish on my robot. It is NOT a program, but just an idea. If this works, we will have not only an autonymous robot, but one that will be able to LEARN and Improve over time.

Anyone is welcome to tackle it. If you succeed, please POST the code.

This should be changed into code and Placed inside your Navigation script.

Initialize Set ConfidenceLevel to 3 #a group of any actions could be more or less than 16 but I have actions (0-15) Actions: 0=sleep 1=Forward 2=Backward 3=TurnLeft 4=TurnRight 5=Spin Around 6=playExplore 7=LookCenter 8=LookLeft 9=LookRight 10=LookUp 11=LookDown 12=GiveTimeDateDay 13=checkSonars 14=Check4Lifeforms (ScanPIR) 15=Laugh

While navigating:

Generate Unique Random Number (RN) (0-15) choose action (that random number) Read LastMove if last move=bad then (confidence level=confidenceLevel -1) if last move=good then (confidence level equal ConfidenceLevel +1) if ConfidenceLevel more than 3 then confidenceLevel=3 if ConfidenceLevel less than 0 then confidenceLevel=zero if confidenceLevel greater than Zero then confidenceLevel=good if confidenceLevel =zero then goback and generate New RN and start over at the top read status of sonars if status= good then confidenceLevel =(confidenceLevel+1) if status=good then preform Action if status=bad then confidencelevel=(confidenceLevel-1) if status=bad then goback and generate new RN let lastmove=newmove save status save lastmove

We would also listen for the word "No!" if we heard that, Confidencelevel would shrink to Zero also we listen for the word "GOOD!" if we heard that, confidencelevel would be equal to 3

This is a very CRUDE representation of this Algorythm, but, By doing this, the robot could be trained and have More accuracy and Learning. he would be smarter. He will know Good from Bad. Bad would be like running into something. Good would be clear path, etc.

Hope you understand what I am trying to accomplish. If I were a good programmer, it would have already been done.

### Upgrade to ARC Pro

Experience early access to the latest features and updates. You'll have everything that is needed to unleash your robot's potential.

#1

What the Robot will do is that he will react to your algorythm. You are giving him an Environment and sixteen or more actions to preform. You are simply telling him not WHAT to do, but that he MUST do something. HE chooses and decides which action to take by himself. When he makes his choice it will be either a Good choice or a BAD choice. His confidence will be Raised or Lowered with each deciscion that he makes. Over time, he will LEARN much like we do by DOING. After a while, he should exibit Emergent Behavior. Later on, we could make his decisions based on EMOTIONS also to influence his choice. For instance, he may be AFRAID of the Dark , so he will run away from it and seek the light. He may not like HIGH VOLUMES in audio. He may go to somewhere quite to relax. He may run toward you if he is not affraid or he may Avoid you if he doesn't like you. ALL of these choices are UP TO HIM! This way you are giving him FREE AGENCY like our Heavenly Father gave us when we came to the Earth to be tested. HE will choose his own Destiny being a FREE robot, not a Slave.

Hope some of you can do this. It would REALLY help the robot to be more human like.

I have been trying this for the last 20 years of robot building. But, I am simply NOT a professional programmer.

Good LUCK!

#2

Let me know if YOU are going to accept the Challenge. :D

United Kingdom
#3

That would be just a sub-minutia (spelling?) of AI. It can easily be expanded on in so many ways. You could have a list of "good" actions and a list of "bad" actions rather than a list of mixed, a range scale for good and bad where good is one end, bad the other, to begin with from being "new born" it's a 50/50 split... the more you please him, the bigger the good gets and smaller the bad gets, the more you upset him the bigger the bad gets and smaller the good.

For instance, say the Good/Bad (or behaviour) scale is a range from 0 to 99. To begin with any random number from 0 to 49 triggers the good list, anything from 50 to 99 triggers the bad list.

Now, say you play with the robot... program it to be able to play hide and seek or tag or something. You play, he is happy, the good range increases by a set amount (dependant on the activity), causing the random events to be more good than bad.

Say you knock him (throw in tilt sensors, touch sensors etc. I don't know), ignore him for too long, let his battery die too often... that increases the bad scale.

It probably wouldn't be too difficult to do this and when I get more advanced in my builds and more so the programming side and using the SDK etc. I'll certainly be looking to add in some artificial behaviour... I have a lot of AI ideas and brainstorms from years back when I was attempting to program video games, I'll see if I can dig them out.

PRO
Synthiam
#4

That's a good start but it you'd need to define how a "last move" was "good" or "bad".

Within robotics, the concept of A.I. can only be evaluated when the robot is doing something based on a reason. Without a reason, purpose, or goal - there is no intelligence. The concept behind A.I. is to have the robot understand multiple paths to achieve the goal.

1. Define your goals.
• Find red object
• Find a human face
• Ask if anyone is in the room
• etc
1. Create actions (scripts) for each goal.

2. Create a variable called something like \$AISuccess. Every "Action" can set that variable when it exits/completes

3. Have a master AI script that determines what to do next based on the \$AISuccess value

Although, what I just described is how the personality generator runs. But the \$AISuccess thingy is hidden. There is no way to set whether it passed or not. The Personality Generator merely prevents too many of the same action from running in sequence.

#5

MEL already knows how good the AI software we are using in other club we both are in,i guess trying to bring up a few points about it.

PS MEL dont say the name DJ will be very mad and may ban you Best way is use a email if needed,also heard really from DJ he doesnt want any software name metion here,this is what the forum rules are about it (Robots built with other platforms) in forum etiquette. So i dont bring up the name ever,but i do see many many other posts say about other software and boards like arduino. So i guess nobody cant bring any info thaey have on AI SOFTWARE OR ANY OTHER TYPE Not a good idea,but i guess he can make the rules

#6

that a good point DJ,it seems EZB is getting better and bter each day with good ideas where is \$AIsuccess, cant it be used in a script,you say its hidden forget that question i see the answer already

Some of the points of RICH is true AI SOFTWARE should have also stuff like battery low recharge me or if he falls help me.

That part is very easy on EZB all you need for low battery circuit is a divider and a zener for protection to AD PORT. ON tilt best sensor is a gyro On touching me CAPACITANCE type is one of the best and most you can mount inside the plastic shell So many many others ,and i beleave that EZB can do it.With many sensors you can add to EZB

#7

The unit should have a database. That is related to one of the questions I asked earlier. In the data base it would show something like first thing would be a number, the number of the action. If it was move forward and you move forward, it would be good. If it was move forward and you could NOT move forward, it would be bad. Sometimes the same number could be good or bad. It would be whether you could do the action or not. So, after the number, you would have the rating G/Bad, then maybe a comment. It would be the input of all the sensor in a row, example:

4,Center,0, Right,3,Left,0 or something like that. Like I told you, I don't know HOW to do this yet. But, I KNOW it can be done. In the above it would say the c or confidence=0 for center,right=3 so it was high and left=0 so don't turn left.

@D.J. thanks for the advice. Keep it comming, please!

@ Fred, I was happy to see you scored BIG on your last work project. This thread is to push the EZB forward, or at least give it something to think about.

@RichMR2, it is not YOU pleasing him. It is HIM making mistakes and learning from his past to select better options in future deciscions on HIS OWN.

I hope everyone understood what I was trying to say. I cannot take the credit for this concept. It was a combination of David L. Heiserman's "How to build your own Self-Programming robot" and Frank DeCosta's "How to build your own working robot Pet" I sort of mixed those two ideas together.

Both guys have done this and they even show the program. But, it is in Z-80 and 8085 8 bit Assembly code. So , it would have to be converted into a modern day program for modern cpus. Another person was John Baily Blankenship's "Robot Programmer's Bonanza" which he calls it Pain and Pleasure. I called it Good or Bad. It is the CONCEPT that would make it work.

I would LOVE to have thought of this,but I am NOT that Gifted.

#8

YEP i know everone trying to push it ahead,me maybe more then most,mostly AI witch is my most favorate of any idea for EZB. AI makes so very real instead of just a toy robot,plus very real emotions LOVE IS the hardest of all of the emotions there are. i woulder if EZB can understand other languages,i think it might ,so many here from other countries

PRO
Synthiam
#9

@MovieMaker, take a look at the File Operations example to see how to parse a comma separated file. Also, there is a post about regarding reading from a spectrometer to determine liquids. This was an example I wrote for @RobotMaker to adapt onto. BUt it gives you an idea of how you could read treat a CSV Text File as a database....

*Disclaimer: this code will not work for a spectrometer as discussed, it was only an example. This is also not the proper thread for spectrometer discussion - so do not comment on this regarding spectrometer, there is already a thread open for that discussion. The original thread for spectrometer can be found here: https://synthiam.com/Community/Questions/2442

This code is only presented as an example of how to read from a file.

Create a comma separated text file in Excel with the ADC range of each liquid. Then you only need to do something like this...

In your CSV:

1. the first column is the minimum ADC value for the liquid
2. the second column is the maximum ADC value for the liquid
3. the third column is the name of the liquid

Here is an example CSV... [feature] 10, 15, Beer 20, 28, Water 30, 45, Oil 66, 80, Hair Gel 90, 95, Banana 120, 160, DJ 170, 185, Milk 190, 210, Vanilla Ice Cream Yummmmmm [/feature]

Here is the EZ-Script code...

``````
\$filename = "c:\robot\liquids.csv"

if (FileExists(\$filename) = false)
print("\$filename does not exist!")
halt()
endif

# Get the value from the sensor
\$value = GetADC(adc0)

FileReadReset(\$filename)

# Loop through the file to find the matching value
:START

# Read the line of text from the file
\$line = ReadLine(\$filename)

# Split the line of text into fields and use a COMMA as the separator
# Because the file was created in Excel as a CSV
\$fieldMin = split(\$line, ",", 0)
\$fieldMax = split(\$line, ",", 1)
\$fieldName = split(\$line, ",", 2)

# Check if the ADC value is within the range of the field
if (\$value > \$fieldMin and \$value < \$fieldMax)
print("Match found!")
print("Detected liquid is: \$fieldName")
halt()
endif

# Reached the end of the file, must not be a match
if (FileReadEnd(\$filename))
print("Did not find match")
halt()
endif

goto(START)

``````
#10

DJ i said nothing about the specrometer on this post at all.

United Kingdom
#12

I understood, I was just explaining how that is only a tiny part of an AI program/script and how it can be expanded upon in one way.

#14

MEL i can try to help you on the code for AI like DJ POSTED ,i kinda understand it ,getting use to scripts alot and they seem easy so far. :)

#15

OK, that is a starting point. I invite all good programmer's to add on to it.

Thanks,

Mel

#16

Another point MEL ,DJ made the scripts so even a non-programmer can write them ,including young kids too, i would try it first,

A idea i use is i take a EZB and breadboard or attach sensors or motors or whats you going to use on your robots and then with the ARC try the code,if doesnt work try again and again if still stuck post the code. Reason to breadboard as i call it sometimes hard to program attached to a robot,but sometimes you do also.

I know maybe most guys here dont have time to work on you code ,not because they dont want too just too busy working on thier projects.

#17

I will be trying it also. But, Fred, if you want to help , I would appreciate it.

It is ALL about programming. The only programming I took up in school was Fortran and CoBol. I would loved to have taken up C# and Java and VB and stuff like that.

side note: (My homemade Marti (EZB) is doing so much more than my Qbo EVO Pro which is JUST SITTING THERE like the turtlebot I threw away.)

Fred, do you understand the CONCEPT of the point I was trying to make above?

Marti is working fine, except for Navigation and A.I. Maybe this script will help. who knows.

:-)

#18

YES,and yes i will help,problem is not helping you,just never get done with my omnibot 2000 project. I guess you are trying to get it be like the AI software we both have from our club (dont mention the name) ,i want the same thing also, Am i right about this One main reason going to work on it,but it is a very long list of AI stuff to add from other software SO it will take awhile to finish it for you and me

AND YES guys will post the code if i am able to make for everyone to use I always will post all my codes for others to use,i dont see much code sharing on this site.

I see many many robot projects but ALMOST no codes to share ,WHY

#19

Maybe most of these people are NOVICE , or they are Engineers for Hardware, not software.

Most people who really know how to program well are off making TONS of money enjoying what they do. They stay so busy there is not much time for family. But, BOY, D.J. and his team are Surely GOOD at what they do. And Fast!

;)

#20

@MovieMaker..totally awesome! I am 100percent in agreement with your philosophy...hmmm perhaps robotmaker with all his AI expertise can tackle that one!..I love it when the light comes ON...and wow MovieMaker your lighting up the Forum!....Let the experiments begin.Like you I am not a pro programmer but your PREscript is intriguing and worth pursuing. and thanks DJ for you valuable input to "kickstart" the idea.

#21

@irobot58,

``````  I am glad you enjoyed the conversation. Hope that we can all make it fruitful.
``````

God Bless!

#22

IROBOT58 I do know about AI ,been testing different AI software for a very long long time ,so far this maybe a good platform to add it too,but there is a lot of programming needed to make a true AI software.

Like the one i am using now no programming is needed,but wont work for EZB so converting it to EZB AI will take a very long time,SCRIPTING and TXT file does make it a little easy Also i dont know about the \$AIsuccess how it compares to the ones used in AI software i have since they are using many ,AI values we have are based on emotions ,mood ,random and more,

Maybe i can post a small part of the AI code and see if it can be done. I think DJ said that the \$AIsuccess is only random and ours also has a differents of levels ,like 1,2,3,4 depending on the mood or emotions or random

i guess only DJ can answer it,or make changes if he wants

#23

Fred, feel FREE to post code. I would like to look at any code you have.

United Kingdom
#24

@robotmaker, there is more than just a lot of code for good AI, try millions of dollars in R&D and literally years of writing and fine tuning code, that's what happens when game devs use AI.

What DJ was talking about with the \$AIsuccess is the personality generator, there's noting stopping anyone from making a different personality generator/AI with different levels etc. Personality generator, at least on first looks, is a basic form of AI based on random numbers picking an action and code to avoid repeating the same thing too many times in a row. It'll work for some applications but those who want more lifelike, more of a freewill for their bots will be disappointed in it... but if you want a robot that advanced you have to put the time and effort in.

#25

YES i know that very well it is very hard,thats what software i have does have Hopping to convert some to EZB CODING The software i has does almost freewill and more lifelike Post you email and i will send you a link to the code,so DJ wont be mad, Then you can take a look at it,it is a very long code like you said thatr AI HAS . I want to try to use some or most in my favorate board of all time EZB ATleast i hope it will be about the same or just have to use both systems THOMAS did make a code to use both together ,but on the his post DJ said no posting dont know why DJ OBJECTS about it,it uses the EZB

#26

Fred, you already have it. But, you have not responded to hundreds of emails sent. so, go ahead and I will give it to you again.

yhmmc>yahoo Dot com.

Thanks,

#27

I know yours MEL I meant RICH's email since he like to check out AI like me

#28

OK, well , send me one too, please. Thanks

#29

MEL you are in the club already with me (please dont say the name dj will be mad)

#30

Oh, you are talking about THAT software. I thought you might have written some.

Merry Merry Christmas and Happy root beer, I mean NEW YEAR!

Watch out for tommorow the 21 off dec 2012. Supposed to be the end of the world according to some people. I don't believe it. But, it is a good day to watch out for Crazies.

#31

YEP THAT bs comes up alot,many crazies out there

#32

MEL i forgot my friend have a bleesed christmas and a happy new year ,try not to drink is bad for for you.

#33

I don't drink or smoke.

Same to you. thanks for your concern.

#34

thats good i never tried to drink or smoke ever

#35

There is absolutely no future in that sort of stuff.