|
" 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.PWM
public class PWM
Class implements the PWM generation in the FPGA. Values supplied as arguments for PWM outputs range from -1.0 to 1.0. They are mapped to the hardware dependent values, in this case 0-255 for the FPGA. Changes are immediately sent to the FPGA, and the update occurs at the next FPGA cycle. There is no delay. As of revision 0.1.4 of the FPGA, the FPGA interprets the 0-255 values as follows: 255 = full "forward" 254 to 129 = linear scaling from "full forward" to "center" 128 = center value 127 to 2 = linear scaling from "center" to "full reverse" 1 = full "reverse" 0 = disabled (i.e. PWM output is held low)
Nested Class Summary | |
---|---|
static class |
PWM.PeriodMultiplier
Represents the amount to multiply the minimum servo-pulse pwm period by. |
Field Summary | |
---|---|
protected static int |
kDefaultMinPwmHigh
kDefaultMinPwmHigh is "ticks" where each tick is 6.525us - There are 128 pwm values less than the center, so... |
protected static int |
kDefaultPwmPeriod
kDefaultPwmPeriod is "ticks" where each tick is 6.525us - 20ms periods (50 Hz) are the "safest" setting in that this works for all devices - 20ms periods seem to be desirable for Vex Motors - 20ms periods are the specified period for HS-322HD servos, but work reliably down to 10.0 ms; starting at about 8.5ms, the servo sometimes hums and get hot; by 5.0ms the hum is nearly continuous - 10ms periods work well for Victor 884 - 5ms periods allows higher update rates for Luminary Micro Jaguar speed controllers. |
static int |
kPwmDisabled
|
Fields inherited from class edu.wpi.first.wpilibj.SensorBase |
---|
kAnalogChannels, kAnalogModules, kDigitalChannels, kPwmChannels, kRelayChannels, kSolenoidChannels, kSolenoidModules, kSystemClockTicksPerMicrosecond |
Constructor Summary | |
---|---|
PWM(int channel)
Allocate a PWM in the default module given a channel. |
|
PWM(int moduleNumber,
int channel)
Allocate a PWM given a module and channel. |
Method Summary | |
---|---|
void |
enableDeadbandElimination(boolean eliminateDeadband)
Optionally eliminate the deadband from a speed controller. |
void |
free()
Free the PWM channel. |
int |
getChannel()
Gets the channel number associated with the PWM Object. |
int |
getModuleNumber()
Gets the module number associated with the PWM Object. |
double |
getPosition()
Get the PWM value in terms of a position. |
int |
getRaw()
Get the PWM value directly from the hardware. |
String |
getSmartDashboardType()
|
double |
getSpeed()
Get the PWM value in terms of speed. |
ITable |
getTable()
|
void |
initTable(ITable subtable)
Initializes a table for this sendable object. |
void |
setBounds(int max,
int deadbandMax,
int center,
int deadbandMin,
int min)
Set the bounds on the PWM values. |
void |
setPeriodMultiplier(PWM.PeriodMultiplier mult)
Slow down the PWM signal for old devices. |
void |
setPosition(double pos)
Set the PWM value based on a position. |
void |
setRaw(int value)
Set the PWM value directly to the hardware. |
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 |
Field Detail |
---|
protected static final int kDefaultPwmPeriod
protected static final int kDefaultMinPwmHigh
public static final int kPwmDisabled
Constructor Detail |
---|
public PWM(int moduleNumber, int channel)
moduleNumber
- The module number of the digital module to use.channel
- The PWM channel on the digital module.public PWM(int channel)
channel
- The PWM channel on the digital module.Method Detail |
---|
public void free()
free
in class SensorBase
public void enableDeadbandElimination(boolean eliminateDeadband)
eliminateDeadband
- If true, set the motor curve on the Jaguar to eliminate
the deadband in the middle of the range. Otherwise, keep the full range without
modifying any values.public void setBounds(int max, int deadbandMax, int center, int deadbandMin, int min)
max
- The Minimum pwm valuedeadbandMax
- The high end of the deadband rangecenter
- The center speed (off)deadbandMin
- The low end of the deadband rangemin
- The minimum pwm valuepublic int getModuleNumber()
public int getChannel()
public void setPosition(double pos)
pos
- The position to set the servo between 0.0 and 1.0.public double getPosition()
public double getSpeed()
public void setRaw(int value)
value
- Raw PWM value. Range 0 - 255.public int getRaw()
public void setPeriodMultiplier(PWM.PeriodMultiplier mult)
mult
- The period multiplier to apply to this channelpublic String getSmartDashboardType()
getSmartDashboardType
in interface Sendable
public void initTable(ITable subtable)
initTable
in interface Sendable
subtable
- The table to put the values in.public void updateTable()
updateTable
in interface LiveWindowSendable
public ITable getTable()
getTable
in interface Sendable
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 |