From b16ba87cd53e5609888ce5f556c73d3c54a4d266 Mon Sep 17 00:00:00 2001 From: Drew Williams Date: Mon, 23 Jan 2023 13:09:53 -0500 Subject: [PATCH] Fixes C++ example not using the correct encoder (#8) * Fixes C++ example not using the correct encoder Fixes #7 * Fix comment Co-authored-by: Jan-Felix Abellera --- src/main/cpp/subsystems/MAXSwerveModule.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/cpp/subsystems/MAXSwerveModule.cpp b/src/main/cpp/subsystems/MAXSwerveModule.cpp index 0e1b25f..bef5b9d 100644 --- a/src/main/cpp/subsystems/MAXSwerveModule.cpp +++ b/src/main/cpp/subsystems/MAXSwerveModule.cpp @@ -48,6 +48,10 @@ MAXSwerveModule::MAXSwerveModule(const int drivingCANId, const int turningCANId, kTurningEncoderPositionPIDMinInput.value()); m_turningPIDController.SetPositionPIDWrappingMaxInput( kTurningEncoderPositionPIDMaxInput.value()); + + // Set the PID Controller to use the duty cycle encoder on the swerve + // module instead of the built in NEO550 encoder. + m_turningPIDController.SetFeedbackDevice(m_turningAbsoluteEncoder); // Set the PID gains for the driving motor. Note these are example gains, and // you may need to tune them for your own robot!