mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-04 03:11:43 +00:00
Update LiveWindow to provide continuous telemetry. (#771)
LiveWindow.updateValues() is now called from IterativeRobotBase on every loop iteration. Telemetry for all WPILib classes is enabled by default; it can be disabled for specific classes using LiveWindow.disableTelemetry(), or all telemetry can be disabled using LiveWindow.disableAllTelemetry(). This necessitated changing the hook methodology into other classes to be more property-based rather than each class providing multiple functions. This had the benefit of reducing boilerplate and increasing consistency. - Remove NamedSendable, add name to Sendable. - Provide SendableBase abstract class. - Deprecate LiveWindow addSensor/addActuator interfaces. - Add LiveWindow support to drive classes. - Add addChild() helper functions to Subsystem. - Fix inheritance hierarchy. Now only sensors inherit from SensorBase. Other devices inherit from some combination of SendableBase, ErrorBase, or nothing.
This commit is contained in:
@@ -7,14 +7,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include <HAL/Types.h>
|
||||
|
||||
#include "LiveWindow/LiveWindowSendable.h"
|
||||
#include "SolenoidBase.h"
|
||||
#include "networktables/NetworkTableEntry.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
@@ -25,23 +20,19 @@ namespace frc {
|
||||
* The DoubleSolenoid class is typically used for pneumatics solenoids that
|
||||
* have two positions controlled by two separate channels.
|
||||
*/
|
||||
class DoubleSolenoid : public SolenoidBase, public LiveWindowSendable {
|
||||
class DoubleSolenoid : public SolenoidBase {
|
||||
public:
|
||||
enum Value { kOff, kForward, kReverse };
|
||||
|
||||
explicit DoubleSolenoid(int forwardChannel, int reverseChannel);
|
||||
DoubleSolenoid(int moduleNumber, int forwardChannel, int reverseChannel);
|
||||
virtual ~DoubleSolenoid();
|
||||
~DoubleSolenoid() override;
|
||||
virtual void Set(Value value);
|
||||
virtual Value Get() const;
|
||||
bool IsFwdSolenoidBlackListed() const;
|
||||
bool IsRevSolenoidBlackListed() const;
|
||||
|
||||
void UpdateTable();
|
||||
void StartLiveWindowMode();
|
||||
void StopLiveWindowMode();
|
||||
std::string GetSmartDashboardType() const;
|
||||
void InitTable(std::shared_ptr<nt::NetworkTable> subTable);
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
|
||||
private:
|
||||
int m_forwardChannel; // The forward channel on the module to control.
|
||||
@@ -50,9 +41,6 @@ class DoubleSolenoid : public SolenoidBase, public LiveWindowSendable {
|
||||
int m_reverseMask; // The mask for the reverse channel.
|
||||
HAL_SolenoidHandle m_forwardHandle = HAL_kInvalidHandle;
|
||||
HAL_SolenoidHandle m_reverseHandle = HAL_kInvalidHandle;
|
||||
|
||||
nt::NetworkTableEntry m_valueEntry;
|
||||
NT_EntryListener m_valueListener = 0;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
|
||||
Reference in New Issue
Block a user