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

@@ -45,8 +45,6 @@ void Robot::TeleopPeriodic() {
frc::Scheduler::GetInstance()->Run();
}
void Robot::TestPeriodic() {
m_lw.Run();
}
void Robot::TestPeriodic() {}
START_ROBOT_CLASS(Robot)

View File

@@ -8,8 +8,10 @@
#pragma once
#include <Commands/Command.h>
#include <Commands/Scheduler.h>
#include <IterativeRobot.h>
#include <LiveWindow/LiveWindow.h>
#include <SmartDashboard/SmartDashboard.h>
#include "Commands/Autonomous.h"
#include "OI.h"

View File

@@ -7,12 +7,10 @@
#include "Claw.h"
#include <LiveWindow/LiveWindow.h>
Claw::Claw()
: frc::Subsystem("Claw") {
// Let's show everything on the LiveWindow
// frc::LiveWindow::GetInstance()->AddActuator("Claw", "Motor", &motor);
AddChild("Motor", m_motor);
}
void Claw::InitDefaultCommand() {}

View File

@@ -8,7 +8,7 @@
#include "DriveTrain.h"
#include <Joystick.h>
#include <LiveWindow/LiveWindow.h>
#include <SmartDashboard/SmartDashboard.h>
#include "../Commands/TankDriveWithJoystick.h"
@@ -31,25 +31,14 @@ DriveTrain::DriveTrain()
#endif
// Let's show everything on the LiveWindow
// frc::LiveWindow::GetInstance()->AddActuator("Drive Train",
// "Front_Left Motor", &m_frontLeft);
// frc::LiveWindow::GetInstance()->AddActuator("Drive Train",
// "Rear Left Motor", &m_rearLeft);
// frc::LiveWindow::GetInstance()->AddActuator("Drive Train",
// "Front Right Motor", &m_frontRight);
// frc::LiveWindow::GetInstance()->AddActuator("Drive Train",
// "Rear Right Motor", &m_rearRight);
// frc::LiveWindow::GetInstance()->AddSensor("Drive Train", "Left
// Encoder",
// &m_leftEncoder);
// frc::LiveWindow::GetInstance()->AddSensor("Drive Train", "Right
// Encoder",
// &m_rightEncoder);
// frc::LiveWindow::GetInstance()->AddSensor("Drive Train",
// "Rangefinder",
// &m_rangefinder);
// frc::LiveWindow::GetInstance()->AddSensor("Drive Train", "Gyro",
// &m_gyro);
// AddChild("Front_Left Motor", m_frontLeft);
// AddChild("Rear Left Motor", m_rearLeft);
// AddChild("Front Right Motor", m_frontRight);
// AddChild("Rear Right Motor", m_rearRight);
AddChild("Left Encoder", m_leftEncoder);
AddChild("Right Encoder", m_rightEncoder);
AddChild("Rangefinder", m_rangefinder);
AddChild("Gyro", m_gyro);
}
/**

View File

@@ -18,11 +18,8 @@ Elevator::Elevator()
SetAbsoluteTolerance(0.005);
// Let's show everything on the LiveWindow
// frc::LiveWindow::GetInstance()->AddActuator("Elevator", "Motor",
// &m_motor);
// frc::LiveWindow::GetInstance()->AddSensor("Elevator", "Pot", &m_pot);
// frc::LiveWindow::GetInstance()->AddActuator("Elevator", "PID",
// GetPIDController());
AddChild("Motor", m_motor);
AddChild("Pot", &m_pot);
}
void Elevator::InitDefaultCommand() {}

View File

@@ -7,7 +7,6 @@
#include "Wrist.h"
#include <LiveWindow/LiveWindow.h>
#include <SmartDashboard/SmartDashboard.h>
Wrist::Wrist()
@@ -18,11 +17,8 @@ Wrist::Wrist()
SetAbsoluteTolerance(2.5);
// Let's show everything on the LiveWindow
// frc::LiveWindow::GetInstance()->AddActuator("Wrist", "Motor",
// &motor);
// frc::LiveWindow::GetInstance()->AddSensor("Wrist", "Pot", &pot);
frc::LiveWindow::GetInstance()->AddActuator(
"Wrist", "PID", GetPIDController());
AddChild("Motor", m_motor);
AddChild("Pot", m_pot);
}
void Wrist::InitDefaultCommand() {}