burrow-pi-img/deps/tools/configServer/src/VisionStatus.h
Peter Johnson c85fd9f33c
Revamp image to build dependencies as part of stages (#83)
Fixes #17.

Stage 2 is fairly minimal, stage 3 builds/installs OpenCV and WPILib et al, and stage 4
builds/installs the FRCVision webdash and adds the vision examples.

Other changes:
- OpenCV compiled with ffmpeg, OpenBLAS, and libgtk (fixes #79, fixes #80)
- OpenBLAS added to image (fixes #65)
- C++ Makefile is more easily extensible (fixes #71)
- Sources for everything are bundled into image into /usr/src
- README updated (fixes #16)
- pkg-config files for wpilibc et al are now installed and C++ Makefile uses them (if compiled local to Pi)
- Both dynamic and static libs are included in image

The only downside of all these changes (particularly the ffmpeg, OpenBLAS, and libgtk inclusion)
is the image size is now over 3GB (800MB compressed). The previous image didn't quite fit on a
2GB card however.
2019-02-02 23:37:18 -08:00

67 lines
1.9 KiB
C++

/*----------------------------------------------------------------------------*/
/* Copyright (c) 2018 FIRST. 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. */
/*----------------------------------------------------------------------------*/
#ifndef RPICONFIGSERVER_VISIONSTATUS_H_
#define RPICONFIGSERVER_VISIONSTATUS_H_
#include <functional>
#include <memory>
#include <vector>
#include <cscore.h>
#include <wpi/Signal.h>
#include <wpi/StringRef.h>
#include <wpi/uv/Loop.h>
namespace wpi {
class json;
namespace uv {
class Buffer;
} // namespace uv
} // namespace wpi
class VisionStatus {
struct private_init {};
public:
explicit VisionStatus(const private_init&) {}
VisionStatus(const VisionStatus&) = delete;
VisionStatus& operator=(const VisionStatus&) = delete;
void SetLoop(std::shared_ptr<wpi::uv::Loop> loop);
void Up(std::function<void(wpi::StringRef)> onFail);
void Down(std::function<void(wpi::StringRef)> onFail);
void Terminate(std::function<void(wpi::StringRef)> onFail);
void Kill(std::function<void(wpi::StringRef)> onFail);
void UpdateStatus();
void ConsoleLog(wpi::uv::Buffer& buf, size_t len);
void UpdateCameraList();
wpi::sig::Signal<const wpi::json&> update;
wpi::sig::Signal<const wpi::json&> log;
wpi::sig::Signal<const wpi::json&> cameraList;
static std::shared_ptr<VisionStatus> GetInstance();
private:
void RunSvc(const char* cmd, std::function<void(wpi::StringRef)> onFail);
void RefreshCameraList();
std::shared_ptr<wpi::uv::Loop> m_loop;
struct CameraInfo {
cs::UsbCameraInfo info;
std::vector<cs::VideoMode> modes;
};
std::vector<CameraInfo> m_cameraInfo;
};
#endif // RPICONFIGSERVER_VISIONSTATUS_H_