Table of Contents

Class CoreCANdi

Namespace
CTRE.Phoenix6.Hardware.Core
Assembly
Phoenix6.Hardware.dll

Class for CTR Electronics' CANdi™ branded device, a device that integrates digital signals into the existing CAN bus network.

public class CoreCANdi : ParentDevice, CommonDevice
Inheritance
CoreCANdi
Implements
Derived
Inherited Members

Constructors

CoreCANdi(int)

Constructs a new CANdi object.

Constructs the device using the default CAN bus for the system (see CANBus(string)).
public CoreCANdi(int deviceId)

Parameters

deviceId int

ID of the device, as configured in Phoenix Tuner

CoreCANdi(int, CANBus)

Constructs a new CANdi object.

public CoreCANdi(int deviceId, CANBus canbus)

Parameters

deviceId int

ID of the device, as configured in Phoenix Tuner

canbus CANBus

The CAN bus this device is on

CoreCANdi(int, string)

Constructs a new CANdi object.

[Obsolete("Constructing devices with a CAN bus string is deprecated for removal in the 2027 season. Construct devices using a CANBus instance instead.")]
public CoreCANdi(int deviceId, string canbus)

Parameters

deviceId int

ID of the device, as configured in Phoenix Tuner

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

Properties

Configurator

The configurator for this device. Users may use this to refresh and apply configs, such as the CANdiConfiguration object

public CANdiConfigurator Configurator { get; }

Property Value

CANdiConfigurator

SimState

Gets the simulation state for this device.

This function reuses an allocated simulation state object, so it is safe to call this function multiple times in a robot loop.
public CANdiSimState SimState { get; }

Property Value

CANdiSimState

Methods

ClearStickyFault_5V(double)

Clear sticky fault: The CTR Electronics' CANdi™ branded device has detected a 5V fault. This may be due to overcurrent or a short-circuit.

public StatusCode ClearStickyFault_5V(double timeoutSeconds = 0.1)

Parameters

timeoutSeconds double

Maximum time to wait up to in seconds.

Returns

StatusCode

StatusCode of the set command

ClearStickyFault_BootDuringEnable(double)

Clear sticky fault: Device boot while detecting the enable signal

public StatusCode ClearStickyFault_BootDuringEnable(double timeoutSeconds = 0.1)

Parameters

timeoutSeconds double

Maximum time to wait up to in seconds.

Returns

StatusCode

StatusCode of the set command

ClearStickyFault_Hardware(double)

Clear sticky fault: Hardware fault occurred

public StatusCode ClearStickyFault_Hardware(double timeoutSeconds = 0.1)

Parameters

timeoutSeconds double

Maximum time to wait up to in seconds.

Returns

StatusCode

StatusCode of the set command

ClearStickyFault_Undervoltage(double)

Clear sticky fault: Device supply voltage dropped to near brownout levels

public StatusCode ClearStickyFault_Undervoltage(double timeoutSeconds = 0.1)

Parameters

timeoutSeconds double

Maximum time to wait up to in seconds.

Returns

StatusCode

StatusCode of the set command

ClearStickyFault_UnlicensedFeatureInUse(double)

Clear sticky fault: An unlicensed feature is in use, device may not behave as expected.

public StatusCode ClearStickyFault_UnlicensedFeatureInUse(double timeoutSeconds = 0.1)

Parameters

timeoutSeconds double

Maximum time to wait up to in seconds.

Returns

StatusCode

StatusCode of the set command

ClearStickyFaults(double)

Clear the sticky faults in the device.

This typically has no impact on the device functionality. Instead, it just clears telemetry faults that are accessible via API and Tuner Self-Test.
public StatusCode ClearStickyFaults(double timeoutSeconds = 0.1)

Parameters

timeoutSeconds double

Maximum time to wait up to in seconds.

Returns

StatusCode

StatusCode of the set command

GetFaultField(bool)

Integer representing all fault flags reported by the device.

These are device specific and are not used directly in typical applications. Use the signal specific GetFault_*() methods instead.
  • Minimum Value0
  • Maximum Value4294967295
  • Default Value0
  • Units

Default Rates:

  • CAN4.0 Hz

This refreshes and returns a cached StatusSignal object.
public StatusSignal<int> GetFaultField(bool refresh = true)

Parameters

refresh bool

Whether to refresh the StatusSignal before returning it; defaults to true

Returns

StatusSignal<int>

FaultField Status Signal Object

GetFault_5V(bool)

The CTR Electronics' CANdi™ branded device has detected a 5V fault. This may be due to overcurrent or a short-circuit.

  • Default ValueFalse

