WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
wpi::RobotController Class Reference

#include <wpi/system/RobotController.hpp>

Public Member Functions

 RobotController ()=delete

Static Public Member Functions

static std::string GetSerialNumber ()
 Return the serial number of the roboRIO.
static std::string GetComments ()
 Return the comments from the roboRIO web interface.
static int32_t GetTeamNumber ()
 Returns the team number configured for the robot controller.
static void SetTimeSource (std::function< uint64_t()> supplier)
 Sets a new source to provide the clock time in microseconds.
static uint64_t GetTime ()
 Read the microsecond timestamp.
static uint64_t GetFPGATime ()
 Read the microsecond-resolution timer on the FPGA.
static wpi::units::volt_t GetBatteryVoltage ()
 Read the battery voltage.
static bool IsSysActive ()
 Check if the FPGA outputs are enabled.
static bool IsBrownedOut ()
 Check if the system is browned out.
static int GetCommsDisableCount ()
 Gets the number of times the system has been disabled due to communication errors with the Driver Station.
static bool GetRSLState ()
 Gets the current state of the Robot Signal Light (RSL).
static bool IsSystemTimeValid ()
 Gets if the system time is valid.
static double GetInputVoltage ()
 Get the input voltage to the robot controller.
static double GetVoltage3V3 ()
 Get the voltage of the 3.3V rail.
static double GetCurrent3V3 ()
 Get the current output of the 3.3V rail.
static void SetEnabled3V3 (bool enabled)
 Enables or disables the 3.3V rail.
static bool GetEnabled3V3 ()
 Get the enabled state of the 3.3V rail.
static int GetFaultCount3V3 ()
 Get the count of the total current faults on the 3.3V rail since the code started.
static void ResetRailFaultCounts ()
 Reset the overcurrent fault counters for all user rails to 0.
static wpi::units::volt_t GetBrownoutVoltage ()
 Get the current brownout voltage setting.
static void SetBrownoutVoltage (wpi::units::volt_t brownoutVoltage)
 Set the voltage the roboRIO will brownout and disable all outputs.
static wpi::units::celsius_t GetCPUTemp ()
 Get the current CPU temperature.
static CANStatus GetCANStatus (int busId)
 Get the current status of the CAN bus.

Constructor & Destructor Documentation

◆ RobotController()

wpi::RobotController::RobotController ( )
delete

Member Function Documentation

◆ GetBatteryVoltage()

wpi::units::volt_t wpi::RobotController::GetBatteryVoltage ( )
static

Read the battery voltage.

Returns
The battery voltage in Volts.

◆ GetBrownoutVoltage()

wpi::units::volt_t wpi::RobotController::GetBrownoutVoltage ( )
static

Get the current brownout voltage setting.

Returns
The brownout voltage

◆ GetCANStatus()

CANStatus wpi::RobotController::GetCANStatus ( int busId)
static

Get the current status of the CAN bus.

Parameters
busIdThe bus ID.
Returns
The status of the CAN bus

◆ GetComments()

std::string wpi::RobotController::GetComments ( )
static

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.

◆ GetCommsDisableCount()

int wpi::RobotController::GetCommsDisableCount ( )
static

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.

◆ GetCPUTemp()

wpi::units::celsius_t wpi::RobotController::GetCPUTemp ( )
static

Get the current CPU temperature.

Returns
current CPU temperature

◆ GetCurrent3V3()

double wpi::RobotController::GetCurrent3V3 ( )
static

Get the current output of the 3.3V rail.

Returns
The controller 3.3V rail output current value in Amps

◆ GetEnabled3V3()

bool wpi::RobotController::GetEnabled3V3 ( )
static

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.

◆ GetFaultCount3V3()

int wpi::RobotController::GetFaultCount3V3 ( )
static

Get the count of the total current faults on the 3.3V rail since the code started.

Returns
The number of faults

◆ GetFPGATime()

uint64_t wpi::RobotController::GetFPGATime ( )
static

Read the microsecond-resolution timer on the FPGA.

Returns
The current time in microseconds according to the FPGA (since FPGA reset).

◆ GetInputVoltage()

double wpi::RobotController::GetInputVoltage ( )
static

Get the input voltage to the robot controller.

Returns
The controller input voltage value in Volts

◆ GetRSLState()

bool wpi::RobotController::GetRSLState ( )
static

Gets the current state of the Robot Signal Light (RSL).

Returns
The current state of the RSL- true if on, false if off

◆ GetSerialNumber()

std::string wpi::RobotController::GetSerialNumber ( )
static

Return the serial number of the roboRIO.

Returns
The serial number of the roboRIO.

◆ GetTeamNumber()

int32_t wpi::RobotController::GetTeamNumber ( )
static

Returns the team number configured for the robot controller.

Returns
team number, or 0 if not found.

◆ GetTime()

uint64_t wpi::RobotController::GetTime ( )
static

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.

◆ GetVoltage3V3()

double wpi::RobotController::GetVoltage3V3 ( )
static

Get the voltage of the 3.3V rail.

Returns
The controller 3.3V rail voltage value in Volts

◆ IsBrownedOut()

bool wpi::RobotController::IsBrownedOut ( )
static

Check if the system is browned out.

Returns
True if the system is browned out

◆ IsSysActive()

bool wpi::RobotController::IsSysActive ( )
static

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.

◆ IsSystemTimeValid()

bool wpi::RobotController::IsSystemTimeValid ( )
static

Gets if the system time is valid.

Returns
True if the system time is valid, false otherwise

◆ ResetRailFaultCounts()

void wpi::RobotController::ResetRailFaultCounts ( )
static

Reset the overcurrent fault counters for all user rails to 0.

◆ SetBrownoutVoltage()

void wpi::RobotController::SetBrownoutVoltage ( wpi::units::volt_t brownoutVoltage)
static

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
brownoutVoltageThe brownout voltage

◆ SetEnabled3V3()

void wpi::RobotController::SetEnabled3V3 ( bool enabled)
static

Enables or disables the 3.3V rail.

Parameters
enabledwhether to enable the 3.3V rail.

◆ SetTimeSource()

void wpi::RobotController::SetTimeSource ( std::function< uint64_t()> supplier)
static

Sets a new source to provide the clock time in microseconds.

Changing this affects the return value of GetTime.

Parameters
supplierFunction to return the time in microseconds.

The documentation for this class was generated from the following file: