Asked — Edited

Iron Man Jarvis Ez-Robot Recreation Scripting Questions

Hi.

quick questions for scripting.

  1. Is there a command that says "if __________ is said(microphone), start this script."?
  2. Is there a way to say "if this script starts, do this."?

User-inserted image


ARC Pro

Upgrade to ARC Pro

Don't limit your robot's potential – subscribe to ARC Pro and transform it into a dynamic, intelligent machine.

#1  

I'm not sure cause I still don't have the ez-b yet,(By monday:) ) but if your speech recognition is good and, if I'm not mistaken, you can call/assign any function you want to the command. So you would have to make a function with the if statements in it. So it depends on what your checking. I imagine you can do something like if servo is at x position do whatever. Or maybe even, depending on your set up something like if distance is x do something. and the details all depend on your setup but that would be the logic to the problem. Someone will have to verify that.

That's why I bought the ez-complete. It's programming seems pretty simple but incredibly powerful. I can't wait to start testing all of my theories and questions out.

And well, let's be honest, for being my into to robotics kit it is power packed for the price. I could have easily spent $300-$600 on something half as capable.

United Kingdom
#2  

Dude, you should know this already:)

Voice recognition control, add the phrase i.e. "robot dance" and add the command ControlCommand( "Script Manager", ScriptStart, "MyScript" ) to start a script

And the same for when a script starts, have the first line as a ControlCommand too.

You could also use the WaitForSpeech( timeOut Seconds, phrases ) command in a script, but the VR control is a much better way. WaitForSpeech is good for confirmation of command though. I'm pretty sure there are some speech confirmation scripts in the forum.

A quick example of voice activated control running a script is here (not the complete jarvis project I'm putting together just part of it)

And it does something like this...

#3  

ok so 1.Speech recognition "Jarvis test rc car robotÈ

ControlCommand(ÈRc Car", scriptstart)

2.IF controlCommand(ÈRc CarÈ, scriptstart) Controlcommand(ÈLight TestÈ, scriptstart) ENDIF

Sorry, having a brain fart moment.

#4  

Im not 100% on the code so I may be misunderstanding but. 2. IF (get servo position, or get distance, or get what ever reading you need from your sensors) = or<or>(what ever operator you need) what ever your parameter is. Do something.

So as an example (My pseudo code, not ez script, you'll have to port it yourself. I'm trying to mix english and code so it makes sense.)

Assuming that 2. is the code for the function you are calling.

2. IF sevo.d1.position = 45 (Then? does ezb use if then or just if?) servo.d2.position=45 ENDIF

So, that says, if servo.d1(RightArm) is at position 45 then move servo.d2(LeftArm) to position 45. I've read enough of your posts to know that you know what I'm trying to show you. The mail came and went so no ezb till monday. So while I'm not experienced in EZScript, it seems to be an object oriented language. And I have yet to meet an OOL that I haven't been able to talk to ;-)

As far as OOL programing goes, the phrase "I walked the dog." means "I walked the dog." in any language you say it. (I wish human languages were as simple.) It's usually a matter of getting a syntax reference. The concept of programming is the same, you just have to think in things in terms of a language you already understand and then just look up the equivalent in the language you need to use. All of the OOL have fairly similar commands. One thing that gets people is the End Of Line or more to the point, what I call End Of Phrase.

Some languages simply treat a newline [Enter] as the end of a line of code or phrase. Others require the semicolon ( ; ) . Some languages use If () then {}, some use just, if(){}. () being where conditions go, and {} being where the code goes. I'm pretty sure when it comes to arrays, that ALL languages start at 0. You always have to be mindful of what I call 0 based returns and 1 based returns. Arrays start at 0. But Array.Count() in most languages starts at 1. So if you use Array.Count, it returns 5. But if you call or reference Array[5] it could error because, it is beyond the scope of Array. "It said I have 5 items in the Array." Yes, 0-4 is five items. So to call or reference the 5th Array object you'd use Array[4]. I said could error because you can define a max length of an Array and some languages fill the spots as some sort of "existing but empty" so it may throw an error while some languages see them all as "non-existent" or "undefined" and that would throw an error.

It may sound trivial but if you plan to explore multiple programming languages, especially object oriented, things like that are gonna be the best place to start looking when you go to porting code or learning a new language. They really are all very similar. OOL seems to be the current standard. I've never touched "C" and only dabbled very minimally in "C++". I've never had to use them to do anything I've ever wanted to do. But then I've never tried to start building robots till now ;-)

The first computer I owned, was a Commodore 128, back when I was about your age. I learned basic, where a novella's worth of code got a balloon to scroll across a monochrome screen. Oh the good old days of no-def computing. But I digress, Then I got into HTML and web design. Which led to JavaScript and PHP (I've always been a big fan of PHP.) Which lead to SQL, MySql. And then I was just sor of known as the computer guy. Alot of my skills after that came from people saying, "I'll give you $XX - $XXXX if you can do this for me." And I'd tell them up front that I don't know how long it would take, ask them if they had any language requirements, and a no money back lack of guarantee. Then they would say "Shut the hell up, you know you can do that sh*t."

