James Mc Posted April 13, 2010 Report Share Posted April 13, 2010 (edited) Hi All, I am currently architecting a program where I have multiple parallel services running for a robotics application e.g. mapping and motion control. I am finding myself using a lot of notifiers to pass control signals between them for example I have a global e-stop notifier and check its status for a value. The reason I have gone for this is to a)Avoid local variables as I can pass notifier references easily into the 'sub-VIs' which are my services and can then be passed down to sub-VIs in them. b)Avoid shared variables, I am using shared variables for data e.g. my global 2D Pose but want maximum reliability for items like my E-Stop system and dont entirely trust shared variables for these. However I don't know too much about how they work under the hood. Am I correct in thinking that they have a low overhead and high reliability and speed of update? Also how do data references compare? Will be interested to hear everyones thoughts on this. Regards, James EDIT: I should also mention this code will be deployed on RT. As such should I use data references? I wonder because the in place structure blocks the reference to avoid race conditions but this is non deterministic, I am only writing in 1 place and reading at multiple others so wonder if there is a good alternative? Edited April 13, 2010 by James Mc Quote Link to comment
jdunham Posted April 13, 2010 Report Share Posted April 13, 2010 (edited) Am I correct in thinking that they have a low overhead and high reliability and speed of update? Yes, you are correct. If you have many notifiers and continually look them up by name, you will pay a penalty for that, but if you wire the notifier references directly, they are very fast and reliable. Our application has dozens of parallel while loops (sometimes hundreds) and most of them wait in an idle state until data is received on a queue or a notifier. EDIT: I should also mention this code will be deployed on RT. As such should I use data references? I wonder because the in place structure blocks the reference to avoid race conditions but this is non deterministic, I am only writing in 1 place and reading at multiple others so wonder if there is a good alternative? I think we would need to know more about your application. Notifiers are themselves references, but with a built-in trigger for catching updates. However there is no protection from a race condition or a missed update. If you are streaming data to multiple readers I would use one queue for each recipient and have the single writer looping through the array of queues every time there is a new update it needs to broadcast. Edited April 13, 2010 by jdunham Quote Link to comment
David Wisti Posted April 13, 2010 Report Share Posted April 13, 2010 EDIT: I should also mention this code will be deployed on RT. If you using RT and need deterministic code, I would avoid notifiers. There is nothing wrong with Shared Variables (i.e. RT FIFO enabled SV's). If you really don't like Shared Variables then use RT FIFO's. Also, Type2 Globals can be used deterministically if the VI is set to subroutine priority and "Skip Subroutine Call if Busy" is selected. Here are some good links at NI with info about RT FIFOs & Shared Variables. Real-Time FIFO Frequently Asked Questions Notifiers cause a lot of jitter, use single-element RT-FIFOs instead. Monitor for Empty State in RT FIFO Enabled Shared Variable Real-Time FIFO for Deterministic Data Transfer Between VIs Avoiding Shared Resources Quote Link to comment
crelf Posted April 13, 2010 Report Share Posted April 13, 2010 If you using RT and need deterministic code... There is nothing wrong with Shared Variables (i.e. RT FIFO enabled SV's). If you really don't like Shared Variables then use RT FIFO's. Also, Type2 Globals can be used deterministically if the VI is set to subroutine priority and "Skip Subroutine Call if Busy" is selected. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.