|
Random break time in the pipeline Francesco from Italy [20 posts] |
8 year
|
Hi,
I would want to make a random break in the pipeline among a minimum and a maximum of time from me established.
I have created a VBScript, but it doesn't work. It continually performs beep, and quickly, therefore it doesn't do the break.
I would want to understand where I am wrong.
Besides, I have noticed that loading the file that I attach you, the first line ...Object Recognition, loses every time the path, and I am forced to introduce it....why ?
Thanks for the availability. program.robo
|
|
|
Steven Gentner from United States [273 posts] |
8 year
|
See the attached ... when you Sleep in VBScript module it will continue to execute other modules (so as NOT to stop the pipeline). So you can use a variable setting to indicate when a beep should happen or not.
Note, if the pipeline is stopped or broken the app *WILL* freeze.
STeven.
|
|
|
Steven Gentner from United States [273 posts] |
8 year
|
|
|
Francesco from Italy [20 posts] |
8 year
|
Hi,
I have tried the single files .robo (01-02-03) what it need to complete a only pipeline (test).
Uniting them I have mistaken them something and therefore the timer random doesn't work to the line 6, unfortunately it performs beep immediately.
Probably it would be possible compact also the final pipeline and to optimize it.
The pipeline test has this sequence :
01 Object Recognition: A and B
02 if it recognizes only A > Beep (or Disable through key in low) + Click Mouse
03 if B recognizes > no action
04 if recognizes A + B > no action
05 begin again
Thanks for the help. program.robo
|
|
|
Francesco from Italy [20 posts] |
8 year
|
|
|
Francesco from Italy [20 posts] |
8 year
|
File that has not succeeded in attaching in 1 zip file. Files Robo.zip
|
|
|
Steven Gentner from United States [1446 posts] |
8 year
|
See if you understand the attached. Note the use of the "Latch" in the object found if statement. This ensures that the contents of the if statement ONLY execute once when object_found becomes true. It has to become false and then true again in order to trigger the contents of the if statement.
Also note the use of SetTimedVariable which is used to turn off the beeping after the set number of seconds.
STeven. program.robo
|
|
|
Francesco from Italy [20 posts] |
8 year
|
Thanks for the answer, it is clear and the simplest the pipeline, but unfortunately it doesn't work as I would want.
I try to explain better the Pipeline :
01 If "A" recognized then > later once casual time > Click of the Mouse in the established position and Beep together
02 if "A" recognizes or "A + B" no action.
03 restart again from the beginning
With the file.robo that you have attached me I have noticed that when it recognized "A" the first time, it doesn't execute the casual break, and it execute the click without moving the mouse in the established position and it also execute the beep.
The second time that recognized "A" , it doesn't execute the casual break and then moves the mouse and clic the in the position established and execute Beep, but always instantly.
And then it is always this way.
If the Beep is a problem I can also eliminate it.
The main point is that it execute the click of the mouse when the condition the object_found becomes true once later casual time established and then it is again ready to the action.
I would be you thankful if he succeeded in resolving the problem.
Thanks.
|
|
|
Francesco from Italy [20 posts] |
8 year
|
P.S. I have been wrong to write :
-- 02 if "B" recognized or "A + B" no action. --
"A" always action
Thanks.
|
|
|
Francesco from Italy [20 posts] |
8 year
|
Hi,
I have also tried this file robo, that works, following your preceding instructions, but I don't understand because it doesn't execute the casual break before of execute the clic of mouse. How can I do ?
I would be you thankful if you could help me to understand the problem.
Thanks. program.robo
|
|
|
Steven Gentner from United States [273 posts] |
8 year
|
By "casual break" do you mean the beep? The VBScript is setting the trigger_beep to zero before the sleep and then 1 after it. That should be switched. You also need to move that into the If Statement so it doesn't execute EVERY pipeline iteration. Any module NOT in an If Statement module will execute EVERYTIME.
Then you actually need something in the pipeline to react to that trigger_beep variable as just setting a variable and doing nothing with it will not do anything ... if you look in the previous robofiles you will see an if statement checking that variable and then beeping when the variable is set.
Start simple, then add functionality incrementally and ensure you understand why something works or does not work before you continue. Adding too much functionality too quickly is causing you to get lost in the complexity.
STeven.
|
|
|
Guido from Italy [7 posts] |
8 year
|
I have simplified as you have recommended me.
This pipeline correctly works.
Every time that recognize only "A" the Beep performs.
If it recognizes "B" or "A+B" NO action.
The only problem that I don't know how to do is:
- before performing the Beep, the Pipeline must paused for once time casual that goes from 5 seconds to 10 seconds.
As I can do to insert this break ?
Thanks for the assistance. program.robo
|
|
|
Steven Gentner from United States [273 posts] |
8 year
|
One way to perform a delayed variable set is to use the SetTimedVariable which takes number of milliseconds as its last parameter as to how long to wait until setting the variable. BUT you can only call this ONCE since calling it again and again will always reset the timer ... so you use another variable like "timer_on" to ensure that it only gets called once which will allow the timing to work. You then set timer_on to 0 once you been to allow for new beeps to happen. See attached.
STeven. program.robo
|
|
|
Francesco from Italy [20 posts] |
8 year
|
I first of all apologize me for my insistence on this matter.
I have tried your file attached with two objects A and B, that perfectly recognized, but the Beep never performs.
As you will surely have understood, to me it needs that every time that recognized "A" and only "A" a Beep it performs after a period of random time that goes from a min. to a max of time.
How can I resolve?
I wanted to know, to this point, if the following VBscript that you have suggested me preceding in the attached, is to exclude for my purpose ? :
Dim max,min
max=3000
min=1000
Randomize
SetVariable "trigger_beep", 0
sleep(Int((max-min+1)*Rnd+min))
SetVariable "trigger_beep", 1
Thanks.
|
|
|
Francesco from Italy [20 posts] |
8 year
|
Hi,
I have retried the file attached but the Beep doesn't perform.
Is possible that there am not a way to make delayed variable during the execution of the Pipeline ?
We can for instance take also a casual break among two Beep. ( "Beep" ....."delayed variable from 2 a 5 sencond" ....."Beep" )
I would be you thankful for any suggestion.
Thanks.
|
|
|
Guido from Italy [7 posts] |
8 year
|
Dear Stevens,
I would want to know if a way exists to make once a pause random during the execution of a pipeline, only if a condition is true.
Then, for instance, if is recognized the object, the pipeline paused for once random time, and then it continues the execution of the pipeline.
Rest waiting for one polite answer of yours in the hope that is a solution to mine simple question.
Yours Sincerely.
|
|