LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Real Time Stream Channel: Timed Loop makes MyRio disconnect

Dear all,

 

I am writing a program on the MyRio to simulate a drag race for a mini RC project, so that we can test the autonomous RC vehicle's software before we physically drive it. The general flow of the VI is that the "main" loop (producer) generates a position and velocity, and gives that to four different sensors (consumers) to act upon that. The "main" loop needs to run exactly real-time (run once every 1 ms) in order to be of value for testing.


Question 1

If I do this with a Tag channel, all works well except my "main" loop is not fast enough.  Now if I try the same with the Real Time Streaming Channel and a Timed Loop, the Timed Loop executes once and then crashes/disconnects the MyRio.

 

I'm have no succes finding the right errors. I'm guessing the dual-core (ARM Cortex real-time processing) CPU is overloaded so to say, but the main loop does not look too compuationally heavy, as I have taken out all of the digital and analogue in- and outputs. I have tried setting the Timed Loop's wait time to eg. 100 ms, but that made it crash as well. I have also tried to get the brake activation while loop inside the 'main' loop, but that does not make a difference. I have tried experimenting with merging two of the consumer loops, with no result so far.

 

Any suggestions on why, and especially how to solve this? I am looking forward to having this run smoothly! I have posted a "schematic" and the actual VI here.

 

Question 2

In the bigger picture: Are wired channels (tag-channel or rt-channel) the right thing to look at in order to improve the main loop's execution speed? Or do you advise looking into RT FIFO, Queue's, Global Variables etc. instead?)

 

Any advice on improving running speed is appreciated! 

 

Specs:

-MyRio-1900 with dual-core ARM® Cortex™-A9 real-time processing.

-Labview 2019 SP  with MyRio Toolkit (RT + FPGA options).

-Pc runs Windows 10 (runs no VI during execution).

-All is in one VI: there are no subvi's just yet.

 

Thank you in advance,

 

Kindest regards,

 

~Incompressible

Download All
0 Kudos
Message 1 of 4
(2,126 Views)

Hello, Incompressible.  I am a big enthusiast of Asynchronous Channel Wires, and use them heavily in my routines.  I'm just getting into myRIO, and my previous LabVIEW RT project was just before Channel Wires were introduced, so while I know about RT FIFOs, I'm not (yet) experience with the RT Streaming Channel (which I think uses RT FIFOs).

 

While I've used Streams for Producer/Consumer transfers, I have never "split" the Stream using Replicate -- it always struck me as "unwise".  Might I suggest that you try a simpler version of your code that removes some of the Consumers, reducing a "Triplicate the Data and send to Three Consuumers" to "Send Data to One Consumer" (removing the other two Consumers) and see if it runs in a satisfactory manner?  

 

I'm very nervous about the "Global Stop", which seems to stop every loop in its tracks.  Stream Channels have a "last element?" feature that lets the Producer signal its Consumers that they should exit.  This is a much safer way of closing down a multi-loop routine like yours.

 

Bob Schor

0 Kudos
Message 2 of 4
(2,076 Views)

Dear Bob,

 

Thank you for looking into this,

 

Thanks for the suggestion on using the "last element". I'll change that. Too bad that the tag channel does not have this option, as I found those to work better than the stream channel for this VI. Secondly, I have tried merging three of the consumer loops into one, with no effect on performance.

 

Do you think using RT FIFO's would be a logical alternative?

 

~Incompressible

0 Kudos
Message 3 of 4
(2,046 Views)

Consider a Consumer loop connected to its Producer by a Stream.  Which runs faster, the Producer or the Consumer?  Well, the Consumer needs to "consume" something, so it cannot run faster than the Producer (since it has to Consume what the Producer produces..

 

Now replace the Stream Channel with a Tag Channel.  Let the Producer produce 1 element.  The Consumer will consume it over and over again, as fast as it is able.  Streams and Tags operate differently.

 

Bob Schor

0 Kudos
Message 4 of 4
(2,037 Views)