RobotController
- class wpilib.RobotController
Bases:
pybind11_object
- static getBatteryVoltage() wpimath.units.volts
Read the battery voltage.
- Returns:
The battery voltage in Volts.
- static getBrownoutVoltage() wpimath.units.volts
Get the current brownout voltage setting.
- Returns:
The brownout voltage
- static getCANStatus() wpilib._wpilib.CANStatus
Get the current status of the CAN bus.
- Returns:
The status of the CAN bus
- static getCPUTemp() wpimath.units.celsius
Get the current CPU temperature.
- Returns:
current CPU temperature
- static getComments() str
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.
- static getCommsDisableCount() int
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.
- static getCurrent3V3() float
Get the current output of the 3.3V rail.
- Returns:
The controller 3.3V rail output current value in Amps
- static getCurrent5V() float
Get the current output of the 5V rail.
- Returns:
The controller 5V rail output current value in Amps
- static getCurrent6V() float
Get the current output of the 6V rail.
- Returns:
The controller 6V rail output current value in Amps
- static getEnabled3V3() bool
Get the enabled state of the 3.3V rail. The rail may be disabled due to calling SetEnabled3V3(), a controller brownout, a short circuit on the rail, or controller over-voltage.
- Returns:
The controller 3.3V rail enabled value. True for enabled.
- static getEnabled5V() bool
Get the enabled state of the 5V rail. The rail may be disabled due to calling SetEnabled5V(), a controller brownout, a short circuit on the rail, or controller over-voltage.
- Returns:
The controller 5V rail enabled value. True for enabled.
- static getEnabled6V() bool
Get the enabled state of the 6V rail. The rail may be disabled due to calling SetEnabled6V(), a controller brownout, a short circuit on the rail, or controller over-voltage.
- Returns:
The controller 6V rail enabled value. True for enabled.
- static getFPGARevision() int
Return the FPGA Revision number.
The format of the revision is 3 numbers. The 12 most significant bits are the Major Revision. The next 8 bits are the Minor Revision. The 12 least significant bits are the Build Number.
- Returns:
FPGA Revision number.
- static getFPGATime() int
Read the microsecond-resolution timer on the FPGA.
- Returns:
The current time in microseconds according to the FPGA (since FPGA reset).
- static getFPGAVersion() int
Return the FPGA Version number.
For now, expect this to be competition year.
- Returns:
FPGA Version number.
- static getFaultCount3V3() int
Get the count of the total current faults on the 3.3V rail since the code started.
- Returns:
The number of faults
- static getFaultCount5V() int
Get the count of the total current faults on the 5V rail since the code started.
- Returns:
The number of faults
- static getFaultCount6V() int
Get the count of the total current faults on the 6V rail since the code started.
- Returns:
The number of faults.
- static getInputCurrent() float
Get the input current to the robot controller.
- Returns:
The controller input current value in Amps
- static getInputVoltage() float
Get the input voltage to the robot controller.
- Returns:
The controller input voltage value in Volts
- static getRSLState() bool
Gets the current state of the Robot Signal Light (RSL)
- Returns:
The current state of the RSL- true if on, false if off
- static getRadioLEDState() wpilib._wpilib.RadioLEDState
Get the state of the “Radio” LED. On the RoboRIO, this reads from sysfs, so this function should not be called multiple times per loop cycle to avoid overruns.
- Returns:
The state of the LED.
- static getSerialNumber() str
Return the serial number of the roboRIO.
- Returns:
The serial number of the roboRIO.
- static getTeamNumber() int
Returns the team number configured for the robot controller.
- Returns:
team number, or 0 if not found.
- static getTime() int
Read the microsecond timestamp. By default, the time is based on the FPGA hardware clock in microseconds since the FPGA started. 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 microseconds.
- static getUserButton() bool
Get the state of the “USER” button on the roboRIO.
@warning the User Button is used to stop user programs from automatically loading if it is held for more then 5 seconds. Because of this, it’s not recommended to be used by teams for any other purpose.
- Returns:
True if the button is currently pressed down
- static getVoltage3V3() float
Get the voltage of the 3.3V rail.
- Returns:
The controller 3.3V rail voltage value in Volts
- static getVoltage5V() float
Get the voltage of the 5V rail.
- Returns:
The controller 5V rail voltage value in Volts
- static getVoltage6V() float
Get the voltage of the 6V rail.
- Returns:
The controller 6V rail voltage value in Volts
- static isBrownedOut() bool
Check if the system is browned out.
- Returns:
True if the system is browned out
- static isSysActive() bool
Check if 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.
- static isSystemTimeValid() bool
Gets if the system time is valid.
- Returns:
True if the system time is valid, false otherwise
- static resetRailFaultCounts() None
Reset the overcurrent fault counters for all user rails to 0.
- static setBrownoutVoltage(brownoutVoltage: wpimath.units.volts) None
Set the voltage the roboRIO will brownout and disable all outputs.
Note that this only does anything on the roboRIO 2. On the roboRIO it is a no-op.
- Parameters:
brownoutVoltage – The brownout voltage
- static setEnabled3V3(enabled: bool) None
Enables or disables the 3.3V rail.
- Parameters:
enabled – whether to enable the 3.3V rail.
- static setEnabled5V(enabled: bool) None
Enables or disables the 5V rail.
- Parameters:
enabled – whether to enable the 5V rail.
- static setEnabled6V(enabled: bool) None
Enables or disables the 6V rail.
- Parameters:
enabled – whether to enable the 6V rail.
- static setRadioLEDState(state: wpilib._wpilib.RadioLEDState) None
Set the state of the “Radio” LED. On the RoboRIO, this writes to sysfs, so this function should not be called multiple times per loop cycle to avoid overruns.
- Parameters:
state – The state to set the LED to.
- static setTimeSource(supplier: Callable[[], int]) None
Sets a new source to provide the clock time in microseconds. Changing this affects the return value of
GetTime
.- Parameters:
supplier – Function to return the time in microseconds.