Wiki

This version is outdated by a newer approved version.DiffThis version (25 Jul 2018 00:12) is a draft.
Approvals: 0/1

This is an old revision of the document!


ADXRS450 Gyro Board for FIRST Robotics

The ADXRS450 gyro board is a single-axis industrial sensor, designed to get teams up and running quickly without having to load 3rd-party libraries. This gyro is readily accessible through multiple sources and is recommended for all teams, including those with no gyro experience. It plugs directly into the SPI port on the RoboRIO and libraries are already included in WPILib - all you have to do is declare it in your robot code and use it!

Supporting code for the ADXRS450 only exists in the three main programming languages supported by FIRST. If your team wants to use this board with other programming languages, please refer to the ADXRS450 product datasheet for more information on how to communicate with this gyro via SPI.

Getting Started

There are currently two versions of the FRC Gyro board. The libraries detailed on this page apply to both of these versions, however there are some considerations to take into account for each one.

FRC Accelerometer & Gyroscope (REV1)

This version was made available to FRC teams through 2016. It includes both the ADXRS450 and the ADXL362 accelerometer. This board continues to be supported by WPILib and you can even use the WPI Accelerometer library to connect to it if you want. Just note that the accelerometer component is no longer supported, so there's a chance that new RoboRIO firmware released each year may not work with this sensor.


FRC Gyro with Chip Select Jumper (REV2)

This version of the gyro board was available for the 2017 and 2018 seasons. The accelerometer was removed in favor of a jumper that allows you to configure the “chip select” pin used to communicate with the sensor in case you want to have other devices on the same SPI bus. To use the libraries built-in to WPILib, the default configuration should be to connect the jumper between the CS0 pin and the unlabeled center pin. If you want to use a different setting, you will need to change the “chip select” pin address when initializing the sensor in your robot code. Take a look at the guides linked below and be sure to walk through the one for your team's programming language.

FRC Gyro With Solderable Jumpers (REV3)

This is the lower-cost, more reliable version of the sensor board made available to teams for the 2019 season. To make using the sensor even easier for teams, we removed the chip select pin jumpers and added a solderable jumper. This change improves reliability as there is no risk of the jumper accidentally getting lost or removed, but still allows teams the flexibility of adding additional sensors to the SPI bus.

Using the Gyro in LabVIEW

If you need some help getting up and running in LabVIEW, check out the WPI Screensteps page to get started on the basics.

As with any LabVIEW robot project, there are a few places you must place code in order to use the gyro board: Begin.vi, Finish.vi, and any .vi in which you want to access gyro data. The screenshots in this example assume you are starting from the Arcade robot project, but the steps are the same for any robot project.

Setting Up the Gyro in Begin.vi

Open your robot project, or create a new one if you don't have one created already, and open up your Begin.vi block diagram. This can be found in the project window under Team Code.

The first step is to create a new instance of the gyro, then assign a reference name to it so that you can call the gyro reference anywhere in your robot code. You can find the gyro VI under WPI Robotics Library --> Sensors --> Gyro. Bring the Gyro Open VI into your Begin.vi code. It doesn't matter where you place it in this VI.


When you first bring the instance into your code, it will default to an analog gyro, so you will need to change the type using the drop-down menu below the VI's icon. Select “XRS450 SPI Open” to tell your robot that you're working with the ADXRS450 board.


Next, you need to tell LabVIEW which SPI “chip select” (CS) it will be using. Right click on the “SPI Bus” pin on the Open VI and click “Create --> Constant” to insert an enumerated variable. LabVIEW will automatically assign the gyro to CS0, which is the default. Unless you are using the CS Jumper version of the gyro and want to use C1 or C2 by moving the jumper, do not change this variable!



Now you need to assign a reference name to this gyro so that you can refer to it in other VIs. Grab the Registry Set VI from the Gyro palette and place to the right of your Open VI. Then, connect the GyroDevRef pin on the Open VI to the GyroDevRef on the Registry Set VI.





Now you need to assign a name to your gyro. Right click on the “refnum name” pin on the Registry Set VI and click “Create --> Constant” and create a unique name that you will use to refer to this gyro in the rest of your code. I've left the default value of “My Gyro RefNum” but you can change this to whatever you want.





Closing Communication in Finish.vi

Whenever you open a communication bus in your robot code, you have to close those communications when your robot code finishes, just like you have to close all of the programs running on a computer before you can shut it down properly. This is done in the Finish.vi code. Open your robot project and open up the Finish.vi block diagram. Then, place an instance of the Registry Get VI on the outside of the Flat Sequence Structure (the film strip boxes), and an instance of Gyro Close VI on the inside of the first panel of the Flat Sequence Structure.



Then, connect the GyroDevRef pins of both VIs together.


Now, create a string constant by right clicking on the Gyro RefName pin on the Registry Get VI and clicking Create --> Constant. Rename this string to be the same name you used when instantiating the gyro in your Begin.vi code. I've left mine as the default, since that's what I used in my Begin.vi code. You're now ready to call data from the gyro!



Using the Gyro in Your Robot Code

first/adxrs450_gyro_board_frc.1532470320.txt.gz · Last modified: 25 Jul 2018 00:12 by Juan Chong