Remove most 2022 deprecations (#4205)

Excludes "old" commands and SimDevice functions.
This commit is contained in:
Tyler Veness
2022-05-04 20:37:27 -07:00
committed by GitHub
parent ce1a7d698a
commit ee03a7ad3b
75 changed files with 165 additions and 1882 deletions

View File

@@ -34,14 +34,6 @@ Compressor::~Compressor() {
}
}
void Compressor::Start() {
EnableDigital();
}
void Compressor::Stop() {
Disable();
}
bool Compressor::Enabled() const {
return IsEnabled();
}

View File

@@ -233,12 +233,6 @@ Instance::~Instance() {
}
}
DriverStation& DriverStation::GetInstance() {
::GetInstance();
static DriverStation instance;
return instance;
}
bool DriverStation::GetStickButton(int stick, int button) {
if (stick < 0 || stick >= kJoystickPorts) {
FRC_ReportError(warn::BadJoystickIndex, "stick {} out of range", stick);
@@ -504,20 +498,12 @@ bool DriverStation::IsAutonomousEnabled() {
return controlWord.autonomous && controlWord.enabled;
}
bool DriverStation::IsOperatorControl() {
return IsTeleop();
}
bool DriverStation::IsTeleop() {
HAL_ControlWord controlWord;
HAL_GetControlWord(&controlWord);
return !(controlWord.autonomous || controlWord.test);
}
bool DriverStation::IsOperatorControlEnabled() {
return IsTeleopEnabled();
}
bool DriverStation::IsTeleopEnabled() {
HAL_ControlWord controlWord;
HAL_GetControlWord(&controlWord);
@@ -671,10 +657,6 @@ void DriverStation::InAutonomous(bool entering) {
::GetInstance().userInAutonomous = entering;
}
void DriverStation::InOperatorControl(bool entering) {
InTeleop(entering);
}
void DriverStation::InTeleop(bool entering) {
::GetInstance().userInTeleop = entering;
}

View File

@@ -16,9 +16,6 @@
using namespace frc;
IterativeRobotBase::IterativeRobotBase(double period)
: IterativeRobotBase(units::second_t(period)) {}
IterativeRobotBase::IterativeRobotBase(units::second_t period)
: m_period(period),
m_watchdog(period, [this] { PrintLoopOverrunMessage(); }) {}

View File

@@ -38,12 +38,6 @@ void ResetPreferencesInstance() {
} // namespace frc::impl
#endif
Preferences* Preferences::GetInstance() {
::GetInstance();
static Preferences instance;
return &instance;
}
std::vector<std::string> Preferences::GetKeys() {
return ::GetInstance().table->GetKeys();
}
@@ -80,10 +74,6 @@ void Preferences::SetString(std::string_view key, std::string_view value) {
entry.SetPersistent();
}
void Preferences::PutString(std::string_view key, std::string_view value) {
SetString(key, value);
}
void Preferences::InitString(std::string_view key, std::string_view value) {
auto entry = ::GetInstance().table->GetEntry(key);
entry.SetDefaultString(value);
@@ -96,10 +86,6 @@ void Preferences::SetInt(std::string_view key, int value) {
entry.SetPersistent();
}
void Preferences::PutInt(std::string_view key, int value) {
SetInt(key, value);
}
void Preferences::InitInt(std::string_view key, int value) {
auto entry = ::GetInstance().table->GetEntry(key);
entry.SetDefaultDouble(value);
@@ -112,10 +98,6 @@ void Preferences::SetDouble(std::string_view key, double value) {
entry.SetPersistent();
}
void Preferences::PutDouble(std::string_view key, double value) {
SetDouble(key, value);
}
void Preferences::InitDouble(std::string_view key, double value) {
auto entry = ::GetInstance().table->GetEntry(key);
entry.SetDefaultDouble(value);
@@ -128,10 +110,6 @@ void Preferences::SetFloat(std::string_view key, float value) {
entry.SetPersistent();
}
void Preferences::PutFloat(std::string_view key, float value) {
SetFloat(key, value);
}
void Preferences::InitFloat(std::string_view key, float value) {
auto entry = ::GetInstance().table->GetEntry(key);
entry.SetDefaultDouble(value);
@@ -144,10 +122,6 @@ void Preferences::SetBoolean(std::string_view key, bool value) {
entry.SetPersistent();
}
void Preferences::PutBoolean(std::string_view key, bool value) {
SetBoolean(key, value);
}
void Preferences::InitBoolean(std::string_view key, bool value) {
auto entry = ::GetInstance().table->GetEntry(key);
entry.SetDefaultBoolean(value);
@@ -160,10 +134,6 @@ void Preferences::SetLong(std::string_view key, int64_t value) {
entry.SetPersistent();
}
void Preferences::PutLong(std::string_view key, int64_t value) {
SetLong(key, value);
}
void Preferences::InitLong(std::string_view key, int64_t value) {
auto entry = ::GetInstance().table->GetEntry(key);
entry.SetDefaultDouble(value);

View File

@@ -20,10 +20,6 @@ bool RobotState::IsEStopped() {
return DriverStation::IsEStopped();
}
bool RobotState::IsOperatorControl() {
return IsTeleop();
}
bool RobotState::IsTeleop() {
return DriverStation::IsTeleop();
}

View File

@@ -196,16 +196,6 @@ void SPI::SetSampleDataOnTrailingEdge() {
HAL_SetSPIOpts(m_port, m_msbFirst, m_sampleOnTrailing, m_clockIdleHigh);
}
void SPI::SetSampleDataOnFalling() {
m_sampleOnTrailing = true;
HAL_SetSPIOpts(m_port, m_msbFirst, m_sampleOnTrailing, m_clockIdleHigh);
}
void SPI::SetSampleDataOnRising() {
m_sampleOnTrailing = false;
HAL_SetSPIOpts(m_port, m_msbFirst, m_sampleOnTrailing, m_clockIdleHigh);
}
void SPI::SetClockActiveLow() {
m_clockIdleHigh = true;
HAL_SetSPIOpts(m_port, m_msbFirst, m_sampleOnTrailing, m_clockIdleHigh);
@@ -278,10 +268,6 @@ void SPI::StartAutoRate(units::second_t period) {
FRC_CheckErrorStatus(status, "Port {}", m_port);
}
void SPI::StartAutoRate(double period) {
StartAutoRate(units::second_t(period));
}
void SPI::StartAutoTrigger(DigitalSource& source, bool rising, bool falling) {
int32_t status = 0;
HAL_StartSPIAutoTrigger(m_port, source.GetPortHandleForRouting(),
@@ -355,13 +341,6 @@ void SPI::InitAccumulator(units::second_t period, int cmd, int xferSize,
m_accum->m_notifier.StartPeriodic(period * kAccumulateDepth / 2);
}
void SPI::InitAccumulator(double period, int cmd, int xferSize, int validMask,
int validValue, int dataShift, int dataSize,
bool isSigned, bool bigEndian) {
InitAccumulator(units::second_t(period), cmd, xferSize, validMask, validValue,
dataShift, dataSize, isSigned, bigEndian);
}
void SPI::FreeAccumulator() {
m_accum.reset(nullptr);
FreeAuto();

View File

@@ -1,69 +0,0 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "frc/SpeedControllerGroup.h"
#include <wpi/sendable/SendableBuilder.h>
#include <wpi/sendable/SendableRegistry.h>
using namespace frc;
// Can't use a delegated constructor here because of an MSVC bug.
// https://developercommunity.visualstudio.com/content/problem/583/compiler-bug-with-delegating-a-constructor.html
SpeedControllerGroup::SpeedControllerGroup(
std::vector<std::reference_wrapper<SpeedController>>&& speedControllers)
: m_speedControllers(std::move(speedControllers)) {
Initialize();
}
void SpeedControllerGroup::Initialize() {
for (auto& speedController : m_speedControllers) {
wpi::SendableRegistry::AddChild(this, &speedController.get());
}
static int instances = 0;
++instances;
wpi::SendableRegistry::Add(this, "SpeedControllerGroup", instances);
}
void SpeedControllerGroup::Set(double speed) {
for (auto speedController : m_speedControllers) {
speedController.get().Set(m_isInverted ? -speed : speed);
}
}
double SpeedControllerGroup::Get() const {
if (!m_speedControllers.empty()) {
return m_speedControllers.front().get().Get() * (m_isInverted ? -1 : 1);
}
return 0.0;
}
void SpeedControllerGroup::SetInverted(bool isInverted) {
m_isInverted = isInverted;
}
bool SpeedControllerGroup::GetInverted() const {
return m_isInverted;
}
void SpeedControllerGroup::Disable() {
for (auto speedController : m_speedControllers) {
speedController.get().Disable();
}
}
void SpeedControllerGroup::StopMotor() {
for (auto speedController : m_speedControllers) {
speedController.get().StopMotor();
}
}
void SpeedControllerGroup::InitSendable(wpi::SendableBuilder& builder) {
builder.SetSmartDashboardType("Speed Controller");
builder.SetActuator(true);
builder.SetSafeState([=] { StopMotor(); });
builder.AddDoubleProperty(
"Value", [=] { return Get(); }, [=](double value) { Set(value); });
}

View File

@@ -70,8 +70,6 @@ void TimedRobot::EndCompetition() {
HAL_StopNotifier(m_notifier, &status);
}
TimedRobot::TimedRobot(double period) : TimedRobot(units::second_t(period)) {}
TimedRobot::TimedRobot(units::second_t period) : IterativeRobotBase(period) {
m_startTime = Timer::GetFPGATimestamp();
AddPeriodic([=] { LoopFunc(); }, period);

View File

@@ -65,10 +65,6 @@ bool Timer::HasElapsed(units::second_t period) const {
return Get() >= period;
}
bool Timer::HasPeriodPassed(units::second_t period) {
return AdvanceIfElapsed(period);
}
bool Timer::AdvanceIfElapsed(units::second_t period) {
if (Get() >= period) {
// Advance the start time by the period.

View File

@@ -12,20 +12,12 @@
#include <wpi/sendable/SendableRegistry.h>
#include "frc/MathUtil.h"
#include "frc/SpeedController.h"
#include "frc/motorcontrol/MotorController.h"
using namespace frc;
#if defined(_MSC_VER)
#pragma warning(disable : 4996) // was declared deprecated
#elif defined(__clang__)
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
DifferentialDrive::DifferentialDrive(SpeedController& leftMotor,
SpeedController& rightMotor)
DifferentialDrive::DifferentialDrive(MotorController& leftMotor,
MotorController& rightMotor)
: m_leftMotor(&leftMotor), m_rightMotor(&rightMotor) {
wpi::SendableRegistry::AddChild(this, m_leftMotor);
wpi::SendableRegistry::AddChild(this, m_rightMotor);

View File

@@ -13,27 +13,19 @@
#include <wpi/sendable/SendableRegistry.h>
#include "frc/MathUtil.h"
#include "frc/SpeedController.h"
#include "frc/motorcontrol/MotorController.h"
using namespace frc;
#if defined(_MSC_VER)
#pragma warning(disable : 4996) // was declared deprecated
#elif defined(__clang__)
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
KilloughDrive::KilloughDrive(SpeedController& leftMotor,
SpeedController& rightMotor,
SpeedController& backMotor)
KilloughDrive::KilloughDrive(MotorController& leftMotor,
MotorController& rightMotor,
MotorController& backMotor)
: KilloughDrive(leftMotor, rightMotor, backMotor, kDefaultLeftMotorAngle,
kDefaultRightMotorAngle, kDefaultBackMotorAngle) {}
KilloughDrive::KilloughDrive(SpeedController& leftMotor,
SpeedController& rightMotor,
SpeedController& backMotor, double leftMotorAngle,
KilloughDrive::KilloughDrive(MotorController& leftMotor,
MotorController& rightMotor,
MotorController& backMotor, double leftMotorAngle,
double rightMotorAngle, double backMotorAngle)
: m_leftMotor(&leftMotor),
m_rightMotor(&rightMotor),

View File

@@ -13,23 +13,15 @@
#include <wpi/sendable/SendableRegistry.h>
#include "frc/MathUtil.h"
#include "frc/SpeedController.h"
#include "frc/drive/Vector2d.h"
#include "frc/motorcontrol/MotorController.h"
using namespace frc;
#if defined(_MSC_VER)
#pragma warning(disable : 4996) // was declared deprecated
#elif defined(__clang__)
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
MecanumDrive::MecanumDrive(SpeedController& frontLeftMotor,
SpeedController& rearLeftMotor,
SpeedController& frontRightMotor,
SpeedController& rearRightMotor)
MecanumDrive::MecanumDrive(MotorController& frontLeftMotor,
MotorController& rearLeftMotor,
MotorController& frontRightMotor,
MotorController& rearRightMotor)
: m_frontLeftMotor(&frontLeftMotor),
m_rearLeftMotor(&rearLeftMotor),
m_frontRightMotor(&frontRightMotor),

View File

@@ -10,7 +10,6 @@
#include <hal/FRCUsageReporting.h>
#include "frc/MathUtil.h"
#include "frc/motorcontrol/MotorController.h"
using namespace frc;
@@ -31,10 +30,6 @@ void RobotDriveBase::FeedWatchdog() {
Feed();
}
double RobotDriveBase::ApplyDeadband(double value, double deadband) {
return frc::ApplyDeadband(value, deadband);
}
void RobotDriveBase::Desaturate(wpi::span<double> wheelSpeeds) {
double maxMagnitude = std::abs(wheelSpeeds[0]);
for (size_t i = 1; i < wheelSpeeds.size(); i++) {

View File

@@ -75,12 +75,6 @@ std::shared_ptr<Component> Instance::GetOrAdd(wpi::Sendable* sendable) {
return data;
}
LiveWindow* LiveWindow::GetInstance() {
::GetInstance();
static LiveWindow instance;
return &instance;
}
void LiveWindow::SetEnabledCallback(std::function<void()> func) {
::GetInstance().enabled = func;
}

View File

@@ -2,12 +2,12 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "frc/SpeedController.h"
#include "frc/motorcontrol/MotorController.h"
#include <frc/RobotController.h>
using namespace frc;
void SpeedController::SetVoltage(units::volt_t output) {
void MotorController::SetVoltage(units::volt_t output) {
Set(output / units::volt_t(RobotController::GetInputVoltage()));
}

View File

@@ -192,18 +192,10 @@ bool RobotBase::IsAutonomousEnabled() const {
return DriverStation::IsAutonomousEnabled();
}
bool RobotBase::IsOperatorControl() const {
return DriverStation::IsTeleop();
}
bool RobotBase::IsTeleop() const {
return DriverStation::IsTeleop();
}
bool RobotBase::IsOperatorControlEnabled() const {
return DriverStation::IsTeleopEnabled();
}
bool RobotBase::IsTeleopEnabled() const {
return DriverStation::IsTeleopEnabled();
}

View File

@@ -58,24 +58,6 @@ class Compressor : public wpi::Sendable,
Compressor(Compressor&&) = default;
Compressor& operator=(Compressor&&) = default;
/**
* Starts closed-loop control. Note that closed loop control is enabled by
* default.
*
* @deprecated Use EnableDigital() instead.
*/
WPI_DEPRECATED("Use EnableDigital() instead")
void Start();
/**
* Stops closed-loop control. Note that closed loop control is enabled by
* default.
*
* @deprecated Use Disable() instead.
*/
WPI_DEPRECATED("Use Disable() instead")
void Stop();
/**
* Check if compressor output is active.
* To (re)enable the compressor use EnableDigital() or EnableAnalog(...).

View File

@@ -7,7 +7,6 @@
#include <string>
#include <units/time.h>
#include <wpi/deprecated.h>
namespace wpi::log {
class DataLog;
@@ -24,15 +23,6 @@ class DriverStation final {
enum Alliance { kRed, kBlue, kInvalid };
enum MatchType { kNone, kPractice, kQualification, kElimination };
/**
* Return a reference to the singleton DriverStation.
*
* @return Reference to the DS instance
* @deprecated Use the static methods
*/
WPI_DEPRECATED("Use static methods")
static DriverStation& GetInstance();
static constexpr int kJoystickPorts = 6;
/**
@@ -196,15 +186,6 @@ class DriverStation final {
*/
static bool IsAutonomousEnabled();
/**
* Check if the DS is commanding teleop mode.
*
* @return True if the robot is being commanded to be in teleop mode
* @deprecated Use IsTeleop() instead.
*/
WPI_DEPRECATED("Use IsTeleop() instead")
static bool IsOperatorControl();
/**
* Check if the DS is commanding teleop mode.
*
@@ -212,16 +193,6 @@ class DriverStation final {
*/
static bool IsTeleop();
/**
* Check if the DS is commanding teleop mode and if it has enabled the robot.
*
* @return True if the robot is being commanded to be in teleop mode and
* enabled.
* @deprecated Use IsTeleopEnabled() instead.
*/
WPI_DEPRECATED("Use IsTeleopEnabled() instead")
static bool IsOperatorControlEnabled();
/**
* Check if the DS is commanding teleop mode and if it has enabled the robot.
*
@@ -395,17 +366,6 @@ class DriverStation final {
*/
static void InAutonomous(bool entering);
/**
* Only to be used to tell the Driver Station what code you claim to be
* executing for diagnostic purposes only.
*
* @param entering If true, starting teleop code; if false, leaving teleop
* code.
* @deprecated Use InTeleop() instead.
*/
WPI_DEPRECATED("Use InTeleop() instead")
static void InOperatorControl(bool entering);
/**
* Only to be used to tell the Driver Station what code you claim to be
* executing for diagnostic purposes only.

View File

@@ -166,7 +166,9 @@ class Encoder : public CounterBase,
* scaled using the value from SetDistancePerPulse().
*
* @return Period in seconds of the most recent pulse.
* @deprecated Use getRate() in favor of this method.
*/
WPI_DEPRECATED("Use GetRate() in favor of this method")
units::second_t GetPeriod() const override;
/**
@@ -177,13 +179,12 @@ class Encoder : public CounterBase,
* to determine if the wheels or other shaft has stopped rotating.
* This method compensates for the decoding type.
*
* @deprecated Use SetMinRate() in favor of this method. This takes unscaled
* periods and SetMinRate() scales using value from
* SetDistancePerPulse().
*
* @param maxPeriod The maximum time between rising and falling edges before
* the FPGA will report the device stopped. This is expressed
* in seconds.
* @deprecated Use SetMinRate() in favor of this method. This takes unscaled
* periods and SetMinRate() scales using value from
* SetDistancePerPulse().
*/
WPI_DEPRECATED(
"Use SetMinRate() in favor of this method. This takes unscaled periods "

View File

@@ -5,7 +5,6 @@
#pragma once
#include <units/time.h>
#include <wpi/deprecated.h>
#include "frc/RobotBase.h"
#include "frc/Watchdog.h"
@@ -207,17 +206,6 @@ class IterativeRobotBase : public RobotBase {
*/
units::second_t GetPeriod() const;
/**
* Constructor for IterativeRobotBase.
*
* @param period Period in seconds.
*
* @deprecated Use IterativeRobotBase(units::second_t period) with unit-safety
* instead
*/
WPI_DEPRECATED("Use constructor with unit-safety instead.")
explicit IterativeRobotBase(double period);
/**
* Constructor for IterativeRobotBase.
*

View File

@@ -10,8 +10,6 @@
#include <string_view>
#include <vector>
#include <wpi/deprecated.h>
namespace frc {
/**
@@ -30,15 +28,6 @@ namespace frc {
*/
class Preferences {
public:
/**
* Get the one and only {@link Preferences} object.
*
* @return pointer to the {@link Preferences}
* @deprecated Use the static methods
*/
WPI_DEPRECATED("Use static methods")
static Preferences* GetInstance();
/**
* Returns a vector of all the keys.
*
@@ -119,18 +108,6 @@ class Preferences {
*/
static void SetString(std::string_view key, std::string_view value);
/**
* Puts the given string into the preferences table.
*
* The value may not have quotation marks, nor may the key have any whitespace
* nor an equals sign.
*
* @param key the key
* @param value the value
*/
WPI_DEPRECATED("Use SetString instead.")
static void PutString(std::string_view key, std::string_view value);
/**
* Puts the given string into the preferences table if it doesn't
* already exist.
@@ -147,17 +124,6 @@ class Preferences {
*/
static void SetInt(std::string_view key, int value);
/**
* Puts the given int into the preferences table.
*
* The key may not have any whitespace nor an equals sign.
*
* @param key the key
* @param value the value
*/
WPI_DEPRECATED("Use SetInt instead.")
static void PutInt(std::string_view key, int value);
/**
* Puts the given int into the preferences table if it doesn't
* already exist.
@@ -174,17 +140,6 @@ class Preferences {
*/
static void SetDouble(std::string_view key, double value);
/**
* Puts the given double into the preferences table.
*
* The key may not have any whitespace nor an equals sign.
*
* @param key the key
* @param value the value
*/
WPI_DEPRECATED("Use SetDouble instead.")
static void PutDouble(std::string_view key, double value);
/**
* Puts the given double into the preferences table if it doesn't
* already exist.
@@ -201,17 +156,6 @@ class Preferences {
*/
static void SetFloat(std::string_view key, float value);
/**
* Puts the given float into the preferences table.
*
* The key may not have any whitespace nor an equals sign.
*
* @param key the key
* @param value the value
*/
WPI_DEPRECATED("Use SetFloat instead.")
static void PutFloat(std::string_view key, float value);
/**
* Puts the given float into the preferences table if it doesn't
* already exist.
@@ -228,17 +172,6 @@ class Preferences {
*/
static void SetBoolean(std::string_view key, bool value);
/**
* Puts the given boolean into the preferences table.
*
* The key may not have any whitespace nor an equals sign.
*
* @param key the key
* @param value the value
*/
WPI_DEPRECATED("Use SetBoolean instead.")
static void PutBoolean(std::string_view key, bool value);
/**
* Puts the given boolean into the preferences table if it doesn't
* already exist.
@@ -255,17 +188,6 @@ class Preferences {
*/
static void SetLong(std::string_view key, int64_t value);
/**
* Puts the given long (int64_t) into the preferences table.
*
* The key may not have any whitespace nor an equals sign.
*
* @param key the key
* @param value the value
*/
WPI_DEPRECATED("Use SetLong instead.")
static void PutLong(std::string_view key, int64_t value);
/**
* Puts the given long into the preferences table if it doesn't
* already exist.

View File

@@ -11,7 +11,6 @@
#include <hal/HALBase.h>
#include <hal/Main.h>
#include <wpi/condition_variable.h>
#include <wpi/deprecated.h>
#include <wpi/mutex.h>
#include "frc/Errors.h"
@@ -151,16 +150,6 @@ class RobotBase {
*/
bool IsAutonomousEnabled() const;
/**
* Determine if the robot is currently in Operator Control mode.
*
* @return True if the robot is currently operating in Tele-Op mode as
* determined by the field controls.
* @deprecated Use IsTeleop() instead.
*/
WPI_DEPRECATED("Use IsTeleop() instead")
bool IsOperatorControl() const;
/**
* Determine if the robot is currently in Operator Control mode.
*
@@ -169,16 +158,6 @@ class RobotBase {
*/
bool IsTeleop() const;
/**
* Determine if the robot is current in Operator Control mode and enabled.
*
* @return True if the robot is currently operating in Tele-Op mode while
* enabled as determined by the field-controls.
* @deprecated Use IsTeleopEnabled() instead.
*/
WPI_DEPRECATED("Use IsTeleopEnabled() instead")
bool IsOperatorControlEnabled() const;
/**
* Determine if the robot is current in Operator Control mode and enabled.
*

View File

@@ -4,8 +4,6 @@
#pragma once
#include <wpi/deprecated.h>
namespace frc {
class RobotState {
@@ -15,8 +13,6 @@ class RobotState {
static bool IsDisabled();
static bool IsEnabled();
static bool IsEStopped();
WPI_DEPRECATED("Use IsTeleop() instead")
static bool IsOperatorControl();
static bool IsTeleop();
static bool IsAutonomous();
static bool IsTest();

View File

@@ -10,7 +10,6 @@
#include <hal/SPITypes.h>
#include <units/time.h>
#include <wpi/deprecated.h>
#include <wpi/span.h>
namespace frc {
@@ -76,26 +75,6 @@ class SPI {
*/
void SetSampleDataOnTrailingEdge();
/**
* Configure that the data is stable on the falling edge and the data
* changes on the rising edge.
*
* @deprecated Use SetSampleDataOnTrailingEdge() instead.
*
*/
WPI_DEPRECATED("Use SetSampleDataOnTrailingEdge instead.")
void SetSampleDataOnFalling();
/**
* Configure that the data is stable on the rising edge and the data
* changes on the falling edge.
*
* @deprecated Use SetSampleDataOnLeadingEdge() instead.
*
*/
WPI_DEPRECATED("Use SetSampleDataOnLeadingEdge instead")
void SetSampleDataOnRising();
/**
* Configure the clock output line to be active low.
* This is sometimes called clock polarity high or clock idle high.
@@ -189,19 +168,6 @@ class SPI {
*/
void StartAutoRate(units::second_t period);
/**
* Start running the automatic SPI transfer engine at a periodic rate.
*
* InitAuto() and SetAutoTransmitData() must be called before calling this
* function.
*
* @deprecated use unit-safe StartAutoRate(units::second_t period) instead.
*
* @param period period between transfers, in seconds (us resolution)
*/
WPI_DEPRECATED("Use StartAutoRate with unit-safety instead")
void StartAutoRate(double period);
/**
* Start running the automatic SPI transfer engine when a trigger occurs.
*
@@ -286,31 +252,6 @@ class SPI {
int validMask, int validValue, int dataShift,
int dataSize, bool isSigned, bool bigEndian);
/**
* Initialize the accumulator.
*
* @deprecated Use unit-safe version instead.
* InitAccumulator(units::second_t period, int cmd, int <!--
* --> xferSize, int validMask, int validValue, int dataShift, <!--
* --> int dataSize, bool isSigned, bool bigEndian)
*
* @param period Time between reads
* @param cmd SPI command to send to request data
* @param xferSize SPI transfer size, in bytes
* @param validMask Mask to apply to received data for validity checking
* @param validValue After valid_mask is applied, required matching value for
* validity checking
* @param dataShift Bit shift to apply to received data to get actual data
* value
* @param dataSize Size (in bits) of data field
* @param isSigned Is data field signed?
* @param bigEndian Is device big endian?
*/
WPI_DEPRECATED("Use InitAccumulator with unit-safety instead")
void InitAccumulator(double period, int cmd, int xferSize, int validMask,
int validValue, int dataShift, int dataSize,
bool isSigned, bool bigEndian);
/**
* Frees the accumulator.
*/

View File

@@ -1,74 +0,0 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#pragma once
#include <units/voltage.h>
#include <wpi/deprecated.h>
namespace frc {
/**
* Interface for speed controlling devices.
*
* @deprecated Use MotorController.
*/
class WPI_DEPRECATED("use MotorController") SpeedController {
public:
virtual ~SpeedController() = default;
/**
* Common interface for setting the speed of a speed controller.
*
* @param speed The speed to set. Value should be between -1.0 and 1.0.
*/
virtual void Set(double speed) = 0;
/**
* Sets the voltage output of the SpeedController. Compensates for
* the current bus voltage to ensure that the desired voltage is output even
* if the battery voltage is below 12V - highly useful when the voltage
* outputs are "meaningful" (e.g. they come from a feedforward calculation).
*
* <p>NOTE: This function *must* be called regularly in order for voltage
* compensation to work properly - unlike the ordinary set function, it is not
* "set it and forget it."
*
* @param output The voltage to output.
*/
virtual void SetVoltage(units::volt_t output);
/**
* Common interface for getting the current set speed of a speed controller.
*
* @return The current set speed. Value is between -1.0 and 1.0.
*/
virtual double Get() const = 0;
/**
* Common interface for inverting direction of a speed controller.
*
* @param isInverted The state of inversion, true is inverted.
*/
virtual void SetInverted(bool isInverted) = 0;
/**
* Common interface for returning the inversion state of a speed controller.
*
* @return isInverted The state of inversion, true is inverted.
*/
virtual bool GetInverted() const = 0;
/**
* Common interface for disabling a motor.
*/
virtual void Disable() = 0;
/**
* Common interface to stop the motor until Set is called again.
*/
virtual void StopMotor() = 0;
};
} // namespace frc

View File

@@ -1,55 +0,0 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#pragma once
#include <functional>
#include <vector>
#include <wpi/deprecated.h>
#include <wpi/sendable/Sendable.h>
#include <wpi/sendable/SendableHelper.h>
#include "frc/motorcontrol/MotorController.h"
namespace frc {
/**
* Allows multiple SpeedController objects to be linked together.
*
* @deprecated Use MotorControllerGroup.
*/
class WPI_DEPRECATED("use MotorControllerGroup") SpeedControllerGroup
: public wpi::Sendable,
public MotorController,
public wpi::SendableHelper<SpeedControllerGroup> {
public:
template <class... SpeedControllers>
explicit SpeedControllerGroup(SpeedController& speedController,
SpeedControllers&... speedControllers);
explicit SpeedControllerGroup(
std::vector<std::reference_wrapper<SpeedController>>&& speedControllers);
SpeedControllerGroup(SpeedControllerGroup&&) = default;
SpeedControllerGroup& operator=(SpeedControllerGroup&&) = default;
void Set(double speed) override;
double Get() const override;
void SetInverted(bool isInverted) override;
bool GetInverted() const override;
void Disable() override;
void StopMotor() override;
void InitSendable(wpi::SendableBuilder& builder) override;
private:
bool m_isInverted = false;
std::vector<std::reference_wrapper<SpeedController>> m_speedControllers;
void Initialize();
};
} // namespace frc
#include "frc/SpeedControllerGroup.inc"

View File

@@ -1,22 +0,0 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#pragma once
#include <functional>
#include <vector>
#include "frc/SpeedControllerGroup.h"
namespace frc {
template <class... SpeedControllers>
SpeedControllerGroup::SpeedControllerGroup(
SpeedController& speedController, SpeedControllers&... speedControllers)
: m_speedControllers(std::vector<std::reference_wrapper<SpeedController>>{
speedController, speedControllers...}) {
Initialize();
}
} // namespace frc

View File

@@ -11,7 +11,6 @@
#include <hal/Types.h>
#include <units/math.h>
#include <units/time.h>
#include <wpi/deprecated.h>
#include <wpi/priority_queue.h>
#include "frc/IterativeRobotBase.h"
@@ -42,17 +41,6 @@ class TimedRobot : public IterativeRobotBase {
*/
void EndCompetition() override;
/**
* Constructor for TimedRobot.
*
* @deprecated use unit safe constructor instead.
* TimedRobot(units::second_t period = kDefaultPeriod)
*
* @param period Period in seconds.
*/
WPI_DEPRECATED("Use constructor with unit-safety instead.")
explicit TimedRobot(double period);
/**
* Constructor for TimedRobot.
*

View File

@@ -5,7 +5,6 @@
#pragma once
#include <units/time.h>
#include <wpi/deprecated.h>
namespace frc {
@@ -94,18 +93,6 @@ class Timer {
*/
bool HasElapsed(units::second_t period) const;
/**
* Check if the period specified has passed and if it has, advance the start
* time by that period. This is useful to decide if it's time to do periodic
* work without drifting later by the time it took to get around to checking.
*
* @param period The period to check for.
* @return True if the period has passed.
* @deprecated Use AdvanceIfElapsed() instead.
*/
WPI_DEPRECATED("Use AdvanceIfElapsed() instead.")
bool HasPeriodPassed(units::second_t period);
/**
* Check if the period specified has passed and if it has, advance the start
* time by that period. This is useful to decide if it's time to do periodic

View File

@@ -13,18 +13,7 @@
namespace frc {
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable : 4996) // was declared deprecated
#elif defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
class SpeedController;
class MotorController;
/**
* A class for driving differential drive/skid-steer drive platforms such as
@@ -120,7 +109,7 @@ class DifferentialDrive : public RobotDriveBase,
* To pass multiple motors per side, use a MotorControllerGroup. If a motor
* needs to be inverted, do so before passing it in.
*/
DifferentialDrive(SpeedController& leftMotor, SpeedController& rightMotor);
DifferentialDrive(MotorController& leftMotor, MotorController& rightMotor);
~DifferentialDrive() override = default;
@@ -223,16 +212,8 @@ class DifferentialDrive : public RobotDriveBase,
void InitSendable(wpi::SendableBuilder& builder) override;
private:
SpeedController* m_leftMotor;
SpeedController* m_rightMotor;
MotorController* m_leftMotor;
MotorController* m_rightMotor;
};
#if defined(_MSC_VER)
#pragma warning(pop)
#elif defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
} // namespace frc

View File

@@ -15,18 +15,7 @@
namespace frc {
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable : 4996) // was declared deprecated
#elif defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
class SpeedController;
class MotorController;
/**
* A class for driving Killough drive platforms.
@@ -88,8 +77,8 @@ class KilloughDrive : public RobotDriveBase,
* @param rightMotor The motor on the right corner.
* @param backMotor The motor on the back corner.
*/
KilloughDrive(SpeedController& leftMotor, SpeedController& rightMotor,
SpeedController& backMotor);
KilloughDrive(MotorController& leftMotor, MotorController& rightMotor,
MotorController& backMotor);
/**
* Construct a Killough drive with the given motors.
@@ -106,8 +95,8 @@ class KilloughDrive : public RobotDriveBase,
* @param backMotorAngle The angle of the back wheel's forward direction of
* travel.
*/
KilloughDrive(SpeedController& leftMotor, SpeedController& rightMotor,
SpeedController& backMotor, double leftMotorAngle,
KilloughDrive(MotorController& leftMotor, MotorController& rightMotor,
MotorController& backMotor, double leftMotorAngle,
double rightMotorAngle, double backMotorAngle);
~KilloughDrive() override = default;
@@ -173,9 +162,9 @@ class KilloughDrive : public RobotDriveBase,
void InitSendable(wpi::SendableBuilder& builder) override;
private:
SpeedController* m_leftMotor;
SpeedController* m_rightMotor;
SpeedController* m_backMotor;
MotorController* m_leftMotor;
MotorController* m_rightMotor;
MotorController* m_backMotor;
Vector2d m_leftVec;
Vector2d m_rightVec;
@@ -184,12 +173,4 @@ class KilloughDrive : public RobotDriveBase,
bool reported = false;
};
#if defined(_MSC_VER)
#pragma warning(pop)
#elif defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
} // namespace frc

View File

@@ -14,18 +14,7 @@
namespace frc {
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable : 4996) // was declared deprecated
#elif defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
class SpeedController;
class MotorController;
/**
* A class for driving Mecanum drive platforms.
@@ -81,9 +70,9 @@ class MecanumDrive : public RobotDriveBase,
*
* If a motor needs to be inverted, do so before passing it in.
*/
MecanumDrive(SpeedController& frontLeftMotor, SpeedController& rearLeftMotor,
SpeedController& frontRightMotor,
SpeedController& rearRightMotor);
MecanumDrive(MotorController& frontLeftMotor, MotorController& rearLeftMotor,
MotorController& frontRightMotor,
MotorController& rearRightMotor);
~MecanumDrive() override = default;
@@ -148,20 +137,12 @@ class MecanumDrive : public RobotDriveBase,
void InitSendable(wpi::SendableBuilder& builder) override;
private:
SpeedController* m_frontLeftMotor;
SpeedController* m_rearLeftMotor;
SpeedController* m_frontRightMotor;
SpeedController* m_rearRightMotor;
MotorController* m_frontLeftMotor;
MotorController* m_rearLeftMotor;
MotorController* m_frontRightMotor;
MotorController* m_rearRightMotor;
bool reported = false;
};
#if defined(_MSC_VER)
#pragma warning(pop)
#elif defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
} // namespace frc

View File

@@ -7,7 +7,6 @@
#include <memory>
#include <string>
#include <wpi/deprecated.h>
#include <wpi/span.h>
#include "frc/MotorSafety.h"
@@ -72,17 +71,6 @@ class RobotDriveBase : public MotorSafety {
std::string GetDescription() const override = 0;
protected:
/**
* Returns 0.0 if the given value is within the specified range around zero.
* The remaining range between the deadband and 1.0 is scaled from 0.0 to 1.0.
*
* @param value value to clip
* @param deadband range around zero
* @deprecated Use ApplyDeadband() in frc/MathUtil.h.
*/
WPI_DEPRECATED("Use ApplyDeadband() in frc/MathUtil.h")
static double ApplyDeadband(double value, double deadband);
/**
* Renormalize all wheel speeds if the magnitude of any wheel is greater than
* 1.0.

View File

@@ -6,8 +6,6 @@
#include <functional>
#include <wpi/deprecated.h>
namespace wpi {
class Sendable;
} // namespace wpi
@@ -20,17 +18,6 @@ namespace frc {
*/
class LiveWindow final {
public:
/**
* Get an instance of the LiveWindow main class.
*
* This is a singleton to guarantee that there is only a single instance
* regardless of how many times GetInstance is called.
* @deprecated Use the static methods unless guaranteeing LiveWindow is
* instantiated
*/
WPI_DEPRECATED("Use static methods")
static LiveWindow* GetInstance();
/**
* Set function to be called when LiveWindow is enabled.
*

View File

@@ -6,32 +6,66 @@
#include <units/voltage.h>
#include "frc/SpeedController.h"
namespace frc {
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable : 4996) // was declared deprecated
#elif defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
/**
* Interface for motor controlling devices.
*/
class MotorController : public SpeedController {};
class MotorController {
public:
virtual ~MotorController() = default;
#if defined(_MSC_VER)
#pragma warning(pop)
#elif defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
/**
* Common interface for setting the speed of a motor controller.
*
* @param speed The speed to set. Value should be between -1.0 and 1.0.
*/
virtual void Set(double speed) = 0;
/**
* Sets the voltage output of the SpeedController. Compensates for
* the current bus voltage to ensure that the desired voltage is output even
* if the battery voltage is below 12V - highly useful when the voltage
* outputs are "meaningful" (e.g. they come from a feedforward calculation).
*
* <p>NOTE: This function *must* be called regularly in order for voltage
* compensation to work properly - unlike the ordinary set function, it is not
* "set it and forget it."
*
* @param output The voltage to output.
*/
virtual void SetVoltage(units::volt_t output);
/**
* Common interface for getting the current set speed of a motor controller.
*
* @return The current set speed. Value is between -1.0 and 1.0.
*/
virtual double Get() const = 0;
/**
* Common interface for inverting direction of a motor controller.
*
* @param isInverted The state of inversion, true is inverted.
*/
virtual void SetInverted(bool isInverted) = 0;
/**
* Common interface for returning the inversion state of a motor controller.
*
* @return isInverted The state of inversion, true is inverted.
*/
virtual bool GetInverted() const = 0;
/**
* Common interface for disabling a motor.
*/
virtual void Disable() = 0;
/**
* Common interface to stop the motor until Set is called again.
*/
virtual void StopMotor() = 0;
};
} // namespace frc

View File

@@ -8,7 +8,6 @@
#include <string_view>
#include <wpi/StringMap.h>
#include <wpi/deprecated.h>
#include "frc/smartdashboard/SendableChooserBase.h"
@@ -68,36 +67,6 @@ class SendableChooser : public SendableChooserBase {
*/
void SetDefaultOption(std::string_view name, T object);
/**
* Adds the given object to the list of options.
*
* On the SmartDashboard on the desktop, the object will appear as the given
* name.
*
* @deprecated use AddOption(std::string_view name, T object) instead.
*
* @param name the name of the option
* @param object the option
*/
WPI_DEPRECATED("use AddOption() instead")
void AddObject(std::string_view name, T object) { AddOption(name, object); }
/**
* Add the given object to the list of options and marks it as the default.
*
* Functionally, this is very close to AddOption() except that it will use
* this as the default option if none other is explicitly selected.
*
* @deprecated use SetDefaultOption(std::string_view name, T object) instead.
*
* @param name the name of the option
* @param object the option
*/
WPI_DEPRECATED("use SetDefaultOption() instead")
void AddDefault(std::string_view name, T object) {
SetDefaultOption(name, object);
}
/**
* Returns a copy of the selected option (a raw pointer U* if T =
* std::unique_ptr<U> or a std::weak_ptr<U> if T = std::shared_ptr<U>).