mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Remove percent tolerance from PID controller
It breaks the unit system badly; the tolerance member variable has different units depending on percent vs absolute. Absolute tolerance is a lot more natural than percent tolerance anyway.
This commit is contained in:
committed by
Peter Johnson
parent
0ca8d667d2
commit
ff8b8f0a8a
@@ -18,7 +18,7 @@ DriveStraight::DriveStraight(double distance, DriveTrain* drivetrain)
|
||||
[this](double output) { m_drivetrain->Drive(output, output); },
|
||||
{drivetrain}),
|
||||
m_drivetrain(drivetrain) {
|
||||
m_controller.SetAbsoluteTolerance(0.01);
|
||||
m_controller.SetTolerance(0.01);
|
||||
}
|
||||
|
||||
// Called just before this Command runs the first time
|
||||
|
||||
@@ -18,7 +18,7 @@ SetDistanceToBox::SetDistanceToBox(double distance, DriveTrain* drivetrain)
|
||||
[this](double output) { m_drivetrain->Drive(output, output); },
|
||||
{drivetrain}),
|
||||
m_drivetrain(drivetrain) {
|
||||
m_controller.SetAbsoluteTolerance(0.01);
|
||||
m_controller.SetTolerance(0.01);
|
||||
}
|
||||
|
||||
// Called just before this Command runs the first time
|
||||
|
||||
@@ -16,7 +16,7 @@ Elevator::Elevator()
|
||||
#ifdef SIMULATION // Check for simulation and update PID values
|
||||
GetPIDController()->SetPID(kP_simulation, kI_simulation, 0, 0);
|
||||
#endif
|
||||
m_controller.SetAbsoluteTolerance(0.005);
|
||||
m_controller.SetTolerance(0.005);
|
||||
|
||||
SetName("Elevator");
|
||||
// Let's show everything on the LiveWindow
|
||||
|
||||
@@ -14,7 +14,7 @@ Wrist::Wrist() : frc2::PIDSubsystem(frc2::PIDController(kP_real, 0, 0)) {
|
||||
#ifdef SIMULATION // Check for simulation and update PID values
|
||||
GetPIDController()->SetPID(kP_simulation, 0, 0, 0);
|
||||
#endif
|
||||
m_controller.SetAbsoluteTolerance(2.5);
|
||||
m_controller.SetTolerance(2.5);
|
||||
|
||||
SetName("Wrist");
|
||||
// Let's show everything on the LiveWindow
|
||||
|
||||
Reference in New Issue
Block a user