CTRE Phoenix 6 C++ 25.0.0-beta-4
Loading...
Searching...
No Matches
ctre::phoenix6::swerve::SwerveDrivetrainConstants Struct Reference

Common constants for a swerve drivetrain. More...

#include <ctre/phoenix6/swerve/SwerveDrivetrainConstants.hpp>

Public Member Functions

constexpr SwerveDrivetrainConstants ()=default
 
constexpr SwerveDrivetrainConstantsWithCANBusName (std::string_view newCANBusName)
 Modifies the CANBusName parameter and returns itself.
 
constexpr SwerveDrivetrainConstantsWithPigeon2Id (int newPigeon2Id)
 Modifies the Pigeon2Id parameter and returns itself.
 
SwerveDrivetrainConstantsWithPigeon2Configs (const std::optional< configs::Pigeon2Configuration > &newPigeon2Configs)
 Modifies the Pigeon2Configs parameter and returns itself.
 

Public Attributes

std::string_view CANBusName = "rio"
 Name of the CAN bus the swerve drive is on.
 
int Pigeon2Id = 0
 CAN ID of the Pigeon2 on the drivetrain.
 
std::optional< configs::Pigeon2ConfigurationPigeon2Configs = std::nullopt
 The configuration object to apply to the Pigeon2.
 

Detailed Description

Common constants for a swerve drivetrain.

Constructor & Destructor Documentation

◆ SwerveDrivetrainConstants()

constexpr ctre::phoenix6::swerve::SwerveDrivetrainConstants::SwerveDrivetrainConstants ( )
constexprdefault

Member Function Documentation

◆ WithCANBusName()

constexpr SwerveDrivetrainConstants & ctre::phoenix6::swerve::SwerveDrivetrainConstants::WithCANBusName ( std::string_view newCANBusName)
inlineconstexpr

Modifies the CANBusName 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
newCANBusNameParameter to modify
Returns
this object

◆ WithPigeon2Configs()

SwerveDrivetrainConstants & ctre::phoenix6::swerve::SwerveDrivetrainConstants::WithPigeon2Configs ( const std::optional< configs::Pigeon2Configuration > & newPigeon2Configs)
inline

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
newPigeon2ConfigsParameter to modify
Returns
this object

◆ WithPigeon2Id()

constexpr SwerveDrivetrainConstants & ctre::phoenix6::swerve::SwerveDrivetrainConstants::WithPigeon2Id ( int newPigeon2Id)
inlineconstexpr

Modifies the Pigeon2Id parameter and returns itself.

CAN ID of the Pigeon2 on the drivetrain.

Parameters
newPigeon2IdParameter to modify
Returns
this object

Member Data Documentation

◆ CANBusName

std::string_view ctre::phoenix6::swerve::SwerveDrivetrainConstants::CANBusName = "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.

◆ Pigeon2Configs

std::optional<configs::Pigeon2Configuration> ctre::phoenix6::swerve::SwerveDrivetrainConstants::Pigeon2Configs = std::nullopt

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.

◆ Pigeon2Id

int ctre::phoenix6::swerve::SwerveDrivetrainConstants::Pigeon2Id = 0

CAN ID of the Pigeon2 on the drivetrain.


The documentation for this struct was generated from the following file: