loading
 
Timer Random
Anonymous
4 years
Hi,
I would want to know if among the various modules of the pipeline there is a way for inserting a timer "random" to put in break the execution of the pipeline for a period of time what it goes from (i.e.) 0 sec to 3 sec, for then to continue the execution of the following modules.

If it is possible, to also do this with some instructions in module VbScript positioned to the correct place.

Thanks for the help.
Anonymous 4 years
Continuing what I have written up, I have noticed that a timer random can be gotten, using the module VBScript, producing a random number before, and then inserting such "number" in the following instuction: "WScript.sleep (number)". The problem is that WScript.sleep inserted in the module VBScript it produces error "error (6) : necessary object: 'WScript' " ; while if I create a script .vbs in Windows with the same instuction, it regularly works.

How can I resolve the problem ? Qual' the correct instuction ?

Thanks.
Steven Gentner from United States  [1370 posts] 4 years
Don't use sleep, set a variable and then test for that variable using the If Statement Module and exclude the rest of your pipeline. This will ensure that the image keeps updating and that the rest of the pipeline continues to execute at top speed.

STeven.
Anonymous 4 years
I thank you to have answered shortly time, and I have looked for the solution, I didn't want to disturb again you, but, I am a little practical and you are the only person to whom I can ask for resolving the problem.

To simplify the things:

- I must insert a pause in the execution of the pipeline (I don't want to use the module timer).
- After the pause of "X" second, the pipeline must normally continue. (the pipeline can also make a complete pause, the main point is that, after the pause, it must take back from the point in which is paused.

If possible I would want an example of as to use "if Statement" to make the pause. I have not understood what it means : "...test for that variable..." , how ?

Rest waiting for one kind answer of yours.
Thanks.
Anonymous 4 years
I correct the post as soon as above, in the part where I have written that: "the pipeline can also make a complete pause", this is not good; excellent, instead, what you have written me:

"This will ensure that the image keeps updating....".

To still simplify :

The content of the pipeline is :

1) Object Recognition  (OK - i have a fixed image)
2) If OBJECT_NAME = "A" then  (OK)
3) ..VBScript Program  (NO OK - it doesn't make the pause)
4) ..Beep    (OK - but repeated quickly, because the pause doesn't work)
5) end_if    (OK)


Contained of the VBScript (copied from the documentation online):

period = 2000
step = GetVariable("step")
if step = 0 then
   SetVariable "data", 2
   SetVariable "step", 1
   SetTimedVariable "step", 2, period
else
   if step = 2 then
      SetVariable "data", 4
      SetVariable "step", 3
      SetTimedVariable "step", 0, period
   end if
end if


- How to make to work the pause ?
- In the VBScript is not enough only the line : (SetTimedVariable "step", 0, period) , that assigns a value to the variable "step" after the planned period , and therefore does it also work from timer ?

Rest waiting for one kind answer of yours.
Thanks.
Anonymous 4 years
Have I perhaps been too much long in the description, but would I want at least to know how to have the pause before the Beep? ...and if the Beep can be inserted in the VBScript and with which line of command ?
The content of the VBSript regularly works.

I recopy the content of the Pipeline :

1) Object Recognition  (OK - i have a fixed image for testing)
2) If OBJECT_NAME = "A" then  (OK)
3) ..VBScript Program  (NO OK - it doesn't make the pause)
4) ..Beep    (OK - but repeated quickly, because the pause doesn't work)
5) end_if    (OK)


Contained of the VBScript (copied from the documentation online):

period = 2000
step = GetVariable("step")
if step = 0 then
   SetVariable "data", 2
   SetVariable "step", 1
   SetTimedVariable "step", 2, period
else
   if step = 2 then
      SetVariable "data", 4
      SetVariable "step", 3
      SetTimedVariable "step", 0, period
   end if
end if

Thanks.
Steven Gentner from United States  [1370 posts] 4 years
It is always best to post your robofile instead of typing it as text (you can press save button and call it something.robo and then post that file here). That makes it much easier to understand what you are asking for.

For example, the attached robofile will beep only once per object. This uses the new "latch" capability in the If Statement module which will only execute once until the data changes. We just added a "hand" as an object to the OR module.

Is that what you were looking for?

STeven.

program.robo
Anonymous 4 years
Not really, however this function is very useful and I could use it however.

What I wanted is to know if among the various modules of the pipeline there is a way to insert a timer "random" to put in break the execution of the pipeline in a certain point and for a certain period of time.

To do this I have used the following code in a form VBScript that I have inserted among a condition of the module If_Statement and the Beep module.
So that if condition is true the Beep it is verified once later random.

Thanks for the answer.

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index