×

Our Future . . .

When I initially created this site in 2014, it was to serve two primary purposes.

  1. To document the tips, tricks, and other higher level development practices that make programming for FRC in LabVIEW easier.
  2. Provide a common place for LabVIEW teams to find resources.

At first, this meant documenting the architectural and similar tools that I had learned on my way to becoming a Certified LabVIEW Developer, that had been put to use by the team I was currently mentoring (#3937, Breakaway). (This had the added bonus of helping the senior programmer that had been soaking all this up document it for his successor.)

Since then, this site has had a few additions and updates (mostly by me).

While I have often invited other teams (I am no longer in the AR area and have pretty much lost contact with Breakaway) on CD and at the regionals I've been at to write tutorials for specific topics that they had solved, I was rarely met with a response (specifically once - shout out to the Huskie Robotics 3061 for actually following through, but they were the only ones).

 

In recent years, I have found myself going through some family changes and needing to dial back my commitment to other activities.

This leaves this site both:

  1. Looking for a new champion/curator, that is willing to:
    • maintain the back end,
    • make sure material that becomes obsolete is either updated, or moved to the archives section of the menu,
    • and either write content or get other teams to write content to help this site remain relevant.
  2. Looking for a new source of funding/hosting. (I have been personall providing the $36/yr that it costs to maintain it using Google Domains for the domain name - and email - and Hosting24 for the hosting; I have thought about using some sort of a Donate button, but have not been able to find a platform that allows for *only* raising the target amount).

 

If you have any interest in seeing the continuation of this site, please let me know.

FRC LabVIEW Tutorials - Functional Global Variable

Table of Contents

What is a Functional Global Variable(FGV)?

An FGV is a standard LabVIEW data structure that implements data storage in a globally accessible way. Every time you call the FGV (which is a vi), the block diagram runs exactly once - either updating the data or reading it.

FGV vs. Global Variable

The FGV is a data structure designed to help prevent race conditions. However, if you are writing to your variable in one loop (for example, in Teleop), and reading from it in another (for example, periodic tasks), this will not cause a race condition.
There are three criteria that should be considered when choosing to implement an FGV or a simple Global

Always consider which is the better data structure for the particular scenario.

How to make an FGV

For this example, we will make an FGV that contains the speed for the a shooter motor, and will briefly discuss how to use it

Create a new VI

This vi will be the FGV, so it needs a couple of controls.

Adding the controls and indicator

These controls and the indicator need to be accessible via the connector pane.
To connect a control or indicator to the connector pane, select the desired terminal.

select a terminal

Then select the control or indicator to connect it to.

select the corresponding control/indicator

Block Diagram

The basis of the FGV is a while loop that has two things:

Add a shift register to the while loop

Add a shift register to the while loop

Put a case structure inside the while loop and connect it the enum to the selector. Notice that not all of the enum values are setup as cases initially, so right click on the case structure and select "Add case for every value".

Add all Cases

Add a case structure to the while loop

For the initialize case, put a default value in.

Put a default value in the initialize case

In the set case, this is where we can enforce the valid range of values. We take the input and run it through a coerce block and store the coerced value in the shift register.

Coerce the value and put it int eh shift register

In the read case, we take the value from the shift register and report it to the indicator.

Pass the shift register out to the indicator

We are now faced with a decision of what to do in the other cases where the output is not needed.
Two options present themselves:

  1. Move it to the output of the shift register so it is always updated
  2. Configure the output to be the default for a number (which is zero) if the selected Mode is not Read.

This example implements a default.

Use the default value when not reading

And we are Done. Click here to download the finished version

Final version

If this tutorial inadvertently leaves some details out, please tell us about it and we will update it.

Google Form to request details