53 std::string_view _name;
73 constexpr CANBus(std::string_view canbus =
"") :
102 CANBus(std::string_view canbus,
char const *hootFilepath) :
118 if (canbus < 0 || canbus > 4) [[unlikely]] {
119 throw std::invalid_argument{
"Systemcore CAN bus index must be within 0-4."};
122 case 0:
return {
"can_s0"};
123 case 1:
return {
"can_s1"};
124 case 2:
return {
"can_s2"};
125 case 3:
return {
"can_s3"};
126 case 4:
return {
"can_s4"};
163 if (port < 0 || port > 19) [[unlikely]] {
164 throw std::invalid_argument{
"Motioncore port must be within 0-19."};
167 case 0:
return {
"can_s5"};
168 case 1:
return {
"can_s6"};
169 case 2:
return {
"can_s7"};
170 case 3:
return {
"can_s8"};
171 case 4:
return {
"can_s9"};
172 case 5:
return {
"can_s10"};
173 case 6:
return {
"can_s11"};
174 case 7:
return {
"can_s12"};
175 case 8:
return {
"can_s13"};
176 case 9:
return {
"can_s14"};
177 case 10:
return {
"can_s15"};
178 case 11:
return {
"can_s16"};
179 case 12:
return {
"can_s17"};
180 case 13:
return {
"can_s18"};
181 case 14:
return {
"can_s19"};
182 case 15:
return {
"can_s20"};
183 case 16:
return {
"can_s21"};
184 case 17:
return {
"can_s22"};
185 case 18:
return {
"can_s23"};
186 case 19:
return {
"can_s24"};
249struct std::hash<
ctre::phoenix6::CANBus> {
252 return std::hash<std::string_view>{}(canbus.GetName());
Class for getting information about an available CAN bus.
Definition CANBus.hpp:19
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 t...
Definition CANBus.hpp:102
CANBusStatus GetStatus() const
Gets the status of the CAN bus, including the bus utilization and the error counters.
static constexpr CANBus Motioncore(int port)
Creates a new CAN bus for one of the Motioncore ports.
Definition CANBus.hpp:161
static constexpr CANBus Systemcore(int canbus)
Creates a new CAN bus for one of the native Systemcore buses.
Definition CANBus.hpp:116
constexpr friend bool operator==(CANBus const &, CANBus const &)=default
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 r...
Definition CANBus.hpp:148
constexpr CANBus(std::string_view canbus="")
Creates a new CAN bus with the given name.
Definition CANBus.hpp:73
friend std::ostream & operator<<(std::ostream &os, CANBus const &canbus)
constexpr friend auto operator<=>(CANBus const &, CANBus const &)=default
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 (...
Definition CANBus.hpp:206
bool IsNetworkFD() const
Gets whether the CAN bus is a CAN FD network.
constexpr std::string_view GetName() const
Get the name used to construct this CAN bus.
Definition CANBus.hpp:218
static ctre::phoenix::StatusCode LoadFile(char const *filepath)
Loads the given file and starts signal log replay.
Status codes reported by APIs, including OK, warnings, and errors.
Definition StatusCodes.h:28
Definition ExternalFeedbackConfigs.hpp:16
Definition motor_constants.h:14
Contains status information about a CAN bus.
Definition CANBus.hpp:24
uint32_t TxFullCount
Transmit buffer full count.
Definition CANBus.hpp:41
ctre::phoenix::StatusCode Status
Status code response of getting the data.
Definition CANBus.hpp:28
float BusUtilization
CAN bus utilization, from 0.0 to 1.0.
Definition CANBus.hpp:33
uint32_t BusOffCount
Bus off count.
Definition CANBus.hpp:37
uint32_t REC
Receive Error Counter (REC).
Definition CANBus.hpp:45
uint32_t TEC
Transmit Error Counter (TEC).
Definition CANBus.hpp:49
size_t operator()(ctre::phoenix6::CANBus const &canbus) const noexcept
Definition CANBus.hpp:250