Skip to content

Commit

Permalink
Merge pull request #12 from FRC3407/update-deps
Browse files Browse the repository at this point in the history
fix ntables, update neon
  • Loading branch information
S1ink committed Feb 13, 2023
2 parents 40cc6f8 + 7b32c3c commit 449de33
Show file tree
Hide file tree
Showing 16 changed files with 483 additions and 170 deletions.
10 changes: 9 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,15 @@
"unordered_set": "cpp",
"future": "cpp",
"variant": "cpp",
"span": "cpp"
"span": "cpp",
"any": "cpp",
"bitset": "cpp",
"cfenv": "cpp",
"numbers": "cpp",
"ranges": "cpp",
"scoped_allocator": "cpp",
"shared_mutex": "cpp",
"typeindex": "cpp"
},
"cmake.configureOnOpen": false
}
8 changes: 4 additions & 4 deletions lib-vs/obj/tfmodel.cpp.pic.d
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ obj/tfmodel.cpp.pic.o: src\core/tfmodel.cpp src\core/tfmodel.h \
include/networktables/NetworkTableInstance.h \
include/networktables/NetworkTableInstance.inc \
include/networktables/Topic.h include/networktables/Topic.inc \
include/networktables/DoubleTopic.h \
include/networktables/DoubleTopic.inc \
include/networktables/IntegerTopic.h \
include/networktables/IntegerTopic.inc \
include/cameraserver/CameraServer.h include/cscore.h include/cscore_c.h \
include/cscore_cpp.h include/cscore_oo.h include/cscore_oo.inc \
include/cscore_cv.h include/cameraserver/CameraServer.inc \
Expand Down Expand Up @@ -320,8 +320,8 @@ include/networktables/NetworkTableInstance.h:
include/networktables/NetworkTableInstance.inc:
include/networktables/Topic.h:
include/networktables/Topic.inc:
include/networktables/DoubleTopic.h:
include/networktables/DoubleTopic.inc:
include/networktables/IntegerTopic.h:
include/networktables/IntegerTopic.inc:
include/cameraserver/CameraServer.h:
include/cscore.h:
include/cscore_c.h:
Expand Down
8 changes: 4 additions & 4 deletions lib-vs/obj/visioncamera.cpp.pic.d
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ obj/visioncamera.cpp.pic.o: src\core/visioncamera.cpp \
include/networktables/NetworkTableEntry.inc \
include/networktables/NetworkTableInstance.inc \
include/networktables/Topic.h include/networktables/Topic.inc \
include/networktables/DoubleTopic.h \
include/networktables/DoubleTopic.inc \
include/networktables/IntegerTopic.h \
include/networktables/IntegerTopic.inc \
include/cameraserver/CameraServer.h include/cscore.h include/cscore_c.h \
include/cscore_cpp.h include/cscore_oo.h include/cscore_oo.inc \
include/cscore_cv.h include/cameraserver/CameraServer.inc \
Expand Down Expand Up @@ -254,8 +254,8 @@ include/networktables/NetworkTableEntry.inc:
include/networktables/NetworkTableInstance.inc:
include/networktables/Topic.h:
include/networktables/Topic.inc:
include/networktables/DoubleTopic.h:
include/networktables/DoubleTopic.inc:
include/networktables/IntegerTopic.h:
include/networktables/IntegerTopic.inc:
include/cameraserver/CameraServer.h:
include/cscore.h:
include/cscore_c.h:
Expand Down
8 changes: 4 additions & 4 deletions lib-vs/obj/visionserver2.cpp.pic.d
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ obj/visionserver2.cpp.pic.o: src\core/visionserver2.cpp \
include/networktables/NetworkTableInstance.h \
include/networktables/NetworkTableInstance.inc \
include/networktables/Topic.h include/networktables/Topic.inc \
include/networktables/DoubleTopic.h \
include/networktables/DoubleTopic.inc \
include/networktables/IntegerTopic.h \
include/networktables/IntegerTopic.inc \
include/cameraserver/CameraServer.h include/cscore.h include/cscore_c.h \
include/cscore_cpp.h include/cscore_oo.h include/cscore_oo.inc \
include/cscore_cv.h include/cameraserver/CameraServer.inc \
Expand Down Expand Up @@ -255,8 +255,8 @@ include/networktables/NetworkTableInstance.h:
include/networktables/NetworkTableInstance.inc:
include/networktables/Topic.h:
include/networktables/Topic.inc:
include/networktables/DoubleTopic.h:
include/networktables/DoubleTopic.inc:
include/networktables/IntegerTopic.h:
include/networktables/IntegerTopic.inc:
include/cameraserver/CameraServer.h:
include/cscore.h:
include/cscore_c.h:
Expand Down
Binary file modified lib-vs/obj/visionserver2.cpp.pic.o
Binary file not shown.
7 changes: 4 additions & 3 deletions lib-vs/out/include/aprilpose.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ class AprilPose_ : public vs2::VPipeline<AprilPose_<derived_t> > {
inline AprilPose_(
const cv::Ptr<cv::aruco::Board> f,
cv::Ptr<cv::aruco::DetectorParameters> p = cv::aruco::DetectorParameters::create()
) : vs2::VPipeline<This_t>("AprilTag Pose Estimator "), field{f}, markers{f->dictionary}, params{p}
) : vs2::VPipeline<This_t>("AprilTag Pose Estimator"), field{f}, markers{f->dictionary}, params{p}
{
this->getTable()->PutNumber("Scaling", this->scale);
this->getTable()->PutNumber("Decimate", this->params->aprilTagQuadDecimate);
}

