Skip to content

Commit ecaa2e0

Browse files
committed
Profiled PID Controller Logger
1 parent b64ad49 commit ecaa2e0

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package frc.robot.loggers;
2+
3+
import edu.wpi.first.epilogue.CustomLoggerFor;
4+
import edu.wpi.first.epilogue.logging.ClassSpecificLogger;
5+
import edu.wpi.first.epilogue.logging.EpilogueBackend;
6+
import edu.wpi.first.math.controller.ProfiledPIDController;
7+
8+
@CustomLoggerFor(ProfiledPIDController.class)
9+
public class ProfiledPIDControllerLogger extends ClassSpecificLogger<ProfiledPIDController> {
10+
public ProfiledPIDControllerLogger() {
11+
super(ProfiledPIDController.class);
12+
}
13+
14+
@Override
15+
protected void update(EpilogueBackend backend, ProfiledPIDController controller) {
16+
backend.log("P", controller.getP());
17+
backend.log("I", controller.getI());
18+
backend.log("D", controller.getD());
19+
backend.log("At Goal Position", controller.atSetpoint());
20+
backend.log("Positional Error", controller.getPositionError());
21+
backend.log("Velocity Error", controller.getVelocityError());
22+
backend.log("Velocity Tolerance", controller.getVelocityTolerance());
23+
backend.log("Positional Tolerance", controller.getVelocityError());
24+
}
25+
}

0 commit comments

Comments
 (0)