Default Rates:

  • CAN4.0 Hz

This refreshes and returns a cached StatusSignal object.
public StatusSignal<bool> GetFault_5V(bool refresh = true)

Parameters

refresh bool

Whether to refresh the StatusSignal before returning it; defaults to true

Returns

StatusSignal<bool>

Fault_5V Status Signal Object

GetFault_BootDuringEnable(bool)

Device boot while detecting the enable signal

  • Default ValueFalse

Default Rates:

  • CAN4.0 Hz

This refreshes and returns a cached StatusSignal object.
public StatusSignal<bool> GetFault_BootDuringEnable(bool refresh = true)

Parameters

refresh bool

Whether to refresh the StatusSignal before returning it; defaults to true

Returns

StatusSignal<bool>

Fault_BootDuringEnable Status Signal Object

GetFault_Hardware(bool)

Hardware fault occurred

  • Default ValueFalse

Default Rates:

  • CAN4.0 Hz

This refreshes and returns a cached StatusSignal object.
public StatusSignal<bool> GetFault_Hardware(bool refresh = true)

Parameters

refresh bool

Whether to refresh the StatusSignal before returning it; defaults to true

Returns

StatusSignal<bool>

Fault_Hardware Status Signal Object

GetFault_Undervoltage(bool)

Device supply voltage dropped to near brownout levels

  • Default ValueFalse

Default Rates:

  • CAN4.0 Hz

This refreshes and returns a cached StatusSignal object.
public StatusSignal<bool> GetFault_Undervoltage(bool refresh = true)

Parameters

refresh bool

Whether to refresh the StatusSignal before returning it; defaults to true

Returns

StatusSignal<bool>

Fault_Undervoltage Status Signal Object

GetFault_UnlicensedFeatureInUse(bool)

An unlicensed feature is in use, device may not behave as expected.

  • Default ValueFalse

Default Rates:

  • CAN4.0 Hz

This refreshes and returns a cached StatusSignal object.
public StatusSignal<bool> GetFault_UnlicensedFeatureInUse(bool refresh = true)

Parameters

refresh bool

Whether to refresh the StatusSignal before returning it; defaults to true

Returns

StatusSignal<bool>

Fault_UnlicensedFeatureInUse Status Signal Object

GetIsProLicensed(bool)

Whether the device is Phoenix Pro licensed.

  • Default ValueFalse

Default Rates:

  • CAN4.0 Hz

This refreshes and returns a cached StatusSignal object.
public StatusSignal<bool> GetIsProLicensed(bool refresh = true)

Parameters

refresh bool

Whether to refresh the StatusSignal before returning it; defaults to true

Returns

StatusSignal<bool>

IsProLicensed Status Signal Object

GetOutputCurrent(bool)

Measured output current. This includes both Vbat and 5V output current.

  • Minimum Value0.0
  • Maximum Value0.51
  • Default Value0
  • UnitsA

Default Rates:

  • CAN 2.0100.0 Hz
  • CAN FD100.0 Hz (TimeSynced with Pro)

This refreshes and returns a cached StatusSignal object.
public StatusSignal<double> GetOutputCurrent(bool refresh = true)

Parameters

refresh bool

Whether to refresh the StatusSignal before returning it; defaults to true

Returns

StatusSignal<double>

OutputCurrent Status Signal Object

GetOvercurrent(bool)

True when the CANdi™ is in overcurrent protection mode. This may be due to either overcurrent or a short-circuit.

  • Default Value0

Default Rates:

  • CAN 2.0100.0 Hz
  • CAN FD100.0 Hz (TimeSynced with Pro)

This refreshes and returns a cached StatusSignal object.
public StatusSignal<bool> GetOvercurrent(bool refresh = true)

Parameters

refresh bool

Whether to refresh the StatusSignal before returning it; defaults to true

Returns

StatusSignal<bool>

Overcurrent Status Signal Object

GetPWM1Position(bool)

Measured position of the PWM sensor at the S1 input of the CTR Electronics' CANdi™.

  • Minimum Value-16384.0
  • Maximum Value16383.999755859375
  • Default Value0
  • Unitsrotations

Default Rates:

  • CAN 2.020.0 Hz
  • CAN FD100.0 Hz (TimeSynced with Pro)

This refreshes and returns a cached StatusSignal object.
public StatusSignal<double> GetPWM1Position(bool refresh = true)

Parameters

refresh bool

Whether to refresh the StatusSignal before returning it; defaults to true

Returns

StatusSignal<double>

PWM1Position Status Signal Object

