WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
wpi Namespace Reference

Namespaces

namespace  cs
 CameraServer (cscore) namespace.
namespace  net
namespace  math
namespace  hal
 WPILib Hardware Abstraction Layer (HAL) namespace.
namespace  util
namespace  xrp
namespace  cmd
namespace  sim
namespace  nt
 NetworkTables (ntcore) namespace.
namespace  romi
namespace  log
namespace  vision
namespace  err
namespace  warn
namespace  filesystem
 WPILib FileSystem namespace.
namespace  detail
namespace  internal
namespace  sysid
namespace  impl
namespace  apriltag

Classes

class  RobotDriveBase
 Common base class for drive platforms. More...
class  EventLoop
 A declarative way to bind a set of actions to a loop and execute them when the loop is polled. More...
class  I2C
 I2C bus interface class. More...
class  FieldObject2d
 Game field object on a Field2d. More...
class  ExpansionHubMotor
 This class controls a specific motor and encoder hooked up to an ExpansionHub. More...
class  MotorSafety
 The Motor Safety feature acts as a watchdog timer for an individual motor. More...
class  SensorUtil
 Stores most recent status information as well as containing utility functions for checking channels and error processing. More...
class  NetworkBooleanEvent
 A Button that uses a NetworkTable boolean field. More...
class  AddressableLED
 A class for driving addressable LEDs, such as WS2812B, WS2815, and NeoPixels. More...
class  Field2d
 2D representation of game field for dashboards. More...
struct  CANStatus
class  RobotController
class  Timer
 A timer class. More...
class  SmartDashboard
class  Solenoid
 Solenoid class for running high voltage Digital Output on a pneumatics module. More...
class  SendableBuilderImpl
 Implementation detail for SendableBuilder. More...
class  ScopedTracer
 A class for keeping track of how much time it takes for different parts of code to execute. More...
class  DoubleSolenoid
 DoubleSolenoid class for running 2 channels of high voltage Digital Output on a pneumatics module. More...
class  BooleanEvent
 This class provides an easy way to link actions to active high logic signals. More...
class  ExpansionHubPidConstants
 This class contains PID constants for an ExpansionHub motor. More...
class  PWMSparkFlex
 REV Robotics SPARK Flex Motor Controller with PWM control. More...
class  Gamepad
 Handle input from Gamepad controllers connected to the Driver Station. More...
class  RuntimeError
 Runtime error exception. More...
class  Compressor
 Class for operating a compressor connected to a pneumatics module. More...
class  SharpIR
class  SerialPort
 Driver for the RS-232 serial port on the roboRIO. More...
class  NiDsPS5Controller
 Handle input from NiDsPS5 controllers connected to the Driver Station. More...
class  AnalogPotentiometer
 Class for reading analog potentiometers. More...
class  PWMTalonFX
 Cross the Road Electronics (CTRE) Talon FX Motor Controller with PWM control. More...
class  Mechanism2d
 Visual 2D representation of arms, elevators, and general mechanisms through a node-based API. More...
class  DigitalInput
 Class to read a digital input. More...
class  IterativeRobotBase
 IterativeRobotBase implements a specific type of robot program framework, extending the RobotBase class. More...
class  SparkMini
 REV Robotics SPARKMini Motor Controller with PWM control. More...
class  DigitalOutput
 Class to write to digital outputs. More...
class  MechanismLigament2d
 Ligament node on a Mechanism2d. More...
class  VictorSP
 Vex Robotics Victor SP Motor Controller with PWM control. More...
class  RobotBase
 Implement a Robot Program framework. More...
class  SharpIRSim
 Simulation class for Sharp IR sensors. More...
class  CAN
 High level class for interfacing with CAN devices conforming to the standard CAN spec. More...
class  Watchdog
 A class that's a wrapper around a watchdog timer. More...
class  Koors40
 AndyMark Koors40 Motor Controller with PWM control. More...
class  Spark
 REV Robotics SPARK Motor Controller with PWM control. More...
class  UpDownCounter
 Up Down Counter. More...
class  SendableChooserBase
 This class is a non-template base class for SendableChooser. More...
class  ADXL345_I2C
 ADXL345 Accelerometer on I2C. More...
