|
" 2013 FRC Java API " |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.wpi.first.wpilibj.SensorBase
edu.wpi.first.wpilibj.Gyro
public class Gyro
Use a rate gyro to return the robots heading relative to a starting position. The Gyro class tracks the robots heading based on the starting position. As the robot rotates the new heading is computed by integrating the rate of rotation returned by the sensor. When the class is instantiated, it does a short calibration routine where it samples the gyro while at rest to determine the default offset. This is subtracted from each sample to determine the heading.
Field Summary |
---|
Fields inherited from class edu.wpi.first.wpilibj.SensorBase |
---|
kAnalogChannels, kAnalogModules, kDigitalChannels, kPwmChannels, kRelayChannels, kSolenoidChannels, kSolenoidModules, kSystemClockTicksPerMicrosecond |
Constructor Summary | |
---|---|
Gyro(AnalogChannel channel)
Gyro constructor with a precreated analog channel object. |
|
Gyro(int channel)
Gyro constructor with only a channel. |
|
Gyro(int slot,
int channel)
Gyro constructor given a slot and a channel. |
Method Summary | |
---|---|
void |
free()
Delete (free) the accumulator and the analog components used for the gyro. |
double |
getAngle()
Return the actual angle in degrees that the robot is currently facing. |
String |
getSmartDashboardType()
|
ITable |
getTable()
|
void |
initTable(ITable subtable)
Initializes a table for this sendable object. |
double |
pidGet()
Get the angle of the gyro for use with PIDControllers |
void |
reset()
Reset the gyro. |
void |
setSensitivity(double voltsPerDegreePerSecond)
Set the gyro type based on the sensitivity. |
void |
startLiveWindowMode()
Start having this sendable object automatically respond to value changes reflect the value on the table. |
void |
stopLiveWindowMode()
Stop having this sendable object automatically respond to value changes. |
void |
updateTable()
Update the table for this sendable object with the latest values. |
Methods inherited from class edu.wpi.first.wpilibj.SensorBase |
---|
checkAnalogChannel, checkAnalogModule, checkDigitalChannel, checkDigitalModule, checkPWMChannel, checkPWMModule, checkRelayChannel, checkRelayModule, checkSolenoidChannel, checkSolenoidModule, getDefaultAnalogModule, getDefaultDigitalModule, getDefaultSolenoidModule, setDefaultAnalogModule, setDefaultDigitalModule, setDefaultSolenoidModule |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Gyro(int slot, int channel)
slot
- The cRIO slot for the analog module the gyro is connected to.channel
- The analog channel the gyro is connected to.public Gyro(int channel)
channel
- The analog channel the gyro is connected to.public Gyro(AnalogChannel channel)
channel
- The AnalogChannel object that the gyro is connected to.Method Detail |
---|
public void reset()
public void free()
free
in class SensorBase
public double getAngle()
public void setSensitivity(double voltsPerDegreePerSecond)
voltsPerDegreePerSecond
- The type of gyro specified as the voltage that represents one degree/second.public double pidGet()
pidGet
in interface PIDSource
public String getSmartDashboardType()
getSmartDashboardType
in interface Sendable
public void initTable(ITable subtable)
initTable
in interface Sendable
subtable
- The table to put the values in.public ITable getTable()
getTable
in interface Sendable
public void updateTable()
updateTable
in interface LiveWindowSendable
public void startLiveWindowMode()
startLiveWindowMode
in interface LiveWindowSendable
public void stopLiveWindowMode()
stopLiveWindowMode
in interface LiveWindowSendable
|
" 2013 FRC Java API " |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |