Pandorabots icon Pandorabots Connects ARC to Pandorabots for AI chat, sends text and gets replies (executes [EZ-Script]), integrates with speech recognition and custom bots Try it →
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


ARC Pro

Upgrade to ARC Pro

Stay on the cutting edge of robotics with ARC Pro, guaranteeing that your robot is always ahead of the game.

Author Avatar
PRO
Synthiam
LinkedIn Thingiverse Twitter YouTube GitHub
#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()...


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?

Author Avatar
United Kingdom
LinkedIn Twitter Google+ YouTube
#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

Author Avatar
PRO
Synthiam
LinkedIn Thingiverse Twitter YouTube GitHub
#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..


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