XRPGyro

class xrp.XRPGyro

Bases: pybind11_object

Use a rate gyro to return the robots heading relative to a starting position.

This class is for the XRP onboard gyro, and will only work in simulation/XRP mode. Only one instance of a XRPGyro is supported.

Constructs an XRPGyro.

Only one instance of a XRPGyro is supported.

getAngle() wpimath.units.radians

Return the actual angle in radians that the robot is currently facing.

The angle is based on integration of the returned rate form the gyro. The angle is continuous, that is, it will continue from 2π->2.1π. This allows algorithms that wouldn’t want to see a discontinuity in the gyro output as it sweeps from 2π to 0 radians on the second time around.

Returns:

the current heading of the robot in radians.

getAngleX() wpimath.units.radians

Gets the currently reported angle around the X-axis.

Returns:

current angle around X-axis in radians

getAngleY() wpimath.units.radians

Gets the currently reported angle around the Y-axis.

Returns:

current angle around Y-axis in radians

getAngleZ() wpimath.units.radians

Gets the currently reported angle around the Z-axis.

Returns:

current angle around Z-axis in radians

getRate() wpimath.units.radians_per_second

Return the rate of rotation of the gyro

The rate is based on the most recent reading of the gyro.

Returns:

the current rate in radians per second

getRateX() wpimath.units.radians_per_second

Gets the rate of turn in radians-per-second around the X-axis.

Returns:

rate of turn in radians-per-second

getRateY() wpimath.units.radians_per_second

Gets the rate of turn in radians-per-second around the Y-axis.

Returns:

rate of turn in radians-per-second

getRateZ() wpimath.units.radians_per_second

Gets the rate of turn in radians-per-second around the Z-axis.

Returns:

rate of turn in radians-per-second

getRotation2d() wpimath._wpimath.Rotation2d

Gets the angle the robot is facing.

Returns:

A wpi::math::Rotation2d with the current heading.

reset() None

Reset the gyro angles to 0.