[build] Build examples in CMake CI (#5667)

This commit is contained in:
Tyler Veness
2023-09-20 21:03:55 -07:00
committed by GitHub
parent 97021f074a
commit 07a0d22fe6
7 changed files with 43 additions and 11 deletions

View File

@@ -18,21 +18,25 @@ SwerveModule::SwerveModule(int driveMotorChannel, int turningMotorChannel,
: m_driveMotor(driveMotorChannel),
m_turningMotor(turningMotorChannel),
m_driveEncoder(driveEncoderPorts[0], driveEncoderPorts[1]),
m_turningEncoder(turningEncoderPorts[0], turningEncoderPorts[1]),
m_reverseDriveEncoder(driveEncoderReversed),
m_reverseTurningEncoder(turningEncoderReversed) {
m_turningEncoder(turningEncoderPorts[0], turningEncoderPorts[1]) {
// Set the distance per pulse for the drive encoder. We can simply use the
// distance traveled for one rotation of the wheel divided by the encoder
// resolution.
m_driveEncoder.SetDistancePerPulse(
ModuleConstants::kDriveEncoderDistancePerPulse);
// Set whether drive encoder should be reversed or not
m_driveEncoder.SetReverseDirection(driveEncoderReversed);
// Set the distance (in this case, angle) per pulse for the turning encoder.
// This is the the angle through an entire rotation (2 * std::numbers::pi)
// divided by the encoder resolution.
m_turningEncoder.SetDistancePerPulse(
ModuleConstants::kTurningEncoderDistancePerPulse);
// Set whether turning encoder should be reversed or not
m_turningEncoder.SetReverseDirection(turningEncoderReversed);
// Limit the PID Controller's input range between -pi and pi and set the input
// to be continuous.
m_turningPIDController.EnableContinuousInput(

View File

@@ -47,9 +47,6 @@ class SwerveModule {
frc::Encoder m_driveEncoder;
frc::Encoder m_turningEncoder;
bool m_reverseDriveEncoder;
bool m_reverseTurningEncoder;
frc::PIDController m_drivePIDController{
ModuleConstants::kPModuleDriveController, 0, 0};
frc::ProfiledPIDController<units::radians> m_turningPIDController{