Package com.revrobotics.servohub
Class ServoHubLowLevel
java.lang.Object
com.revrobotics.servohub.ServoHubLowLevel
- Direct Known Subclasses:
ServoHub
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
class
class
class
class
class
-
Field Summary
-
Constructor Summary
ConstructorDescriptionServoHubLowLevel
(int deviceId) Create a new object to control a ServoHub Servo Controller -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the ServoHub Controllervoid
Create the sim gui Fault Manager for this Servo Hubint
Set the control frame send period for the native CAN Send thread.int
Get the configured Device ID of the ServoHub.Get the firmware version of the ServoHub.Get the firmware version of the ServoHub as a string.void
setCANMaxRetries
(int numRetries) Set the maximum number of times to retry an RTR CAN frame.setCANTimeout
(int timeout_ms) Sets the timeout duration for waiting for CAN responses from the device.void
setControlFramePeriodMs
(int periodMs) Set the control frame send period for the native CAN Send thread.void
setPeriodicFrameTimeout
(int timeout_ms) Set the amount of time to wait for a periodic status frame before returning a timeout error.protected void
-
Field Details
-
servoHubHandle
protected final long servoHubHandle
-
-
Constructor Details
-
ServoHubLowLevel
public ServoHubLowLevel(int deviceId) Create a new object to control a ServoHub Servo Controller- Parameters:
deviceId
- The device ID.
-
-
Method Details
-
close
public void close()Closes the ServoHub Controller -
getDeviceId
public int getDeviceId()Get the configured Device ID of the ServoHub.- Returns:
- int device ID
-
getFirmwareVersion
Get the firmware version of the ServoHub.- Returns:
- FirmwareVersion tbd
-
getFirmwareVersionString
Get the firmware version of the ServoHub as a string.- Returns:
- String Human readable firmware version string
-
setPeriodicFrameTimeout
public void setPeriodicFrameTimeout(int timeout_ms) Set the amount of time to wait for a periodic status frame before returning a timeout error. This timeout will apply to all periodic status frames for the ServoHub servo controller.To prevent invalid timeout errors, the minimum timeout for a given periodic status is 2.1 times its period. To use the minimum timeout for all status frames, set timeout_ms to 0.
The default timeout is 500ms.
- Parameters:
timeout_ms
- The timeout in milliseconds
-
setCANTimeout
Sets the timeout duration for waiting for CAN responses from the device.- Parameters:
timeout_ms
- The timeout in milliseconds.- Returns:
REVLibError.kOk
if successful
-
setCANMaxRetries
public void setCANMaxRetries(int numRetries) Set the maximum number of times to retry an RTR CAN frame. This applies to calls such as GetFirmwareVersion where a request is made to the ServoHub and a response is expected. Anytime sending the request or receiving the response fails, it will retry the request a number of times, no more than the value set by this method. If an attempt succeeds, it will immediately return. The minimum number of retries is 0, where only a single attempt will be made and will return regardless of success or failure.The default maximum is 5 retries.
- Parameters:
numRetries
- The maximum number of retries
-
setControlFramePeriodMs
public void setControlFramePeriodMs(int periodMs) Set the control frame send period for the native CAN Send thread.- Parameters:
periodMs
- The send period in milliseconds between 1ms and 100ms or set to 0 to disable periodic sends.
-
getControlFramePeriodMs
public int getControlFramePeriodMs()Set the control frame send period for the native CAN Send thread.- Returns:
- int The send period in milliseconds.
-
getPeriodicStatus0
-
getPeriodicStatus1
-
getPeriodicStatus2
-
getPeriodicStatus3
-
getPeriodicStatus4
-
createSimFaultManager
public void createSimFaultManager()Create the sim gui Fault Manager for this Servo Hub -
throwIfClosed
protected void throwIfClosed()
-