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 | Systemcore (int canbus) |
| | Creates a new CAN bus for one of the native Systemcore buses.
|
| static CANBus | Systemcore (int canbus, char const *hootFilepath) |
| | Creates a new CAN bus for one of the native Systemcore buses, and loads an associated hoot file for replay (equivalent to HootReplay::LoadFile).
|
| static constexpr CANBus | Motioncore (int port) |
| | Creates a new CAN bus for one of the Motioncore ports.
|
| static CANBus | Motioncore (int port, char const *hootFilepath) |
| | Creates a new CAN bus for one of the Motioncore ports, 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 Systemcore CAN buses, use Systemcore instead.
For the Motioncore CAN buses, use Motioncore instead.
- Parameters
-
| canbus | Name of the CAN bus. Possible CAN bus strings are:
- "can_s0" to "can_s24" for the native Systemcore/Motioncore CAN buses
- 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:
- "can_s1" on Systemcore
- "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 Systemcore CAN buses, use Systemcore instead.
For the Motioncore CAN buses, use Motioncore instead.
- Parameters
-
| canbus | Name of the CAN bus. Possible CAN bus strings are:
- "can_s0" to "can_s24" for the native Systemcore/Motioncore CAN buses
- 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:
- "can_s1" on Systemcore
- "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
◆ Motioncore() [1/2]
| constexpr CANBus ctre::phoenix6::CANBus::Motioncore |
( |
int | port | ) |
|
|
inlinestaticconstexpr |
Creates a new CAN bus for one of the Motioncore ports.
- Parameters
-
| port | The Motioncore port, from 0-19 |
- Returns
- A Motioncore CAN bus
◆ Motioncore() [2/2]
| CANBus ctre::phoenix6::CANBus::Motioncore |
( |
int | port, |
|
|
char const * | hootFilepath ) |
|
inlinestatic |
Creates a new CAN bus for one of the Motioncore ports, 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
-
| port | The Motioncore port, from 0-19 |
| hootFilepath | Path and name of the hoot file to load |
- Returns
- A Motioncore CAN bus
◆ Systemcore() [1/2]
| constexpr CANBus ctre::phoenix6::CANBus::Systemcore |
( |
int | canbus | ) |
|
|
inlinestaticconstexpr |
Creates a new CAN bus for one of the native Systemcore buses.
For the Motioncore CAN buses, use Motioncore instead.
- Parameters
-
| canbus | Index of the Systemcore bus, from 0-4 |
- Returns
- A native Systemcore CAN bus
◆ Systemcore() [2/2]
| CANBus ctre::phoenix6::CANBus::Systemcore |
( |
int | canbus, |
|
|
char const * | hootFilepath ) |
|
inlinestatic |
Creates a new CAN bus for one of the native Systemcore buses, 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 Motioncore CAN buses, use Motioncore instead.
- Parameters
-
| canbus | Index of the Systemcore bus, from 0-4 |
| hootFilepath | Path and name of the hoot file to load |
- Returns
- A native Systemcore CAN bus
◆ operator<<
| std::ostream & operator<< |
( |
std::ostream & | os, |
|
|
CANBus const & | canbus ) |
|
friend |
◆ operator<=>
◆ operator==
The documentation for this class was generated from the following file: