Package com.revrobotics.servohub
Class ServoHubSim
java.lang.Object
com.revrobotics.servohub.ServoHubSim
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddisable()Disable the Servo Hub Devicevoidenable()Enable the Servo Hub Device.doubleGet the simulated bank pulse period.doubleGet the simulated device current.doubleGet the simulated device voltage.Get theServoHubSimFaultManagerobject associated with this Servo Hub Device.doubleGet the simulated servo voltage.voidsetBankPulsePeriod(ServoHub.Bank bank, int pulsePeriod_us) Set the simulated bank pulse periodvoidsetDeviceCurrent(double current) Set the simulated device current.voidsetDeviceVoltage(double voltage) Set the simulated device voltage.voidsetServoVoltage(double voltage) Set the simulated servo voltage.voidUse the driver station enable as the method to enable/disable the Servo Hub.
-
Constructor Details
-
ServoHubSim
Create a simulated CAN Servo Hub object. This class simulates some of the internal behavior of the device. This class is not required to display to the sim GUI, but is required to interact with it.- Parameters:
servoHub- The Servo Hub to simulate
-
-
Method Details
-
getDeviceVoltage
public double getDeviceVoltage()Get the simulated device voltage. This matches the value from the ServoHub.getDeviceVoltage().- Returns:
- device voltage in volts
-
setDeviceVoltage
public void setDeviceVoltage(double voltage) Set the simulated device voltage.- Parameters:
voltage- device voltage in volts
-
getDeviceCurrent
public double getDeviceCurrent()Get the simulated device current. This matches the value from the ServoHub.getDeviceCurrent().- Returns:
- device current in amps
-
setDeviceCurrent
public void setDeviceCurrent(double current) Set the simulated device current.- Parameters:
current- device current in amps
-
getServoVoltage
public double getServoVoltage()Get the simulated servo voltage. This matches the value from the ServoHub.getServoVoltage().- Returns:
- servo voltage in volts
-
setServoVoltage
public void setServoVoltage(double voltage) Set the simulated servo voltage.- Parameters:
voltage- servo voltage in volts
-
getBankPulsePeriod
Get the simulated bank pulse period. This matches the value from the ServoHub.getBankPulsePeriod().- Parameters:
bank- the specific bank (0-2, or 3-5)to get- Returns:
- pulse period (in microseconds)for the specified bank
-
setBankPulsePeriod
Set the simulated bank pulse period- Parameters:
bank- the specific bank (0-2, or 3-5)to getpulsePeriod_us- pulse period (in microseconds)for the specified bank
-
enable
public void enable()Enable the Servo Hub Device. -
disable
public void disable()Disable the Servo Hub Device -
useDriverStationEnable
public void useDriverStationEnable()Use the driver station enable as the method to enable/disable the Servo Hub. This is the default, so you do not need to call this unless you previously called enable() or disable(). -
getFaultManager
Get theServoHubSimFaultManagerobject associated with this Servo Hub Device. This will allow you to set simulated faults on your simulated device and view the Fault Manager in the Sim GUI.- Returns:
- The
ServoHubSimFaultManagerobject associated with this Servo Hub Device
-