I tried to get an answer to this question in the past but I think I never clarified what I wanted to do properly. I will try to explain with a simple example.
1. There are 10 objects or faces programed to be recognized by a camera.
(a specific variable)
One face is recognized. (x variable) This opens a specific database so
the speech recognition will respond to this face or object with specific replies
or phrases which are stored in a folder only for this recognition (x variable).
( stored somewhere?)
2. The next object is seen (y variable), which opens the specific folder for this
object. Appropriate responses are made.
3 Load and unload continues based on object seen ( ? variable).
I know I can tag the image to respond, ("I see a frog"), but what I want is to queue a whole folder of responses of speech recognition files determined on who or what is seen ( ? variable), and what is said to the robot ( audio in files and responses in folder (normal speech recognition)). This can also run movement or outputs etc.
I sit in front of robot.
I say "Hello" My robot responds to me with my name.
I ask a question. the answer is appropriate for me.
My wife sits in front of robot.
She says "Hello" Robot responds to her with her name.
Answers and responses are for her.
My friend visits.
He is asked about baseball.
Two or three objects or faces can be done totally with scripting, but 10 or 20 would be more difficult.
I have a Omron camera which can recognize many faces. A variable is given for each one. This can point to a folder. What I need help with is how and where to put folders of data which can be loaded into and out of the EZ Builder. Then how they can be used for the speech recognition as needed.
The folders will have a lot of data specific to that object or face.
My computer skill are minimal at best. Anyone have any advice on how to do this? ( I guess be able to move folders of data into and out of the speech recognition portion of the EZ Builder based on specific variables.?)
I hope this is clear?
This would be dead simple to script... I really mean no offence but If you learn how to code (ez script), you would be able to do this kind of stuff for yourself... I never usually ask for help on here not because I am all that brilliant (I know squat about PC programming), but because I am very good at scripting... I came from the basic stamp micro so logic programming with ez script came naturally... I am actually not singling you out as there are a few long time members that need to take some time and learn how to script... ez builder controls are awesome as we know, but they can only take you so far... Besides ez script @DJ has provided us with scratch and Blockly as well... Logic programming will get you what you want...
Start by sitting down and drawing a flow chart on what you want to do... Then look over ez script (examples are usually provided)... Start with a basic outline... IF, ELSEIF and ELSE... then fill in the details...
Sorry I realize I did help much with the actual question... But what you want to do is much easier than you think. It will just take a bit of learning first...
RR, correct. This would be a simple IF, ELSEIF and ELSE tree script. In your ez zcript you need to first declare the variable that your camera is sending (Camera_variable = $Camera_variable ) then do your IF, ELSEIF and ELSE statements.
Here's a section of a script I just picked and cut out of my project that may help you see how this works. It's totally unrelated to what you're doing but the structure is what you may be looking for:
$Both_Arms_Centered = 1 #Reset variable so script will run. 1=not centered, 0=centered
$Both_Elbow_Seek_Speed = 600
$Rt_Elbow_Center = 2400
$lFt_Elbow_Center = 2500
uartWrite(2, 0, "1,P"+$Rt_Elbow_Center, "s1600", 0x0d) #Move Rt Elbow Motor
uartWrite(2, 0, "2,P"+$lFt_Elbow_Center, "s1600", 0x0d) #Move Lft Elbow Motor
Sleep(1500)#Wait for arms to center
$ADC_Rt_Elbow = GetADC(2.ADC0)
if ($ADC_Rt_Elbow >= 160) #160-350 is in Centered position
Goto(Check_Left_Elbow) #in a lower section of the script
ELSEif ($ADC_Rt_Elbow < 160) #Below 160 is not chetered
Goto(Adjust_Arms) #in a lower section of the script
$ADC_Lft_Elbow = GetADC(2.ADC1)
if ($ADC_Lft_Elbow >= 160)#160-350 is in Centered position
$Both_Arms_Centered = 0 #Sets varable 1=not cnetered, 0=centered
Goto(End_Script) #in a lower section of the script
ELSEif ($ADC_Lft_Elbow < 160) #Below 160 is not centered
Goto(Adjust_Arms) #in a lower section of the script
In my above code I guess I could use an Else statement instead of a Elseif. I think you use an elseif when you are comparing two values in the same statement. An Else is used when nothing else applies to the value you're looking at. However it seems to work for me.
Remember to add sleep commands when needed to process things outside of the script to complete before the script moves on or things may not happen you need to happen.
Hope this helps.
I still haven't made my self clear. I understand the scripting mentioned. We have gone thru this in the past. I have a script which does work based on IF/ELSEIF/ELSE. I guess I need to post an example script of what works then go from there.
Ahh but I do understand what you want to do... go through the ez builder script commands to see how to create txt files. You can use them to store data on recognized objects. For example each object (person recognized) can have it's own file (or as you call it.. folder) that contains the relevant information on that specific object or person .... See below...
FileDelete( filename )
Deletes a file on your computer
FileWrite( filename, contents )
Appends text to the specified file. This does not append a new line.
Example: FileWrite(“c:\temp\mylog.txt”, “My Variable: “ + $x)
Example: FileWrite(“c:\temp\mylog.txt”, “Servo Position: GetServo(d2)”)
FileWriteLine( filename, contents )
Appends text as a new line to the specified file.
Example: FileWriteLine(“c:\temp\mylog.txt”, “My Variable: “ + $x)
Example: FileWriteLine(“c:\temp\mylog.txt”, “Servo Position: GetServo(d2)”)
FileReadClose( filename )
Closes the file from reading.
This must call must be performed before writing to the file. Once you begin reading from the file, the file is OPEN. Closing the file will reset to the start once you begin reading again.
FileReadReset( filename )
Resets the file to the beginning.
If you read to the end of a file, this function must be called to reset reading from the beginning of the file.
FileExists( filename )
Returns a 1 or 0 if the specified file exists.
Example: $fileExists = FileExists(“c:\temp\mylog.txt”)
FileReadEnd( filename )
Returns a 1 or 0 if the file has reached the end.
Example: $fileEnd = FileReadEnd(“c:\temp\mylog.txt”)
FileReadChar( filename )
Returns the next character in the specified file
Example: $char = FileReadChar(“c:\temp\mylog.txt”)
FileReadLine( filename )
Returns the next line of the specified filename.
Example: $line = FileReadLine(“c:\temp\mylog.txt”)
FileReadAll( filename )
Returns the entire contents of the specified file.
Example: $contents = FileReadAll(“c:\temp\mylog.txt”)
FileReadLineRandom( filename )
Returns a random line within the specified file
Example: $randomLine = FileReadLineRandom(“c:\temp\mylog.txt”)
HOORAY.... I Think you got it. My biggest problem is conveying what I wanted to do. Richard, I believe you understand.
I will look into the txt file info in your example. This should get me going in the right direction. THANKS
Thanks for the advice guys.
Here is what I am doing.
Antonn knows and recognizes 5 people (face recognition) from a Omron camera.
I use the speech recognition and the IF/ ELSEIF/ELSE to determine what response to return.
For example if Bob is seen, and Bob says Hello, Anton response to Bob with "Hello Bob, good to see you. How is your wife Jane?" The responses continue based on what is stores and flagged for the variable from the camera for Bob.
When Jane is seen, and speaks, the responses return the same way, but only for Jane. Jen, Tom etc. If the face is not recognized, generic replies are made.
My goal was housekeeping. I wanted to store the responses together so I can edit more easily than I do using the IF/ELSEIF/ELSE. I also want to use the gender variable so Antonn can reply more gender correct . Jane is pretty, Bob is handsome. She wears a pretty red dress. He wears a nice blue shirt. I have over 100 responses built in so far, so I wanted to try to organize and access them easily, or easier.
This is why I asked this question. Make sense?
I will look in the EZ Builder info on txt file creation.
@Andy, I also think text files and IF/ELSIF/ELSE logic is the way to go. I've been using and experimenting with the same method for my robots. I also have an Omron camera I want to integrate. There is a
Tutorial for Text Files
Something I think that is easy to do at first is integrate a random joke teller, where you use a txt file with a listing of jokes and randomly pick one to read.
Once you get used to working with files I think you'll start to see some new uses for them.
For example I could see a text file for Male adjectives and one for Female. If Anton was to create the sentence "Bob looks handsome today." The logic flow might be something like this:
1. ID the face
2. ID the gender of the face
3. Based on gender open adjectives file and select random adjective
4. Prepare greeting, standing greeting is: NAME looks ADJECTIVE today.
5. Say greeting
You could then have Anton read at a txt file with knowledge items for Bob where Anton might asks "How about those Atlanta Falcons?"
I'd be happy to collaborate with you Andy.
You are exactly where I want to go.... Dave Cochran was planning on making a script which would load information about a "new" person from the Omron. I have no idea how it would work. I assumed this data could be used to develope responses. Davids job and classes occupy all his time now, so wouldn't want to bother him about it.
I would like to work together on this. What is the best way to contact you.
Is the Gmail account in your profile best?