VAFIRST LabVIEW Workshop 11/19/11 Presenters: Marin Kobin & Patrick Foley.

Slides:



Advertisements
Similar presentations
Previously… We created a simulated temperature reader which alerts if too hot or too cold… Download the solved practice to keep in sync: Thermostat.vi.
Advertisements

Apple Pi Robotics Logic System and Programming Basics 1 1.
Additional Programming Concepts MVRT 2011 – 2012 Season.
US First Robotics Lab View Tutorials Jim Thomas Lawrence Berkeley National Laboratory Team 496 Port Jeff Powerhouse.
Robot Code MVRT 2010 – 2011 Season. Robot code controls the robot Robot Main.vi –Calls all the smaller SubVis Rules of programming the robot –Be careful.
Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 2 Virtual Instruments Read Bishop, Chapter 2. Lab #2 and Homework #2 due next week. Quiz #1 next week.
Lesson 2 Navigating LabVIEW
Exercise 1: Install PC Software & NXT Firmware
Based on LabVIEW 2011 Student Edition
Jason Howard. Agenda I. How to download robotc II. What is tele-op used for? III. How to build a basic tele-op program IV. Getting the robot to drive.
Add and Use a Sensor & Autonomous For FIRST Robotics
Jeff Beltramo NHTI-Concord’s Community College FRC Team 1922.
1. 2 LabVIEW for FRC Doug Norman National Instruments January 6, 2012.
Presented by Team 3350 (T-BOTS).  Students should lead their teams in the building, design, and all other aspects of the robot.  Knowledge of the Kit.
Networking By: Matt Motl… Programmer Brent Everson… Programming Mentor.
Welcome! Workshop 2 of 7.
Programming and Electronics Training
De la Rosa-Pohl ECE 1100 Introduction to Engineering Intro to LabVIEW: Programming for Symon University of Houston Diana de la Rosa-Pohl Len Trombetta.
Introduction to LabVIEW
V EX C OACHES ' T RAINING October 12, Agenda for Today 9 – 10 AM : Tina Reeves and the Engineering Notebook 10 – Noon : Finish Building, Basic Robot.
Overview of New System Beta Team from Wilsonville 1425 Wilsonville Robotics – Code Xero 2550 Oregon City Robotics.
FRC LabVIEW Software Overview Joe Hershberger Staff Software Engineer National Instruments.
CS320n –Visual Programming LabVIEW Foundations. Visual ProgrammingLabVIEW Foundations2 What We Will Do Today Hand back and review the midterm Look at.
Introduction to LabVIEW Seth Price Department of Chemical Engineering New Mexico Tech Rev. 10/5/14.
How to Use This Training Deck
Lecture 13LabVIEW and GPIB LabVIEW (National Instruments) –Graphical program language –Widely used in academia (lab) and industry (R&D) General Purpose.
What is RobotC?!?! Team 2425 Hydra. Overview What is RobotC What is RobotC used for What you need to program a robot How a robot program works Framework.
Driver Station MVRT 2009 – 2010 Season. Add information Breadboard Classmate PC USB Hub Joysticks Stop Button.
V1: HMFR, V2: MFNB, 2007 LabView Seminar University of Puerto Rico Mayagüez Campus.
US First Kickoff 2012 Software Programming (And Control System) Daniel Kohn University of Memphis.
LabView Basics The Fighting Pi Controls Group. About LabView LabView is a highly adaptable programming GUI (Graphic User Interface) LabView compiles the.
MCEN 371 – Mechanical Engineering Lab Chapter 6: LabVIEW Part 1: Introduction.
Chapter 1 LabVIEW Basics. Features > Uses Graphic Symbols > Created by National Instruments > Virtual Instruments (VIs) > Extensive Library of VIs.
Virtual Instrumentation With LabVIEW. Front Panel Controls = Inputs Indicators = Outputs LabVIEW Programs Are Called Virtual Instruments (VIs) Block Diagram.
LabVIEW an Introduction
Introduction to LabVIEW
LabVIEW Program and Data Flow Review LabVIEW Robotics Fundamentals.
Weston Schreiber & Joshua Gabrielse Robotics Summer Training Programming #1: EasyC Basics.
LabVIEW Workshop September 26, 2009 Hauppauge High School SPBLI - FIRST Mark McLeod Advisor Hauppauge Team 358 Northrop Grumman Corp.
2009 FRC Control System Software Overview Dave Doerr, Mentor, Team 67 November 15, 2008.
Teacher/Mentor Institute Using easyC Joel Kirkland July 30-31, 2015.
FRC Robot Framework Labview Made Easy (er) For FIRST Robotics 1.
LabView instrumentoinnissa, 55492, 3op Labview in instrumentation Lecturer: Heikki Ojala, room C204a
EET 2259 Unit 7 Case Structures; Sequence Structures  Read Bishop, Sections 5.4 and 5.5.  Lab #7 and Homework #7 due next week.  Quiz #3 next week.
1. 2 LabVIEW Intro, Basics, Tips, Tricks Doug Norman & Stephanie Brierty National Instruments January 8, 2010.
2010 LabVIEW Beginner Workshop October 9, 2010 Hauppauge High School SPBLI – LI FIRST Mark McLeod Hauppauge Team 358 Northrop Grumman Corp.
1. 2 FRC 2010 Robot and Dashboard Projects Doug Norman & Stephanie Brierty National Instruments January 8, 2010.
Mechanics of LabVIEW Workshop January 10, 2009 Farmingdale State College SPBLI - FIRST Mark McLeod Advisor Hauppauge Team 358 Northrop Grumman Corp.
Part II Introduction to Robot Code. How to open a new FRC robot project 1.Open LabVIEW. 2.Click "FRC cRIO Robot Project" in the upper left section "New".
FRC Robot Programming 1.PID Continued 2.Downloading and Deploying Code 3.Program a 2012 Robot from Spec Basic code For FIRST Robotics.
Digital Electronics and Computer Interfacing Tim Mewes 4. LabVIEW - Advanced.
Introduction to LabVIEW 8.5
Part III Robot Drive. Robot Main.vi The main body of your code: accesses all of the other programs in your project A big loop! Do not add any more loops.
Understanding The 2008 FRC Robot Controller Chris Gregory FRC1089 – Team Mercury
LabVIEW Basics Dustin Cruise. Who is this guy? Graduate Student in Mechanical Engineering at Purdue University Specialty Areas: Combustion Control Systems.
Session 11 Intro to FRC API.
Workshop 2 of 4 Welcome!. Survey While You Wait ni.com/duke >> Recent Documents >> LabVIEW Workshop Participation Survey.
Cr yptonite robotics labview beta findings December 19, 2015.
Introduction to Labview Dawgma Team 1712 Bob Bellini, Paul Gehman.
MEH108 - Intro. To Engineering Applications KOU Electronics and Communications Engineering.
Introduction to LabVIEW. Overview Objectives Background Materials Procedure Report/Presentation Closing.
Creating Flexible, Script-Controlled Autonomous Software Example Explanation.
Introduction to Programming in RobotC
EE 200 Design Tools Laboratory 14
EET 2259 Unit 3 Editing and Debugging VIs
Introduction to LabVIEW
Lesson 2: Introduction to Control programming using Labview
Structures- case, sequence, formula node
EET 2259 Unit 7 Case Structures; Sequence Structures
EET 2259 Unit 2 Virtual Instruments
Presentation transcript:

VAFIRST LabVIEW Workshop 11/19/11 Presenters: Marin Kobin & Patrick Foley

Objectives What is LabVIEW? Give an overview of the LabVIEW environment Create a sample drive code for a 2 Drive Motor Robot Create a sample Autonomous program.

Assumptions Have a basic understanding of

The LabVIEW Language LabVIEW program consists of one or more Virtual Instruments (VIs) A VI is like a function or a procedure or a subroutine – except that it has a richer interface

Each VI has 2 Windows Front Panel User Interface (UI) – Controls = Inputs – Indicators = Outputs Block Diagram Graphical Code – Data travels on wires from controls through functions to indicators – Blocks execute by Dataflow LabVIEW Programs Are Called Virtual Instruments (VIs) 5

Functions (and Structures) Palette 6 (Place items on the Block Diagram Window) Structure: While Loop

LabVIEW Nodes While loop For loop Boolean logic PID Control Arrays Signal processing Mathematics Timing

LabVIEW Types Floating point Integer Boolean String Array – note wire thickness Cluster

LabVIEW Tasks Multiple tasks in parallel Data flow still applies Loops 1, 2, and 3 will run Loop 4 runs after 3 stops

Creating a new FRC cRIO Project Select New: FRC cRIO Robot Project Create a Project name: – VARFIRST Workshop cRio IP address: Replace xx.yy with your team number – Choose Robot Framework with Game Code. Press Finish when done.

