midtownrobotics / 2024-Offseason

Other
0 stars 0 forks source link

Fix LoggedTunableNumber.ifChanged usage #54

Closed Mysterium422 closed 1 week ago

Mysterium422 commented 2 weeks ago

LoggedTunableNumber.ifChanged takes 3 requirements:

1) hashCode() - used to uniquely identify which object is calling the function

2) A function to run if the tunable number(s) have changed

3) The tunable numbers which should trigger the function if changed. Listed varargs style.

Spot which is missing:

LoggedTunableNumber.ifChanged(hashCode(), () -> {
        m_turningPIDController.setP(Constants.NeoSwerveModuleConstants.TURNING_P.get());
        m_turningPIDController.setI(Constants.NeoSwerveModuleConstants.TURNING_I.get());
        m_turningPIDController.setD(Constants.NeoSwerveModuleConstants.TURNING_D.get());
        m_turningPIDController.setFF(Constants.NeoSwerveModuleConstants.TURNING_FF.get());
});