Asked — Edited

Can Jd Stand Up From A Fall And Smoothly Continue Its Movement?

I would like to use the MPU9150 to simply detect that JD has fallen on its face or back, right itself and continue with what it was doing (for example a dance sequence). Looking at the sample code from EZ-Robot the following appears in the update gyro script:

:loop IF ($AutoPositionStatus = true) print("AutoPositioner already running...")
sleep(2000) goto(loop) ENDIF

When JD is dancing, autoPositioner seems to be always active, this is expected, but if it tips over, the gyro script will not detect it or recover. I removed the code that checked for the autoPositioner to be running and the result "kind of works". JD does try to stand up but often makes a mess of the move in progress and can fall down again.

My questions are:

  1. If 2 (or more) scripts call the autoPositioner via the ControlCommand() how is that handled? Is there a queue?

  2. Is there a way to make JD super smart, and after standing up from a fall, perform a smooth transition to the next dance move? I realize this may be complex as each action is made up of frames and it would probably be best to start the action over from the beginning.

Any input is appreciated! -Paul


Upgrade to ARC Pro

Your robot can be more than a simple automated machine with the power of ARC Pro!

  1. If two or more scrips call the auto positioner (this is with script commands as well) then the last script or command will supersede all others. It will appear as if the previous script or command was ignored... Think about it ... if you call a servo move to 180 then on the next line call another servo move to 1 then the servo will just go to 1 seemingly ignoring the 180 move... You'll have to check and wait until the auto positioner is finished running and then call another move...

  2. You can pause scripts with the "pause" command and then in other scripts have the paused script continue....


Richard, thank you for the responses.

With regard to the the first question, what I am asking is what processing model is used by EZ-Script? Can a ControlCommand from one script really interrupt a ControlCommand being processed by another script or would the command in progress complete before the next one is executed?

With regard to the second question, the pause command sounds promising but when pause is called does the the action being executed complete or could it stop during a frame within it? If the ControlCommand being executed completes before the pause then all is good otherwise it will be difficult to cleanly restart the interrupted action unless there is a way to resume that action from the first frame.

I will do some experiments.


yes it will interrupt previously called "CC" no matter what script called it... unless the second "CC" is doing something completely unrelated to the first "cc".... The first "cc" won't complete if you call another "cc" immediately after it... For example you call a "Stand" command for JD and then a second "CC" immediately after to sit... JD will initially (for a mirco second) begin to stand but the "sit" "CC" will supersede it and JD will abandon the "stand" "CC" and just sit... Hope that makes sense...

I believe the pause command will only pause a script where it was called... If an auto postilioner command is called before the pause, well you're out of luck in that regard...


Thanks again Richard. My tests confirm what you are saying. I think I just need to get a bit tricky with $AutoPositionStatus tests in the scripts.