GetPWM1RiseToRise(bool)

Measured rise to rise time of the PWM signal at the S1 input of the CTR Electronics' CANdi™.

  • Minimum Value0
  • Maximum Value131070
  • Default Value0
  • Unitsus

Default Rates:

  • CAN 2.020.0 Hz
  • CAN FD100.0 Hz (TimeSynced with Pro)

This refreshes and returns a cached StatusSignal object.
public StatusSignal<double> GetPWM1RiseToRise(bool refresh = true)

Parameters

refresh bool

Whether to refresh the StatusSignal before returning it; defaults to true

Returns

StatusSignal<double>

PWM1RiseToRise Status Signal Object

GetPWM1Velocity(bool)

Measured velocity of the PWM sensor at the S1 input of the CTR Electronics' CANdi™.

  • Minimum Value-512.0
  • Maximum Value511.998046875
  • Default Value0
  • Unitsrotations per second

Default Rates:

  • CAN 2.020.0 Hz
  • CAN FD100.0 Hz (TimeSynced with Pro)

This refreshes and returns a cached StatusSignal object.
public StatusSignal<double> GetPWM1Velocity(bool refresh = true)

Parameters

refresh bool

Whether to refresh the StatusSignal before returning it; defaults to true

Returns

StatusSignal<double>

PWM1Velocity Status Signal Object

GetPWM2Position(bool)

Measured position of the PWM sensor at the S2 input of the CTR Electronics' CANdi™.

  • Minimum Value-16384.0
  • Maximum Value16383.999755859375
  • Default Value0
  • Unitsrotations

Default Rates:

  • CAN 2.020.0 Hz
  • CAN FD100.0 Hz (TimeSynced with Pro)

This refreshes and returns a cached StatusSignal object.
public StatusSignal<double> GetPWM2Position(bool refresh = true)

Parameters

refresh bool

Whether to refresh the StatusSignal before returning it; defaults to true

Returns

StatusSignal<double>

PWM2Position Status Signal Object

GetPWM2RiseToRise(bool)

Measured rise to rise time of the PWM signal at the S2 input of the CTR Electronics' CANdi™.

  • Minimum Value0
  • Maximum Value131070
  • Default Value0
  • Unitsus

Default Rates:

  • CAN 2.020.0 Hz
  • CAN FD100.0 Hz (TimeSynced with Pro)

This refreshes and returns a cached StatusSignal object.
public StatusSignal<double> GetPWM2RiseToRise(bool refresh = true)

Parameters

refresh bool

Whether to refresh the StatusSignal before returning it; defaults to true

Returns

StatusSignal<double>

PWM2RiseToRise Status Signal Object

GetPWM2Velocity(bool)

Measured velocity of the PWM sensor at the S2 input of the CTR Electronics' CANdi™.

  • Minimum Value-512.0
  • Maximum Value511.998046875
  • Default Value0
  • Unitsrotations per second

Default Rates:

  • CAN 2.020.0 Hz
  • CAN FD100.0 Hz (TimeSynced with Pro)

This refreshes and returns a cached StatusSignal object.
public StatusSignal<double> GetPWM2Velocity(bool refresh = true)

Parameters

refresh bool

Whether to refresh the StatusSignal before returning it; defaults to true

Returns

StatusSignal<double>

PWM2Velocity Status Signal Object

GetQuadraturePosition(bool)

Position from a quadrature encoder sensor connected to both the S1IN and S2IN inputs.

  • Minimum Value-16384.0
  • Maximum Value16383.999755859375
  • Default Value0
  • Unitsrotations

Default Rates:

  • CAN 2.020.0 Hz
  • CAN FD100.0 Hz (TimeSynced with Pro)

This refreshes and returns a cached StatusSignal object.
public StatusSignal<double> GetQuadraturePosition(bool refresh = true)

Parameters

refresh bool

Whether to refresh the StatusSignal before returning it; defaults to true

Returns

StatusSignal<double>

QuadraturePosition Status Signal Object

GetQuadratureVelocity(bool)

Velocity from a quadrature encoder sensor connected to both the S1IN and S2IN inputs.

  • Minimum Value-512.0
  • Maximum Value511.998046875
  • Default Value0
  • Unitsrotations per second

Default Rates:

  • CAN 2.020.0 Hz
  • CAN FD100.0 Hz (TimeSynced with Pro)

This refreshes and returns a cached StatusSignal object.
public StatusSignal<double> GetQuadratureVelocity(bool refresh = true)

Parameters

refresh bool

Whether to refresh the StatusSignal before returning it; defaults to true

