[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:
Peter Johnson
2025-01-25 10:52:19 -08:00
committed by GitHub
parent adbe95e610
commit eee30c49e2
88 changed files with 85 additions and 1356 deletions

View File

@@ -212,19 +212,6 @@ class IterativeRobotBase : public RobotBase {
[[deprecated("Deprecated without replacement.")]]
void SetNetworkTablesFlushEnabled(bool enabled);
/**
* Sets whether LiveWindow operation is enabled during test mode.
*
* @param testLW True to enable, false to disable. Defaults to false.
* @throws if called in test mode.
*/
void EnableLiveWindowInTest(bool testLW);
/**
* Whether LiveWindow operation is enabled during test mode.
*/
bool IsLiveWindowEnabledInTest();
/**
* Gets time period between calls to Periodic() functions.
*/
@@ -260,7 +247,6 @@ class IterativeRobotBase : public RobotBase {
units::second_t m_period;
Watchdog m_watchdog;
bool m_ntFlushEnabled = true;
bool m_lwEnabledInTest = false;
bool m_calledDsConnected = false;
void PrintLoopOverrunMessage();

View File

@@ -54,7 +54,6 @@ class PWM : public wpi::Sendable, public wpi::SendableHelper<PWM> {
* @param channel The PWM channel number. 0-9 are on-board, 10-19 are on the
* MXP port
* @param registerSendable If true, adds this instance to SendableRegistry
* and LiveWindow
*/
explicit PWM(int channel, bool registerSendable = true);

View File

@@ -1,90 +0,0 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#pragma once
#include <functional>
namespace wpi {
class Sendable;
} // namespace wpi
namespace frc {
/**
* The LiveWindow class is the public interface for putting sensors and
* actuators on the LiveWindow.
*/
class LiveWindow final {
public:
/**
* Sets function to be called when LiveWindow is enabled.
*
* @param func function (or nullptr for none)
*/
static void SetEnabledCallback(std::function<void()> func);
/**
* Sets function to be called when LiveWindow is disabled.
*
* @param func function (or nullptr for none)
*/
static void SetDisabledCallback(std::function<void()> func);
/**
* Enable telemetry for a single component.
*
* @param component sendable
*/
static void EnableTelemetry(wpi::Sendable* component);
/**
* Disable telemetry for a single component.
*
* @param component sendable
*/
static void DisableTelemetry(wpi::Sendable* component);
/**
* Disable ALL telemetry.
*/
static void DisableAllTelemetry();
/**
* Enable ALL telemetry.
*/
static void EnableAllTelemetry();
/**
* Returns true if LiveWindow is enabled.
*
* @return True if LiveWindow is enabled.
*/
static bool IsEnabled();
/**
* Change the enabled status of LiveWindow.
*
* If it changes to enabled, start livewindow running otherwise stop it
*/
static void SetEnabled(bool enabled);
/**
* Tell all the sensors to update (send) their values.
*
* Actuators are handled through callbacks on their value changing from the
* SmartDashboard widgets.
*/
static void UpdateValues();
private:
LiveWindow() = default;
/**
* Updates the entries, without using a mutex or lock.
*/
static void UpdateValuesUnsafe();
};
} // namespace frc

View File

@@ -73,18 +73,6 @@ class SendableBuilderImpl : public nt::NTSendableBuilder {
*/
void StopListeners();
/**
* Start LiveWindow mode by hooking the setters for all properties. Also
* calls the SafeState function if one was provided.
*/
void StartLiveWindowMode();
/**
* Stop LiveWindow mode by unhooking the setters for all properties. Also
* calls the SafeState function if one was provided.
*/
void StopLiveWindowMode();
/**
* Clear properties.
*/
@@ -92,7 +80,6 @@ class SendableBuilderImpl : public nt::NTSendableBuilder {
void SetSmartDashboardType(std::string_view type) override;
void SetActuator(bool value) override;
void SetSafeState(std::function<void()> func) override;
void SetUpdateTable(wpi::unique_function<void()> func) override;
nt::Topic GetTopic(std::string_view key) override;
@@ -238,7 +225,6 @@ class SendableBuilderImpl : public nt::NTSendableBuilder {
void AddSmallPropertyImpl(Topic topic, Getter getter, Setter setter);
std::vector<std::unique_ptr<Property>> m_properties;
std::function<void()> m_safeState;
std::vector<wpi::unique_function<void()>> m_updateTables;
std::shared_ptr<nt::NetworkTable> m_table;
bool m_controllable = false;