From 21b413991ff3679a789be65da4482b64f7c4a394 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sun, 18 Oct 2026 15:57:31 +0200 Subject: [PATCH] Fix builds with newest libprotobuf/libabsl and protocol --- cmake/FindSpinnaker.cmake | 2 +- cmake/FindmvIMPACT.cmake | 2 +- src/Perspective.cpp | 4 ++-- src/Resources.cpp | 2 +- src/calib/Distortion.cpp | 2 +- src/calib/GeomModel.cpp | 8 ++++---- src/driver/cameradriver.cpp | 8 ++++---- src/driver/mvimpactdriver.cpp | 2 +- src/driver/mvimpactdriver.h | 2 +- src/driver/spinnakerdriver.cpp | 4 ++-- src/driver/spinnakerdriver.h | 2 +- src/log.h | 2 +- src/main.cpp | 8 ++++---- src/opencl.cpp | 2 +- src/rtpstreamer.cpp | 2 +- src/udpsocket.cpp | 6 +++--- 16 files changed, 29 insertions(+), 29 deletions(-) diff --git a/cmake/FindSpinnaker.cmake b/cmake/FindSpinnaker.cmake index 33dcaeb..b446ebf 100644 --- a/cmake/FindSpinnaker.cmake +++ b/cmake/FindSpinnaker.cmake @@ -34,7 +34,7 @@ if (WITH_SPINNAKER) SPINNAKER_LIBS STREQUAL "SPINNAKER_LIBS-NOTFOUND" OR SPINNAKER_INCLUDE_DIRS STREQUAL "SPINNAKER_INCLUDE_DIRS-NOTFOUND" )) - add_definitions( -DSPINNAKER ) + add_definitions( -DSPINNAKER_AVAILABLE ) message(STATUS "Spinnaker found, activating Spinnaker support.") else() set(SPINNAKER_INCLUDE_DIRS "") diff --git a/cmake/FindmvIMPACT.cmake b/cmake/FindmvIMPACT.cmake index 0796a96..968ac31 100644 --- a/cmake/FindmvIMPACT.cmake +++ b/cmake/FindmvIMPACT.cmake @@ -30,7 +30,7 @@ if (WITH_MVIMPACT) mvIMPACT_LIBS STREQUAL "mvIMPACT_LIBS-NOTFOUND" OR mvIMPACT_INCLUDE_DIRS STREQUAL "mvIMPACT_INCLUDE_DIRS-NOTFOUND" )) - add_definitions( -DMVIMPACT ) + add_definitions( -DMVIMPACT_AVAILABLE ) message(STATUS "mvIMPACT found, activating mvIMPACT support.") else() set(mvIMPACT_INCLUDE_DIRS "") diff --git a/src/Perspective.cpp b/src/Perspective.cpp index 88fc33f..1172393 100644 --- a/src/Perspective.cpp +++ b/src/Perspective.cpp @@ -89,7 +89,7 @@ void Perspective::geometryCheck(const int width, const int height, const double } } fieldScale = fieldScaleSum / (float)n * resamplingFactor; - LOG("Field scale: " << minFieldScale << "mm/px < " << fieldScale << "mm/px < " << maxFieldScale << "mm/px"); + VP_LOG("Field scale: " << minFieldScale << "mm/px < " << fieldScale << "mm/px < " << maxFieldScale << "mm/px"); //update visibleFieldExtent Eigen::Vector2f center = model.image2field({0.0f, 0.0f}, (float)maxBotHeight).head<2>(); @@ -121,7 +121,7 @@ void Perspective::geometryCheck(const int width, const int height, const double if(reprojectedFieldSize[1] % 2) reprojectedFieldSize[1]++; - LOG("Visible field extent: " << visibleFieldExtent.transpose() << "mm (xmin,xmax,ymin,ymax) Field scale: " << fieldScale << "mm/px"); + VP_LOG("Visible field extent: " << visibleFieldExtent.transpose() << "mm (xmin,xmax,ymin,ymax) Field scale: " << fieldScale << "mm/px"); } Eigen::Vector2f Perspective::flat2field(const Eigen::Vector2f& pos) const { diff --git a/src/Resources.cpp b/src/Resources.cpp index e5d713d..eacab4e 100644 --- a/src/Resources.cpp +++ b/src/Resources.cpp @@ -230,7 +230,7 @@ void Resources::reloadConfigIfChanged() { try { YAML::Node config = YAML::LoadFile(configPath); applyTunables(config); - LOG("Reloaded tunables from " << configPath); + VP_LOG("Reloaded tunables from " << configPath); } catch(const YAML::Exception& e) { WARN("Config reload failed, keeping previous values: " << e.what()); } diff --git a/src/calib/Distortion.cpp b/src/calib/Distortion.cpp index e337f21..b69dfff 100644 --- a/src/calib/Distortion.cpp +++ b/src/calib/Distortion.cpp @@ -114,7 +114,7 @@ bool calibrateDistortion(const std::vector>& linePo lm.minimize(k); if((k(1) < 0.0f || k(2) < 0.0f || k(1) >= model.size.x() || k(2) >= model.size.y())) { - LOG("Principal point outside of image, aborting calibration for this frame"); + VP_LOG("Principal point outside of image, aborting calibration for this frame"); return false; } diff --git a/src/calib/GeomModel.cpp b/src/calib/GeomModel.cpp index f6410b2..aa40e4c 100644 --- a/src/calib/GeomModel.cpp +++ b/src/calib/GeomModel.cpp @@ -497,7 +497,7 @@ void geometryCalibration(const Resources& r, const CLImage& rgba) { const int halfLineWidth = halfLineWidthEstimation(r, gray); diag.half_line_width = halfLineWidth; - LOG("Half line width: " << halfLineWidth); + VP_LOG("Half line width: " << halfLineWidth); cv::Mat thresholded(gray.rows, gray.cols, CV_8UC1, 0.0); thresholdImage(r, gray, halfLineWidth, thresholded); @@ -520,12 +520,12 @@ void geometryCalibration(const Resources& r, const CLImage& rgba) { lines.emplace_back(a, b); } diag.raw_line_segments = (int)lines.size(); - LOG("Line segments: " << lines.size()); + VP_LOG("Line segments: " << lines.size()); const std::vector compoundLines = groupLineSegments(r, lines); const CVLines mergedLines = mergeLineSegments(compoundLines); diag.merged_line_count = (int)mergedLines.size(); - LOG("Lines: " << mergedLines.size()); + VP_LOG("Lines: " << mergedLines.size()); std::vector> mergedPixels(mergedLines.size()); { @@ -568,7 +568,7 @@ void geometryCalibration(const Resources& r, const CLImage& rgba) { model.updateDerived(); int error = modelError(r, model, linePixels); - LOG("Best model: " << model << " error " << (error/(float)linePixels.size())); + VP_LOG("Best model: " << model << " error " << (error/(float)linePixels.size())); diag.focal_length = model.focalLength; diag.position = model.pos; diff --git a/src/driver/cameradriver.cpp b/src/driver/cameradriver.cpp index e37ad87..8fea83b 100644 --- a/src/driver/cameradriver.cpp +++ b/src/driver/cameradriver.cpp @@ -16,10 +16,10 @@ #include "cameradriver.h" #include "driver/opencvdriver.h" -#ifdef SPINNAKER +#ifdef SPINNAKER_AVAILABLE #include "driver/spinnakerdriver.h" #endif -#ifdef MVIMPACT +#ifdef MVIMPACT_AVAILABLE #include "driver/mvimpactdriver.h" #endif @@ -76,12 +76,12 @@ bool CameraConfig::autoGamma() const { std::unique_ptr openCamera(const CameraConfig& config) { -#ifdef SPINNAKER +#ifdef SPINNAKER_AVAILABLE if(config.driverType == "SPINNAKER") return std::make_unique(config); #endif -#ifdef MVIMPACT +#ifdef MVIMPACT_AVAILABLE if(config.driverType == "MVIMPACT") return std::make_unique(config); #endif diff --git a/src/driver/mvimpactdriver.cpp b/src/driver/mvimpactdriver.cpp index c01f703..9de3f89 100644 --- a/src/driver/mvimpactdriver.cpp +++ b/src/driver/mvimpactdriver.cpp @@ -13,7 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -#ifdef MVIMPACT +#ifdef MVIMPACT_AVAILABLE #include "mvimpactdriver.h" #include diff --git a/src/driver/mvimpactdriver.h b/src/driver/mvimpactdriver.h index eb69883..b8bc58a 100644 --- a/src/driver/mvimpactdriver.h +++ b/src/driver/mvimpactdriver.h @@ -14,7 +14,7 @@ limitations under the License. */ #pragma once -#ifdef MVIMPACT +#ifdef MVIMPACT_AVAILABLE #include "cameradriver.h" #include diff --git a/src/driver/spinnakerdriver.cpp b/src/driver/spinnakerdriver.cpp index 545ab52..ce86e51 100644 --- a/src/driver/spinnakerdriver.cpp +++ b/src/driver/spinnakerdriver.cpp @@ -13,7 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -#ifdef SPINNAKER +#ifdef SPINNAKER_AVAILABLE #include "spinnakerdriver.h" @@ -44,7 +44,7 @@ SpinnakerDriver::SpinnakerDriver(const CameraConfig& config) { if (camList.GetSize() > config.hardwareId) { pCam = camList.GetByIndex(config.hardwareId); pCam->Init(); - LOG("Opened " << pCam->DeviceModelName.GetValue() << " - " << pCam->DeviceSerialNumber.GetValue().c_str()); + VP_LOG("Opened " << pCam->DeviceModelName.GetValue() << " - " << pCam->DeviceSerialNumber.GetValue().c_str()); camList.Clear(); break; } diff --git a/src/driver/spinnakerdriver.h b/src/driver/spinnakerdriver.h index af0d52b..fd6be82 100644 --- a/src/driver/spinnakerdriver.h +++ b/src/driver/spinnakerdriver.h @@ -14,7 +14,7 @@ limitations under the License. */ #pragma once -#ifdef SPINNAKER +#ifdef SPINNAKER_AVAILABLE #include "cameradriver.h" #include "Spinnaker.h" diff --git a/src/log.h b/src/log.h index 77185b2..a289b11 100644 --- a/src/log.h +++ b/src/log.h @@ -16,6 +16,6 @@ #pragma once #include -#define LOG(data) std::cout << "[" << __FILE__ << ":" << __LINE__ << "] " << data << std::endl +#define VP_LOG(data) std::cout << "[" << __FILE__ << ":" << __LINE__ << "] " << data << std::endl #define WARN(data) std::cerr << "[" << __FILE__ << ":" << __LINE__ << "] " << data << std::endl #define FATAL(data) { WARN(data); exit(1); } diff --git a/src/main.cpp b/src/main.cpp index 7a0baa5..047b169 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -362,7 +362,7 @@ int main(int argc, char* argv[]) { #if BENCHMARK detection->set_t_sent(startTime + processingTime); - LOG("time " << processingTime * 1000.0 << " ms " << matches.size() << " blobs " << detection->balls().size() << " balls " << (detection->robots_yellow_size() + detection->robots_blue_size()) << " bots"); + VP_LOG("time " << processingTime * 1000.0 << " ms " << matches.size() << " blobs " << detection->balls().size() << " balls " << (detection->robots_yellow_size() + detection->robots_blue_size()) << " bots"); r.openCl->printRuntimes(); #else detection->set_t_sent(r.camera->getTime()); @@ -372,7 +372,7 @@ int main(int argc, char* argv[]) { r.openCl->clearEvents(); if(processingTime > r.camera->expectedFrametime()) - LOG("frame time overrun: " << processingTime * 1000.0 << " ms " << matches.size() << " blobs " << detection->balls().size() << " balls " << (detection->robots_yellow_size() + detection->robots_blue_size()) << " bots"); + VP_LOG("frame time overrun: " << processingTime * 1000.0 << " ms " << matches.size() << " blobs " << detection->balls().size() << " balls " << (detection->robots_yellow_size() + detection->robots_blue_size()) << " bots"); if(r.rawFeed) { r.streamQuad(channels); @@ -417,11 +417,11 @@ int main(int argc, char* argv[]) { r.snapshotWriter->offer(r.quad2rgba(channels), "img/" + std::to_string(r.camId) + ".raw.jpg"); lastDebugSaveTime = realStartTime; if(frameId == 100) - LOG("Saved sample image"); + VP_LOG("Saved sample image"); } } } - LOG("Stopping vision_processor"); + VP_LOG("Stopping vision_processor"); return 0; } diff --git a/src/opencl.cpp b/src/opencl.cpp index dbe0465..31c3379 100644 --- a/src/opencl.cpp +++ b/src/opencl.cpp @@ -57,7 +57,7 @@ bool OpenCL::searchDevice(const std::vector& platforms, cl_device_ for(cl::Device& d : devices) { device = d; - LOG("Using device: " << platform.getInfo() << " » " << device.getInfo()); + VP_LOG("Using device: " << platform.getInfo() << " » " << device.getInfo()); return true; } } diff --git a/src/rtpstreamer.cpp b/src/rtpstreamer.cpp index e975431..00da74f 100644 --- a/src/rtpstreamer.cpp +++ b/src/rtpstreamer.cpp @@ -97,7 +97,7 @@ void RTPStreamer::allocResources() { FATAL("Failed to find suitable encoder."); } - LOG("Using codec: " << codec->long_name); + VP_LOG("Using codec: " << codec->long_name); fmtCtx = avformat_alloc_context(); auto* avFormat = (AVOutputFormat*)av_guess_format("rtp", nullptr, nullptr); diff --git a/src/udpsocket.cpp b/src/udpsocket.cpp index 990e5d6..77f57e2 100644 --- a/src/udpsocket.cpp +++ b/src/udpsocket.cpp @@ -124,7 +124,7 @@ void VisionSocket::geometryCheck() { ballRadius = geometry.field().ball_radius(); geometryVersion++; - LOG("New geometry received"); + VP_LOG("New geometry received"); } geometryMutex.unlock(); } @@ -319,11 +319,11 @@ void GCSocket::parse(char *data, int length) { if(botHeights.find(referee.yellow().name()) != botHeights.end() && botHeights[referee.yellow().name()] != yellowBotHeight) { yellowBotHeight = botHeights[referee.yellow().name()]; - LOG("Updated yellow bot height to " << yellowBotHeight << "mm"); + VP_LOG("Updated yellow bot height to " << yellowBotHeight << "mm"); } if(botHeights.find(referee.blue().name()) != botHeights.end() && botHeights[referee.blue().name()] != blueBotHeight) { blueBotHeight = botHeights[referee.blue().name()]; - LOG("Updated blue bot height to " << blueBotHeight << "mm"); + VP_LOG("Updated blue bot height to " << blueBotHeight << "mm"); } }