Package edu.wpi.first.wpilibj.simulation
Class RoboRioSim
java.lang.Object
edu.wpi.first.wpilibj.simulation.RoboRioSim
A utility class to control a simulated RoboRIO.
-
Method Summary
Modifier and TypeMethodDescriptionstatic double
Measure the Brownout voltage.static String
Get the comments string.static double
Get the cpu temp.static String
Get the serial number.static int
Get the team number.static boolean
Get the 3.3V rail active state.static double
Measure the 3.3V rail current.static int
Get the 3.3V rail number of faults.static double
Measure the 3.3V rail voltage.static double
Measure the Vin voltage.static CallbackStore
registerBrownoutVoltageCallback
(NotifyCallback callback, boolean initialNotify) Register a callback to be run whenever the Brownout voltage changes.static CallbackStore
registerCPUTempCallback
(NotifyCallback callback, boolean initialNotify) Register a callback to be run whenever the cpu temp changes.static CallbackStore
registerTeamNumberCallback
(NotifyCallback callback, boolean initialNotify) Register a callback to be run whenever the team number changes.static CallbackStore
registerUserActive3V3Callback
(NotifyCallback callback, boolean initialNotify) Register a callback to be run whenever the 3.3V rail active state changes.static CallbackStore
registerUserCurrent3V3Callback
(NotifyCallback callback, boolean initialNotify) Register a callback to be run whenever the 3.3V rail current changes.static CallbackStore
registerUserFaults3V3Callback
(NotifyCallback callback, boolean initialNotify) Register a callback to be run whenever the 3.3V rail number of faults changes.static CallbackStore
registerUserVoltage3V3Callback
(NotifyCallback callback, boolean initialNotify) Register a callback to be run whenever the 3.3V rail voltage changes.static CallbackStore
registerVInVoltageCallback
(NotifyCallback callback, boolean initialNotify) Register a callback to be run whenever the Vin voltage changes.static void
Reset all simulation data.static void
setBrownoutVoltage
(double vInVoltage) Define the Brownout voltage.static void
setComments
(String comments) Set the comments string.static void
setCPUTemp
(double cpuTemp) Set the cpu temp.static void
setSerialNumber
(String serialNumber) Set the serial number.static void
setTeamNumber
(int teamNumber) Set the team number.static void
setUserActive3V3
(boolean userActive3V3) Set the 3.3V rail active state.static void
setUserCurrent3V3
(double userCurrent3V3) Define the 3.3V rail current.static void
setUserFaults3V3
(int userFaults3V3) Set the 3.3V rail number of faults.static void
setUserVoltage3V3
(double userVoltage3V3) Define the 3.3V rail voltage.static void
setVInVoltage
(double vInVoltage) Define the Vin voltage.
-
Method Details
-
registerVInVoltageCallback
public static CallbackStore registerVInVoltageCallback(NotifyCallback callback, boolean initialNotify) Register a callback to be run whenever the Vin voltage changes.- Parameters:
callback
- the callbackinitialNotify
- whether to call the callback with the initial state- Returns:
- the
CallbackStore
object associated with this callback.
-
getVInVoltage
Measure the Vin voltage.- Returns:
- the Vin voltage
-
setVInVoltage
Define the Vin voltage.- Parameters:
vInVoltage
- the new voltage
-
registerUserVoltage3V3Callback
public static CallbackStore registerUserVoltage3V3Callback(NotifyCallback callback, boolean initialNotify) Register a callback to be run whenever the 3.3V rail voltage changes.- Parameters:
callback
- the callbackinitialNotify
- whether the callback should be called with the initial value- Returns:
- the
CallbackStore
object associated with this callback.
-
getUserVoltage3V3
Measure the 3.3V rail voltage.- Returns:
- the 3.3V rail voltage
-
setUserVoltage3V3
Define the 3.3V rail voltage.- Parameters:
userVoltage3V3
- the new voltage
-
registerUserCurrent3V3Callback
public static CallbackStore registerUserCurrent3V3Callback(NotifyCallback callback, boolean initialNotify) Register a callback to be run whenever the 3.3V rail current changes.- Parameters:
callback
- the callbackinitialNotify
- whether the callback should be called with the initial value- Returns:
- the
CallbackStore
object associated with this callback.
-
getUserCurrent3V3
Measure the 3.3V rail current.- Returns:
- the 3.3V rail current
-
setUserCurrent3V3
Define the 3.3V rail current.- Parameters:
userCurrent3V3
- the new current
-
registerUserActive3V3Callback
public static CallbackStore registerUserActive3V3Callback(NotifyCallback callback, boolean initialNotify) Register a callback to be run whenever the 3.3V rail active state changes.- Parameters:
callback
- the callbackinitialNotify
- whether the callback should be called with the initial state- Returns:
- the
CallbackStore
object associated with this callback.
-
getUserActive3V3
Get the 3.3V rail active state.- Returns:
- true if the 3.3V rail is active
-
setUserActive3V3
Set the 3.3V rail active state.- Parameters:
userActive3V3
- true to make rail active
-
registerUserFaults3V3Callback
public static CallbackStore registerUserFaults3V3Callback(NotifyCallback callback, boolean initialNotify) Register a callback to be run whenever the 3.3V rail number of faults changes.- Parameters:
callback
- the callbackinitialNotify
- whether the callback should be called with the initial value- Returns:
- the
CallbackStore
object associated with this callback.
-
getUserFaults3V3
Get the 3.3V rail number of faults.- Returns:
- number of faults
-
setUserFaults3V3
Set the 3.3V rail number of faults.- Parameters:
userFaults3V3
- number of faults
-
registerBrownoutVoltageCallback
public static CallbackStore registerBrownoutVoltageCallback(NotifyCallback callback, boolean initialNotify) Register a callback to be run whenever the Brownout voltage changes.- Parameters:
callback
- the callbackinitialNotify
- whether to call the callback with the initial state- Returns:
- the
CallbackStore
object associated with this callback.
-
getBrownoutVoltage
Measure the Brownout voltage.- Returns:
- the Brownout voltage
-
setBrownoutVoltage
Define the Brownout voltage.- Parameters:
vInVoltage
- the new voltage
-
registerCPUTempCallback
Register a callback to be run whenever the cpu temp changes.- Parameters:
callback
- the callbackinitialNotify
- whether to call the callback with the initial state- Returns:
- the
CallbackStore
object associated with this callback.
-
getCPUTemp
Get the cpu temp.- Returns:
- the cpu temp.
-
setCPUTemp
Set the cpu temp.- Parameters:
cpuTemp
- the new cpu temp.
-
registerTeamNumberCallback
public static CallbackStore registerTeamNumberCallback(NotifyCallback callback, boolean initialNotify) Register a callback to be run whenever the team number changes.- Parameters:
callback
- the callbackinitialNotify
- whether to call the callback with the initial state- Returns:
- the
CallbackStore
object associated with this callback.
-
getTeamNumber
Get the team number.- Returns:
- the team number.
-
setTeamNumber
Set the team number.- Parameters:
teamNumber
- the new team number.
-
getSerialNumber
Get the serial number.- Returns:
- The serial number.
-
setSerialNumber
Set the serial number.- Parameters:
serialNumber
- The serial number.
-
getComments
Get the comments string.- Returns:
- The comments string.
-
setComments
Set the comments string.- Parameters:
comments
- The comments string.
-
resetData
Reset all simulation data.
-