Project Explorer Expand the “Team Code” Folder. This is where you will find the 3 sub.vi’s that you will have to use to create a proper working robot. – Begin.vi – Autonomous Independent. Vi – Teleop.vi

3 Sub.vi’s that are used to create a working robot code Begin.vi – Open all your devices here, and create refnum names to uniquely identify each of them. This is called only once at the very start. – The Framework is setup here in Begin.vi to automatically call the Autonomous Independent.vi at the start of Autonomous Mode and to automatically kill it when Autonomous Mode ends. Autonomous Independent.vi – Do NOT add an explict call to this vi in your code. It is set to be automatically called and adding your own calls will disrupt that background process and can cause your robot to be inoperable during teleop. – This is called only once, so put everything you want done during Autonomous Mode here. You don't leave this, so waits and delays can be used as desired here. Teleop.vi – Typical driver controls. This is called 50 times each second as the Driver Station control packets arrive. Do NOT write code in here that waits or takes more than a few milliseconds to execute. If this vi takes too long to execute, then your driver controls will respond sluggishly, sporadically, or not at all. That means no While loops, no wait timers, no Watchdog Feed & Delay. – Normal driver operating code will usually be split between Teleop.vi and Periodic Tasks.vi – Teleop.vi gets the flow-through actions, such as driving via the joysticks, that don't require delays to give a mechanical mechanism time to complete operation. – Periodic Tasks.vi gets the complex time-consuming actions that need much time to complete, like a catapult that needs to be released and cocked again as part of a single joystick button press. Compared to computer speed it takes a very long time to physically pull back a mechanism, latch it, and release it again. Anything that makes you want to add a time delay or have to wait for a sensor to tell you it's ready can more easily be done in Periodic Tasks.vi than anywhere else.

Begin.vi – Default Code Access the back panel Erase everything except the “Camera Code” and “Error out” to start from scratch. Leave the “Camera Code” so you still can have the camera send back a video stream to the Driver Station.

Begin.vi - Joystick Activation Place “WPI_Joystick Open” Add constant to JoystickDevice (USB 1) Place “WPI_JoystickRefNumRegistrySet.vi” – Connect with a wire “JoystickDevRef between the two.vi’s Refnum name – Create a constant and give this joystick an identity. – Call it “joystick1 *When naming.vi’s it is best not to use capitals letters and spaces. You will have to refer back to the names later. **You will need to activate 2 separate Joysticks. – Label each joystick – joystick1 and joystick2 WPI Functions Pallet

Completed Begin.vi

Tank Drive 2 Motors – Begin.vi Place Drive Open 2 Motor – Choose your speed controllers (Jaguar, CAN Jaguar or Victors). Don’t mix speed controllers in your drive train. – Create a constant for the left and right motor. Select PWM Channel for the left and right motor Place RobotDriveRefNumRegistrySet.vi – Connect the RobotDriveDevRef between the two.vi’s with a wire Refnum name – Create a constant and give this drivetrain an identity. – Call it leftandrightmotors

Tank Drive 2 Motors – Begin.vi Invert motors – Create a constant on the DriveOpen2Motor.vi – Choose True to invert that motor. – False will not invert a motor

Tank Drive – Teleop.vi Erase everything in the box. This is not what we are going to use. We have already created different drive motors and joystick.vi’s This is where we will create all of your robot actions. We will first look at creating 2 Motor tank drive Erase

2 Motor Drive – Teleop.vi Place the following.vi’s – RobotDriveRefNumRegis teryGet.vi – RobotDriveTankDrive.vi Using a wire connect the RobotDriveDevRef Create a constant to recall the Refnum name – leftandrightmotors

2 Motor Drive – Teleop.vi Place the following.vi’s – JoystickRefNumRegistryGet.vi (2 needed) – Left and Right Joysticks) – JoystickGet.vi (2 needed) Using a wire connect the JoystickDevRef Create a constant to recall the Refnum name – joystick1 – Left joystick = Left Motor – Joystick2 – Right joystick = Right motor

2 Motor Drive – Teleop.vi JoystickGet.vi – Create a Unbundled by Name (Located in Class, Cluster, & Variant Palette) – Do this for each Joystick. Connect one Unbundled by Name to each axis on the JoystickGet.vi. Each Unbundled by Name should be set to the y-axis Joystick1 Unbundled by Name connect to Left Axis on TankDrive.vi Joystick2 Unbundled by Name connect to Right Axis on TankDrive.vi.

