Autostop diagram

I am currently playing around with rtmaps and I as wondering if there is a way to automatically stop my recording diagram ?

Ideally, I’d like RTMaps to stop when it stops receiving data

Thank you,

Hello,

Yes, you can dynamically start/stop any diagram.

To monitor the sample rate (i.e if data is received) you can use the component Sample Rate
To autostop a diagram, you need the component Condition

image

In its initial state, the Condition does not have any input.
Simply define a condition in its Condition property.

In this case, I want to act if I detect a sample rate inferior or equal to 0
This is done by setting the Condition property like this :
image

This will create the Condition’s input sample_rate.
I could have named it a, my_input or whatever but I like clear variables name.

The other important property is “Parse when True”
This is the command that will be called when the condition is true.
For more details on how the Condition component works right-click on it → help
In this example, I simply want to stop the diagram, the corresponding command is shutdown

Here is an example diagram, while the diagram is running right-click on the generator to disable it thus dropping the sample rate to 0.
The Condition will then send the shutdown command to the engine.

shutdown_if_no_data.rtd (9.4 KB)

For more details on how-to use the Parse scripting language :

2 Likes

In case you need a longer timeout, you may as well use the Watchdog component (section Diagnostic) to get an event when it has not been receiving any data sample for some configurable time (and use the same Condition component downstream to shutdown the diagram.