Class for getting information about an available CAN bus.
More...
#include <ctre/phoenix6/CANBus.hpp>
|
constexpr | CANBus (std::string_view canbus="") |
| Creates a new CAN bus with the given name.
|
|
| CANBus (std::string_view canbus, char const *hootFilepath) |
| Creates a new CAN bus with the given name, and loads an associated hoot file for replay (equivalent to HootReplay::LoadFile).
|
|
constexpr std::string_view | GetName () const |
| Get the name used to construct this CAN bus.
|
|
bool | IsNetworkFD () const |
| Gets whether the CAN bus is a CAN FD network.
|
|
CANBusStatus | GetStatus () const |
| Gets the status of the CAN bus, including the bus utilization and the error counters.
|
|
|
static bool | IsNetworkFD (std::string const &canbus) |
| Gets whether the CAN bus is a CAN FD network.
|
|
static CANBusStatus | GetStatus (std::string const &canbus) |
| Gets the status of the CAN bus, including the bus utilization and the error counters.
|
|
Class for getting information about an available CAN bus.
◆ CANBus() [1/2]
constexpr ctre::phoenix6::CANBus::CANBus |
( |
std::string_view | canbus = "" | ) |
|
|
inlineconstexpr |
Creates a new CAN bus with the given name.
- Parameters
-
canbus | Name of the CAN bus. Possible CAN bus strings are:
- "rio" for the native roboRIO CAN bus
- CANivore name or serial number
- SocketCAN interface (non-FRC Linux only)
- "*" for any CANivore seen by the program
- empty string (default) to select the default for the system:
- "rio" on roboRIO
- "can0" on Linux
- "*" on Windows
|
◆ CANBus() [2/2]
ctre::phoenix6::CANBus::CANBus |
( |
std::string_view | canbus, |
|
|
char const * | hootFilepath ) |
|
inline |
Creates a new CAN bus with the given name, and loads an associated hoot file for replay (equivalent to HootReplay::LoadFile).
Only one hoot log may be replayed at a time. As a result, only one CAN bus should be constructed with a hoot file.
When using relative paths, the file path is typically relative to the top-level folder of the robot project.
- Parameters
-
canbus | Name of the CAN bus. Possible CAN bus strings are:
- "rio" for the native roboRIO CAN bus
- CANivore name or serial number
- SocketCAN interface (non-FRC Linux only)
- "*" for any CANivore seen by the program
- empty string (default) to select the default for the system:
- "rio" on roboRIO
- "can0" on Linux
- "*" on Windows
|
hootFilepath | Path and name of the hoot file to load |
◆ GetName()
constexpr std::string_view ctre::phoenix6::CANBus::GetName |
( |
| ) |
const |
|
inlineconstexpr |
Get the name used to construct this CAN bus.
- Returns
- Name of the CAN bus
◆ GetStatus() [1/2]
Gets the status of the CAN bus, including the bus utilization and the error counters.
This can block for up to 0.001 seconds (1 ms).
- Returns
- Status of the CAN bus
◆ GetStatus() [2/2]
static CANBusStatus ctre::phoenix6::CANBus::GetStatus |
( |
std::string const & | canbus | ) |
|
|
inlinestatic |
Gets the status of the CAN bus, including the bus utilization and the error counters.
- Deprecated
- The CANBus static methods are deprecated for removal in 2026. Construct a new CANBus instance and call GetStatus() instead.
- Parameters
-
canbus | Name of the CAN bus |
- Returns
- Status of the CAN bus
◆ IsNetworkFD() [1/2]
bool ctre::phoenix6::CANBus::IsNetworkFD |
( |
| ) |
const |
Gets whether the CAN bus is a CAN FD network.
- Returns
- True if the CAN bus is CAN FD
◆ IsNetworkFD() [2/2]
static bool ctre::phoenix6::CANBus::IsNetworkFD |
( |
std::string const & | canbus | ) |
|
|
inlinestatic |
Gets whether the CAN bus is a CAN FD network.
- Deprecated
- The CANBus static methods are deprecated for removal in 2026. Construct a new CANBus instance and call IsNetworkFD() instead.
- Parameters
-
canbus | Name of the CAN bus |
- Returns
- True if the CAN bus is CAN FD
The documentation for this class was generated from the following file: