mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-29 02:21:44 +00:00
Update to 2018_v4 image and new build system. (#598)
* Revert "Force OpenCV to 3.1.0 (#602)"
This reverts commit 50ed55e8e2.
* Removes Simulation
* Removes old build system
* Removes old gtest
* Adds new gmock and gtest
* Updates to new ni-libraries
* removes MyRobot (to be replaced)
* moves files to new location
* Adds new sim backend and new test executables
* updates .styleguide and .gitignore
* Changes cpp WPILibVersion to a function
MSVC throws an AV with the old version.
* Disables USBCamera on all systems except for linux
* 2018 NI Libraries
* New build system
This commit is contained in:
committed by
Peter Johnson
parent
50ed55e8e2
commit
e1195e8b9d
87
wpilibc/src/main/native/include/LiveWindow/LiveWindow.h
Normal file
87
wpilibc/src/main/native/include/LiveWindow/LiveWindow.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2012-2017. 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 the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "Commands/Scheduler.h"
|
||||
#include "LiveWindow/LiveWindowSendable.h"
|
||||
#include "tables/ITable.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
struct LiveWindowComponent {
|
||||
std::string subsystem;
|
||||
std::string name;
|
||||
bool isSensor = false;
|
||||
|
||||
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.
|
||||
*/
|
||||
class LiveWindow {
|
||||
public:
|
||||
static LiveWindow* GetInstance();
|
||||
void Run();
|
||||
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);
|
||||
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);
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
@@ -0,0 +1,38 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2012-2017. 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 the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "SmartDashboard/Sendable.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
/**
|
||||
* Live Window Sendable is a special type of object sendable to the live window.
|
||||
*/
|
||||
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;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
@@ -0,0 +1,23 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2012-2017. 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 the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "tables/ITable.h"
|
||||
#include "tables/ITableListener.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
class LiveWindowStatusListener : public ITableListener {
|
||||
public:
|
||||
virtual void ValueChanged(ITable* source, llvm::StringRef key,
|
||||
std::shared_ptr<nt::Value> value, bool isNew);
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
Reference in New Issue
Block a user