mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-26 01:51:41 +00:00
[wpilib] Remove LiveWindow (#7733)
This will be replaced by a different mechanism, but removing it eases the initial implementation burden of a new Telemetry/Sendable framework.
This commit is contained in:
@@ -18,7 +18,6 @@ import edu.wpi.first.wpilibj.RobotState;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.Watchdog;
|
||||
import edu.wpi.first.wpilibj.event.EventLoop;
|
||||
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
|
||||
import edu.wpi.first.wpilibj2.command.Command.InterruptionBehavior;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
@@ -101,13 +100,7 @@ public final class CommandScheduler implements Sendable, AutoCloseable {
|
||||
|
||||
CommandScheduler() {
|
||||
HAL.report(tResourceType.kResourceType_Command, tInstances.kCommand2_Scheduler);
|
||||
SendableRegistry.addLW(this, "Scheduler");
|
||||
LiveWindow.setEnabledListener(
|
||||
() -> {
|
||||
disable();
|
||||
cancelAll();
|
||||
});
|
||||
LiveWindow.setDisabledListener(this::enable);
|
||||
SendableRegistry.add(this, "Scheduler");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -123,8 +116,6 @@ public final class CommandScheduler implements Sendable, AutoCloseable {
|
||||
@Override
|
||||
public void close() {
|
||||
SendableRegistry.remove(this);
|
||||
LiveWindow.setEnabledListener(null);
|
||||
LiveWindow.setDisabledListener(null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,7 +20,7 @@ public abstract class SubsystemBase implements Subsystem, Sendable {
|
||||
public SubsystemBase() {
|
||||
String name = this.getClass().getSimpleName();
|
||||
name = name.substring(name.lastIndexOf('.') + 1);
|
||||
SendableRegistry.addLW(this, name, name);
|
||||
SendableRegistry.add(this, name, name);
|
||||
CommandScheduler.getInstance().registerSubsystem(this);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public abstract class SubsystemBase implements Subsystem, Sendable {
|
||||
*/
|
||||
@SuppressWarnings("this-escape")
|
||||
public SubsystemBase(String name) {
|
||||
SendableRegistry.addLW(this, name, name);
|
||||
SendableRegistry.add(this, name, name);
|
||||
CommandScheduler.getInstance().registerSubsystem(this);
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ public abstract class SubsystemBase implements Subsystem, Sendable {
|
||||
* @param child sendable
|
||||
*/
|
||||
public void addChild(String name, Sendable child) {
|
||||
SendableRegistry.addLW(child, getSubsystem(), name);
|
||||
SendableRegistry.add(child, getSubsystem(), name);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include <frc/RobotBase.h>
|
||||
#include <frc/RobotState.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
#include <frc/livewindow/LiveWindow.h>
|
||||
#include <hal/FRCUsageReporting.h>
|
||||
#include <hal/HALBase.h>
|
||||
#include <networktables/IntegerArrayTopic.h>
|
||||
@@ -72,19 +71,11 @@ CommandScheduler::CommandScheduler()
|
||||
}) {
|
||||
HAL_Report(HALUsageReporting::kResourceType_Command,
|
||||
HALUsageReporting::kCommand2_Scheduler);
|
||||
wpi::SendableRegistry::AddLW(this, "Scheduler");
|
||||
frc::LiveWindow::SetEnabledCallback([this] {
|
||||
this->Disable();
|
||||
this->CancelAll();
|
||||
});
|
||||
frc::LiveWindow::SetDisabledCallback([this] { this->Enable(); });
|
||||
wpi::SendableRegistry::Add(this, "Scheduler");
|
||||
}
|
||||
|
||||
CommandScheduler::~CommandScheduler() {
|
||||
wpi::SendableRegistry::Remove(this);
|
||||
frc::LiveWindow::SetEnabledCallback(nullptr);
|
||||
frc::LiveWindow::SetDisabledCallback(nullptr);
|
||||
|
||||
std::unique_ptr<Impl>().swap(m_impl);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,12 +15,12 @@
|
||||
using namespace frc2;
|
||||
|
||||
SubsystemBase::SubsystemBase() {
|
||||
wpi::SendableRegistry::AddLW(this, GetTypeName(*this));
|
||||
wpi::SendableRegistry::Add(this, GetTypeName(*this));
|
||||
CommandScheduler::GetInstance().RegisterSubsystem({this});
|
||||
}
|
||||
|
||||
SubsystemBase::SubsystemBase(std::string_view name) {
|
||||
wpi::SendableRegistry::AddLW(this, name);
|
||||
wpi::SendableRegistry::Add(this, name);
|
||||
CommandScheduler::GetInstance().RegisterSubsystem({this});
|
||||
}
|
||||
|
||||
@@ -71,5 +71,5 @@ void SubsystemBase::SetSubsystem(std::string_view name) {
|
||||
}
|
||||
|
||||
void SubsystemBase::AddChild(std::string name, wpi::Sendable* child) {
|
||||
wpi::SendableRegistry::AddLW(child, GetSubsystem(), name);
|
||||
wpi::SendableRegistry::Add(child, GetSubsystem(), name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user