I've always been more integrated in being able to do stuff, not getting paid to do stuff. Now that I'm older I sure do appreciate being paid, but I love to learn stuff and share what I've learned. That's what computers were about when I was your age. I've helped a few small businesses get off the ground. One folded, one screwed me. Quick lesson, when it comes to money, get a contract. I learned the hard way. But I'm not upset. That code is all super old now. It's not like they turned into a million dollar company off of my code. (I hope their still not using that old code, my lord. It was a rats nest).

You seem to have an aptitude towards this. I've no doubts that if you pursue your robotics interests the rest of your life you will make the world a better place or be solely responsible for the end of it. ;-)

#5  

Thanks Antron007. Your right. I'm the "Techno Geek" at my school with the teachers always asking for help. I also deal with being 6ft tall(I've got a tough life).

With my coding, I could use variables and each script sets off a variable.

United Kingdom
#6  

Sorry, I've been out all day... it's too late and I've been driving for far too long to read all of that but here is what you want to know (I think)...

To start another script when one is started you can just add ControlCommand( "Script Manager", ScriptStart, "MyScript" ) at the start. So you set up voice recognition.

Phrase: "Jarvis test rc car robot"


ControlCommand( &quot;Script Manager&quot;, ScriptStart, &quot;RCCarTest&quot; )

Then at the start of the RCCarTest script you add in


ControlCommand( &quot;Script Manager&quot;, ScriptStart, &quot;AnotherScript&quot; )

Or you could do it a different way... At the start of the first script, in this case RCCarTest you add in a variable so that ARC knows it's started...


$RCCarTestRunning = 1

Whenever the script can stop running add the following before where it stops


$RCCarTestRunning = 0

In your other script you use a WaitForChange() command and an IF (the IF may not be required but it makes it more accurate).


:wait
WaitForChange($RCCarTestRunning)
If($RCCarTestRunning = 1)
  # Run the script
  Goto(startscript)
ElseIf($RCCarTestRunning = 0)
  # Don't run the script jump back up before the waitforchange
  Goto(wait)
EndIf
:startscript

Or you could just let it loop around the :wait part, but this will use up more resources.

You could also use WaitForServoMove(servoport), Servo_Wait(digital port, higher/lower/equals, value), Digital_Wait(digitalport, on/off/true/false), ADC_Wait(adcport,higher/lower/equals, value), ADC_Wait_Between(adcport, low, high)... and a few more, just type in wait in the search box to the right of the script box to see all of those options.

#7  

@rich- most of it was my version of programming theory 101. I can't wait to get my kit so I can start playing with all of ezb's code.

United Kingdom
#9  

Just play with it, learn the commands (I'd highly suggest reading the EZ-Script manual a few times to get to know what commands there are and what they do) and just try different things.

If you can think logically you just need to find the correct syntax for the commands, it's very easy to use.

You can play with it before you get the EZ-B too.

#10  

I agree @Rich.....I played with and created a huge file with all kinds of coding and scripts waiting for my EZ B to arrive. This file was all less any servo/sensors scripts of course , but at least you get to play and teach the VR stuff!

#11  

Good news! wall-e is taking shape so he may be JARVIS's body!

Wall-VIS? JARL-e?

I don't know. which one is betterÉ

AWWWWW COME ON!

United Kingdom
#12  

You could still play with the servo and sensor controls even without the EZ-B.

Servos, digital, movement etc. just add the servo/digital/movement controls and watch the script change them (ignoring the debug window throwing errors constantly) Sensors, you can use random numbers to emulate sensors, check my PingRoam script for the test mode which I left in.

United Kingdom
#13  

Also, I'll probably be moving my Jarvis over to ARC in the near future, which will be mainly scripts and VR since control of most things has been done through other means. I'll be sharing all of the scripts so it should help figure out how to do a lot of the fun things like news, weather etc.

It'll also include a cool little lighting control idea I have had for my stair case for a while:) Watch this space (well, watch the showcase).

#14  

@technopro,

And, don't forget to look at the examples in the cloud.

:)

#15  

Is there a way I could have ARC in the background and then tell it what to type in the selected box?

United Kingdom
#16  

How do you mean? What selected box?

#17  

like say have speech recognition put what I say into the google textbox

United Kingdom
#18  

If you want that then you'll need something designed for that purpose rather than something designed to control a robot. Windows Speech Recognition can do that but it's not too great unless you have an amazing mic and have trained it a lot (and I mean a lot). Dragon is the best of the bunch for that.

You could probably do it through Pandora Bot, EZ-Script and a lot of work. Pandora Bot is the only part of ARC which supports dictation, all others require a phrase list.

#19  

yea I was looking into the open program command

Exec(&quot;c:/.............&quot;)
#20  

then have it sleep for 30 seconds or so and then terminate the speech-to-text program

United Kingdom
#21  

What programming would you have it open though? And how would you get it to take the payload and use it in the right place?

It all seems like going about things the long and messy way when you could achieve much better results through other software. You can pass information to ARC from other software quite easily using telnet, a lot of the fun scripts and actions I added to Melvin tonight use other software and pass results and variables (which act as triggers) to ARC through telnet via EventGhost's python scripting.

#22  

unfortunately I don't quite understand python scripting. I've read all the documentation but I just can't seem to understand.

United Kingdom
#23  

I'll let you in on a little secret... neither do I... but it's easy enough to adjust an example to send the right info through telnet:)