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:
Prateek Machiraju
2019-08-17 00:56:48 -04:00
committed by Peter Johnson
parent f1d71da8a9
commit c07ac23532
15 changed files with 136 additions and 35 deletions

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2017-2019 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
@@ -7,6 +7,9 @@
#pragma once
#include <units/units.h>
#include <wpi/deprecated.h>
#include "frc/RobotBase.h"
#include "frc/Watchdog.h"
@@ -141,8 +144,16 @@ class IterativeRobotBase : public RobotBase {
*
* @param period Period in seconds.
*/
WPI_DEPRECATED("Use ctor with unit-safety instead.")
explicit IterativeRobotBase(double period);
/**
* Constructor for IterativeRobotBase.
*
* @param period Period.
*/
explicit IterativeRobotBase(units::second_t period);
virtual ~IterativeRobotBase() = default;
IterativeRobotBase(IterativeRobotBase&&) = default;