LabVIEW

From the Team 1432 Robotics Wiki

Jump to: navigation, search
Fancy LabVIEW has been identified by Team 1432 as fancy, which means that mentioning it to any programmers may result in an ecstatic, incoherent rant. Do so at your own risk.
Some of the LabVIEW code from Safe

LabVIEW (Laboratory Virtual Instrumentation Engineering Workbench) is a visual programming environment made by National Instruments. It was first allowed in FRC competitions in the 2008–2009 season, with the introduction of the cRIO. Team 1432 has been using it since then (the first robot to use it was Robot 6).

Contents

Features

Overview

LabVIEW's graphical paradigm makes code appear similar to a flowchart. Data in the program is transferred via wires, lines of various patterns and colors (representing the type of data in the wire). Blocks in the block diagram are called VIs (virtual instruments). VIs are equivalent to subroutines or user-defined functions in other programming languages. LabVIEW also has the concept of built-in library functions, represented by non-editable blocks (usually with a yellow background).

Wires transmit data between VIs, allowing the program to manipulate data. An output from one VI may be wired to an input of another VI, so that data can be used with multiple operations in sequence. (Wires also support branching, so the same data from the same wire can be transferred to multiple other places.)

Due to the separate-block nature of LabVIEW programs, parallel tasks are inherently simple to implement. When two arbitrary blocks are placed in the block diagram of a program, they may run at the same time. The sequence of execution of a program is only guaranteed when:

  • a data dependency is created between two nodes; or
  • a literal "sequence" construct is used.

Data dependencies are created when an input of one block depends on the output of another block. A block will only execute when data is available for all of its inputs.

Debugging

LabVIEW offers a live debugger, which supports slow running of code to see the execution path ("highlight execution"), stepping through code manually, and a tool called a "probe", which can show the data in a wire while the program is running.

Use with CompactRIO

There are two main ways to use LabVIEW with the cRIO and the rest of the control system.

Robot projects

Robot projects are types of LabVIEW projects that are intended to run on the robot. They contain the main program code, which deals with robot motion, sensor input, and so on. When they are compiled, robot projects can be deployed to the cRIO. They may then be run as a startup program, making them the default code the cRIO will run when it turns on.

Alternatively, robot projects may be run directly from LabVIEW, allowing live debugging.

Dashboard projects

Dashboard projects are LabVIEW projects that run on the computer, but communicate with the robot via the driver station. They can retrieve data (such as a camera feed or motor output values) that are sent by the robot's program, and display them directly on the computer.

The LabView project for the dashboard is saved in the "2010 Game Dashboard Project" with in the LabVIEW Data folder of the developer account's documents. In order to update the actual dashboard software shown during competition or practices, the project must be built, then the compiled executable file must be copied to "%PROGRAMFILES%\FRC Dashboard\Dashboard.exe".

WPI Robotics Library

The FRC edition of LabVIEW ships with the WPI Robotics Library installed. This library adds VIs for interacting with the cRIO, performing tasks such as changing PWM outputs, reading analog inputs, and so on, forming the foundation of programming robots with LabVIEW.

See Also