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:
Tyler Veness
2019-08-25 13:01:51 -07:00
committed by Peter Johnson
parent 0ca8d667d2
commit ff8b8f0a8a
29 changed files with 121 additions and 507 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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