Class ServoHub
java.lang.Object
com.revrobotics.NativeResourceCleaner
com.revrobotics.servohub.ServoHubLowLevel
com.revrobotics.servohub.ServoHub
- All Implemented Interfaces:
REVDevice, AutoCloseable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic classstatic classNested classes/interfaces inherited from class ServoHubLowLevel
ServoHubLowLevel.FirmwareVersion, ServoHubLowLevel.PeriodicStatus0, ServoHubLowLevel.PeriodicStatus1, ServoHubLowLevel.PeriodicStatus2, ServoHubLowLevel.PeriodicStatus3, ServoHubLowLevel.PeriodicStatus4Nested classes/interfaces inherited from class NativeResourceCleaner
NativeResourceCleaner.OnClean -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal ServoHubConfigAccessorAccessor for ServoHub parameter values.Fields inherited from class ServoHubLowLevel
servoHubHandle -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionClears all sticky faults.configure(ServoHubConfig config, ResetMode resetMode) Set the configuration for the ServoHub.configureAsync(ServoHubConfig config, ResetMode resetMode) Set the configuration for the ServoHub without waiting for a response.Get the active faults that are currently present on the ServoHub.getServoChannel(ServoChannel.ChannelId channelId) Returns an object to control a specific servo channel.Get the sticky faults that were present on the ServoHub at one point since the sticky faults were last cleared.Get the sticky warnings that were present on the ServoHub at one point since the sticky warnings were last cleared.Get the active warnings that are currently present on the ServoHub.Get whether the ServoHub has one or more active faults.Get whether the ServoHub has one or more active warnings.Get whether the ServoHub has one or more sticky faults.Get whether the ServoHub has one or more sticky warnings.setBankPulsePeriod(ServoHub.Bank bank, int pulsePeriod_us) Set the Pulse Period for servo channels 0-2 or servo channels 3-5.Methods inherited from class ServoHubLowLevel
close, createSimFaultManager, getCanPort, getCleanAction, getControlFramePeriodMs, getDeviceId, getFirmwareVersion, getFirmwareVersionString, getPeriodicStatus0, getPeriodicStatus1, getPeriodicStatus2, getPeriodicStatus3, getPeriodicStatus4, setCANMaxRetries, setCANTimeout, setControlFramePeriodMs, setPeriodicFrameTimeout, throwIfClosedMethods inherited from class NativeResourceCleaner
registerCleaner
-
Field Details
-
configAccessor
Accessor for ServoHub parameter values. This object contains fields and methods to retrieve parameters that have been applied to the device. To set parameters, seeServoHubConfigandconfigure(ServoHubConfig, com.revrobotics.ResetMode).NOTE: This uses calls that are blocking to retrieve parameters and should be used infrequently.
-
-
Constructor Details
-
ServoHub
public ServoHub(org.wpilib.hardware.bus.CANPort canPort, int deviceId) Create a new object to control a ServoHub Servo Controller- Parameters:
canPort- The CAN port this device is connected to.deviceId- The device ID.
-
ServoHub
protected ServoHub(int busId, int deviceId) Create a new object to control a ServoHub Servo Controller from a raw CAN bus ID. For internal tooling that manages buses not representable as a CANPort;ServoHubLowLevel.getCanPort()will throw if the bus ID is not a valid CANPort value.- Parameters:
busId- The raw CAN bus ID this device is on.deviceId- The device ID.
-
-
Method Details
-
configure
Set the configuration for the ServoHub.If
resetModeisResetMode.kResetSafeParameters, this method will reset safe writable parameters to their default values before setting the given configuration.- Parameters:
config- The desired ServoHub configurationresetMode- Whether to reset safe parameters before setting the configuration- Returns:
REVLibError.kOkif successful
-
configureAsync
Set the configuration for the ServoHub without waiting for a response.If
resetModeisResetMode.kResetSafeParameters, this method will reset safe writable parameters to their default values before setting the given configuration.NOTE: This method will immediately return
REVLibError.kOkand the action will be done in the background. Any errors that occur will be reported to the driver station.- Parameters:
config- The desired ServoHub configurationresetMode- Whether to reset safe parameters before setting the configuration- Returns:
REVLibError.kOk- See Also:
-
hasActiveFault
-
hasStickyFault
-
hasActiveWarning
-
hasStickyWarning
-
getFaults
Get the active faults that are currently present on the ServoHub. Faults are fatal errors that prevent the motor from running.- Returns:
- A struct with each fault and their active value
-
getStickyFaults
Get the sticky faults that were present on the ServoHub at one point since the sticky faults were last cleared. Faults are fatal errors that prevent the motor from running.Sticky faults can be cleared with
clearFaults().- Returns:
- A struct with each fault and their sticky value
-
getWarnings
Get the active warnings that are currently present on the ServoHub. Warnings are non-fatal errors.- Returns:
- A struct with each warning and their active value
-
getStickyWarnings
Get the sticky warnings that were present on the ServoHub at one point since the sticky warnings were last cleared. Warnings are non-fatal errors.Sticky warnings can be cleared with
clearFaults().- Returns:
- A struct with each warning and their sticky value
-
clearFaults
-
getDeviceVoltage
-
getDeviceCurrent
-
getServoVoltage
-
getServoChannel
Returns an object to control a specific servo channel.- Parameters:
channelId- The specific servo channel to get- Returns:
- The specified ServoChannel
-
setBankPulsePeriod
Set the Pulse Period for servo channels 0-2 or servo channels 3-5.- Parameters:
bank- The bank of channels (0-2 or 3-5) to setpulsePeriod_us- The pulse period in microseconds- Returns:
REVLibError.kOkif successful
-