mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
[wpilib] Require non-zero positive value for PIDController.period (#3175)
This commit is contained in:
@@ -74,13 +74,16 @@ public class PIDController implements Sendable, AutoCloseable {
|
||||
* @param kp The proportional coefficient.
|
||||
* @param ki The integral coefficient.
|
||||
* @param kd The derivative coefficient.
|
||||
* @param period The period between controller updates in seconds.
|
||||
* @param period The period between controller updates in seconds. Must be non-zero and positive.
|
||||
*/
|
||||
public PIDController(double kp, double ki, double kd, double period) {
|
||||
m_kp = kp;
|
||||
m_ki = ki;
|
||||
m_kd = kd;
|
||||
|
||||
if (period <= 0) {
|
||||
throw new IllegalArgumentException("Controller period must be a non-zero positive number!");
|
||||
}
|
||||
m_period = period;
|
||||
|
||||
instances++;
|
||||
|
||||
Reference in New Issue
Block a user