mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Use DifferentialDriveWheelSpeeds in RamseteCommand ctor (#2091)
This commit is contained in:
committed by
Peter Johnson
parent
b37b68daaf
commit
5891628112
@@ -68,12 +68,7 @@ frc2::Command* RobotContainer::GetAutonomousCommand() {
|
||||
frc::SimpleMotorFeedforward<units::meters>(
|
||||
DriveConstants::ks, DriveConstants::kv, DriveConstants::ka),
|
||||
DriveConstants::kDriveKinematics,
|
||||
[this] {
|
||||
return units::meters_per_second_t(m_drive.GetLeftEncoder().GetRate());
|
||||
},
|
||||
[this] {
|
||||
return units::meters_per_second_t(m_drive.GetRightEncoder().GetRate());
|
||||
},
|
||||
[this] { return m_drive.GetWheelSpeeds(); },
|
||||
frc2::PIDController(DriveConstants::kPDriveVel, 0, 0),
|
||||
frc2::PIDController(DriveConstants::kPDriveVel, 0, 0),
|
||||
[this](auto left, auto right) { m_drive.TankDriveVolts(left, right); },
|
||||
|
||||
@@ -29,9 +29,7 @@ DriveSubsystem::DriveSubsystem()
|
||||
void DriveSubsystem::Periodic() {
|
||||
// Implementation of subsystem periodic method goes here.
|
||||
m_odometry.Update(frc::Rotation2d(units::degree_t(GetHeading())),
|
||||
frc::DifferentialDriveWheelSpeeds{
|
||||
units::meters_per_second_t(m_leftEncoder.GetRate()),
|
||||
units::meters_per_second_t(m_rightEncoder.GetRate())});
|
||||
GetWheelSpeeds());
|
||||
}
|
||||
|
||||
void DriveSubsystem::ArcadeDrive(double fwd, double rot) {
|
||||
@@ -70,6 +68,11 @@ double DriveSubsystem::GetTurnRate() {
|
||||
|
||||
frc::Pose2d DriveSubsystem::GetPose() { return m_odometry.GetPose(); }
|
||||
|
||||
frc::DifferentialDriveWheelSpeeds DriveSubsystem::GetWheelSpeeds() {
|
||||
return {units::meters_per_second_t(m_leftEncoder.GetRate()),
|
||||
units::meters_per_second_t(m_rightEncoder.GetRate())};
|
||||
}
|
||||
|
||||
void DriveSubsystem::ResetOdometry(frc::Pose2d pose) {
|
||||
m_odometry.ResetPosition(pose,
|
||||
frc::Rotation2d(units::degree_t(GetHeading())));
|
||||
|
||||
@@ -101,6 +101,13 @@ class DriveSubsystem : public frc2::SubsystemBase {
|
||||
*/
|
||||
frc::Pose2d GetPose();
|
||||
|
||||
/**
|
||||
* Returns the current wheel speeds of the robot.
|
||||
*
|
||||
* @return The current wheel speeds.
|
||||
*/
|
||||
frc::DifferentialDriveWheelSpeeds GetWheelSpeeds();
|
||||
|
||||
/**
|
||||
* Resets the odometry to the specified pose.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user