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 constexpr CANBus | RoboRIO () |
| | Creates a new CAN bus for the native roboRIO bus.
|
| |
| static CANBus | RoboRIO (char const *hootFilepath) |
| | Creates a new CAN bus for the native roboRIO bus, and loads an associated hoot file for replay (equivalent to HootReplay::LoadFile).
|
| |
Class for getting information about an available CAN bus.
◆ CANBus() [1/2]
| ctre::phoenix6::CANBus::CANBus |
( |
std::string_view | canbus = "" | ) |
|
|
inlineconstexpr |
Creates a new CAN bus with the given name.
For the native roboRIO CAN bus, use RoboRIO instead.
- 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.
For the native roboRIO CAN bus, use RoboRIO instead.
- 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()
| 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()
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
◆ IsNetworkFD()
| 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
◆ RoboRIO() [1/2]
| static constexpr CANBus ctre::phoenix6::CANBus::RoboRIO |
( |
| ) |
|
|
inlinestaticconstexpr |
Creates a new CAN bus for the native roboRIO bus.
- Returns
- The native roboRIO CAN bus
◆ RoboRIO() [2/2]
| static CANBus ctre::phoenix6::CANBus::RoboRIO |
( |
char const * | hootFilepath | ) |
|
|
inlinestatic |
Creates a new CAN bus for the native roboRIO bus, 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
-
| hootFilepath | Path and name of the hoot file to load |
- Returns
- The native roboRIO CAN bus
◆ operator<<
| std::ostream & operator<< |
( |
std::ostream & | os, |
|
|
CANBus const & | canbus ) |
|
friend |
The documentation for this class was generated from the following file: