mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-26 01:51:41 +00:00
Simplify Sendable interface (#1864)
This removes the name and subsystem from individual objects, and instead puts this data into a new singleton class, SendableRegistry. Much of LiveWindow has been refactored into SendableRegistry. In C++, a new CRTP helper class, SendableHelper, has been added to provide move and destruction functionality. Shims for GetName, SetName, GetSubsystem, and SetSubsystem have been added to Command and Subsystem (both old and new), and also to SendableHelper to prevent code breakage. This deprecates SendableBase in preparation for future removal.
This commit is contained in:
@@ -19,10 +19,13 @@
|
||||
#include "frc/PIDOutput.h"
|
||||
#include "frc/PIDSource.h"
|
||||
#include "frc/Timer.h"
|
||||
#include "frc/smartdashboard/SendableBase.h"
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
#include "frc/smartdashboard/SendableHelper.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
class SendableBuilder;
|
||||
|
||||
/**
|
||||
* Class implements a PID Control Loop.
|
||||
*
|
||||
@@ -33,7 +36,10 @@ namespace frc {
|
||||
* in the integral and derivative calculations. Therefore, the sample rate
|
||||
* affects the controller's behavior for a given set of PID constants.
|
||||
*/
|
||||
class PIDBase : public SendableBase, public PIDInterface, public PIDOutput {
|
||||
class PIDBase : public PIDInterface,
|
||||
public PIDOutput,
|
||||
public Sendable,
|
||||
public SendableHelper<PIDBase> {
|
||||
public:
|
||||
/**
|
||||
* Allocate a PID object with the given constants for P, I, D.
|
||||
@@ -58,7 +64,7 @@ class PIDBase : public SendableBase, public PIDInterface, public PIDOutput {
|
||||
PIDBase(double p, double i, double d, double f, PIDSource& source,
|
||||
PIDOutput& output);
|
||||
|
||||
~PIDBase() override = default;
|
||||
virtual ~PIDBase() = default;
|
||||
|
||||
PIDBase(PIDBase&&) = default;
|
||||
PIDBase& operator=(PIDBase&&) = default;
|
||||
|
||||
Reference in New Issue
Block a user