Welcome to Synthiam!

Program robots using technologies created from industry experts. ARC is our free-to-use robot programming software that makes features like vision recognition, navigation and artificial intelligence easy.

Get Started
Asked — Edited
Resolved Resolved by Rich!

Skipping Lines?

hello, i have been working to create a more complicated demo and am having some issues with it skipping between lines, i have found it will go from the middle of one action the the next, currently by adding sleep marks i have corrected many of these issues but i just wanted to make sure that the problem is in my inexperience programing for this robot and not a bug, i have uploaded the configuration file to the public site by accident and the demo2 script in there is what i am having issues with. also if you could take it down off the public site as it seems to have to many issues for now, i will upload it to the public site once i get the bugs all worked out

Thank you
Richard

United Kingdom
#1  
It's a little unclear what you mean. Scripts will not skip lines unless they are surrounded by an If and the statement is not true.

However, if you are using the script to trigger the Auto Position actions (I presumed by actions this is what you meant) then the script is most likely acting as it should. You will need to include Sleep commands between changing actions as the script will continue running regardless of what the action is doing unless you have added a ControlCommand() to the action to pause the script which triggered it.

The script I wrote for Six dancing used sleep commands to sync the moves with the music.
#2  
cool thanks thats another question i was looking into, i will check out your script so that i have a head start when i try that.

i have been using sleep commands tho and adding time but that doesn't seem to be enough to cover all the issues im having

the project is public under humanoid robot and its called "richard advanced robot" but you will need to update all the sleep times to min 6000 and that fixes most the bugs but when you get to the push up example it goes from in the middle of the pushups to trying to do sit ups without standing up

i created the script by copying and pasting parts of the original demo to prevent errors and just changed what was done and said and the sleep timers so i think i have covered that but im still new and unsure
United Kingdom
#3  
It'll be a case of trial and error to be honest. Unless you spend the time to run every action and record how long they take to be completed.
PRO
Synthiam
#5  
Our compiler does not "Skip lines" - if it did, NASA would not be using our product:)

If your Auto Position Action does not "repeat for ever" , than simply do this instead with WaitFor()...

Code:


ControlCommand("Auto Position", AutoPositionAction, "Wave")

# pause for a short period of time to ensure the action is running before we check
Sleep(500)

# now wait for the action status to change from a 1 to a 0 (true to false)
WaitFor($AutoPositionStatus = 0)

ControlCommand("Auto Position", AutoPositionAction, "Attack")

# pause for a short period of time to ensure the action is running before we check
Sleep(500)

# now wait for the action status to change from a 1 to a 0 (true to false)
WaitForChange($AutoPositionStatus = 0)

sayezb("Done")


The variable $AutoPositionStatus stores the active status of the Auto Position. The WaitFor() will wait for ever until the provide expression is true.
PRO
USA
#6  
D.J.,
Please tell us more about N.A.S.A.
United Kingdom
#7  
A variable I wasn't aware of, just out of interest how long has $AutoPositionStatus been there?

Yes that makes it much easier:)
PRO
Synthiam
#8  
It's been there since the release of the Auto Position 2 years ago:)

Much like the Camera Control, Joystick, WiiMote, and a few other controls.. you can see which variables are used in their respective CONFIG menu
PRO
Synthiam
#9  
Here's a way to do it with the new EZ-Script command... If your script does not "repeat for ever" , than simply do this instead with WaitFor()...

Code:


ControlCommand("Auto Position", AutoPositionAction, "Wave")

# pause for a short period of time to ensure the action is running before we check
Sleep(500)

# now wait for the action status to change from a 1 to a 0 (true to false)
WaitFor($AutoPositionStatus = 0)

ControlCommand("Auto Position", AutoPositionAction, "Attack")

# pause for a short period of time to ensure the action is running before we check
Sleep(500)

# now wait for the action status to change from a 1 to a 0 (true to false)
WaitForChange($AutoPositionStatus = 0)

sayezb("Done")


The variable $AutoPositionStatus stores the active status of the Auto Position. WaitFor() will wait until the provided expression is TRUE.
#10  
Forgive me for being a tad slow.... I think I get this... So $AutoPositionStatus will hold true so as long as an "Auto Position" of any type is in progress? Do I understand this correctly?
United Kingdom
#12  
WaitFor() is going to make so many things so much easier, cleaner and more efficient! Something I wanted without even knowing I wanted it.

@Richard $AutoPositionStatus changes from 0 to 1 depending on the status of the Auto Position control. If it's carrying out an action it will be a 1 until it finishes the action then it will be a 0.

WaitFor($AutoPositionStatus = 0) will hold the script at that line until $AutoPositionStatus = 0, or in simple terms, until the action is finished.

So yes, you have that correct:)
#13  
@Rich Thanks dude... Love your new haircut by the way... But the mustache sucks....:P
PRO
Synthiam
#14  
I just realized that the code I posted earlier might need a slight pause after triggering the Auto Position action. This is because EZ-Script compiles and runs soooooo fast that the action may not have actually begun yet, by the time the next command in EZ-Script is executed.

So here is an update to the script example with a slight pause..

Code:


ControlCommand("Auto Position", AutoPositionAction, "Wave")

# pause for a short period of time to ensure the action is running before we check
Sleep(500)

# now wait for the action status to change from a 1 to a 0 (true to false)
WaitFor($AutoPositionStatus = 0)

ControlCommand("Auto Position", AutoPositionAction, "Attack")

# pause for a short period of time to ensure the action is running before we check
Sleep(500)

# now wait for the action status to change from a 1 to a 0 (true to false)
WaitForChange($AutoPositionStatus = 0)

sayezb("Done")
#15  
I second what Steve S said. PLease tell us more about NASA and what they use the EZB for? Thanks
Chris