mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +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:
@@ -8,16 +8,13 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include <HAL/Counter.h>
|
||||
#include <HAL/Types.h>
|
||||
|
||||
#include "AnalogTrigger.h"
|
||||
#include "CounterBase.h"
|
||||
#include "LiveWindow/LiveWindowSendable.h"
|
||||
#include "SensorBase.h"
|
||||
#include "networktables/NetworkTableEntry.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
@@ -33,9 +30,7 @@ class DigitalGlitchFilter;
|
||||
* All counters will immediately start counting - Reset() them if you need them
|
||||
* to be zeroed before use.
|
||||
*/
|
||||
class Counter : public SensorBase,
|
||||
public CounterBase,
|
||||
public LiveWindowSendable {
|
||||
class Counter : public SensorBase, public CounterBase {
|
||||
public:
|
||||
enum Mode {
|
||||
kTwoPulse = 0,
|
||||
@@ -53,7 +48,7 @@ class Counter : public SensorBase,
|
||||
DigitalSource* downSource, bool inverted);
|
||||
Counter(EncodingType encodingType, std::shared_ptr<DigitalSource> upSource,
|
||||
std::shared_ptr<DigitalSource> downSource, bool inverted);
|
||||
virtual ~Counter();
|
||||
~Counter() override;
|
||||
|
||||
void SetUpSource(int channel);
|
||||
void SetUpSource(AnalogTrigger* analogTrigger, AnalogTriggerType triggerType);
|
||||
@@ -96,11 +91,7 @@ class Counter : public SensorBase,
|
||||
int GetSamplesToAverage() const;
|
||||
int GetFPGAIndex() const { return m_index; }
|
||||
|
||||
void UpdateTable() override;
|
||||
void StartLiveWindowMode() override;
|
||||
void StopLiveWindowMode() override;
|
||||
std::string GetSmartDashboardType() const override;
|
||||
void InitTable(std::shared_ptr<nt::NetworkTable> subTable) override;
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
|
||||
protected:
|
||||
// Makes the counter count up.
|
||||
@@ -115,7 +106,6 @@ class Counter : public SensorBase,
|
||||
private:
|
||||
int m_index = 0; // The index of this counter.
|
||||
|
||||
nt::NetworkTableEntry m_valueEntry;
|
||||
friend class DigitalGlitchFilter;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user