LabVIEW Porting Guide - 2014 to 2015
LabVIEW teams will find the VIs and palletes in the 2015 FRC version of LabVIEW very familiar. Teams should only need to make minor changes to get a 2014 program to run on a roboRIO. This document highlights changes in the 2015 VIs and how they correspond with the old code.
- The old Joystick Get VIs have been replaced with a single VI that provides an array (instead of a cluster) for each type of input (axes, buttons and POVs).
- POVs have been changed to be a unique output and to an angle (0 to 360 with -1 indicating not pressed).
- Joysticks, axes, POVs, and buttons (in LabVIEW, buttons are still 1 based in C++\Java) are 0 based
- The DS will now support up to 6 joysticks with a dynamic number of axes, buttons and POVs
Module and Channel numbers
As the roboRIO has no modules, module numbers have been changed to a Controller number which currently has only one option (and therefore does not need to be wired). Channel numbers have been changed to be 0-based (matching the channel numbers on the roboRIO).
Compressor code is no longer required (when using the PCM) unless you wish to get advanced information from or exercise control over the compressor. Opening any solenoid on the PCM the compressor is attached to will automatically enable the closed loop control for that compressor.
Sensor "Start/Stop" - Encoders, Counters, etc.
Sensors which uses to require explicit Start and Stop VIs have been changed to Start on Open. Stop has been removed. If you wish to keep track of values over a single explicit period, call Reset at the start of the period. If you wish to keep track of values over multiple explicit periods, you will have to track this in your code (Reset at the start of each period and keep track of the sum in your code).
DS User Messages
The User messages window on the Driver Station has been removed, therefore this functionality has been removed from the pallete. As a replacement, the default Dashboard contains a number of controls and indicators of different types on the "Basic" tab that teams may wish to use to display robot information or provide input. To write to these controls, use the SmartDashboard VIs, the key names to use are listed on the Dashboard.
On the cRIO, files could be written to the root drive (C:\) or you could create subfolders within that location. On the roboRIO you should write files to /home/lvuser or create a subdirectory underneath that for your files. Note that a File Create will fail if the directory does not exist so you will need to programatically create the directory or create it via SFTP/SSH before trying to create a file in that directory.
DS IO, Enhanced IO, and Kinect
The Cypress Firsttouch board support and Kinect server support has been removed from the DS so these palletes and VIs have been removed. Teams can use the Dashboard or USB HID devices to replace the Cypress board functionality. The TI Launchpad and 16 Hertz Leonardo++ included in your Kit of Parts can both be programmed to appear as HID devices to be used for custom I/O (click the links for more info). Teams wishing to use the Kinect as an input device will need to modify the Kinect server to send data directly to the robot using Network Tables or one of the ports available on the field network.
With the built-in SPI ports, the SPI Ooen and configuration has been simplified and consolidated to a single VI:
- The Clock Phase and Clock Active state have been combined into a mode Enum
- The "MSB First" boolean input has been removed, you will need to flip your data before sending if you need to send LSB first
- The "Frame Mode" input has been removed. The SPI port on the roboRIO does not support this.
- The "Bits per word" input has been removed. The SPI port on the roboRIO does not support this.
- The "Chip Select Active Low" input on the 2014 config VI has been flipped to be a "Chip Select Active High" input on the 2015 open VI.
The Compatibility mode input has been removed from the I2C Read and I2C Write VIs. This is not necessary on the roboRIO I2C.
I2C addressing has changed from an 8-bit address on the cRIO to a 7-bit address on the roboRIO. An 8-bit address includes the bit for whether an operation is a read or write while a 7-bit address does not (the R/W bit is appended by the driver when performing the operation).
The Camera VIs have been modified to support USB cameras (tested with the Microsoft Lifecam HD3000). For complete information see the examples and the Vision Processing section.
In addition to the changes, a number of new VIs have been added to support the new capabilities of the roboRIO and the new Control System. For additional help with these VIs, drag them into your project, right click on them and select Help.
New VIs have been added to get information such as the name, type, and axis, button and POV count of each Joystick and to set HID outputs for devices which support them (such as the TI Launchpad).
These VIs use the output voltage of the analog supply to provide a normalized (0 to 1) reading from a potentiometer or other ratiometric sensor
These VIs help abstract switches used as Limit Switches or Counting Switches.
The accelerometer VIs have been generalized to apply to the internal accelerometer, analog accelerometer, or the ADX345 connected to either the I2C or SPI interface.
These VIs control the 2 Analog Outputs on the MXP port
These VIs provide information about the roboRIO power state, PCM faults, current, and voltage, PDP faults, current and voltage, and the enabled state of the FPGA outputs.