Whitman Robocats

JoystickExample

WPI Robotics Library → DriverStation → Joystick
Programming → Array → Index Array
LabVIEW Joystick Example

Digital Input Example

Ex. limit switches WPI Robotics Library → IO → DigitalInput
LabVIEW DIO Input Example

Analog Input Example

WPI Robotics Library → IO → AnalogChannel
LabVIEW Analog Input Example

Relay Example

WPI Robotics Library → Actuators → Relay
WPI Robotics Library → DriverStation → Joystick
Programming → Comparison
Programming → Array → Index Array
LabVIEW Relay Example
LabVIEW Button Relay Example

Servo Example

WPI Robotics Library → Actuators → Servo
WPI Robotics Library → DriverStation → Joystick
Programming → Comparison
Programming → Array → Index Array
LabVIEW 2010 Servo Example

Single Motor Example

WPI Robotics Library → Actuators → MotorControl
WPI Robotics Library → DriverStation → Joystick
Programming → Array → Index Array
LabVIEW Single Motor Example

Button Toggle Action

WPI Robotics Library → DriverStation → Joystick
Programming → Structures
Programming → Comparison
Programming → Cluster,Class,&Variant
Programming → Array → Index Array
LabVIEW Button Toggle Example

Button Control of Motor Example

WPI Robotics Library → Actuators → MotorControl
WPI Robotics Library → DriverStation → Joystick
Programming → Comparison
Programming → Array → Index Array
LabVIEW Button Control of Motor Example
Want more buttons? Add a Select for each like so:
LabVIEW Button Control of Motor Example
Don't want to have to keep holding the button down? Then add a Feedback Node to remember:
LabVIEW Button Control of Motor Example
Using an xBox where the triggers are actually read as an Axis:
LabVIEW Button Control of Motor Example

Single Solenoid Example

WPI Robotics Library → Actuators → Solenoid
WPI Robotics Library → DriverStation → Joystick
Programming → Array → Index Array
LabVIEW Single Solenoid Example

Double Solenoid Example

WPI Robotics Library → Actuators → Solenoid
Programming → Boolean
WPI Robotics Library → DriverStation → Joystick
Programming → Array → Index Array
LabVIEW Double Solenoid Example

Arcade Drive Example

WPI Robotics Library → RobotDrive
WPI Robotics Library → DriverStation → Joystick
Programming → Array → Index Array
LabVIEW Arcade Drive Example

Tank Drive Example

WPI Robotics Library → RobotDrive
WPI Robotics Library → DriverStation → Joystick
Programming → Array → Index Array
LabVIEW Tank Drive Example
LabVIEW xBox Tank Drive Example

Holonomic or Mecanum Drive Example

WPI Robotics Library → RobotDrive
WPI Robotics Library → DriverStation → Joystick
Programming → Array → Index Array
LabVIEW Holonomic Drive Example

CAN Tank Drive Example

User Libraries → CANJaguar for LabVIEW
WPI Robotics Library → DriverStation → Joystick
Programming → Array → Index Array
LabVIEW CAN Tank Drive Example

Button Start of Timed Action

- the timed-delays used here as an example can be replaced with sensors that tell positively when the mechanism is cocked or has finished shooting. WPI Robotics Library → DriverStation → Joystick
Programming → Structures
Programming → Comparison
Programming → Array → Index Array
LabVIEW Button Timed Response Example

Which Button Was Pushed

- Useful for deciding which of several joystick or custom Driver Station buttons was pushed. This acts based on which of an array of buttons was pushed. Lowest number button wins if several are pushed at once.
WPI Robotics Library → DriverStation → Enhanced IO
Programming → Structures
Programming → Arrays
Programming → Numeric
Programming → Boolean
Programming → Array → Search 1D Array
LabVIEW Which Button Was Pushed Example

Button Increment Power

- This raises or lowers the power to a motor whenever one of the buttons is pushed, so it increments the power one step with each push. Programming → Structures
Programming → Comparison
Programming → Array → Index Array
LabVIEW Button Increment Example

Switch

- has a toggle for selecting Normally-Closed or Normally-Open wiring. Has a counter mode that counts the number of times the switch is activated. WPI Robotics Library → Sensors → Switch
Programming → Array → Index Array
LabVIEW Switch Example

Limit Switch

WPI Robotics Library → DriverStation → Joystick
WPI Robotics Library → IO → DigitalInput
Programming → Structures
Programming → Comparison
Programming → Boolean
LabVIEW Limit Switch Example

Limit Throttle

