FIRST Robotics Competition Documents

cancel
Showing results for 
Search instead for 
Did you mean: 

FRC WPI Robotics Library Overview

 Contents

  • Introduction
  • RobotDrive
  • Sensors
  • Actuators
  • I/O
  • Driver Station
  • Camera
  • Communication
  • Utilities
  • Power
  • Conclusion

Introduction

In this tutorial, we will explore and give an overview of the functionality in the WPI Robotics Library in LabVIEW. The LabVIEW FRC VIs are located under WPI Robotics Library in the Functions Palette.

 

pal.png

 

As you read through this tutorial, notice how the entire library follows the Open»Get/Set»Close paradigm.

 

diagram.jpg

 

Each palette will contain open, get and/or set, and close VIs, whether you are using VIs from the RobotDrive palette.

 

drive.png

The I/O Palette,

 

io.png

 

Or the Camera Palette,

 

camera.jpg

 

They will all follow the Open»Get/Set»Close paradigm. Understanding and applying the Open»Get/Set»Close paradigm will be key in successfully programming your robot. Robots that are not programmed following this paradigm may see reduced performance. See the examples in the NI Example Finder accessible from the Support corner of the LabVIEW getting started window for additional examples of the Open»Get/Set»Close paradigm. You can also access the Example Finder by going to Help»Find Examples.

 

RobotDrive

The RobotDrive palette provides VIs to control the drive motors on your robot. You have many options for designing and configuring the robot drive train. The RobotDrive VIs support two-­‐wheel and four-­‐ wheel drive robots. VIs are provided for arcade, tank, holonomic and skid steering systems.  See the Basic Motor Control tutorial for additional information.

 

robot drive.png

 

Arcade Drive

Arcade Drive accepts inputs from one of the joysticks connected to the Driver Station. This VI then mixes the x-­‐axis and y-­‐axis values to supply different signals to each motor for turning.

Tank Drive

Tank Drive enables you to operate a robot with a tank drive motor configuration. Tank driving uses two joysticks. You control the left and right motors independently with the two joysticks. The two y-­‐axis values from the joysticks supply signals to each motor for robot movement.

Holonomic Drive

Holonomic Drive controls robots with special wheels that allow the robot to drive in any direction without first rotating or maneuvering the robot. Holonomic drive robots use omni-­‐ directional wheels that have a center, large main wheel mounted on a drive shaft and several smaller rollers around the perimeter of the main wheel. The smaller rollers allow the robot to travel in a direction that is perpendicular to the direction of travel with the main wheel without having to first move the main wheel. The robot can travel in any direction by moving the main wheel and the rollers at different speeds.

Motor Control

The RobotDrive Motor Control palette provides the ability to set the speed and direction for motors directly. It provides a lower level of control than the VIs on the RobotDrive main palette.

 

Joystick

The Joystick palette is also included in the Driver Station palette. Use the Joystick VIs to return information from up to 4 joysticks connected to the driver station.

joystick.PNG

Map

The Map VI is used to link the joystick values to motor positions. Use this VI to take joystick inputs and translate their values into motor movements.

Get Values

Get values reads the current values of the joystick position and buttons. You can use this VI to take in joystick data and process it before it goes to the motor.

Set Outputs

Set outputs configures the feedback response of the joystick if it is compatible. You can use this to set the rumble and driven responses as appropriate.

Find Joystick

This VI searches through all connected joysticks for the requested name. You can use this VI if you have multiple joysticks connected and would like to search for one by name.

Get Info

Get info returns the pertinent information about the connected joystick. This could be used to build code that adapts to different types of joysticks or for finding the POV of the connected joystick.

 

Sensors

Use the Sensor VIs to send and receive information from the sensors you connect to the roboRIO. See the Sensor Basics tutorial for additional information.

 

 sensors.png

 

Accelerometer VIs

The Accelerometer VIs are used to determine the acceleration of a robot or robot component as measured by an accelerometer. Accelerometers measure both dynamic motion, or vibration, and static motion, or gravity, by measuring x-­‐axis and y-­‐axis acceleration.  

Counter VIs

