RobotCore 1.0
WPILib port to raspberry Pi
Loading...
Searching...
No Matches
robotCore.Gyro Class Reference

The Gyro class measures the orientation of the robot. More...

Public Member Functions

 Gyro (int d)
double getYaw ()
Rotation2d getRotation2d ()
void reset (double yaw)
void invert (boolean invert)

Static Public Member Functions

static double normalize (double angle, double range)
static double normalizeAngle (double angle)

Detailed Description

The Gyro class measures the orientation of the robot.

Author
John Gaby

Definition at line 35 of file Gyro.java.

Constructor & Destructor Documentation

◆ Gyro() [1/2]

robotCore.Gyro.Gyro ( int d)

Definition at line 45 of file Gyro.java.

◆ Gyro() [2/2]

robotCore.Gyro.Gyro ( )

Definition at line 63 of file Gyro.java.

Member Function Documentation

◆ getRotation2d()

Rotation2d robotCore.Gyro.getRotation2d ( )

Returns the angle using the Rotation2d format.

Returns
Returns the current angle using the Rotation2d format.

Definition at line 147 of file Gyro.java.

◆ getYaw()

double robotCore.Gyro.getYaw ( )

Gets only the yaw.

Returns
Returns the yaw.

Definition at line 137 of file Gyro.java.

◆ invert()

void robotCore.Gyro.invert ( boolean invert)

Specifies that the sense of the yaw be inverted. I.E. controls whether the yaw value increases or decreases when the robot turns clockwise. In general, the Pure Pursuit path following assumes that the yaw will decrease when the robot turns clockwise.

Parameters
invert- If true, inverts the direction of the yaw

Definition at line 171 of file Gyro.java.

◆ normalize()

double robotCore.Gyro.normalize ( double angle,
double range )
static

Normalizes the value to be between -range/2 and +range/2.

Returns
Returns same value but guarenteed to be between -range/2 and +range/2

Definition at line 104 of file Gyro.java.

◆ normalizeAngle()

double robotCore.Gyro.normalizeAngle ( double angle)
static

Normalizes an angle to between -180 and +180 degrees.

Returns
Returns same angle but guarenteed to be between -180 and +180 degrees.

Definition at line 122 of file Gyro.java.

◆ reset()

void robotCore.Gyro.reset ( double yaw)

Resets the yaw and position of the robot.

Parameters
yaw- Specifies the new yaw value for the robot in degrees. This value will be adjusted so that it in the range -180 to 180.

Definition at line 157 of file Gyro.java.


The documentation for this class was generated from the following file: