Post on 25-Feb-2016
description
ni.com/FRC
FRC LabVIEW Quick Start GuideFRC 2014 Training Material
Set Up LabVIEWBasics
Vision,& PID
Advanced Programming
ni.com/FRC
FRC LabVIEW Quick Start Guide
Set Up
LabVIEWBasics
Vision,& PID
Advanced Programming
•Software Set Up Overview
•FRC Software Orientation
•Finding/Connecting to the cRIO
•Basics of the Robot Project
•Deploying and Driving
4ni.com/FRC
Software Overview – What do I download?• Option 1: If you develop in
LabVIEW• Includes Vision
• Option 2: If you develop in C++ or Java and you want to use NI Vision
• ALL FRC TEAMS must download the NI Update Package
• Required for competition regardless of development language
• IE: Installs the driver station and cRIO utilities
Set Up
ALL TEAMSFRC 2014 Update Package
DVD included in Kit of Parts or Download links available at NI.com/FRC
1) LabVIEW Development Suite
2) NI Vision DevelopmentOR
5ni.com/FRC
Installation & Activation• 1) Download the software
• Link on NI.com/FRC
• 2) Unzip and run Setup.exe
• 3) Activate LabVIEW• Serial Number on the Back of the NI Software for FRC 2014 packageStarts with ‘M’
Set Up
6ni.com/FRC
Software Orientation: Getting Started Window• This window will open you start LabVIEW
• Requires FRC 2014 Update Package
Set Up
Create New Project
Built In Training
Tools
Help
Recent Projects
7ni.com/FRC
• The LabVIEW project window allows you to see all of the code that will run on your robot. The FRC software includes a template project with everything you need to start.
Software Orientation : cRIO Robot ProjectSet Up
All the code you need to change is in the Team Code
folder
Robot Main will communicate with the Field control system
and run your team code(Don’t edit)
8ni.com/FRC
Software Orientation: Team Code• This is the Autonomous Independent VI, create your
autonomous program here. This is one of the Vis you will need to edit.
Instructions Included
Edit this code
Set Up
9ni.com/FRC
Software Orientation : Driver Station• The driver station your robot control utility for practice and competition for all
FRC Teams. Open this to connect to your robot and run the code you written.
Set Up
This should be your team #Different Tabs for More
Functionality
All Lights should be green to run
Robot Statistics
Find out more about it here: https://decibel.ni.com/content/docs/DOC-26297
10
ni.com/FRC
Software Orientation : Dashboard• The Dashboard is a customizable display and control utility you can use
to read the current status of controllers, sensors, motors, and more
Set Up
Controller Inputs& Motor Status
Different Tabs for More Functionality
New Record and playback featureCamera View
Learn how to add your own features: https://decibel.ni.com/content/docs/DOC-26296
11
ni.com/FRC
Software Orientation : cRIO Imaging Tool• This utility allows you to set up your
cRIO controller
Set Up
Connect to I/O using the sidecar and bumper boards
Connect to your computer via ethernet
12
ni.com/FRC
IP AddressesSet Up
Both the driver station computer and the cRIO need to have unique IP addresses.
IP always end in .2
IP always end in .5
Control Panel>Network&Sharing>Adapter settings>Properties>IPV4
13
ni.com/FRC
Step1: From the LabVIEW Getting Started Window, select New >> FRC cRIO Robot Project to create a new LabVIEW project. (Step 0: Open LabVIEW for FRC!)
If you plan to use real hardware the cRIO and D-Link will need to be properly set up before attempting the rest. You could run the project in simulation
Set UpDrive a Robot: Step 1 Open the Template Project
14
ni.com/FRC
Step2: Fill in the New Project dialog box. Give the project a meaningful name, use your team number to replace xx.yy in the ip address, and pick the type project you want to make.
Set UpDrive a Robot: Step 2Configure your cRIO Robot Project
Choose the project type that sounds most similar to your robot.
15
ni.com/FRC
Step3: To open Robot Main.vi double click on it in the project window. The front panel should launch. Hit Ctrl+E to open the block diagram and look at the code.
Set UpDrive a Robot: Step 3Open the Template Project
The code you need to edit is in the Team Code folder
If you add new Vis be sure they are under the cRIO
To drive your robot open Robot Main
16
ni.com/FRC
Step4: If you have a cRIO connected make sure it is selected . If you don’t have an actual robot to drive around you can still simulate one. Select the …lvproj/My Computer target to open the simulator
Set UpDrive a Robot: Step 4Select a Target
Real cRIO(not connected here)
Simulated cRIO
17
ni.com/FRC
Step5: Click on the white run arrow at the top left of Robot Main. The robot project will be deployed to the cRIO/Simulator. Once LabVIEW is finished deploying the code you will need to open up the driver station. The LED’s should all be green. Click TeleOp button and then Start.
Set UpDriving a Robot: Step 5Deploy Code
18
ni.com/FRC
• Software Set Up Guide• LabVIEW Development Suite for FRC 2014• Imaging cRIO & Windows IP Configuration• Troubleshooting cRIO connections• Driver Station Tutorial• Custom Dashboard Tutorial• Robotics Framework Tutorial• Robot Simulation Tutorial
• Forum Support• NI.com/FRC – year round
• Phone Support• 1(866)511-6285 from 1pm to 7pm (CST) - During build season only
FRC LabVIEW Quick Start
Guide
Set Up
Set Up Resources
All links available atNI.com/FRC
Click
ni.com/FRC
FRC LabVIEW Quick Start Guide
Set Up
LabVIEWBasics
Vision,& PID
Advanced Programming
• What is LabVIEW?
• LabVIEW development environment
• LabVIEW programming fundamentals
• Tools and Troubleshooting
• Teleop and Autonomous Code
20
ni.com/FRC
What Is LabVIEW?— A graphical programming environment used to develop sophisticated
measurement, test, and control systems.
LabVIEWBasics
Rich User Interface(Front Panel)
Graphical Drag and Drop Code (Block Diagram)
Powerful built-in analysis libraries and tools
21
ni.com/FRC
The LabVIEW EnvironmentLabVIEW
Basics
22
ni.com/FRC
Parts of Robot Main.viLabVIEW
Basics
Project Explorer
Front Panel(User Interface)
Block Diagram(Code)
23
ni.com/FRC
Project Explorer
LabVIEW file extensions:LabVIEW project —.lvprojVirtual instrument (VI) — .viCustom control — .ctl
LabVIEWBasics
24
ni.com/FRC
Parts of a VI – Front PanelThe front panel is the VIs graphical user interface with inputs and outputs.
Controls (inputs) buttons, knobs, slides...
Indicators (outputs) numeric display, graphs, LEDS…
LabVIEWBasics
LED Indicator
Boolean (On/OFF)Control
Numeric Indicator
Slider Control
25
ni.com/FRC
Controls PaletteLabVIEW
Basics
Browse Sub-PalettsControl
Pin to keep openRight-Click on Front Panel (not the block diagram) to open the control palette
Search for Controls
26
ni.com/FRC
Parts of a VI – Block DiagramThe block diagram is the code for each VI. In LabVIEW graphical blocks are connected with wires to control the execution.
LabVIEWBasics
Function
Loop
Terminal(Front Panel Objects)
27
ni.com/FRC
Functions PaletteLabVIEW
Basics
•Right-Click on the Block Diagram (not the front panel) to open the functions palette
•Contains the VIs, functions, and constants you use to create the block diagram.
•FRC Specific Palettes include the WPI Robotics Library, FIRST Vision, and PID
Search for functions by name
28
ni.com/FRC
Same Name
TerminalsTerminals allow you to read and write to front panel controls and indicators.
LabVIEWBasics
29
ni.com/FRC
Dataflow Programming
• Order of execution is controlled by how the wires are connected
• Each function will execute when all of the inputs are ready.
• Parallel code executes at the same time
Turn on Highlight Execution
LabVIEWBasics
30
ni.com/FRC
LabVIEW Toolbar• The tools you need to run, debug, clean up and edit your code
LabVIEWBasics
Run Tools Front Tool Arrange Tools
Debug Tools
Clean UpBroken Arrow(Errors found)
31
ni.com/FRC
Wires (Data types)
• Wires transfer data between block diagram objects.• Wires are different colors, styles, and thicknesses, depending on their
data types.
Scalar
Floating-pointnumber
Integernumber
String Boolean
1-D Array
2-D Array
LabVIEWBasics
Broken Wire(type mismatch)
32
ni.com/FRC
Wires (Data Types)• Here are some other examples of wires in LabVIEW
• Floating point• Integer• Boolean• String• Array – note wire thickness• Cluster (group of other datatypes)
33
ni.com/FRC
Loops• Allow same piece of code to run multiple times• Exit conditions different for each
While Loop For Loop
Run until stop condition met
Run N times
Iteration Counter
34
ni.com/FRC
Troubleshooting: Driver Station Diagnostics
• The Diagnostics tab in the FRC Driver Station can display important warning and error messages for troubleshooting
LabVIEWBasics
Reboot cRIO
35
ni.com/FRC
Context Help
• Displays basic information about wires and nodes when you hover over with your mouse.
• Turn Context Help On/Offo Click the yellow ? on the top right
corner of your VIo Press <Ctrl-H>o Select Help»Show Context Help
from the LabVIEW menu.
LabVIEWBasics
Click for more info
Click ? To Open Context Help
36
ni.com/FRC
LabVIEW Help
• Contains detailed descriptions and instructions for most palettes, menus, tools, VIs, and functions.
• Open LabVIEW Help by− Selecting Help»LabVIEW Help from
the menu
− Clicking the Detailed help link in the Context Help window
− Right-clicking an object and selecting Help from the shortcut menu.
− Press F1
LabVIEWBasics
37
ni.com/FRC
Find Examples
• Find FRC templates in the Support Tab>>Find FRC Examples…
• Or Help>>Find Examples and browse to the FRC Robotics Folder
LabVIEWBasics
38
ni.com/FRC
Debugging: Correcting Broken VIs
Broken Run arrow VI cannot be compiled VI cannot be executed
LabVIEWBasics
39
ni.com/FRC
Debugging: Probes• Use the Probe tool to observe intermediate data
values and check the error output of VIs and functions, especially those performing I/O.
• Specify to retain the values in the wires so that you can probe wires for data after execution.
LabVIEWBasics
40
ni.com/FRC
Breakpoints• When you reach a breakpoint during execution, the VI pauses
and the Pause button appears red.• You can take the following actions at a breakpoint:
• Single-step through execution using the single-stepping buttons.• Probe wires to check intermediate values.• Change values of front panel controls. • Click the Pause button to continue running to the next breakpoint or
until the VI finishes running.
LabVIEWBasics
41
ni.com/FRC
Telop Code
Begin.vi Teleop.vi Finish.vi
When Modifying The FRC Robot Project Template, do not modify Robot Main.vi
Modify the code within the Team Code Folder within the ProjectThis code is called upon in Robot Main.vi
LabVIEWBasics
42
ni.com/FRC
Autonomous Code• Similar to Teleop, Autonomous executes code by references
Begin.vi Autonomous Independant.vi
LabVIEWBasics
43
ni.com/FRC
• Learn LabVIEW - Video Training• LabVIEW Environment Overview• Creating custom controls• LabVIEW Dataflow• LabVIEW Tools• LabVIEW Data Structres• LabVIEW Debugging• WPI Library Overview
• Forum Support• NI.com/FRC – year round
• Phone Support• 1(866)511-6285 from 1pm to 7pm (CST) - During build season only
FRC LabVIEW Quick Start
Guide
Set Up Resources
All links available atNI.com/FRC
Click
LabVIEWBasics
ni.com/FRC
FRC LabVIEW Quick Start Guide
Set Up
LabVIEWBasics
Vision,& PID
Advanced Programming
• NI Vision
•PID Control
ni.com/FRC
FRC LabVIEW Quick Start Guide
Set Up
LabVIEWBasics
Vision,& PID
Advanced Programming
•Customizing Dashboards
•Dashboard Record and Playback
•Event Error Logs
•Performance
•Autonomous Strategies