This guide will walk you through setting up an FRC LabVIEW development environment on your computer. This environment will use LabVIEW FRC, CTRE Phoenix libraries, Sourcetree and Git for Windows, and LabVIEW's source control tools (Professional edition only).
There are several steps, but they are all very simple and rely primarily on program defaults so that you don't need to change anything. This guide is intended for JHS Viking Robotics Team 7221, but will also work for anyone that is interested! Please note that LabVIEW for FRC is only supported on Windows 10, and as such so is this guide.
First off, you will need to have LabVIEW for FRC set up on your Windows PC. You should contact your FRC Mentors for more information on installation and licensing. To install LabVIEW:
-
Install LabVIEW 2020 32-bit & Game Tools 2021 on your computer. Check NI's website for instructions, or search Google for 'Install LabVIEW for FRC'.
-
Configure LabVIEW to seperately store compiled binaries and source code. Open LabVIEW, click
Tools > Options
, then chooseEnvironment
. Check the option forSeparate compiled code from new files
. -
Install CTR Electronics CTRE Phoenix Framework on your computer (scroll down to Tech Resources/Installer, and click the most recent .zip file) You can find the downloads, detailed instructions, and controller firmware on their website.
On Windows 10, LabVIEW automatically creates a folder C:\Users\Your Username\Documents\LavView Data
in which several LabVIEW and FRC dependencies are stored. By default, all projects you create will be kept here, which is not very user friendly nor organized. To avoid issues down the line, make a folder C:\Users\Your Username\Documents\LabView Code
in which you will store all of your LabVIEW projects in.
You should now have LabVIEW 2021 for FRC and the CTRE Phoenix Framework installed on your computer. Make sure that when you open the LabVIEW program, you see "LabVIEW FRC 2021" at the top. If not, uninstall LabVIEW and follow step 1 again.
Now that LabVIEW is set up, you need to set up Git. But first, make sure you have a GitHub account, and access to your team's organization. Once you are sure you have access:
-
Install Git to your computer. The defaults are good, but there is one thing to change. When prompted for a default branch name, please select the option that says "main". The default name was "master" for a long time, but as an effort to increase diversity and be more inclusive, we will join the coding community in deprecating this insensitive term. Read more here or through the link in the installer.
-
Install Sourcetree to your computer. Skip the prompt to sign up for Bitbucket. On the next screen, make sure that Sourcetree finds Git on your computer, and then uncheck the box for Mercurial. Next, enter your name and the email account associated with your GitHub account.
Git and Sourcetree should now be installed, and Sourcetree should be set up to use the system Git not embedded Git.
LabVIEW professional development environment comes with source control tools which are called as scripts from the command line. LabVIEW FRC ships with the professional environment and will work, but it is important to note that other versions of LabVIEW will not allow you to use the source control tools.
The tools are called as scripts from the command line, and they expect all file paths as absolute file paths. However, Sourcetree and Git both supply relative paths. You need to set up a wrapper script which you use as your source control tool, and that wrapper will expand the relative file paths for LabVIEW.
Long story short, do the following:
-
Make sure that WSL Ubuntu is installed on your computer. You should be able to install it from the Windows Store, otherwise check out the official documentation.
-
Copy
_LVCompareWrapper.sh
toC:\Program Files (x86)\National Instruments\Shared\LabVIEW Compare\_LVCompareWrapper.sh
-
Copy
_LVMergeWrapper.sh
toC:\Program Files (x86)\National Instruments\Shared\LabVIEW Merge\_LVMergeWrapper.sh
-
Open Sourcetree and select
Tools >> Options
and selectDiff >> External Diff / Merge
. ForExternal Diff Tool
, selectCustom
and select the_LVCompareWrapper.sh
file that you just copied, and underArguements
enter\"$REMOTE\" \"$LOCAL\"
. -
Do the same thing for
Merge Tool
. Choose the_LVMergeWrapper.sh
file that you copied, and forArguements
enter\"$BASE\" \"$REMOTE\" \"$LOCAL\" \"$MERGED\"
.
At this point you should have Git installed on your computer and Sourcetree should be configured to use it. You should also have LabVIEW FRC 2021 and CTRE Phoenix Framework installed, and LabVIEW should be configured to save all compiled code seperately from your project files. Your machine is ready to go, but you should read on to learn how Git works and how to use it on a team.
GitHub provides incredible tools for storing and organizing files, tracking changes, creating branches for seperate projects, and keeping track of development history. However, as Uncle Ben once said in Spider-Man (2002), "With great power comes great responsibility".
It is super important that you talk with your development team, and really anyone who will touch your code, to make sure that everyone knows what conventions and practices to follow. Working together, following strict rules, and using comments everywhere can turn a mind boggling process into a really useful, easy to use one, and help you to avoid "merge hell" and other painful issues.
Check out National Instruments' GitHub turotial for an overview of how Git works, and how programmers can use it to collaborate. There is also a link to a GitHub page with another tutorial that may be useful. If you have used Git before you should still check it out though, as it will help explain some of the quirks of LabVIEW when it comes to Git.
As anything, Google is your friend. National Instruments has lots of documentation but it is not well organized or updated. However, all of the other programs here are industry standard, and you can find infinite tutorials and guides on how to use them. Keep in mind that while many Git tutorials online will show how to use a command line interface with Git, while this may be intimidating the overall process of pull >> branch >> program >> commit >> merge >> push
is the same no matter the interface.
Go back and make sure that you did not miss a step. If that doesn't work, try the following:
-
Make sure that LabVIEW has all of its components installed and licensed. Check out WpLib's FRC Documentation if LabVIEW isn't working, and check out CTRE's Phoenix Documentation if you have trouble with the Phoenix Framework.
-
Make sure that Git and Sourcetree are working. Check out Sourcetree Support. Git is not likely to have issues, but Sourcetree may be having issues finding it.
-
You can also check out this guide for integrating Git and LabVIEW, and this guide which fixes the problems that Sourcetree has when talking to LabVIEW's source control tools.