virtual void process(cv::Mat& io_frame) override;
inline virtual void process(cv::Mat& io_frame) override { this->_proc(io_frame); }

protected:
inline AprilPose_(
Expand All @@ -42,6 +42,7 @@ class AprilPose_ : public vs2::VPipeline<AprilPose_<derived_t> > {
cv::Ptr<cv::aruco::DetectorParameters> p = cv::aruco::DetectorParameters::create()
) : vs2::VPipeline<This_t>(n), field{f}, markers{f->dictionary}, params{p} { this->getTable()->PutNumber("Scaling", this->scale); }

void _proc(cv::Mat& io_frame);

cv::Ptr<cv::aruco::Board> field;
cv::Ptr<cv::aruco::Dictionary> markers;
Expand All @@ -67,7 +68,7 @@ typedef AprilPose_<> AprilPose;
using hrc = std::chrono::high_resolution_clock;
#endif
template<class derived>
void AprilPose_<derived>::process(cv::Mat& io_frame) {
void AprilPose_<derived>::_proc(cv::Mat& io_frame) {
#ifdef APRILPOSE_DEBUG
hrc::time_point beg, end;
beg = hrc::now();
Expand Down
56 changes: 23 additions & 33 deletions lib-vs/out/include/visioncamera.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include <networktables/NetworkTableInstance.h>
#include <networktables/NetworkTable.h>
#include <networktables/DoubleTopic.h>
#include <networktables/IntegerTopic.h>
#include <cameraserver/CameraServer.h>
#include <wpi/json.h>

Expand Down Expand Up @@ -54,16 +54,20 @@ class VisionCamera final: public cs::VideoCamera {
* @param source_config The camera configuration json object
*/
VisionCamera(const wpi::json& source_config);
// VisionCamera(const VisionCamera&);
// VisionCamera(VisionCamera&&);
VisionCamera(const VisionCamera&) = delete;
VisionCamera(VisionCamera&&);
// inline VisionCamera(const VisionCamera&) { std::cout << "VCamera copied." << std::endl; }
// inline VisionCamera(VisionCamera&&) { std::cout << "VCamera moved." << std::endl; }
/**
* Deletes all networktable entries for the camera's subtable
*/
~VisionCamera();
//VisionCamera& operator=(const VisionCamera&);
//VisionCamera& operator=(VisionCamera&&);

//cs::VideoSource::Kind getType() const;
inline VisionCamera& operator=(const VisionCamera&) = delete;
VisionCamera& operator=(VisionCamera&&);
// inline VisionCamera& operator=(const VisionCamera&) { std::cout << "VCamera copied via operator." << std::endl; }
// inline VisionCamera& operator=(VisionCamera&&) { std::cout << "VCamera moved via operator." << std::endl; }

/**
* Get if the cameras calibration json is valid
* @return Whether or not the calibration json is valid
Expand Down Expand Up @@ -173,33 +177,33 @@ class VisionCamera final: public cs::VideoCamera {
* Get the current brightness setting for the camera
* @return The brightness (0-100, -1 for auto)
*/
int8_t getBrightness() const;
int getBrightness() const;
/**
* Get the current exposure setting for the camera
* @return The exposure (0-100, -1 for auto)
*/
int8_t getExposure() const;
int getExposure() const;
/**
* Get the current whitebalance setting for the camera
* @return The whitebalance (0-??? (>7000), -1 for auto)
*/
int16_t getWhiteBalance() const;
int getWhiteBalance() const;

/**
* Set the brightness of the camera
* @param b The brightness (0-100, -1 for auto)
*/
void setBrightness(int8_t b); // ranges 0 through 100 (a percent)
void setBrightness(int b); // ranges 0 through 100 (a percent)
/**
* Set the whitebalance of the camera
* @param wb The whitebalance (0-???, -1 for auto)
*/
void setWhiteBalance(int16_t wb); // ranges 0 through ~7000(+?) (look up) -> -1 sets to auto
void setWhiteBalance(int wb); // ranges 0 through ~7000(+?) (look up) -> -1 sets to auto
/**
* Set the exposure of the camera
* @param e The exposure (0-100, -1 for auto)
*/
void setExposure(int8_t e); // ranges 0 through 100 -> -1 sets to auto
void setExposure(int e); // ranges 0 through 100 -> -1 sets to auto

/**
* Set the root networktable in which the camera's own networktable should reside
Expand All @@ -210,37 +214,23 @@ class VisionCamera final: public cs::VideoCamera {
* Publish networktables-adjustable settings for exposure, brightness, and whitebalance under the camera's networktable
*/
void setNetworkAdjustable();
/**
* Deletes all created entries in the camera's networktable
*/
void deleteEntries();

protected:
/**
* Publish an adjustable networktable entry for the camera's brightness
*/
void setBrightnessAdjustable();
/**
* Publish an adjustable networktable entry for the camera's whitebalance
*/
void setWhiteBalanceAdjustable();
/**
* Publish an adjustable networktable entry for the camera's exposure
*/
void setExposureAdjustable();
int _setBrightness(int b);
int _setWhiteBalance(int wb);
int _setExposure(int e);

private:
wpi::json config, calibration;
cs::CvSink raw;
cv::Mat_<float> camera_matrix{default_matrix}, distortion{default_distort};
cs::VideoMode properties;

int8_t brightness{50}, exposure{-1};
int16_t whitebalance{-1};

std::shared_ptr<nt::NetworkTable> nt_camera{
std::shared_ptr<nt::NetworkTable> ntable{
nt::NetworkTableInstance::GetDefault().GetTable("Cameras")->GetSubTable(this->GetName())};
//nt::DoubleEntry nt_brightness, nt_exposure, nt_whitebalance;
nt::IntegerEntry
nt_brightness, nt_exposure, nt_whitebalance;
NT_Listener listener_handle{0};


};
4 changes: 2 additions & 2 deletions lib-vs/out/include/visionserver2.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class VisionServer final {
static bool addCamera(VisionCamera&&);
static bool addCameras(std::vector<VisionCamera>&&);
static bool setCameras(std::vector<VisionCamera>&&);
static const std::vector<VisionCamera>& getCameras();
static std::vector<VisionCamera>& getCameras();
static size_t numCameras();

template<class pipeline>
Expand Down Expand Up @@ -261,7 +261,7 @@ typedef SequentialPipeline<> SeqPipeline;

namespace vs2 {

inline const std::vector<VisionCamera>& VisionServer::getCameras() { return inst().cameras; }
inline std::vector<VisionCamera>& VisionServer::getCameras() { return inst().cameras; }
inline size_t VisionServer::numCameras() { return inst().cameras.size(); }
inline const std::vector<VisionServer::BasePipe*>& VisionServer::getPipelines() { return inst().pipelines; }
inline size_t VisionServer::numPipelines() { return inst().pipelines.size(); }
Expand Down
Binary file modified lib-vs/out/libvs3407.so
Binary file not shown.
7 changes: 4 additions & 3 deletions lib-vs/src/core/aprilpose.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ class AprilPose_ : public vs2::VPipeline<AprilPose_<derived_t> > {
inline AprilPose_(
const cv::Ptr<cv::aruco::Board> f,
cv::Ptr<cv::aruco::DetectorParameters> p = cv::aruco::DetectorParameters::create()
) : vs2::VPipeline<This_t>("AprilTag Pose Estimator "), field{f}, markers{f->dictionary}, params{p}
) : vs2::VPipeline<This_t>("AprilTag Pose Estimator"), field{f}, markers{f->dictionary}, params{p}
{
this->getTable()->PutNumber("Scaling", this->scale);
this->getTable()->PutNumber("Decimate", this->params->aprilTagQuadDecimate);
}

virtual void process(cv::Mat& io_frame) override;
inline virtual void process(cv::Mat& io_frame) override { this->_proc(io_frame); }

protected:
inline AprilPose_(
Expand All @@ -42,6 +42,7 @@ class AprilPose_ : public vs2::VPipeline<AprilPose_<derived_t> > {
cv::Ptr<cv::aruco::DetectorParameters> p = cv::aruco::DetectorParameters::create()
) : vs2::VPipeline<This_t>(n), field{f}, markers{f->dictionary}, params{p} { this->getTable()->PutNumber("Scaling", this->scale); }

void _proc(cv::Mat& io_frame);

cv::Ptr<cv::aruco::Board> field;
cv::Ptr<cv::aruco::Dictionary> markers;
Expand All @@ -67,7 +68,7 @@ typedef AprilPose_<> AprilPose;
using hrc = std::chrono::high_resolution_clock;
#endif
template<class derived>
void AprilPose_<derived>::process(cv::Mat& io_frame) {
void AprilPose_<derived>::_proc(cv::Mat& io_frame) {
#ifdef APRILPOSE_DEBUG
hrc::time_point beg, end;
beg = hrc::now();
Expand Down
4 changes: 2 additions & 2 deletions lib-vs/src/core/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ bool initNT(const char* file) {
} else {
wpi::outs() << "Setting up NetworkTables for SIMULATION mode - host: " << str << newline;
#if NT_CLIENT_VERSION == 4
nt::NetworkTableInstance::GetDefault().StartClient4("VisionServer");
nt::NetworkTableInstance::GetDefault().StartClient4("VisionServer");
#else
nt::NetworkTableInstance::GetDefault().StartClient3("VisionServer");
nt::NetworkTableInstance::GetDefault().StartClient3("VisionServer");
#endif
nt::NetworkTableInstance::GetDefault().SetServer(str.c_str());
}
Expand Down
File renamed without changes.
Loading

0 comments on commit 449de33

Please sign in to comment.