Table of Contents

Class CANcoderConfiguration

Namespace
CTRE.Phoenix6.Configs
Assembly
Phoenix6.Hardware.dll

Class for CANcoder, a CAN based magnetic encoder that provides absolute and relative position along with filtered velocity.

This defines all configurations for the CANcoder.
public class CANcoderConfiguration : IParentConfiguration, ISerializable, ICloneable
Inheritance
CANcoderConfiguration
Implements
Inherited Members

Fields

CustomParams

Custom Params.

Custom paramaters that have no real impact on controller.

Parameter list:
public CustomParamsConfigs CustomParams

Field Value

CustomParamsConfigs

FutureProofConfigs

True if we should factory default newer unsupported configs, false to leave newer unsupported configs alone.

This flag addresses a corner case where the device may have firmware with newer configs that didn't exist when this version of the API was built. If this occurs and this flag is true, unsupported new configs will be factory defaulted to avoid unexpected behavior.

This is also the behavior in Phoenix 5, so this flag is defaulted to true to match.
public bool FutureProofConfigs

Field Value

bool

MagnetSensor

Configs that affect the magnet sensor and how to interpret it.

Includes sensor direction, the sensor discontinuity point, and the magnet offset.

Parameter list:
public MagnetSensorConfigs MagnetSensor

Field Value

MagnetSensorConfigs

Methods

Clone()

Creates a copy of this configuration.

public CANcoderConfiguration Clone()

Returns

CANcoderConfiguration

Deserialize(string)

Take a string and deserialize it to this configuration

public StatusCode Deserialize(string to_deserialize)

Parameters

to_deserialize string

Returns

StatusCode

Return code of the deserialize method

Serialize()

Get the serialized form of this configuration

public string Serialize()

Returns

string

Serialized form of this config group

ToString()

Provides the string representation of this object

public override string ToString()

Returns

string

WithCustomParams(CustomParamsConfigs)

Modifies this configuration's CustomParams parameter and returns itself for method-chaining and easier to use config API.

Custom Params.

Custom paramaters that have no real impact on controller.

Parameter list:
public CANcoderConfiguration WithCustomParams(CustomParamsConfigs newCustomParams)

Parameters

newCustomParams CustomParamsConfigs

Parameter to modify

Returns

CANcoderConfiguration

Itself

WithMagnetSensor(MagnetSensorConfigs)

Modifies this configuration's MagnetSensor parameter and returns itself for method-chaining and easier to use config API.

Configs that affect the magnet sensor and how to interpret it.

Includes sensor direction, the sensor discontinuity point, and the magnet offset.

Parameter list:
public CANcoderConfiguration WithMagnetSensor(MagnetSensorConfigs newMagnetSensor)

Parameters

newMagnetSensor MagnetSensorConfigs

Parameter to modify

Returns

CANcoderConfiguration

Itself