Table of Contents

Class CoreCANrange

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

Class for CANrange, a CAN based Time of Flight (ToF) sensor that measures the distance to the front of the device.

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

Constructors

CoreCANrange(int)

Constructs a new CANrange object.

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

Parameters

deviceId int

ID of the device, as configured in Phoenix Tuner

CoreCANrange(int, CANBus)

Constructs a new CANrange object.

public CoreCANrange(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

CoreCANrange(int, string)

Constructs a new CANrange 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 CoreCANrange(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 CANrangeConfiguration object

public CANrangeConfigurator Configurator { get; }

Property Value

CANrangeConfigurator

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 CANrangeSimState SimState { get; }

Property Value

CANrangeSimState

Methods

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

GetAmbientSignal(bool)

The amount of ambient infrared light that the sensor is detecting. For ideal operation, this should be as low as possible.

Short-range mode reduces the influence of ambient infrared light.
  • Minimum Value0
  • Maximum Value65535
  • Default Value0
  • Units

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> GetAmbientSignal(bool refresh = true)

Parameters

refresh bool

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

Returns

StatusSignal<double>

AmbientSignal Status Signal Object

GetDistance(bool)

Distance to the nearest object in the configured field of view of the CANrange.

  • Minimum Value0.0
  • Maximum Value65.535
  • Default Value0
  • Unitsm

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> GetDistance(bool refresh = true)

Parameters

refresh bool

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

Returns

StatusSignal<double>

Distance Status Signal Object

GetDistanceStdDev(bool)

Standard Deviation of the distance measurement.

  • Minimum Value0.0
  • Maximum Value1.3107000000000002
  • Default Value0
  • Unitsm

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> GetDistanceStdDev(bool refresh = true)

Parameters

refresh bool

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

Returns

StatusSignal<double>

DistanceStdDev Status Signal Object

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_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

GetIsDetected(bool)

Whether the CANrange detects an object using the configured proximity parameters.

  • 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> GetIsDetected(bool refresh = true)

Parameters

refresh bool

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

Returns

StatusSignal<bool>

IsDetected 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

GetMeasurementHealth(bool)

Health of the distance measurement.

Default Rates:

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

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

Parameters

refresh bool

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

Returns

StatusSignal<MeasurementHealthValue>

MeasurementHealth Status Signal Object

GetMeasurementTime(bool)

Timestamp of the most recent measurements. This is not synchronized to any other clock source.

Users can use this to check when the measurements are updated.
  • Minimum Value0.0
  • Maximum Value65.535
  • Default Value0
  • Unitss

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> GetMeasurementTime(bool refresh = true)

Parameters

refresh bool

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

Returns

StatusSignal<double>

MeasurementTime Status Signal Object

GetRealFOVCenterX(bool)

The actual center of the FOV in the X direction. This takes into account the user-configured FOVCenterX and FOVRangeX.

  • Minimum Value-16.0
  • Maximum Value15.875
  • Default Value0
  • Unitsdeg

Default Rates:

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

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

Parameters

refresh bool

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

Returns

StatusSignal<double>

RealFOVCenterX Status Signal Object

GetRealFOVCenterY(bool)

The actual center of the FOV in the Y direction. This takes into account the user-configured FOVCenterY and FOVRangeY.

  • Minimum Value-16.0
  • Maximum Value15.875
  • Default Value0
  • Unitsdeg

Default Rates:

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

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

Parameters

refresh bool

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

Returns

StatusSignal<double>

RealFOVCenterY Status Signal Object

GetRealFOVRangeX(bool)

The actual range of the FOV in the X direction. This takes into account the user-configured FOVRangeX.

  • Minimum Value0.0
  • Maximum Value31.875
  • Default Value0
  • Unitsdeg

Default Rates:

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

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

Parameters

refresh bool

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

Returns

StatusSignal<double>

RealFOVRangeX Status Signal Object

GetRealFOVRangeY(bool)

The actual range of the FOV in the Y direction. This takes into account the user-configured FOVRangeY.

  • Minimum Value0.0
  • Maximum Value31.875
  • Default Value0
  • Unitsdeg

Default Rates:

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

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

Parameters

refresh bool

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

Returns

StatusSignal<double>

RealFOVRangeY Status Signal Object

GetSignalStrength(bool)

Approximate signal strength of the measurement. A higher value indicates a higher strength of signal.

A value of ~2500 is typical when detecting an object under short-range conditions.
  • Minimum Value0
  • Maximum Value65535
  • Default Value0
  • Units

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> GetSignalStrength(bool refresh = true)

Parameters

refresh bool

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

Returns

StatusSignal<double>

SignalStrength 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_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 CANrange.

  • Minimum Value4
  • Maximum Value16.75
  • Default Value4
  • 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