- this example works ONLY in Teleop.vi because it depends on the regular 50Hz rate at which Teleop.vi gets called. To use it in Periodic Tasks, for instance, it would be called inside a loop and a loop delay would be added. WPI Robotics Library → DriverStation → Joystick
WPI Robotics Library → Actuators → MotorControl
Programming → Numeric
Programming → Array → Index Array
LabVIEW Limit Throttle Example

Joystick Max Throttle Limit

- How to deal with a drive train that's too fast (well if you can't gear it down). The first example uses the throttle on an Extreme 3D joystick as a variable control to limit max driving power to between 50-100%. A possible variation might be to allow more power to the Arcade rotate input.
In the second example the max power is limited to a hardcoded 80%.
WPI Robotics Library → DriverStation → Joystick
WPI Robotics Library → Actuators → MotorControl
Programming → Comparison
Programming → Numeric
Programming → Array → Index Array
LabVIEW Joystick Max Throttle Limit Example

3-position Switch

WPI Robotics Library → IO → DigitalInput
Programming → Comparison
Programming → Numeric
LabVIEW 3-position Switch Example

Digital 0-9 BCD Switch

WPI Robotics Library → IO → DigitalInput
Programming → Boolean
Programming → Array
LabVIEW Digital 0-9 Switch Example

Write Data to Disk

Programming → File I/O
Programming → File I/O → File Constants
LabVIEW Write Data To Disk Example

Write Image to Disk

Programming → File I/O
Programming → File I/O → File Constants
FIRST Vision → Image Management
LabVIEW Write Image To Disk Example

Tachometer

- assumes a digital sensor, such as a retro-reflective light sensor, is used to detect a spinning object. One caution about Counter - it can produce scrambled or bogus values on startup, so be careful and examine the results when you first put it to use. WPI Robotics Library → Sensors → Counter
LabVIEW Tachometer Example

Encoder

Only allows for four encoders to be sampled at 4x, but many at 2X. WPI Robotics Library → Sensors → Encoder
WPI Robotics Library → IO → DigitalInput
LabVIEW Encoder Example

Gyroscope

WPI Robotics Library → Sensors → Gyro
LabVIEW Gyroscope Example

Accelerometer

WPI Robotics Library → Sensors → Accelerometer
LabVIEW Accelerometer Example

Potentiometer

WPI Robotics Library → Sensors → Potentiometer
LabVIEW Potentiometer Example

Ultrasonic Sensor

- Only for paired emitter/sensor Vex-style WPI Robotics Library → Sensors → Ultrasonic
LabVIEW Ultrasonic Example
LabVIEW Ultrasonic I2C Example

I2C Sensor

WPI Robotics Library → Communications → I2C
Programming → Array
Programming → Numeric → Data Manipulation
Programming → Array → Index Array
LabVIEW I2C Example

Counting Things

WPI Robotics Library → IO → DigitalInput
Programming → Structures
Programming → Comparison
Programming → Boolean
LabVIEW Counting Example

State Machine

- the idea here is that you want to do different things based on a particular state your program is tracking. In this example you'd add some kind of activities for each state, such as activating solenoids or motors. States might change based on sensor feedback, such as a ball sensor. WPI Robotics Library → DriverStation → Joystick
Programming → Structures
Programming → Comparison
Programming → Numeric
Programming → Array → Index Array
LabVIEW State Machine Example

Delayed Event

- this is for use within iterative vi's, such as Teleop, and simply might start an action, then stop it n seconds later. This type of action can also be performed for you by the Elapsed Time vi.
WPI Robotics Library → DriverStation → Joystick
Programming → Structures
Programming → Comparison
Programming → Timing
Programming → Numeric
Programming → Numeric → Conversion
Programming → Array → Index Array
LabVIEW Delayed Event Example

Camera Example

WPI Robotics Library → Camera
FIRST Vision → Image Management
Programming → Structures
LabVIEW Camera Example

Interrupt

Use of this will be rare, but this can be used with either a Digital Input or an Analog Trigger. WPI Robotics Library → Utilities → Interrupts
WPI Robotics Library → IO → DigitalInput
LabVIEW Interrupt Example

Equations

Programming → Numeric
Mathematics → Elementary & Special Functions → Trigonometric Functions
Programming → Structures
LabVIEW Handling Equations Example
The formula node allows for the insertion of a pretty good subset of C. It not only lets you write equations, but loops and conditional code as well.

Programming Examples Provided By Team 358

FRC LABVIEW PROGRAMMING GUIDE FOR ROBORIO