mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
wpilibc: Add overloads for units (#1815)
Add unit-taking overloads to the following classes: - IterativeRobotBase - LinearFilter - Notifier - TimedRobot - Timer (HasPeriodPassed only) - frc2::PIDController The corresponding non-units-taking functions have been deprecated. The return value of TimedRobot::GetPeriod() was updated. This is a breaking change, users should use to<double> to get the value in seconds. Other return values, e.g. Timer::Get(), have NOT been updated due to much wider use.
This commit is contained in:
committed by
Peter Johnson
parent
f1d71da8a9
commit
c07ac23532
@@ -10,6 +10,8 @@
|
||||
#include <functional>
|
||||
#include <limits>
|
||||
|
||||
#include <units/units.h>
|
||||
|
||||
#include "frc/smartdashboard/SendableBase.h"
|
||||
|
||||
namespace frc2 {
|
||||
@@ -30,7 +32,8 @@ class PIDController : public frc::SendableBase {
|
||||
* @param period The period between controller updates in seconds. The
|
||||
* default is 0.02 seconds.
|
||||
*/
|
||||
PIDController(double Kp, double Ki, double Kd, double period = 0.02);
|
||||
PIDController(double Kp, double Ki, double Kd,
|
||||
units::second_t period = 20_ms);
|
||||
|
||||
~PIDController() override = default;
|
||||
|
||||
@@ -97,7 +100,7 @@ class PIDController : public frc::SendableBase {
|
||||
*
|
||||
* @return The period of the controller.
|
||||
*/
|
||||
double GetPeriod() const;
|
||||
units::second_t GetPeriod() const;
|
||||
|
||||
/**
|
||||
* Returns the current controller output.
|
||||
|
||||
Reference in New Issue
Block a user