mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[wpilib, examples] Remove AnalogGyro (#8205)
This commit is contained in:
@@ -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]
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user