class  AnalogInput
 Analog input class. More...
class  NiDsStadiaController
 Handle input from NiDsStadia controllers connected to the Driver Station. More...
class  Encoder
 Class to read quad encoders. More...
class  NiDsXboxController
 Handle input from NiDsXbox controllers connected to the Driver Station. More...
class  PWMSparkMax
 REV Robotics SPARK MAX Motor Controller with PWM control. More...
class  MechanismObject2d
 Common base class for all Mechanism2d node types. More...
class  MechanismRoot2d
 Root Mechanism2d node. More...
class  ExpansionHubServo
 This class controls a specific servo hooked up to an ExpansionHub. More...
class  TimesliceRobot
 TimesliceRobot extends the TimedRobot robot program framework to provide timeslice scheduling of periodic functions. More...
class  PWMVictorSPX
 Cross the Road Electronics (CTRE) Victor SPX Motor Controller with PWM control. More...
class  OnboardIMU
 Systemcore onboard IMU. More...
class  Joystick
 Handle input from standard Joysticks connected to the Driver Station. More...
class  PWM
 Class implements the PWM generation in the FPGA. More...
class  PeriodicOpMode
 An opmode structure for periodic operation. More...
class  Tracer
 A class for keeping track of how much time it takes for different parts of code to execute. More...
class  Tachometer
 Tachometer for getting rotational velocity from a device. More...
class  TimedRobot
 TimedRobot implements the IterativeRobotBase robot program framework. More...
class  GenericHID
 Handle input from standard HID devices connected to the Driver Station. More...
class  OpMode
 Top-level interface for opmode classes. More...
class  CounterBase
 Interface for counting the number of ticks on a digital input channel. More...
class  ExpansionHub
 This class controls a REV ExpansionHub plugged in over USB to Systemcore. More...
class  LEDPattern
class  DutyCycle
 Class to read a duty cycle PWM input. More...
class  PneumaticsControlModule
 Module class for controlling a Cross The Road Electronics Pneumatics Control Module. More...
class  Preferences
 The preferences class provides a relatively simple way to save important values to the roboRIO to access the next time the roboRIO is booted. More...
class  AnalogEncoder
 Class for supporting continuous analog encoders, such as the US Digital MA3. More...
class  DutyCycleEncoder
 Class for supporting duty cycle/PWM encoders, such as the US Digital MA3 with PWM Output, the CTRE Mag Encoder, the Rev Hex Encoder, and the AM Mag Encoder. More...
class  PWMTalonSRX
 Cross the Road Electronics (CTRE) Talon SRX Motor Controller with PWM control. More...
class  NiDsPS4Controller
 Handle input from NiDsPS4 controllers connected to the Driver Station. More...
class  Talon
 Cross the Road Electronics (CTRE) Talon Motor Controller with PWM control. More...
class  Resource
 The Resource class is a convenient way to track allocated resources. More...
class  DataLogManager
 Centralized data log that provides automatic data log file management. More...
class  PWMMotorController
 Common base class for all PWM Motor Controllers. More...
class  PowerDistribution
 Class for getting voltage, current, temperature, power and energy from the CTRE Power Distribution Panel (PDP) or REV Power Distribution Hub (PDH). More...
class  CameraServer
 Singleton class for creating and keeping camera servers. More...
class  OpModeRobotBase
 OpModeRobotBase is the non-templated base class for OpModeRobot. More...
class  OpModeRobot
 OpModeRobot implements the opmode-based robot program framework. More...
class  SystemServer
class  CameraServerShared
class  MecanumDrive
 A class for driving Mecanum drive platforms. More...
class  Notifier
 Notifiers run a user-provided callback function on a separate thread. More...
class  Alert
 Persistent alert to be sent to the driver station. More...
class  DifferentialDrive
 A class for driving differential drive/skid-steer drive platforms such as the Kit of Parts drive base, "tank drive", or West Coast Drive. More...
class  DriverStation
 Provide access to the network communication data to / from the Driver Station. More...
class  PneumaticHub
 Module class for controlling a REV Robotics Pneumatic Hub. More...
class  PneumaticsBase
 Base class for pneumatics devices. More...
