public class Servo extends PWM
The range parameters default to the appropriate values for the Hitec HS-322HD servo provided in the FIRST Kit of Parts in 2008.
PWM.PeriodMultiplier
Modifier and Type | Field and Description |
---|---|
protected static double |
kDefaultMaxServoPWM |
protected static double |
kDefaultMinServoPWM |
kAnalogInputChannels, kAnalogOutputChannels, kDigitalChannels, kPCMModules, kPDPChannels, kPDPModules, kPwmChannels, kRelayChannels, kSolenoidChannels, kSystemClockTicksPerMicrosecond
Constructor and Description |
---|
Servo(int channel)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
double |
get()
Get the servo position.
|
double |
getAngle()
Get the servo angle.
|
java.lang.String |
getSmartDashboardType()
The string representation of the named data type that will be used by the smart dashboard for
this
Sendable . |
void |
initTable(ITable subtable)
Initializes a table for this
Sendable object. |
void |
set(double value)
Set the servo position.
|
void |
setAngle(double degrees)
Set the servo angle.
|
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.
|
enableDeadbandElimination, free, getChannel, getPosition, getRaw, getRawBounds, getSpeed, getTable, setBounds, setDisabled, setPeriodMultiplier, setPosition, setRaw, setRawBounds, setSpeed, setZeroLatch
checkAnalogInputChannel, checkAnalogOutputChannel, checkDigitalChannel, checkPDPChannel, checkPDPModule, checkPWMChannel, checkRelayChannel, checkSolenoidChannel, checkSolenoidModule, getDefaultSolenoidModule, setDefaultSolenoidModule
protected static final double kDefaultMaxServoPWM
protected static final double kDefaultMinServoPWM
public void set(double value)
Servo values range from 0.0 to 1.0 corresponding to the range of full left to full right.
value
- Position from 0.0 to 1.0.public double get()
Servo values range from 0.0 to 1.0 corresponding to the range of full left to full right.
public void setAngle(double degrees)
Assume that the servo angle is linear with respect to the PWM value (big assumption, need to test).
Servo angles that are out of the supported range of the servo simply "saturate" in that direction In other words, if the servo has a range of (X degrees to Y degrees) than angles of less than X result in an angle of X being set and angles of more than Y degrees result in an angle of Y being set.
degrees
- The angle in degrees to set the servo.public double getAngle()
Assume that the servo angle is linear with respect to the PWM value (big assumption, need to test).
public java.lang.String getSmartDashboardType()
Sendable
Sendable
.getSmartDashboardType
in interface Sendable
getSmartDashboardType
in class PWM
Sendable
.public void initTable(ITable subtable)
Sendable
Sendable
object.public void updateTable()
LiveWindowSendable
updateTable
in interface LiveWindowSendable
updateTable
in class PWM
public void startLiveWindowMode()
LiveWindowSendable
startLiveWindowMode
in interface LiveWindowSendable
startLiveWindowMode
in class PWM
public void stopLiveWindowMode()
LiveWindowSendable
stopLiveWindowMode
in interface LiveWindowSendable
stopLiveWindowMode
in class PWM