|
Re: LV Mastery Question ... Main Shifter and Command Global
Ziaholic,
I'm so glad you're enjoying our videos... and asking (then self-answering) very astute questions.
You could put the main shifter into a global. The reason I didn't was because it was simpler to only have what you needed, and better to reduce the quantity of data. Also, I wanted to be able to use it in an autonomous independent.
Some general comments:
What we have here is the biggest problem when working in LabVIEW - breaking out of the dataflow paradigm - efficiently.
In a nutshell, I use this rule of thumb:
- Shift register only when you have a single loop: no locals or globals
- When you have parallel loops, you can pass small amounts of data around using globals. Only write in ONE place. Read in many. That can be tricky, and is what motivated last year's approach of the command signal to go from teleop (or autonomous) --> other loops. Remember that when the other loops needed to send info back, they used their own global, so that it was only written in one place.
- When you have large amounts of data to pass around, use a functional global variable. That's a tricky but very useful beast. I don't think I've brought it up in any videos, nor do I think you **need** it for FRC, but it is interesting. In 10 words or less: an uninitialized shift register in a while loop which only runs once in a subVI will remember stuff. (OK that was more than 10).
Good luck!
Ben
|