Class RobotController
java.lang.Object
org.wpilib.system.RobotController
Contains functions for roboRIO functionality.
-
Method Summary
Modifier and TypeMethodDescriptionstatic doubleRead the battery voltage.static CANStatusgetCANStatus(CANPort busId) Get the current status of the CAN bus.static StringReturn the comments from the roboRIO web interface.static intGets the number of times the system has been disabled due to communication errors with the Driver Station.static doubleGet the current CPU temperature in degrees Celsius.static doubleGet the current output of the 3.3V rail.static booleanGet the enabled state of the 3.3V rail.static intGet the count of the total current faults on the 3.3V rail since the code started.static doubleGet the input voltage to the robot controller.static VoltageRead the battery voltage in a measure.static TemperatureGet the current CPU temperature in a measure.static CurrentGet the current output in a measure of the 3.3V rail.static VoltageGet the input voltage to the robot controller in a measure.static TimeRead the nanosecond monotonic timer in a measure.static TimeRead the nanosecond timestamp.static VoltageGet the voltage in a measure of the 3.3V rail.static longRead the nanosecond monotonic timer.static booleanGets the current state of the Robot Signal Light (RSL).static StringReturn the serial number of the roboRIO.static intReturns the team number configured for the robot controller.static longgetTime()Read the nanosecond timestamp.static doubleGet the voltage of the 3.3V rail.static booleanCheck if the system is browned out.static booleanGets a value indicating whether the FPGA outputs are enabled.static booleanGets if the system time is valid.static voidReset the overcurrent fault counters for all user rails to 0.static voidsetBrownoutVoltages(double brownoutVoltage, double recoveryVoltage) Set the voltages where the robot will enter and recover from brownout.static voidsetBrownoutVoltages(Voltage brownoutVoltage, Voltage recoveryVoltage) Set the voltages in measures where the robot will enter and recover from brownout.static voidsetEnabled3V3(boolean enabled) Enables or disables the 3.3V rail.static voidsetTimeSource(LongSupplier supplier) Sets a new source to provide the clock time in nanoseconds.
-
Method Details
-
getSerialNumber
Return the serial number of the roboRIO.- Returns:
- The serial number of the roboRIO.
-
getComments
Return the comments from the roboRIO web interface.The comments string is cached after the first call to this function on the RoboRIO - restart the robot code to reload the comments string after changing it in the web interface.
- Returns:
- the comments from the roboRIO web interface.
-
getTeamNumber
public static int getTeamNumber()Returns the team number configured for the robot controller.- Returns:
- team number, or 0 if not found.
-
setTimeSource
Sets a new source to provide the clock time in nanoseconds. Changing this affects the return value ofgetTimein Java.- Parameters:
supplier- Function to return the time in nanoseconds.
-
getTime
public static long getTime()Read the nanosecond timestamp. By default, the time is based on the monotonic clock. However, the return value of this method may be modified to use any time base, including non-monotonic and non-continuous time bases.- Returns:
- The current time in nanoseconds.
-
getMeasureTime
Read the nanosecond timestamp. By default, the time is based on the monotonic clock. However, the return value of this method may be modified to use any time base, including non-monotonic and non-continuous time bases.- Returns:
- The current time in a measure.
-
getMonotonicTime
public static long getMonotonicTime()Read the nanosecond monotonic timer.- Returns:
- The current monotonic time in nanoseconds.
-
getMeasureMonotonicTime
Read the nanosecond monotonic timer in a measure.- Returns:
- The current monotonic time in a measure.
-
getBatteryVoltage
public static double getBatteryVoltage()Read the battery voltage.- Returns:
- The battery voltage in Volts.
-
getMeasureBatteryVoltage
Read the battery voltage in a measure.- Returns:
- The battery voltage in a measure.
-
isSysActive
public static boolean isSysActive()Gets a value indicating whether the FPGA outputs are enabled. The outputs may be disabled if the robot is disabled or e-stopped, the watchdog has expired, or if the roboRIO browns out.- Returns:
- True if the FPGA outputs are enabled.
-
isBrownedOut
public static boolean isBrownedOut()Check if the system is browned out.- Returns:
- True if the system is browned out
-
getCommsDisableCount
public static int getCommsDisableCount()Gets the number of times the system has been disabled due to communication errors with the Driver Station.- Returns:
- number of disables due to communication errors.
-
getRSLState
public static boolean getRSLState()Gets the current state of the Robot Signal Light (RSL).- Returns:
- The current state of the RSL- true if on, false if off
-
isSystemTimeValid
public static boolean isSystemTimeValid()Gets if the system time is valid.- Returns:
- True if the system time is valid, false otherwise
-
getInputVoltage
public static double getInputVoltage()Get the input voltage to the robot controller.- Returns:
- The controller input voltage value in Volts
-
getMeasureInputVoltage
Get the input voltage to the robot controller in a measure.- Returns:
- The controller input voltage value in a measure.
-
getVoltage3V3
public static double getVoltage3V3()Get the voltage of the 3.3V rail.- Returns:
- The controller 3.3V rail voltage value in Volts
-
getMeasureVoltage3V3
Get the voltage in a measure of the 3.3V rail.- Returns:
- The controller 3.3V rail voltage value in a measure.
-
getCurrent3V3
public static double getCurrent3V3()Get the current output of the 3.3V rail.- Returns:
- The controller 3.3V rail output current value in Amps
-
getMeasureCurrent3V3
Get the current output in a measure of the 3.3V rail.- Returns:
- The controller 3.3V rail output current value in a measure.
-
setEnabled3V3
public static void setEnabled3V3(boolean enabled) Enables or disables the 3.3V rail.- Parameters:
enabled- whether to enable the 3.3V rail.
-
getEnabled3V3
public static boolean getEnabled3V3()Get the enabled state of the 3.3V rail. The rail may be disabled due to a controller brownout, a short circuit on the rail, or controller over-voltage.- Returns:
- The controller 3.3V rail enabled value
-
getFaultCount3V3
public static int getFaultCount3V3()Get the count of the total current faults on the 3.3V rail since the code started.- Returns:
- The number of faults
-
resetRailFaultCounts
public static void resetRailFaultCounts()Reset the overcurrent fault counters for all user rails to 0. -
setBrownoutVoltages
public static void setBrownoutVoltages(double brownoutVoltage, double recoveryVoltage) Set the voltages where the robot will enter and recover from brownout.The brownout voltage must be between 5 V and 8 V, inclusive. The recovery voltage must be no greater than 8.5 V and at least 0.5 V above the brownout voltage.
- Parameters:
brownoutVoltage- the voltage where the robot will enter brownoutrecoveryVoltage- the voltage where the robot will recover from brownout
-
setBrownoutVoltages
Set the voltages in measures where the robot will enter and recover from brownout.The brownout voltage must be between 5 V and 8 V, inclusive. The recovery voltage must be no greater than 8.5 V and at least 0.5 V above the brownout voltage.
- Parameters:
brownoutVoltage- the voltage where the robot will enter brownoutrecoveryVoltage- the voltage where the robot will recover from brownout
-
getCPUTemp
public static double getCPUTemp()Get the current CPU temperature in degrees Celsius.- Returns:
- current CPU temperature in degrees Celsius
-
getMeasureCPUTemp
Get the current CPU temperature in a measure.- Returns:
- current CPU temperature in a measure.
-
getCANStatus
-