Table of Contents

Struct CANBus

Namespace
CTRE.Phoenix6
Assembly
Phoenix6.Hardware.dll

Class for getting information about an available CAN bus.

public readonly struct CANBus
Inherited Members

Constructors

CANBus()

Creates a new CAN bus using the default for the system:

  • "can0" on Linux
  • "*" on Windows
public CANBus()

CANBus(string)

Creates a new CAN bus with the given name.

public CANBus(string canbus)

Parameters

canbus string

Name of the CAN bus. Possible CAN bus strings are:

  • 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:
    • "can0" on Linux
    • "" on Windows

CANBus(string, string)

Creates a new CAN bus with the given name, and loads an associated hoot file for replay (equivalent to LoadFile(string)).

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.
public CANBus(string canbus, string hootFilepath)

Parameters

canbus string

Name of the CAN bus. Possible CAN bus strings are:

  • 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:
    • "can0" on Linux
    • "" on Windows
hootFilepath string

Path and name of the hoot file to load

Properties

Name

The name used to construct this CAN bus.

public string Name { get; }

Property Value

string

Methods

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).
public CANBus.CANBusStatus GetStatus()

Returns

CANBus.CANBusStatus

Status of the CAN bus

IsNetworkFD()

Gets whether the network is CAN FD.

public bool IsNetworkFD()

Returns

bool

True if the network is CAN FD

ToString()

Provides the string representation of this object.

public override string ToString()

Returns

string