class  AnalogAccelerometer
 Handle operation of an analog accelerometer. More...
class  PWMVenom
 Playing with Fusion Venom Motor Controller with PWM control. More...
class  MotorController
 Interface for motor controlling devices. More...
class  SendableChooser
 The SendableChooser class is a useful tool for presenting a selection of options to the SmartDashboard. More...

Concepts

concept  ConstructibleOpMode
 Concept indicating a class is derived from OpMode and has either a no-argument constructor or a constructorthat accepts R&.

Typedefs

using RobotMode = wpi::hal::RobotMode

Enumerations

enum class  CompressorConfigType { Disabled = 0 , Digital = 1 , Analog = 2 , Hybrid = 3 }
 Compressor config type. More...
enum class  EdgeConfiguration { kRisingEdge = 0 , kFallingEdge = 1 }
 Edge configuration. More...
enum class  PneumaticsModuleType { CTREPCM , REVPH }
 Pneumatics module type. More...
enum  RuntimeType { kRoboRIO , kRoboRIO2 , kSimulation , kSystemcore }
 Runtime type. More...
enum class  RobotMode
 The overall robot mode (not including enabled state). More...

Functions

constexpr auto format_as (AddressableLED::ColorOrder order)
int GetThreadPriority (std::thread &thread, bool *isRealTime)
 Get the thread priority for the specified thread.
int GetCurrentThreadPriority (bool *isRealTime)
 Get the thread priority for the current thread.
bool SetThreadPriority (std::thread &thread, bool realTime, int priority)
 Sets the thread priority for the specified thread.
bool SetCurrentThreadPriority (bool realTime, int priority)
 Sets the thread priority for the current thread.
void Wait (wpi::units::second_t seconds)
 Pause the task for a specified time.
wpi::units::second_t GetTime ()
 Gives real-time clock system time with nanosecond resolution.
const char * GetErrorMessage (int32_t *code)
 Gets error message string for an error code.
void ReportErrorV (int32_t status, const char *fileName, int lineNumber, const char *funcName, fmt::string_view format, fmt::format_args args)
 Reports an error to the driver station (using HAL_SendError).
template<typename... Args>
void ReportError (int32_t status, const char *fileName, int lineNumber, const char *funcName, fmt::string_view format, Args &&... args)
 Reports an error to the driver station (using HAL_SendError).
RuntimeError MakeErrorV (int32_t status, const char *fileName, int lineNumber, const char *funcName, fmt::string_view format, fmt::format_args args)
 Makes a runtime error exception object.
template<typename... Args>
RuntimeError MakeError (int32_t status, const char *fileName, int lineNumber, const char *funcName, fmt::string_view format, Args &&... args)
int RunHALInitialization ()
template<class Robot>
int StartRobot ()
CameraServerSharedGetCameraServerShared ()

Typedef Documentation

◆ RobotMode

Enumeration Type Documentation

◆ CompressorConfigType

enum class wpi::CompressorConfigType
strong

Compressor config type.

Enumerator
Disabled 

Disabled.

Digital 

Digital.

Analog 

Analog.

Hybrid 

Hybrid.

◆ EdgeConfiguration

enum class wpi::EdgeConfiguration
strong

Edge configuration.

Enumerator
kRisingEdge 

Rising edge configuration.

kFallingEdge 

Falling edge configuration.

◆ PneumaticsModuleType

enum class wpi::PneumaticsModuleType
strong

Pneumatics module type.

Enumerator
CTREPCM 

CTRE PCM.

REVPH 

REV PH.

◆ RobotMode

enum class wpi::hal::RobotMode
strong

The overall robot mode (not including enabled state).

◆ RuntimeType

Runtime type.

Enumerator
kRoboRIO 

roboRIO 1.0.

kRoboRIO2 

roboRIO 2.0.

kSimulation 

Simulation runtime.

kSystemcore 

Function Documentation

◆ format_as()

auto wpi::format_as ( AddressableLED::ColorOrder order)
constexpr

◆ GetCameraServerShared()

CameraServerShared * wpi::GetCameraServerShared ( )

◆ GetCurrentThreadPriority()

int wpi::GetCurrentThreadPriority ( bool * isRealTime)

