Class CANCoderAdapter
java.lang.Object
xbot.common.controls.sensors.XAbsoluteEncoder
xbot.common.controls.sensors.XCANCoder
xbot.common.controls.sensors.wpi_adapters.CANCoderAdapter
- All Implemented Interfaces:
DataFrameRefreshable
-
Nested Class Summary
Nested classes/interfaces inherited from class xbot.common.controls.sensors.XCANCoder
XCANCoder.XCANCoderFactory
Nested classes/interfaces inherited from class xbot.common.controls.sensors.XAbsoluteEncoder
XAbsoluteEncoder.XAbsoluteEncoderFactory
-
Field Summary
Fields inherited from class xbot.common.controls.sensors.XAbsoluteEncoder
info
-
Constructor Summary
ConstructorDescriptionCANCoderAdapter
(DeviceInfo deviceInfo, String owningSystemPrefix, DevicePolice police, PropertyFactory pf) -
Method Summary
Modifier and TypeMethodDescriptionint
double
Gets the magnet offset configured on the encoder device.boolean
boolean
setMagnetOffset
(double offsetInDegrees) Sets the magnet offset configured on the encoder device.void
setPosition
(Angle newPosition) setUpdateFrequencyForPosition
(double frequencyInHz) Updates how often we get data about the CANCoder position.Stops all signals that are not explicitly set.void
updateInputs
(XAbsoluteEncoderInputs inputs) void
updateInputs
(XCANCoderInputs inputs) Methods inherited from class xbot.common.controls.sensors.XCANCoder
hasResetOccurred, refreshDataFrame
Methods inherited from class xbot.common.controls.sensors.XAbsoluteEncoder
getAbsolutePosition, getHealth, getPosition, getVelocity
-
Constructor Details
-
CANCoderAdapter
@AssistedInject public CANCoderAdapter(@Assisted("deviceInfo") DeviceInfo deviceInfo, @Assisted("owningSystemPrefix") String owningSystemPrefix, DevicePolice police, PropertyFactory pf)
-
-
Method Details
-
getDeviceId
public int getDeviceId()- Specified by:
getDeviceId
in classXAbsoluteEncoder
-
getPosition_internal
-
getAbsolutePosition_internal
-
getVelocity_internal
-
getHealth_internal
-
setPosition
- Specified by:
setPosition
in classXAbsoluteEncoder
-
getMagnetOffset
public double getMagnetOffset()Gets the magnet offset configured on the encoder device. Blocking call.- Returns:
- The magnet offset in degrees
-
setMagnetOffset
public boolean setMagnetOffset(double offsetInDegrees) Sets the magnet offset configured on the encoder device.- Parameters:
offsetInDegrees
- The magnet offset in degrees- Returns:
- True on success.
-
setUpdateFrequencyForPosition
Description copied from class:XCANCoder
Updates how often we get data about the CANCoder position.- Specified by:
setUpdateFrequencyForPosition
in classXCANCoder
- Parameters:
frequencyInHz
- How many times per second we want to get data.- Returns:
- The status code returned from the underlying object.
-
stopAllUnsetSignals
Description copied from class:XCANCoder
Stops all signals that are not explicitly set. For example, if you haven't called setUpdateFrequencyForPosition, this will stop that signal! Useful for reducing CAN bus traffic for data we're not reading.- Specified by:
stopAllUnsetSignals
in classXCANCoder
- Returns:
- The status code returned from the underlying object.
-
clearStickyFaults
- Specified by:
clearStickyFaults
in classXCANCoder
-
hasResetOccurred_internal
public boolean hasResetOccurred_internal() -
updateInputs
- Specified by:
updateInputs
in classXAbsoluteEncoder
-
updateInputs
- Specified by:
updateInputs
in classXCANCoder
-