Completed Teleop.vi

What about the Finish.vi? You do not need to place any thing into the Finish.vi. By doing so this will stop your program. We do not have to worry about stopping our robot because the Field Management System does this for us. The FMS disables all communications with the robot and by default the robot will not complete any tasks if there is no communication with the driver station.

What is an Autonomous Independet.vi Autonomous Independent.vi can be multiple parallel tasks. For example, the following two samples can co-exist quite comfortably in the same vi. Two independent sequences operating at the same time, one driving the robot while the other blinks a solenoid status light. This case is quite simple, however, it illustrates that much more complicated parallel independent tasking such as this is possible. Maybe a robot juggling while navigating a maze.

Types of Autonomous Programs Flat Sequence Probably the simplest method of programming a fixed sequence of autonomous moves. Everything within a frame must complete before the next frame will start. It has the look of movie film. This assumes the User Watchdog is not used or is handled elsewhere (2010): Loop If there's an action or set of actions you just want to keep repeating as long as Autonomous Mode lasts you might do something like this. This example just works a solenoid, opening and closing it over and over. If no solenoid is actually attached then you'll still get a blinking light on the solenoid module. This assumes the User Watchdog is not used or is handled elsewhere (2010):

Autonomous.vi - Starting from Scratch You can erase everything here. Start from scratch is the best way to achieve what you want. Also we changed a lot of the Refnums and they are no longer linked to anything in this.vi Best way to create an Autonomous program is to create a timeline.

Creating a Flat Sequence Create a Flat Sequence Structure located under Programs-Structures Right click on the edge of the Flat Sequence Structure to add or delete a frame. *Looks kind of like a film strip

Flat Sequence – Reference Motors Add RobotDriveNumRegisteryGet.vi outside the flat sequence. Refnum your leftandrightmotors. With one click create a wire from RobotDrivedefRev across all 3 frames. – This will allow us to use these motors at anytime during the autonomous period

Flat Sequence – Activate Drive Motors Place a DriveTankDrive.vi in each frame Connect RobotDriveDevRef from DriveTankDrive.vi to the pink wire going across each frame.

Flat Sequence – Motor Values Create a constant for each left and right axis. Give a numerical value for each axis – Values can be between -1 to +1 – +1 full power forward, -1 full power reverse – *Do not worry about having to invert the motor. This was done already in the Begin.vi

Flat Sequence – Structure Timing Add a timer to tell each frame how long to run. – Use Wait(ms).vi located under Programing – Timing. Create a constant for each Wait(ms).vi Add a numerical value to tell each frame how long to run. – (ms) stands for milliseconds. When you enter the time make sure you convert it into milliseconds. Example : 1000 milliseconds = 1 second 500 milliseconds =.5 seconds

Flat Structure – Non-Drive Motor Actions You can add other motors and actuators in your autonomous code. Stretch each Flat Structure frame so you have room to add other.vi’s. Make sure you place them into the appropriate frame. Check your timing sequence of when you want to start that particular action.

Building Your Code In the Project Explorer expand “Build Specifications” You should now see “FRC Robot Boot-up Deployment” Right Click on “FRC Robot Boot-up Deployment” and select “Build” This will compile your code and prepare it for deployment to the cRIO

Preparing for Deployment to the cRIO Connect an Ethernet cable from your computer to Port 1 on the cRIO. Power up the cRIO and wait for a few seconds for them to connect. Use the “FRC cRIO Imaging Tool” that was installed with LabVIEW. Format the cRIO with “FRC_2011_v28” image. Select LabVIEW and check Always run deployed code at startup. Enter your Team ID Press “Apply” and to complete the format.

Deploying code to the cRIO In the Project Explorer Window right click on “FRC Robot Boot-up Deployment” and select “Run as startup” This will begin the download of your code to the cRIO. This process may take a couple of minutes to complete. Setup your driver station with 2 Joysticks and have fun.

Compressor Example

Single Solenoid Example

Double Solenoid Examples 2 Examples

Additional Resources olSystem2009-/LabVIEW/ - Team 358 has put together in a single area a great collection of resources for LabVIEW. They have also put together resources for many other areas of robotics. olSystem2009-/LabVIEW/ – NI’s LabVIEW training page. Contains how to videos