Get the thread priority for the current thread.

Parameters
isRealTimeSet to true if thread is real-time, otherwise false.
Returns
The current thread priority. For real-time, this is 1-99 with 99 being highest. For non-real-time, this is 0. See "man 7 sched" for details.

◆ GetErrorMessage()

const char * wpi::GetErrorMessage ( int32_t * code)

Gets error message string for an error code.

◆ GetThreadPriority()

int wpi::GetThreadPriority ( std::thread & thread,
bool * isRealTime )

Get the thread priority for the specified thread.

Parameters
threadReference to the thread to get the priority for.
isRealTimeSet to true if thread is real-time, otherwise false.
Returns
The current thread priority. For real-time, this is 1-99 with 99 being highest. For non-real-time, this is 0. See "man 7 sched" for details.

◆ GetTime()

wpi::units::second_t wpi::GetTime ( )

Gives real-time clock system time with nanosecond resolution.

Returns
The time, just in case you want the robot to start autonomous at 8pm on Saturday.

◆ MakeError()

template<typename... Args>
RuntimeError wpi::MakeError ( int32_t status,
const char * fileName,
int lineNumber,
const char * funcName,
fmt::string_view format,
Args &&... args )
inlinenodiscard

◆ MakeErrorV()

RuntimeError wpi::MakeErrorV ( int32_t status,
const char * fileName,
int lineNumber,
const char * funcName,
fmt::string_view format,
fmt::format_args args )
nodiscard

Makes a runtime error exception object.

This object should be thrown by the caller. Generally the WPILIB_MakeError wrapper macro should be used instead.

Parameters
[out]statuserror code
[in]fileNamesource file name
[in]lineNumbersource line number
[in]funcNamesource function name
[in]formaterror message format
[in]argserror message format args
Returns
runtime error object

◆ ReportError()

template<typename... Args>
void wpi::ReportError ( int32_t status,
const char * fileName,
int lineNumber,
const char * funcName,
fmt::string_view format,
Args &&... args )
inline

Reports an error to the driver station (using HAL_SendError).

Generally the WPILIB_ReportError wrapper macro should be used instead.

Parameters
[out]statuserror code
[in]fileNamesource file name
[in]lineNumbersource line number
[in]funcNamesource function name
[in]formaterror message format
[in]argserror message format args

◆ ReportErrorV()

void wpi::ReportErrorV ( int32_t status,
const char * fileName,
int lineNumber,
const char * funcName,
fmt::string_view format,
fmt::format_args args )

Reports an error to the driver station (using HAL_SendError).

Generally the WPILIB_ReportError wrapper macro should be used instead.

Parameters
[out]statuserror code
[in]fileNamesource file name
[in]lineNumbersource line number
[in]funcNamesource function name
[in]formaterror message format
[in]argserror message format args

◆ RunHALInitialization()

int wpi::RunHALInitialization ( )

◆ SetCurrentThreadPriority()

bool wpi::SetCurrentThreadPriority ( bool realTime,
int priority )

Sets the thread priority for the current thread.

Parameters
realTimeSet to true to set a real-time priority, false for standard priority.
priorityPriority to set the thread to. For real-time, this is 1-99 with 99 being highest. For non-real-time, this is forced to
  1. See "man 7 sched" for more details.
Returns
True on success.

◆ SetThreadPriority()

bool wpi::SetThreadPriority ( std::thread & thread,
bool realTime,
int priority )

Sets the thread priority for the specified thread.

Parameters
threadReference to the thread to set the priority of.
realTimeSet to true to set a real-time priority, false for standard priority.
priorityPriority to set the thread to. For real-time, this is 1-99 with 99 being highest. For non-real-time, this is forced to
  1. See "man 7 sched" for more details.
Returns
True on success.

◆ StartRobot()

template<class Robot>
int wpi::StartRobot ( )

◆ Wait()

void wpi::Wait ( wpi::units::second_t seconds)

Pause the task for a specified time.

Pause the execution of the program for a specified period of time given in seconds. Motors will continue to run at their last assigned values, and sensors will continue to update. Only the task containing the wait will pause until the wait time is expired.

Parameters
secondsLength of time to pause, in seconds.