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
@@ -118,8 +118,7 @@ public class RobotContainer {
|
||||
new RamseteController(kRamseteB, kRamseteZeta),
|
||||
new SimpleMotorFeedforward(ksVolts, kvVoltSecondsPerMeter, kaVoltSecondsSquaredPerMeter),
|
||||
kDriveKinematics,
|
||||
m_robotDrive.getLeftEncoder()::getRate,
|
||||
m_robotDrive.getRightEncoder()::getRate,
|
||||
m_robotDrive::getWheelSpeeds,
|
||||
new PIDController(kPDriveVel, 0, 0),
|
||||
new PIDController(kPDriveVel, 0, 0),
|
||||
// RamseteCommand passes volts to the callback
|
||||
|
||||
@@ -72,11 +72,7 @@ public class DriveSubsystem extends SubsystemBase {
|
||||
@Override
|
||||
public void periodic() {
|
||||
// Update the odometry in the periodic block
|
||||
m_odometry.update(Rotation2d.fromDegrees(getHeading()),
|
||||
new DifferentialDriveWheelSpeeds(
|
||||
m_leftEncoder.getRate(),
|
||||
m_rightEncoder.getRate()
|
||||
));
|
||||
m_odometry.update(Rotation2d.fromDegrees(getHeading()), getWheelSpeeds());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,6 +84,15 @@ public class DriveSubsystem extends SubsystemBase {
|
||||
return m_odometry.getPoseMeters();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current wheel speeds of the robot.
|
||||
*
|
||||
* @return The current wheel speeds.
|
||||
*/
|
||||
public DifferentialDriveWheelSpeeds getWheelSpeeds() {
|
||||
return new DifferentialDriveWheelSpeeds(m_leftEncoder.getRate(), m_rightEncoder.getRate());
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the odometry to the specified pose.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user