phoenix6.swerve.swerve_drivetrain_constants

Module Contents

class phoenix6.swerve.swerve_drivetrain_constants.SwerveDrivetrainConstants

Common constants for a swerve drivetrain.

can_bus_name: str = 'rio'

Name of the CAN bus the swerve drive is on. Possible CAN bus strings are:

  • empty string or “rio” for the native roboRIO CAN bus

  • CANivore name or serial number

  • “*” for any CANivore seen by the program

Note that all devices must be on the same CAN bus.

pigeon2_id: int = 0

CAN ID of the Pigeon2 on the drivetrain.

pigeon2_configs: None | phoenix6.configs.Pigeon2Configuration

The configuration object to apply to the Pigeon2. This defaults to null. If this remains null, then the Pigeon2 will not be configured (and whatever configs are on it remain on it). If this is not null, the Pigeon2 will be overwritten with these configs.

with_can_bus_name(new_can_bus_name: str) SwerveDrivetrainConstants

Modifies the can_bus_name parameter and returns itself.

Name of the CAN bus the swerve drive is on. Possible CAN bus strings are:

  • empty string or “rio” for the native roboRIO CAN bus

  • CANivore name or serial number

  • “*” for any CANivore seen by the program

Note that all devices must be on the same CAN bus.

Parameters:

new_can_bus_name (str) – Parameter to modify

Returns:

this object

Return type:

SwerveDrivetrainConstants

with_pigeon2_id(new_pigeon2_id: int) SwerveDrivetrainConstants

Modifies the pigeon2_id parameter and returns itself.

CAN ID of the Pigeon2 on the drivetrain.

Parameters:

new_pigeon2_id (int) – Parameter to modify

Returns:

this object

Return type:

SwerveDrivetrainConstants

with_pigeon2_configs(new_pigeon2_configs: None | phoenix6.configs.Pigeon2Configuration) SwerveDrivetrainConstants

Modifies the pigeon2_configs parameter and returns itself.

The configuration object to apply to the Pigeon2. This defaults to null. If this remains null, then the Pigeon2 will not be configured (and whatever configs are on it remain on it). If this is not null, the Pigeon2 will be overwritten with these configs.

Parameters:

new_pigeon2_configs (None | Pigeon2Configuration) – Parameter to modify

Returns:

this object

Return type:

SwerveDrivetrainConstants