Returns

StatusSignal<double>

QuadratureVelocity Status Signal Object

GetS1Closed(bool)

True if the Signal 1 input (S1IN) matches the configured S1 Closed State.

Configure the S1 closed state in the Digitals configuration object to change when this is asserted.
  • Default ValueFalse

Default Rates:

  • CAN 2.0100.0 Hz
  • CAN FD100.0 Hz (TimeSynced with Pro)

This refreshes and returns a cached StatusSignal object.
public StatusSignal<bool> GetS1Closed(bool refresh = true)

Parameters

refresh bool

Whether to refresh the StatusSignal before returning it; defaults to true

Returns

StatusSignal<bool>

S1Closed Status Signal Object

GetS1State(bool)

State of the Signal 1 input (S1IN).

Default Rates:

  • CAN 2.0100.0 Hz
  • CAN FD100.0 Hz (TimeSynced with Pro)

This refreshes and returns a cached StatusSignal object.
public StatusSignal<S1StateValue> GetS1State(bool refresh = true)

Parameters

refresh bool

Whether to refresh the StatusSignal before returning it; defaults to true

Returns

StatusSignal<S1StateValue>

S1State Status Signal Object

GetS2Closed(bool)

True if the Signal 2 input (S2IN) matches the configured S2 Closed State.

Configure the S2 closed state in the Digitals configuration object to change when this is asserted.
  • Default ValueFalse

Default Rates:

  • CAN 2.0100.0 Hz
  • CAN FD100.0 Hz (TimeSynced with Pro)

This refreshes and returns a cached StatusSignal object.
public StatusSignal<bool> GetS2Closed(bool refresh = true)

Parameters

refresh bool

Whether to refresh the StatusSignal before returning it; defaults to true

Returns

StatusSignal<bool>

S2Closed Status Signal Object

GetS2State(bool)

State of the Signal 2 input (S2IN).

Default Rates:

  • CAN 2.0100.0 Hz
  • CAN FD100.0 Hz (TimeSynced with Pro)

This refreshes and returns a cached StatusSignal object.
public StatusSignal<S2StateValue> GetS2State(bool refresh = true)

Parameters

refresh bool

Whether to refresh the StatusSignal before returning it; defaults to true

Returns

StatusSignal<S2StateValue>

S2State Status Signal Object

GetStickyFaultField(bool)

Integer representing all (persistent) sticky fault flags reported by the device.

These are device specific and are not used directly in typical applications. Use the signal specific GetStickyFault_*() methods instead.
  • Minimum Value0
  • Maximum Value4294967295
  • Default Value0
  • Units

Default Rates:

  • CAN4.0 Hz

This refreshes and returns a cached StatusSignal object.
public StatusSignal<int> GetStickyFaultField(bool refresh = true)

Parameters

refresh bool

Whether to refresh the StatusSignal before returning it; defaults to true

Returns

StatusSignal<int>

StickyFaultField Status Signal Object

GetStickyFault_5V(bool)

The CTR Electronics' CANdi™ branded device has detected a 5V fault. This may be due to overcurrent or a short-circuit.

  • Default ValueFalse

Default Rates:

  • CAN4.0 Hz

This refreshes and returns a cached StatusSignal object.
public StatusSignal<bool> GetStickyFault_5V(bool refresh = true)

Parameters

refresh bool

Whether to refresh the StatusSignal before returning it; defaults to true

Returns

StatusSignal<bool>

StickyFault_5V Status Signal Object

GetStickyFault_BootDuringEnable(bool)

Device boot while detecting the enable signal

  • Default ValueFalse

Default Rates:

  • CAN4.0 Hz

This refreshes and returns a cached StatusSignal object.
public StatusSignal<bool> GetStickyFault_BootDuringEnable(bool refresh = true)

Parameters

refresh bool

Whether to refresh the StatusSignal before returning it; defaults to true

Returns

StatusSignal<bool>

StickyFault_BootDuringEnable Status Signal Object

GetStickyFault_Hardware(bool)

Hardware fault occurred

  • Default ValueFalse

Default Rates:

  • CAN4.0 Hz

This refreshes and returns a cached StatusSignal object.
public StatusSignal<bool> GetStickyFault_Hardware(bool refresh = true)

Parameters

refresh bool

Whether to refresh the StatusSignal before returning it; defaults to true

Returns

StatusSignal<bool>

StickyFault_Hardware Status Signal Object

GetStickyFault_Undervoltage(bool)

Device supply voltage dropped to near brownout levels

  • Default ValueFalse

Default Rates:

  • CAN4.0 Hz

