|
RoboRealm's Pipeline Alexander from Australia [6 posts] |
7 year
|
Hi,
I've got a bit of a problem where I need RoboRealm to constantly look in a shared folder for a specific text file. If the text file is there it can then start the image analysis.
My question is... Does the RoboRealm pipeline continuously loop?
Another question.. Do vbScripts with in RoboRealm update with the loop?
I create the text file in the shared folder and wait for RoboRealm to start the analysis. However it only works when I click Reload and Run on the vbScript, then the image analysis is done. How can I automate this so that it constantly runs the vb script.
------------ my robo realm code -------------
set run = 0 (set only once )
vbScript
if run = 1 then
#run image analysis and stuff
end if
--------- my vbScript code -------------------
REM It searches for a particular file called All_Coordinates.txt in the shared directory.
REM 1) Creates a system object that can be used to search for files
REM 2) See if the file exists.
REM 3) If the file does exist set run to TRUE, if not do nothing
REM File path variable
path = "\A_LAPTOP\Share\All_Coordinates.txt"
REM System object
Set ob = CreateObject("Scripting.FileSystemObject")
REM Check to see if the file exists, otherwise do nothing
if ob.FileExists(path) Then
Write "file exists, do nothing" & vbNewLine
else
Write "File does NOT exists run RR" & vbNewLine
REM Set variable run to TRUE
run = 1
SetVariable "run", run
end if
Halp me plz!
|
|
|
Steven Gentner from United States [1446 posts] |
7 year
|
Alex,
The pipeline continued to run assuming you are talking about the Main tab. If you are using another tab and you are NOT calling that tab from the Main tab, that tab will ONLY run when selected. The idea is that if you do not call it from the Main tab using the CALL module then you are not actually interesting in running it. The other exception is setting the tab to ALWAYS RUN using the little icons at the extreme right of the pipeline to change a tabs properties.
Think of it like a function call. You can debug the function by selecting it but it will NOT run unless you call it from your main program.
VBScripts will update in the loop. You can think of the pipeline as a big loop. It will typically execute at the camera rate (around 30fps) but can be made to go faster or slower using the Options button->Other tab.
So you may not want to check the file 30 times a second (that seems excessive) so you can slow down the check by doing it only once a second. This can be done in several ways including within VBScript.
You can minimize or select another application and RR will continue to run. You do NOT have to have RR always be the current focused application for it to run.
Let me know if you need additional guidance on how to get this to work. You are on the right approach given the above code.
STeven.
|
|
|
Alexander from Australia [6 posts] |
7 year
|
Hi STeven,
Just re-iterating what you said (to make sure I've got the right idea). The tab you have selected is the tab that is being called. Hence each tab can be seen as a separate function, if you have that selected and not the main you will only be running that particular function.
I seem to get a different behaviour to what you are saying. The RoboRealm pipeline only seems to run when I have selected it. The final output of my RoboRealm program is a text file called All_Coordinates.txt. You can have a look at the program which is attached to this post. As a test I would delete the All_Coordinates.txt file and see how long it would take to reappear. This seemed to be an infinitely long time. However when I opened RoboRealm but didn't click inside the user interface nothing happened either. The only time the pipeline was run is when...
a) I click in the GUI such as highlighting another module.
b) I was already in the vbScript function and clicked "Reload and Run"
So my questions are...
What is preventing RoboRealm or vbScript module from running?
How do I make the program continuously iterate through the pipeline?
Better yet how would I make RoboRealm run if I were to code up another program in C?
Finally, anything else you can tell me about my program to improve it?
Thank you for all of you help and it makes an enormous difference that you are always posting in these forums to help us RoboRealm newbs :)
Alex program.robo
|
|
|
Steven Gentner from United States [1446 posts] |
7 year
|
Alex,
Almost, main ALWAYS runs. If you have a tab select it will run Main and then the selected tab (if not called by main).
You are probably getting confused since you are probably NOT using a camera. A camera connection or camera module is typically what drives the pipeline (i.e. no new image, no need to run the pipeline). Keep in mind that RR is a vision app and not just a generic app building program (which some use it for that which is fine).
So if you don't use a camera the pipeline will NOT run because there is no new data. Only when you click on the GUI or change a parameter will it rerun since you changed something. If you notice, the FPS at the bottom of the application will be N/A which means the pipeline is not running continuously.
To run the pipeline without a camera/image source, use
Options Button->Other Tab (last tab)->Min Processing FPS = 30
which will simulate a 30 fps camera ... or in your case you probably want that to be 1 since once a second is plenty when checking the file system.
STeven.
|
|
|
Alexander from Australia [6 posts] |
7 year
|
Hi STeven,
I've figured out a solution. My problem was under options->other the min FPS was nothing. Hence it wouldn't run unless a new image was given. However the image would only be taken if the All_Coordinates.txt file were given. So I made it have a min fps of 1 and that has solved all of my problems.
If you have any comments on my program please let me know!
regards,
Alex
|
|