mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-06 03:31:43 +00:00
WPILib Reorganization
This is a major restructuring of the WPILib repository to simply build procedures and remove the remnants of Maven from everything except the eclipse plugins. Gradle files have been largely simplified or rewritten, taking advantage of splitting up parts of the build into separate build files for ease of reading. The eclipse plugins are now in a separate project, as is ntcore. All dependencies are resolved via Maven dependencies, with the Jenkins-maintained WPILib repo. Project structures have also been simplified: we no longer have separate subprojects inside wpilibc and wpilibj. Where possible, these changes hav been done with git renames, to make sure we still have full history for all repositories. Other unrelated subprojects have also been broken out: OutlineViewer is now a separate project. Change-Id: Ib4e2a6e1a2f66427a14f16612b0e0d69ed661878
This commit is contained in:
87
wpilibc/shared/include/LiveWindow/LiveWindow.h
Normal file
87
wpilibc/shared/include/LiveWindow/LiveWindow.h
Normal file
@@ -0,0 +1,87 @@
|
||||
#ifndef _LIVE_WINDOW_H
|
||||
#define _LIVE_WINDOW_H
|
||||
|
||||
#include "LiveWindow/LiveWindowSendable.h"
|
||||
#include "tables/ITable.h"
|
||||
#include "Commands/Scheduler.h"
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
|
||||
struct LiveWindowComponent {
|
||||
std::string subsystem;
|
||||
std::string name;
|
||||
bool isSensor;
|
||||
|
||||
LiveWindowComponent() = default;
|
||||
LiveWindowComponent(std::string subsystem, std::string name, bool isSensor) {
|
||||
this->subsystem = subsystem;
|
||||
this->name = name;
|
||||
this->isSensor = isSensor;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* The LiveWindow class is the public interface for putting sensors and
|
||||
* actuators
|
||||
* on the LiveWindow.
|
||||
*
|
||||
* @author Brad Miller
|
||||
*/
|
||||
class LiveWindow {
|
||||
public:
|
||||
static LiveWindow *GetInstance();
|
||||
void Run();
|
||||
DEPRECATED(
|
||||
"Raw pointers are deprecated; pass the component using shared_ptr "
|
||||
"instead.")
|
||||
void AddSensor(const std::string &subsystem, const std::string &name,
|
||||
LiveWindowSendable *component);
|
||||
void AddSensor(const std::string &subsystem, const std::string &name,
|
||||
LiveWindowSendable &component);
|
||||
void AddSensor(const std::string &subsystem, const std::string &name,
|
||||
std::shared_ptr<LiveWindowSendable> component);
|
||||
DEPRECATED(
|
||||
"Raw pointers are deprecated; pass the component using shared_ptr "
|
||||
"instead.")
|
||||
void AddActuator(const std::string &subsystem, const std::string &name,
|
||||
LiveWindowSendable *component);
|
||||
void AddActuator(const std::string &subsystem, const std::string &name,
|
||||
LiveWindowSendable &component);
|
||||
void AddActuator(const std::string &subsystem, const std::string &name,
|
||||
std::shared_ptr<LiveWindowSendable> component);
|
||||
|
||||
DEPRECATED(
|
||||
"Raw pointers are deprecated; pass the component using shared_ptr "
|
||||
"instead.")
|
||||
void AddSensor(std::string type, int channel, LiveWindowSendable *component);
|
||||
void AddActuator(std::string type, int channel,
|
||||
LiveWindowSendable *component);
|
||||
void AddActuator(std::string type, int module, int channel,
|
||||
LiveWindowSendable *component);
|
||||
|
||||
bool IsEnabled() const { return m_enabled; }
|
||||
void SetEnabled(bool enabled);
|
||||
|
||||
protected:
|
||||
LiveWindow();
|
||||
virtual ~LiveWindow() = default;
|
||||
|
||||
private:
|
||||
void UpdateValues();
|
||||
void Initialize();
|
||||
void InitializeLiveWindowComponents();
|
||||
|
||||
std::vector<std::shared_ptr<LiveWindowSendable>> m_sensors;
|
||||
std::map<std::shared_ptr<LiveWindowSendable>, LiveWindowComponent> m_components;
|
||||
|
||||
std::shared_ptr<ITable> m_liveWindowTable;
|
||||
std::shared_ptr<ITable> m_statusTable;
|
||||
|
||||
Scheduler *m_scheduler;
|
||||
|
||||
bool m_enabled = false;
|
||||
bool m_firstTime = true;
|
||||
};
|
||||
|
||||
#endif
|
||||
38
wpilibc/shared/include/LiveWindow/LiveWindowSendable.h
Normal file
38
wpilibc/shared/include/LiveWindow/LiveWindowSendable.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) Patrick Plenefisch 2012. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef LIVEWINDOWSENDABLE_H_
|
||||
#define LIVEWINDOWSENDABLE_H_
|
||||
|
||||
#include "SmartDashboard/Sendable.h"
|
||||
|
||||
/**
|
||||
* Live Window Sendable is a special type of object sendable to the live window.
|
||||
*
|
||||
* @author Patrick Plenefisch
|
||||
*/
|
||||
class LiveWindowSendable : public Sendable {
|
||||
public:
|
||||
/**
|
||||
* Update the table for this sendable object with the latest
|
||||
* values.
|
||||
*/
|
||||
virtual void UpdateTable() = 0;
|
||||
|
||||
/**
|
||||
* Start having this sendable object automatically respond to
|
||||
* value changes reflect the value on the table.
|
||||
*/
|
||||
virtual void StartLiveWindowMode() = 0;
|
||||
|
||||
/**
|
||||
* Stop having this sendable object automatically respond to value
|
||||
* changes.
|
||||
*/
|
||||
virtual void StopLiveWindowMode() = 0;
|
||||
};
|
||||
|
||||
#endif /* LIVEWINDOWSENDABLE_H_ */
|
||||
13
wpilibc/shared/include/LiveWindow/LiveWindowStatusListener.h
Normal file
13
wpilibc/shared/include/LiveWindow/LiveWindowStatusListener.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef _LIVE_WINDOW_STATUS_LISTENER_H
|
||||
#define _LIVE_WINDOW_STATUS_LISTENER_H
|
||||
|
||||
#include "tables/ITable.h"
|
||||
#include "tables/ITableListener.h"
|
||||
|
||||
class LiveWindowStatusListener : public ITableListener {
|
||||
public:
|
||||
virtual void ValueChanged(ITable* source, llvm::StringRef key,
|
||||
std::shared_ptr<nt::Value> value, bool isNew);
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user