Class SwerveDrivetrainConstants

java.lang.Object
com.ctre.phoenix6.swerve.SwerveDrivetrainConstants

public class SwerveDrivetrainConstants extends Object
Common constants for a swerve drivetrain.
  • Field Details

    • CANBusName

      Name of the CAN bus the swerve drive is on. Possible CAN bus strings are:
      • "rio" for the native roboRIO CAN bus
      • 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:
        • "rio" on roboRIO
        • "can0" on Linux
        • "*" on Windows
      Note that all devices must be on the same CAN bus.
    • Pigeon2Id

      public int Pigeon2Id
      CAN ID of the Pigeon2 on the drivetrain.
    • Pigeon2Configs

      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.
  • Constructor Details

  • Method Details

    • withCANBusName

      Modifies the CANBusName parameter and returns itself.

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

      • "rio" for the native roboRIO CAN bus
      • 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:
        • "rio" on roboRIO
        • "can0" on Linux
        • "*" on Windows
      Note that all devices must be on the same CAN bus.
      Parameters:
      newCANBusName - Parameter to modify
      Returns:
      this object
    • withPigeon2Id

      public SwerveDrivetrainConstants withPigeon2Id(int newPigeon2Id)
      Modifies the Pigeon2Id parameter and returns itself.

      CAN ID of the Pigeon2 on the drivetrain.

      Parameters:
      newPigeon2Id - Parameter to modify
      Returns:
      this object
    • withPigeon2Configs

      Modifies the Pigeon2Configs 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:
      newPigeon2Configs - Parameter to modify
      Returns:
      this object