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

@@ -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>).