Class ServoHub
- All Implemented Interfaces:
REVDevice,AutoCloseable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic classstatic enumDeprecated, for removal: This API element is subject to removal in a future version.static classNested classes/interfaces inherited from class com.revrobotics.servohub.ServoHubLowLevel
ServoHubLowLevel.FirmwareVersion, ServoHubLowLevel.PeriodicStatus0, ServoHubLowLevel.PeriodicStatus1, ServoHubLowLevel.PeriodicStatus2, ServoHubLowLevel.PeriodicStatus3, ServoHubLowLevel.PeriodicStatus4Nested classes/interfaces inherited from class com.revrobotics.NativeResourceCleaner
NativeResourceCleaner.OnClean -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal ServoHubConfigAccessorAccessor for ServoHub parameter values.Fields inherited from class com.revrobotics.servohub.ServoHubLowLevel
servoHubHandle -
Constructor Summary
ConstructorsConstructorDescriptionServoHub(int deviceId) Create a new object to control a ServoHub Servo Controller -
Method Summary
Modifier and TypeMethodDescriptionClears all sticky faults.configure(ServoHubConfig config, ResetMode resetMode) Set the configuration for the ServoHub.configure(ServoHubConfig config, ServoHub.ResetMode resetMode) Deprecated, for removal: This API element is subject to removal in a future version.configureAsync(ServoHubConfig config, ServoHub.ResetMode resetMode) Set the configuration for the ServoHub without waiting for a response.doubledoubleGet the active faults that are currently present on the ServoHub.getServoChannel(ServoChannel.ChannelId channelId) Returns an object to control a specific servo channel.doubleGet 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.booleanGet whether the ServoHub has one or more active faults.booleanGet whether the ServoHub has one or more active warnings.booleanGet whether the ServoHub has one or more sticky faults.booleanGet 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 com.revrobotics.servohub.ServoHubLowLevel
close, createSimFaultManager, getCleanAction, getControlFramePeriodMs, getDeviceId, getFirmwareVersion, getFirmwareVersionString, getPeriodicStatus0, getPeriodicStatus1, getPeriodicStatus2, getPeriodicStatus3, getPeriodicStatus4, setCANMaxRetries, setCANTimeout, setControlFramePeriodMs, setPeriodicFrameTimeout, throwIfClosedMethods inherited from class com.revrobotics.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(int deviceId) Create a new object to control a ServoHub Servo Controller- Parameters:
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
-
configure
@Deprecated(since="2026", forRemoval=true) public REVLibError configure(ServoHubConfig config, ServoHub.ResetMode resetMode) Deprecated, for removal: This API element is subject to removal in a future version.Useconfigure(ServoHubConfig, com.revrobotics.ResetMode)instead.Set the configuration for the ServoHub.If
resetModeisServoHub.ResetMode.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
resetModeisServoHub.ResetMode.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
public boolean hasActiveFault()Get whether the ServoHub has one or more active faults.- Returns:
- true if there is an active fault
- See Also:
-
hasStickyFault
public boolean hasStickyFault()Get whether the ServoHub has one or more sticky faults.- Returns:
- true if there is a sticky fault
- See Also:
-
hasActiveWarning
public boolean hasActiveWarning()Get whether the ServoHub has one or more active warnings.- Returns:
- true if there is an active warning
- See Also:
-
hasStickyWarning
public boolean hasStickyWarning()Get whether the ServoHub has one or more sticky warnings.- Returns:
- true if there is a sticky warning
- See Also:
-
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
Clears all sticky faults.- Returns:
REVLibError.kOkif successful
-
getDeviceVoltage
public double getDeviceVoltage()- Returns:
- The voltage fed into the servo controller.
-
getDeviceCurrent
public double getDeviceCurrent()- Returns:
- The servo controller's output current in Amps.
-
getServoVoltage
public double getServoVoltage()- Returns:
- The voltage fed to the actual servos.
-
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
-
configure(ServoHubConfig, com.revrobotics.ResetMode)instead.