phoenix6.configs.cancoder_configs

Module Contents

class phoenix6.configs.cancoder_configs.CANcoderConfiguration

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.

future_proof_configs: bool = 'True'

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.

magnet_sensor: phoenix6.configs.config_groups.MagnetSensorConfigs

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

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

Parameter list:

  • MagnetSensorConfigs.sensor_direction

  • MagnetSensorConfigs.magnet_offset

  • MagnetSensorConfigs.absolute_sensor_discontinuity_point

custom_params: phoenix6.configs.config_groups.CustomParamsConfigs

Custom Params.

Custom paramaters that have no real impact on controller.

Parameter list:

  • CustomParamsConfigs.custom_param0

  • CustomParamsConfigs.custom_param1

with_magnet_sensor(new_magnet_sensor: phoenix6.configs.config_groups.MagnetSensorConfigs) CANcoderConfiguration

Modifies this configuration’s magnet_sensor 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:

  • MagnetSensorConfigs.sensor_direction

  • MagnetSensorConfigs.magnet_offset

  • MagnetSensorConfigs.absolute_sensor_discontinuity_point

Parameters:

new_magnet_sensor (MagnetSensorConfigs) – Parameter to modify

Returns:

Itself

Return type:

CANcoderConfiguration

with_custom_params(new_custom_params: phoenix6.configs.config_groups.CustomParamsConfigs) CANcoderConfiguration

Modifies this configuration’s custom_params 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:

  • CustomParamsConfigs.custom_param0

  • CustomParamsConfigs.custom_param1

Parameters:

new_custom_params (CustomParamsConfigs) – Parameter to modify

Returns:

Itself

Return type:

CANcoderConfiguration

serialize() str

Get the serialized form of this configuration

Returns:

Serialized form of this config group

Return type:

str

deserialize(to_deserialize: str) phoenix6.status_code.StatusCode

Take a string and deserialize it to this configuration

Returns:

Return code of the deserialize method

Return type:

str

class phoenix6.configs.cancoder_configs.CANcoderConfigurator(id: phoenix6.hardware.device_identifier.DeviceIdentifier)

Bases: phoenix6.configs.parent_configurator.ParentConfigurator

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

This handles applying and refreshing the configurations for CANcoder.

refresh(configs: CANcoderConfiguration, timeout_seconds: phoenix6.units.second = 0.1) phoenix6.status_code.StatusCode
refresh(configs: phoenix6.configs.config_groups.MagnetSensorConfigs, timeout_seconds: phoenix6.units.second = 0.1) phoenix6.status_code.StatusCode
refresh(configs: phoenix6.configs.config_groups.CustomParamsConfigs, timeout_seconds: phoenix6.units.second = 0.1) phoenix6.status_code.StatusCode

Refreshes the values of the specified config group.

Call to refresh the selected configs from the device.

Parameters:
  • configs (SupportsSerialization) – The configs to refresh

  • timeout_seconds (second) – Maximum amount of time to wait when performing configuration

Returns:

StatusCode of refreshing the configs

Return type:

StatusCode

apply(configs: CANcoderConfiguration, timeout_seconds: phoenix6.units.second = 0.1) phoenix6.status_code.StatusCode
apply(configs: phoenix6.configs.config_groups.MagnetSensorConfigs, timeout_seconds: phoenix6.units.second = 0.1) phoenix6.status_code.StatusCode
apply(configs: phoenix6.configs.config_groups.CustomParamsConfigs, timeout_seconds: phoenix6.units.second = 0.1) phoenix6.status_code.StatusCode

Applies the contents of the specified config to the device.

Call to apply the selected configs.

Parameters:
  • configs (SupportsSerialization) – Configs to apply

  • timeout_seconds (second) – Maximum amount of time to wait when performing configuration

Returns:

StatusCode of the apply method

Return type:

StatusCode

set_position(new_value: phoenix6.units.rotation, timeout_seconds: phoenix6.units.second = 0.1) phoenix6.status_code.StatusCode

Sets the current position of the device.

This is available in the configurator in case the user wants to initialize their device entirely without passing a device reference down to the code that performs the initialization. In this case, the user passes down the configurator object and performs all the initialization code on the object.

Parameters:
  • new_value (rotation) – Value to set to. Units are in rotations.

  • timeout_seconds (second) – Maximum time to wait up to in seconds.

Returns:

StatusCode of the set command

Return type:

StatusCode

clear_sticky_faults(timeout_seconds: phoenix6.units.second = 0.1) phoenix6.status_code.StatusCode

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.

This is available in the configurator in case the user wants to initialize their device entirely without passing a device reference down to the code that performs the initialization. In this case, the user passes down the configurator object and performs all the initialization code on the object.

Parameters:

timeout_seconds (second) – Maximum time to wait up to in seconds.

Returns:

StatusCode of the set command

Return type:

StatusCode

clear_sticky_fault_hardware(timeout_seconds: phoenix6.units.second = 0.1) phoenix6.status_code.StatusCode

Clear sticky fault: Hardware fault occurred

This is available in the configurator in case the user wants to initialize their device entirely without passing a device reference down to the code that performs the initialization. In this case, the user passes down the configurator object and performs all the initialization code on the object.

Parameters:

timeout_seconds (second) – Maximum time to wait up to in seconds.

Returns:

StatusCode of the set command

Return type:

StatusCode

clear_sticky_fault_undervoltage(timeout_seconds: phoenix6.units.second = 0.1) phoenix6.status_code.StatusCode

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

This is available in the configurator in case the user wants to initialize their device entirely without passing a device reference down to the code that performs the initialization. In this case, the user passes down the configurator object and performs all the initialization code on the object.

Parameters:

timeout_seconds (second) – Maximum time to wait up to in seconds.

Returns:

StatusCode of the set command

Return type:

StatusCode

clear_sticky_fault_boot_during_enable(timeout_seconds: phoenix6.units.second = 0.1) phoenix6.status_code.StatusCode

Clear sticky fault: Device boot while detecting the enable signal

This is available in the configurator in case the user wants to initialize their device entirely without passing a device reference down to the code that performs the initialization. In this case, the user passes down the configurator object and performs all the initialization code on the object.

Parameters:

timeout_seconds (second) – Maximum time to wait up to in seconds.

Returns:

StatusCode of the set command

Return type:

StatusCode

clear_sticky_fault_unlicensed_feature_in_use(timeout_seconds: phoenix6.units.second = 0.1) phoenix6.status_code.StatusCode

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

This is available in the configurator in case the user wants to initialize their device entirely without passing a device reference down to the code that performs the initialization. In this case, the user passes down the configurator object and performs all the initialization code on the object.

Parameters:

timeout_seconds (second) – Maximum time to wait up to in seconds.

Returns:

StatusCode of the set command

Return type:

StatusCode

clear_sticky_fault_bad_magnet(timeout_seconds: phoenix6.units.second = 0.1) phoenix6.status_code.StatusCode

Clear sticky fault: The magnet distance is not correct or magnet is missing

This is available in the configurator in case the user wants to initialize their device entirely without passing a device reference down to the code that performs the initialization. In this case, the user passes down the configurator object and performs all the initialization code on the object.

Parameters:

timeout_seconds (second) – Maximum time to wait up to in seconds.

Returns:

StatusCode of the set command

Return type:

StatusCode