Split Sendable into NT and non-NT portions (#3432)

The non-NT portion has been moved to wpiutil.
The NT portion has been moved to ntcore (as NTSendable).

SendableBuilder similarly split and moved.

SendableRegistry moved to wpiutil.

In C++, SendableHelper also moved to wpiutil.

This enables use of Sendable from wpimath and also enables
moving several classes from wpilib to wpimath.
This commit is contained in:
Peter Johnson
2021-06-13 16:38:05 -07:00
committed by GitHub
parent ef4ea84cb5
commit b417d961ec
196 changed files with 1147 additions and 891 deletions

View File

@@ -7,15 +7,16 @@
#include <functional>
#include <vector>
#include <wpi/sendable/Sendable.h>
#include <wpi/sendable/SendableHelper.h>
#include "frc/motorcontrol/MotorController.h"
#include "frc/smartdashboard/Sendable.h"
#include "frc/smartdashboard/SendableHelper.h"
namespace frc {
class MotorControllerGroup : public Sendable,
class MotorControllerGroup : public wpi::Sendable,
public MotorController,
public SendableHelper<MotorControllerGroup> {
public wpi::SendableHelper<MotorControllerGroup> {
public:
template <class... MotorControllers>
explicit MotorControllerGroup(MotorController& motorController,
@@ -33,7 +34,7 @@ class MotorControllerGroup : public Sendable,
void Disable() override;
void StopMotor() override;
void InitSendable(SendableBuilder& builder) override;
void InitSendable(wpi::SendableBuilder& builder) override;
private:
bool m_isInverted = false;

View File

@@ -6,24 +6,23 @@
#include <string>
#include <wpi/sendable/Sendable.h>
#include <wpi/sendable/SendableHelper.h>
#include "frc/DigitalOutput.h"
#include "frc/MotorSafety.h"
#include "frc/PWM.h"
#include "frc/motorcontrol/MotorController.h"
#include "frc/smartdashboard/Sendable.h"
#include "frc/smartdashboard/SendableHelper.h"
namespace frc {
class SendableBuilder;
/**
* Nidec Brushless Motor.
*/
class NidecBrushless : public MotorController,
public MotorSafety,
public Sendable,
public SendableHelper<NidecBrushless> {
public wpi::Sendable,
public wpi::SendableHelper<NidecBrushless> {
public:
/**
* Constructor.
@@ -86,7 +85,7 @@ class NidecBrushless : public MotorController,
int GetChannel() const;
// Sendable interface
void InitSendable(SendableBuilder& builder) override;
void InitSendable(wpi::SendableBuilder& builder) override;
private:
bool m_isInverted = false;

View File

@@ -7,11 +7,12 @@
#include <string>
#include <string_view>
#include <wpi/sendable/Sendable.h>
#include <wpi/sendable/SendableHelper.h>
#include "frc/MotorSafety.h"
#include "frc/PWM.h"
#include "frc/motorcontrol/MotorController.h"
#include "frc/smartdashboard/Sendable.h"
#include "frc/smartdashboard/SendableHelper.h"
namespace frc {
@@ -20,8 +21,8 @@ namespace frc {
*/
class PWMMotorController : public MotorController,
public MotorSafety,
public Sendable,
public SendableHelper<PWMMotorController> {
public wpi::Sendable,
public wpi::SendableHelper<PWMMotorController> {
public:
PWMMotorController(PWMMotorController&&) = default;
PWMMotorController& operator=(PWMMotorController&&) = default;
@@ -67,7 +68,7 @@ class PWMMotorController : public MotorController,
*/
PWMMotorController(std::string_view name, int channel);
void InitSendable(SendableBuilder& builder) override;
void InitSendable(wpi::SendableBuilder& builder) override;
PWM m_pwm;