Asked — Edited
Resolved Resolved by Dunning-Kruger!

Command To Check Pause State Of Personality Or Speech Recognition Controls

Is there a command or other way for a script to check the Pause state of the Speech Recognition or Personality controls? I want to keep a PauseOff command in a script from running for these two controls if they are already paused?

For example; I have several scripts written that turn on and then off these two controls while the scripts are running. I also have a button on the outside of the robot that's attached to an ADC port on EZB that I also use to toggle these controls Pause on and off. If I've activated the pause on either control using the external robot button through the ADC port I'd like to add lines to my other scripts that will check to see this state. Basically I don't want those scripts turning off the Pause if I've already turned it on.


ARC Pro

Upgrade to ARC Pro

Unleash your creativity with the power of easy robot programming using Synthiam ARC Pro

#1  

You can set a variable to keep track of whether Speech or any other control is active or paused... For instance....

Speech Recognition PauseOn $x=1

Speech Recognition PauseOFF $x=0 You can use the value of $x in other scripts to determine whether the control is on or has been paused...

#2  

OK, so would it look something like this:

I could define and set the variable in the Button/ADC script that first turns the Pause on or off. Then in the following scripts that would have a pause command I'd also need to place a check on this variable to see if it's on or off with an "If" and "Elseif"?

Could I possibly set these variables in my "Int" script that first run when EZB first starts?

Still trying to wrap my head around coding. I kinda thought I could use a variable for this but just couldn't work out how to make it happen.

#3  

I usually set my variables in my connection control script .... So the second I connect everything is initialized including whether I want my speech recognition control set to be paused or set to be on... for example


speechControlPauseOff
$speech=1

personalityGeneratorPauseOff
$personality=1

then as you turn on and off your controls via scripts you set the $speech and $personality accordingly... Then use if statements as you mentioned to check if the variables $speech and $personality is 1 or 0.... This is a good way to determine if you have already set the controls on or off in another script...

So something like this....


if $speech=1 #speech control is un paused

speechControlPauseOn # then pause it
$speech=0

endif

Next time this code is run the speech control is already paused (the $speech flag is set to 0) so the if statement will return false and won't try and pause it a second time...

#4  

Thanks Richard! This example and explanation makes it easy to understand. It's good to have you here on the forum and so willing to share your talent and knowledge.

#5  

Ha, Ha thanks Dave... It's a 2 way street though, dude... I always appreciated your fabrication and mechanical skills....

#6  

Well I've gotten the Variables and script written. Wow, I can't believe how elegant this is and how well this works! It wasn't really such a hard concept to understand and work into my project once I thought it through. However I was surprised at how my befuddled mind farted around with it till I worked it through in the scripts and reread your suggestions @Richard.

The Flag comment is what helped me sort it out. I thought I had a good idea of how a variable worked but that's just it, a variable does not work. The way I understand it now is that It's just a bookmark of sorts, a simple value, a marker or a "flag" as you put it. The script just uses this value as a target or sign post for direction.

Anyway, I set the "flag" to whatever will tell the script is the proper On or Off value of the state of the Voice or Personality Pause. In my case; 0 for Pause, 1 for Unpause.

So: The script that runs when I push the button on the robot that's attached to a ADC port to toggle the Voice Recognition or Personality Generator script on or off will change the Variable to "0" when I first push it. Then an ADC_Wait() command will hold the script till the button is pushed again and the variable will again change to 1

In the mean time I can run other scripts that have a couple "If" statements in them looking at these variables and depending if it sees a "0" or "1" will pause either or both of the Voice Recognition or Personality Generator.

Simply amazing. Thanks so much for the guidance!

#7  

ARC is a awesome tool to learn logic programing... I knew how to program before in other simple programming languages, but nothing complicated.... However, because I learned so much with ARC, It has helped me take a stab at C (programming Arduinos)...

A little tip about variables... I have a bad habit of using short variable names like $x.... later as my program grows and evolves I end up scratching my head trying to figure out what I originally used $x for... Good practice is to instead use a variable name that represents what you are using it for... For example $PersonalityFlag or $PerFlag.... That way later when you come back to a script you know what the $PerFlag is for....

Like you, I do like fabricating, although I am not quite as skilled as you so I opted to use kits like Vex... Anyway, programming is just as awesome and a great way to express creativity.... Dave, you built an amazing bot.... If you dig into programming you can really make him come alive....

Cheers Richard

#8  

Just had an idea... Rich or DJ, if you're listening... I see a book on using EZB and ARC down the road... I mean, why not "Programming the EZB with ARC"? Arduino has a ton, EZ Robot is due...

United Kingdom
#9  

Already thought about it dude;)

But with the speed at which things change, plus the V4 and revolution being announced I put a hold on what I was throwing together.

When I have more time I intend on getting back on to some type of unofficial EZ-B/ARC/EZ-Script for dummies style book.

#10  

Awesome... I really think you should, Rich... V4 will be EZ Robot's flagship for sometime to come.... And there is always room for 2nd, 3rd and 4th additions....:)

United Kingdom
#11  

I have a lot of it done, where do you think my tutorials spawn from?:)

It's just a whole bunch of separate documents or pages and pages of notes. When I find the time I'll get back on to putting it in some kind of order and covering the things I haven't yet covered.

#12  

I am the bookmaker. I make books not book.