The Counter VIs are used to count the number of pulses in a digital signal. You can use the Counter VIs to count up or count down based on the rising or falling edges of the signal. The Counter VIs are especially useful when an algorithm or subroutine necessary to your program is not already incorporated in some of the higher-level encoder VIs.

Encoder VIs

The Encoder VIs are used to get position information measured by a quadrature encoder. The FPGA on the roboRIO uses 4x decoding. This setup will return a count value for every rising and falling edge as well as Boolean value that indicates direction. From this information and the specifications for your encoder, you can determine the angular position of a gear or motor.

Gyro VIs

The Gyro VIs are used to set and monitor the heading, or direction, of the robot as measured by a gyroscope transducer. The Gyro VIs measure the instantaneous rate of rotation or yaw rate of the robot. You can use the Gyro VIs to make sure that your robot is moving on a desired heading by measuring the difference between the gyro reading and a desired set point, and then correcting for any error.

 

Ultrasonic VIs

The Ultrasonic VIs are used to measure the distance between an ultrasonic sensor on the robot and the closest object in range of the sensor. This can be useful in developing a system that keeps your robot from running into objects.

 

Actuators

The VIs in the Actuators palette are used to control the behavior of actuators such as relays, motors, and solenoids.

 

MAKE MOVE.png

 

Motor Control VIs

The Motor Control VIs are used to set or get the speed of a motor using a Jaguar or Victor motor controller. The Motor Control VIs use preconfigured PWM range and deadband values specific to the  motor controller, depending on which instance of the VIs you select, so you do not need to perform any conversions or scaling calculations on the raw PWM values.

 

polymorph.jpg

 

Relay VIs

The Relay VIs are used to manipulate relays. You can open and close relays to control the power source for a motor or other device.

Servo VIs

The Servo VIs are used to set or get the angle and position of a servo motor. If you use a servo, use the Servo VIs instead of the PWM VIs. The Servo VIs use preconfigured PWM range and deadband values specific to the servo so you do not need to perform any conversions or scaling calculations on the raw PWM values.

Solenoid VIs

The Solenoid VIs are used to operate a solenoid. A solenoid is a pneumatic valve that can release air to move a part on the robot.

Compressor

Use the Compressor VIs to start and stop a compressor. The Compressor VIs manipulate a pressure switch connected to the high pressure side of the pneumatic circuit of the robot, controlling the compressor of the robot.

 

I/O

The I/O VIs can be used to send and receive analog and digital data from a module on the roboRIO. These VIs are meant for low-­‐level applications—connecting to sensors, actuators, etc.

io pal.png

 

Analog Trigger VIs

The Analog Trigger VIs are used to create digital signals from analog signals. You can use analog triggers as sources for the Counter VIs and Encoder VIs. The analog trigger circuit on the target produces three types of output: TriggerState, InWindow, and Pulse. Use the Output VI to get the TriggerState and InWindow output from the trigger.

Analog Channel VIs

Use the Analog Channel VIs to acquire an analog signal from a channel on a module on the roboRIO. You can configure how the channel samples the signal by specifying the number of bits and the number of oversample bits. You can acquire the raw signal or the scaled voltage signal.

Digital Input VIs

The Digital Input VIs are used to open or close a reference to a digital input and to acquire digital values that sensors send to the roboRIO.

Digital Output VIs

The Digital Output VIs are used to open or close a reference to a digital output and to set the value of the digital output.

PWM VIs

The PWM VIs are used to generate a hobby-­‐style pulse width modulation (PWM) signal. You can use PWM signals to drive motor controllers and servos. Use the VIs on this palette with custom motor controllers or servos. Otherwise, use the VIs on motor control palettes to use PWM for those devices.

 

Driver Station

Use the DriverStation VIs to manipulate data flow between the robot, driver station, and laptop. The Driver Station VIs can receive, interpret, and display both analog and digital data from your various sensors and joysticks.

 

driver.PNG

 

The Driver Station VIs can be used to relay information about the robot state to the laptop and establish communication between the driver station and the robot. It can also gather information about match time and team alliance.

 

Communication

