Wiki

This version is outdated by a newer approved version.DiffThis version (13 Aug 2018 20:53) 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. The sections below detail how to do this for each of the three supported languages.

FRC Gyro With Solderable Jumpers (REV3)

This is the lower-cost, more reliable version of the sensor board made available to teams starting with 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.

A Note on Gyro Calibration

To help the robot identify a starting angle position more accurately and remove most gyro drift, it is recommended that you allow the robot to calibrate the sensor first. It will do this by taking several readings from the sensor and average them together to obtain your “zero” angle. Calibration typically takes about 30 seconds.

Remember, the ADXRS450 is a rate sensor, not a raw angle sensor, so any movement during this calibration routine will cause the robot to think that movement is part of the natural drift that the sensor has. Because of this, it is imperative that the robot is left completely stationary during this calibration period.



Calibration should be performed as soon as the robot is powered on, to prevent the calibration routine from interfering with any autonomous code execution. You can usually tell that your robot was bumped during calibration if you notice that your gyro angle readings are drifting off into space very rapidly. In LabVIEW, this calibration is done as part of the initialization. But in Cand Java, you must explicitly call the calibrate routine. You can read more info on your team's specific language below. \\ \\ ===== Using the Gyro in LabVIEW ===== If you need some help getting up and running in LabVIEW, check out the [[https://wpilib.screenstepslive.com/s/currentCS/m/labview/l/145335-creating-building-and-loading-your-benchtop-test-program

If you need some help getting started with the basics of a robot project in C++, you may want to check out the screensteps guide here.

Before you can use the gyro in your code, you must first instantiate an instance. It must be defined globabally, so that you can access the object throughout your robot code. The ADXRS450 has its own dedicated class in the frc namespace. When you instantiate your gyro, you will need to define which SPI port the device will be using. Depending on how you have set up your gyro, this will vary, but the default will be CS0.

Once your gyro is defined, you will need to initialize it with a calibration in the RobotInit() method.

Now that your gyro is calibrated when the robot turns on, you can access data from the robot in your code. You can do this using the GetAngle() method to obtain the robot's current heading, or more rarely by using the GetRate() method to obtain the current rotation rate being measured should you happen to need it. These are most common places to use these functions are inside of the AutonomousPeriodic() and Teleop Periodic() methods.

As a general note, the GetAngle() method will count continuously, meaning when it reaches 360 degrees, it will continue to 361, not zero. This is to make any functionality in your code using the gyro angle easier to implement without having to keep track of where in the 0-360 range your robot is and how many rotations have happened.



Occasionally, you may need to correct for gyro drift during a match. Some drift is inevitable and it's impossible to completely calibrate out all sources of drift. You can do this by using the Reset() method, which will set the current direction the robot is facing as the new zero.

first/adxrs450_gyro_board_frc.1534186422.txt.gz · Last modified: 13 Aug 2018 20:53 by Kristen Chong