This refreshes and returns a cached StatusSignal object.
public StatusSignal<bool> GetStickyFault_Undervoltage(bool refresh = true)

Parameters

refresh bool

Whether to refresh the StatusSignal before returning it; defaults to true

Returns

StatusSignal<bool>

StickyFault_Undervoltage Status Signal Object

GetStickyFault_UnlicensedFeatureInUse(bool)

An unlicensed feature is in use, device may not behave as expected.

  • Default ValueFalse

Default Rates:

  • CAN4.0 Hz

This refreshes and returns a cached StatusSignal object.
public StatusSignal<bool> GetStickyFault_UnlicensedFeatureInUse(bool refresh = true)

Parameters

refresh bool

Whether to refresh the StatusSignal before returning it; defaults to true

Returns

StatusSignal<bool>

StickyFault_UnlicensedFeatureInUse Status Signal Object

GetSupplyVoltage(bool)

Measured supply voltage to the CANdi™.

  • Minimum Value4.0
  • Maximum Value29.5
  • Default Value0
  • UnitsV

Default Rates:

  • CAN 2.0100.0 Hz
  • CAN FD100.0 Hz (TimeSynced with Pro)

This refreshes and returns a cached StatusSignal object.
public StatusSignal<double> GetSupplyVoltage(bool refresh = true)

Parameters

refresh bool

Whether to refresh the StatusSignal before returning it; defaults to true

Returns

StatusSignal<double>

SupplyVoltage Status Signal Object

GetVersion(bool)

Full Version of firmware in device. The format is a four byte value.

  • Minimum Value0
  • Maximum Value4294967295
  • Default Value0
  • Units

Default Rates:

  • CAN4.0 Hz

This refreshes and returns a cached StatusSignal object.
public StatusSignal<int> GetVersion(bool refresh = true)

Parameters

refresh bool

Whether to refresh the StatusSignal before returning it; defaults to true

Returns

StatusSignal<int>

Version Status Signal Object

GetVersionBugfix(bool)

App Bugfix Version number.

  • Minimum Value0
  • Maximum Value255
  • Default Value0
  • Units

Default Rates:

  • CAN4.0 Hz

This refreshes and returns a cached StatusSignal object.
public StatusSignal<int> GetVersionBugfix(bool refresh = true)

Parameters

refresh bool

Whether to refresh the StatusSignal before returning it; defaults to true

Returns

StatusSignal<int>

VersionBugfix Status Signal Object

GetVersionBuild(bool)

App Build Version number.

  • Minimum Value0
  • Maximum Value255
  • Default Value0
  • Units

Default Rates:

  • CAN4.0 Hz

This refreshes and returns a cached StatusSignal object.
public StatusSignal<int> GetVersionBuild(bool refresh = true)

Parameters

refresh bool

Whether to refresh the StatusSignal before returning it; defaults to true

Returns

StatusSignal<int>

VersionBuild Status Signal Object

GetVersionMajor(bool)

App Major Version number.

  • Minimum Value0
  • Maximum Value255
  • Default Value0
  • Units

Default Rates:

  • CAN4.0 Hz

This refreshes and returns a cached StatusSignal object.
public StatusSignal<int> GetVersionMajor(bool refresh = true)

Parameters

refresh bool

Whether to refresh the StatusSignal before returning it; defaults to true

Returns

StatusSignal<int>

VersionMajor Status Signal Object

GetVersionMinor(bool)

App Minor Version number.

  • Minimum Value0
  • Maximum Value255
  • Default Value0
  • Units

Default Rates:

  • CAN4.0 Hz

This refreshes and returns a cached StatusSignal object.
public StatusSignal<int> GetVersionMinor(bool refresh = true)

Parameters

refresh bool

Whether to refresh the StatusSignal before returning it; defaults to true

Returns

StatusSignal<int>

VersionMinor Status Signal Object

SetControl(ControlRequest)

Control device with generic control request object.

User must make sure the specified object is castable to a valid control request, otherwise this function will fail at run-time and return the NotSupported StatusCode
public StatusCode SetControl(ControlRequest request)

Parameters

request ControlRequest

Control object to request of the device

Returns

StatusCode

Status Code of the request, 0 is OK

SetQuadraturePosition(double, double)

Sets the position of the quadrature input.

public StatusCode SetQuadraturePosition(double newValue, double timeoutSeconds = 0.1)

Parameters

newValue double

Value to set to. Units are in rotations.

timeoutSeconds double

Maximum time to wait up to in seconds.

Returns

StatusCode

StatusCode of the set command