The Communication VIs can be used to create connections between various sensors and your roboRIO.

 

comm.png

 

Serial Port VIs

The Serial Port VIs allow you to create, configure, and use serial port communications. The serial port communications are the least defined method of communicating with your robot. As a result, you have access to lower level commands such as flushing the buffer or verifying how many bytes were received. You can determine how long you are willing to listen for a message before reaching a timeout. With these VIs, you can build your own communication protocol to integrate all the elements of your robot.

I2C VIs

You can use these VIs to create, delete, read data, send data, and configure I2C (I squared C) connections. I2C uses one line to send a reference clock and a second line to pass data. Both of these lines are bidirectional. A master node will initiate a connection and give a slave instruction. The slave will act on the master’s instruction and respond to the master. This response means the master does not have to guess whether or not the task is complete. If you would like to learn more about the I2C protocol, you can read this Wikipedia page.

SPI VIs

These VIs allow you to create, delete, read, and send data using a Serial Peripheral Interface, or SPI. SPI uses a single master and multiple slaves in full duplex. This means every node can both transmit and receive at the same time. SPI communication requires three Digital Input/Output lines. If you would like to learn more about the SPI protocol, you can read this Wikipedia page.

CAN VIs

Controller area networks, or CAN, were originally designed to work with microcontrollers within a vehicle. The CAN palette provides the ability to send a message, receive a message, enumerate your network, and get the current status. Sending and receiving messages is based on the Message ID you select. Multiple IDs can be sent across the same network and recipients will listen for their desired ID. The enumerate VI is a lot like a handshake. Devices respond to the enumerate message to say they are listening to the network. You should use the Get Status VI to monitor the health of your network. This will report the number of errors, what percentage of the bus is currently being used, and how many times you have filled your buffer. This information can help you determine if you are overloading the CAN bus. Doing this may cause your robot to respond slowly or in unexpected manners.

 

Camera

You can use the Camera VIs to configure the Axis camera properties, acquire images directly on the roboRIO, or to retrieve images from the roboRIO in your Dashboard project. The camera VIs deal exclusively with image acquisition and setup. Explore the FIRST Vision palette and the Image Processing tutorial to learn more about the available image processing functionality.

 

cam pal.png

 

Utilities

Use the Utility VIs to return information about the roboRIO such as the version of the FPGA, the status of LEDs and switches.

 

util.png

 

In previous years, Watchdog VIs were used to control the user watchdog if you chose to enable it. This was used to disable the PWM relay and solenoid outputs if the Feed Watchdog VI did not receive an input within a specified amount of time. If the watchdog timed out all of the motors and actuators were immediately disabled on the robot. See this Safety Configuration tutorial for additional information about the current safety configuration.

 

Power

The Power VIs are used to interface with your power rail, Pneumatics Control Module (PCM), Power Distribution Panel (PDP), and to enable outputs.

 

power.png

 

You can monitor the faults and disable specific power rails using these VIs.  You can also determine    the current voltage, current, and faults reported by the PCM. The PDP will tell you its current Energy, Current, and Voltage usage. Your robot has the ability to disable outputs in case of an error condition. This acts like a fuse. It immediately kills all outputs until you tell it to enable the outputs again. This gives you the ability to clean up after the error before enabling the outputs so you do not damage your robot.

 

RefNum Registry VIs

These VIs exist in many of the palettes discussed above and allow you to store references to specific motors or sensors to be used in other locations in your code. When you create the reference, you can store it in the registry using the Registry Set VI for the reference type. You can then get that reference back in other parts of your code by using the Registry Get VI. Don’t forget to close all the references in the registry when you’re stopping the robot code!

 

motor registry.PNG

 

Conclusion

This concludes the FRC Robotics Library overview. You now know what tools are available to you and have a high level view of how they can be used to build a better robot! Please refer to the FRC LabVIEW Quick Start Guide page for more detailed information regarding the contents of the WPI Robotics Library.

Comments
qanbarzadeh
Member
Member
on
Good Day Thank you How can I download The LabVIEW FRC WPI Robotics Library ؟ Best regards, Abolfazl ghanbarzadeh
Contributors