public class Gyro extends SensorBase implements PIDSource, LiveWindowSendable
PIDSource.PIDSourceParameter
Modifier and Type | Field and Description |
---|---|
protected AnalogInput |
m_analog |
kAnalogInputChannels, kAnalogOutputChannels, kDigitalChannels, kPDPChannels, kPwmChannels, kRelayChannels, kSolenoidChannels, kSolenoidModules, kSystemClockTicksPerMicrosecond
Constructor and Description |
---|
Gyro(AnalogInput channel)
Gyro constructor with a precreated analog channel object.
|
Gyro(int channel)
Gyro constructor using the channel number
|
Modifier and Type | Method and Description |
---|---|
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.
|
double |
getRate()
Return the rate of rotation of the gyro
The rate is based on the most recent reading of the gyro analog value
|
String |
getSmartDashboardType() |
edu.wpi.first.wpilibj.tables.ITable |
getTable() |
void |
initGyro()
Initialize the gyro.
|
void |
initTable(edu.wpi.first.wpilibj.tables.ITable subtable)
Initializes a table for this sendable object.
|
double |
pidGet()
Get the output of the gyro for use with PIDControllers.
|
void |
reset()
Reset the gyro.
|
void |
setPIDSourceParameter(PIDSource.PIDSourceParameter pidSource)
Set which parameter of the gyro you are using as a process control
variable.
|
void |
setSensitivity(double voltsPerDegreePerSecond)
Set the gyro 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.
|
checkAnalogInputChannel, checkAnalogOutputChannel, checkDigitalChannel, checkPDPChannel, checkPWMChannel, checkRelayChannel, checkSolenoidChannel, checkSolenoidModule, getDefaultSolenoidModule, setDefaultSolenoidModule
protected AnalogInput m_analog
public Gyro(int channel)
channel
- The analog channel the gyro is connected to. Gyros can only
be used on on-board channels 0-1.public Gyro(AnalogInput channel)
channel
- The AnalogInput object that the gyro is connected to. Gyros
can only be used on on-board channels 0-1.public void initGyro()
public void reset()
public void free()
free
in class SensorBase
public double getAngle()
public double getRate()
public void setSensitivity(double voltsPerDegreePerSecond)
voltsPerDegreePerSecond
- The sensitivity in Volts/degree/second.public void setPIDSourceParameter(PIDSource.PIDSourceParameter pidSource)
pidSource
- An enum to select the parameter.public double pidGet()
public String getSmartDashboardType()
getSmartDashboardType
in interface Sendable
public void initTable(edu.wpi.first.wpilibj.tables.ITable subtable)
public edu.wpi.first.wpilibj.tables.ITable getTable()
public void updateTable()
updateTable
in interface LiveWindowSendable
public void startLiveWindowMode()
startLiveWindowMode
in interface LiveWindowSendable
public void stopLiveWindowMode()
stopLiveWindowMode
in interface LiveWindowSendable
Copyright © 2015. All rights reserved.