[wpimath] Enable continuous angle input for HolonomicDriveController (#4453)

This commit is contained in:
Starlight220
2022-10-07 01:46:22 +03:00
committed by GitHub
parent 893b46139a
commit b2276e47de
2 changed files with 5 additions and 1 deletions

View File

@@ -8,6 +8,7 @@ import edu.wpi.first.math.geometry.Pose2d;
import edu.wpi.first.math.geometry.Rotation2d;
import edu.wpi.first.math.kinematics.ChassisSpeeds;
import edu.wpi.first.math.trajectory.Trajectory;
import edu.wpi.first.math.util.Units;
/**
* This holonomic drive controller can be used to follow trajectories using a holonomic drivetrain
@@ -44,6 +45,7 @@ public class HolonomicDriveController {
m_xController = xController;
m_yController = yController;
m_thetaController = thetaController;
m_thetaController.enableContinuousInput(0, Units.degreesToRadians(360.0));
}
/**

View File

@@ -15,7 +15,9 @@ HolonomicDriveController::HolonomicDriveController(
ProfiledPIDController<units::radian> thetaController)
: m_xController(std::move(xController)),
m_yController(std::move(yController)),
m_thetaController(std::move(thetaController)) {}
m_thetaController(std::move(thetaController)) {
m_thetaController.EnableContinuousInput(0_deg, 360.0_deg);
}
bool HolonomicDriveController::AtReference() const {
const auto& eTranslate = m_poseError.Translation();