[wpilib, examples] Remove AnalogGyro (#8205)

This commit is contained in:
Ryan Blue
2025-10-10 15:44:39 -04:00
committed by GitHub
parent 35e4a18e86
commit 33f91589b4
30 changed files with 109 additions and 563 deletions

View File

@@ -62,10 +62,10 @@ frc2::CommandPtr Drive::DriveDistanceCommand(units::meter_t distance,
frc2::CommandPtr Drive::TurnToAngleCommand(units::degree_t angle) {
return StartRun(
[this] { m_controller.Reset(m_gyro.GetRotation2d().Degrees()); },
[this] { m_controller.Reset(m_imu.GetRotation2d().Degrees()); },
[this, angle] {
m_drive.ArcadeDrive(
0, m_controller.Calculate(m_gyro.GetRotation2d().Degrees(),
0, m_controller.Calculate(m_imu.GetRotation2d().Degrees(),
angle) +
// Divide feedforward voltage by battery voltage to
// normalize it to [-1, 1]

View File

@@ -6,8 +6,8 @@
#include <functional>
#include <frc/AnalogGyro.h>
#include <frc/Encoder.h>
#include <frc/OnboardIMU.h>
#include <frc/controller/ProfiledPIDController.h>
#include <frc/controller/SimpleMotorFeedforward.h>
#include <frc/drive/DifferentialDrive.h>
@@ -65,7 +65,7 @@ class Drive : public frc2::SubsystemBase {
DriveConstants::kRightEncoderPorts[1],
DriveConstants::kRightEncoderReversed};
frc::AnalogGyro m_gyro{0};
frc::OnboardIMU m_imu{frc::OnboardIMU::kFlat};
frc::ProfiledPIDController<units::radians> m_controller{
DriveConstants::kTurnP,