5package org.wpilib.system;
7import static org.wpilib.units.Units.Amps;
8import static org.wpilib.units.Units.Celsius;
9import static org.wpilib.units.Units.Nanoseconds;
10import static org.wpilib.units.Units.Volts;
12import java.util.function.LongSupplier;
13import org.wpilib.hardware.bus.CANPort;
14import org.wpilib.hardware.hal.HAL;
15import org.wpilib.hardware.hal.HALUtil;
16import org.wpilib.hardware.hal.PowerJNI;
17import org.wpilib.hardware.hal.can.CANJNI;
18import org.wpilib.hardware.hal.can.CANStatus;
19import org.wpilib.units.measure.Current;
20import org.wpilib.units.measure.Temperature;
21import org.wpilib.units.measure.Time;
22import org.wpilib.units.measure.Voltage;
25public final class RobotController {
28 private RobotController() {
29 throw new UnsupportedOperationException(
"This is a utility class!");
38 return HALUtil.getSerialNumber();
69 m_timeSource = supplier;
80 return m_timeSource.getAsLong();
91 return Nanoseconds.of(m_timeSource.getAsLong());
100 return HALUtil.getMonotonicTime();
109 return Nanoseconds.of(
HALUtil.getMonotonicTime());
127 return Volts.of(
PowerJNI.getVinVoltage());
137 return HAL.getSystemActive();
146 return HAL.getBrownedOut();
156 return HAL.getCommsDisableCount();
165 return HAL.getRSLState();
174 return HAL.getSystemTimeValid();
192 return Volts.of(
PowerJNI.getVinVoltage());
201 return PowerJNI.getUserVoltage3V3();
210 return Volts.of(
PowerJNI.getUserVoltage3V3());
219 return PowerJNI.getUserCurrent3V3();
228 return Amps.of(
PowerJNI.getUserCurrent3V3());
237 PowerJNI.setUserEnabled3V3(enabled);
256 return PowerJNI.getUserCurrentFaults3V3();
274 PowerJNI.setBrownoutVoltages(brownoutVoltage, recoveryVoltage);
288 brownoutVoltage.baseUnitMagnitude(), recoveryVoltage.baseUnitMagnitude());
306 return Celsius.of(
PowerJNI.getCPUTemp());
static void setEnabled3V3(boolean enabled)
static boolean getRSLState()
static long getMonotonicTime()
static boolean isBrownedOut()
static boolean isSystemTimeValid()
static String getComments()
static int getCommsDisableCount()
static double getVoltage3V3()
static void setTimeSource(LongSupplier supplier)
static CANStatus getCANStatus(CANPort busId)
static Voltage getMeasureInputVoltage()
static Voltage getMeasureVoltage3V3()
static Temperature getMeasureCPUTemp()
static Current getMeasureCurrent3V3()
static int getFaultCount3V3()
static Voltage getMeasureBatteryVoltage()
static int getTeamNumber()
static void resetRailFaultCounts()
static double getBatteryVoltage()
static boolean getEnabled3V3()
static void setBrownoutVoltages(double brownoutVoltage, double recoveryVoltage)
static Time getMeasureTime()
static boolean isSysActive()
static double getCurrent3V3()
static String getSerialNumber()
static double getInputVoltage()
static double getCPUTemp()
static void setBrownoutVoltages(Voltage brownoutVoltage, Voltage recoveryVoltage)
static Time getMeasureMonotonicTime()