loading
 
Call module neither function nor task
Anonymous
3 years
The Call module seems not to work like the function/subroutine call model indicated in the documentation.  Instead it seems to be mostly like a task, in that when the main pipeline 'calls' a tab, the tab script does not run to the end and then return execution to the main pipeline.  Instead, the tab script continues to loop as an independent pipeline.

The drastically simplified attached program illustrates the task-like behavior using a Speak module in the Camera tab and a Timer delay in Main.

I've tested many different configurations with camera and controller script elements in and out of Main.  I think what is needed in the RR documentation is a detailed description of the RR framework execution model.

Even if Call is considered a subroutine invocation, it seems to be non-blocking; it returns to the Main thread immediately.  (Proven in another RR program by putting a Timer delay in the 'called' tab.)

Right now, the only script I can understand is when I put all my code in one long Main.  Have I missed something obvious?
program.robo
Steven Gentner from United States  [1370 posts] 3 years
There are a couple ways in which a tab will get called:

1. A tab is executed when referenced using Call from the first main tab. The first tab is ALWAYS executed regardless to ensure that the main function of the pipeline is executed.

2. A tab is executed when you are currently looking at the tab REGARDLESS of if it is specified in the main tab or not. The assumption here is that when you are clicked into a tab you want to see the results of its processing regardless of when it is called from the main tab or even if it is called from the main tab. This allows you to click onto another tab to test some other process without polluting your main tab.

3. A tab is ALWAYS executed if the tab properties (the = looking like icon on the far right) is set to "Always Run" (which yours was). This tells RR that the tab should always execute at least once when the pipeline is executed. This means that if you are not currently looking at that tab and the main tab does not call the tab it WILL still execute. If the tab is called from the main tab or if you are currently looking at it it will also execute but, naturally, only once.

The order of processing is the first tab is executed. Any tabs that are called from that tab will execute inline to the call (i.e. acts like you would expect a sub would). After this execution the system checks to see if any tabs that did NOT run that have the "Always Run" checkbox set are execute. Then it finally checks to ensure that the tab you are currently in (if not the first tab) executed.

While a bit confusing these 3 conditions are meant to support both testing new pipeline changes (ie. when you are looking at the specific tab), using a tab like a subroutine when called from main, and finally as a second thread/process to execute an independent pipeline (Always Run checkbox). Because it has 3 modes it can be a bit tricky to determine when a tab is or isn't executing. Hopefully this sheds some light on that.

STeven.



John Davis  [71 posts] 3 years
Thanks for the comprehensive reply.  Sorry I forgot to turn "Always Run" back off before uploading the example program.  I had been experimenting with it both on and off.  Nothing fixed the problem and it is still a problem.

I just now downloaded the program back down to my laptop and turned "Always Run" off on both called tabs; Camera task still runs over and over with no time delay, even with no lines highlighted in any tab.  (RR 2.67.26)

One thing that "Always Run" does do is keep the tab running even when the overall run button is off; this is very annoying.  However, I can imagine some scenarios where that might be useful.
program.robo

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