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:
Peter Johnson
2017-12-04 23:28:33 -08:00
committed by GitHub
parent 3befc7015b
commit f9bece2ffb
213 changed files with 3704 additions and 3758 deletions

View File

@@ -11,9 +11,10 @@
#include <set>
#include <string>
#include <llvm/Twine.h>
#include "ErrorBase.h"
#include "SmartDashboard/NamedSendable.h"
#include "networktables/NetworkTableEntry.h"
#include "SmartDashboard/SendableBase.h"
namespace frc {
@@ -44,16 +45,16 @@ class Subsystem;
* @see CommandGroup
* @see Subsystem
*/
class Command : public ErrorBase, public NamedSendable {
class Command : public ErrorBase, public SendableBase {
friend class CommandGroup;
friend class Scheduler;
public:
Command();
explicit Command(const std::string& name);
explicit Command(const llvm::Twine& name);
explicit Command(double timeout);
Command(const std::string& name, double timeout);
virtual ~Command();
Command(const llvm::Twine& name, double timeout);
~Command() override = default;
double TimeSinceInitialized() const;
void Requires(Subsystem* s);
bool IsCanceled() const;
@@ -76,6 +77,7 @@ class Command : public ErrorBase, public NamedSendable {
bool IsTimedOut() const;
bool AssertUnlocked(const std::string& message);
void SetParent(CommandGroup* parent);
bool IsParented() const;
void ClearRequirements();
virtual void Initialize();
@@ -116,9 +118,6 @@ class Command : public ErrorBase, public NamedSendable {
void StartRunning();
void StartTiming();
// The name of this command
std::string m_name;
// The time since this command was initialized
double m_startTime = -1;
@@ -153,14 +152,7 @@ class Command : public ErrorBase, public NamedSendable {
static int m_commandCounter;
public:
std::string GetName() const override;
void InitTable(std::shared_ptr<nt::NetworkTable> subtable) override;
std::string GetSmartDashboardType() const override;
private:
nt::NetworkTableEntry m_runningEntry;
nt::NetworkTableEntry m_isParentedEntry;
NT_EntryListener m_runningListener = 0;
void InitSendable(SendableBuilder& builder) override;
};
} // namespace frc