Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmake/FindSpinnaker.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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 "")
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindmvIMPACT.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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 "")
Expand Down
4 changes: 2 additions & 2 deletions src/Perspective.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>();
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/Resources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down
2 changes: 1 addition & 1 deletion src/calib/Distortion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ bool calibrateDistortion(const std::vector<std::vector<Eigen::Vector2f>>& 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;
}

Expand Down
8 changes: 4 additions & 4 deletions src/calib/GeomModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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<CVLines> 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<std::vector<Eigen::Vector2f>> mergedPixels(mergedLines.size());
{
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/driver/cameradriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -76,12 +76,12 @@ bool CameraConfig::autoGamma() const {


std::unique_ptr<CameraDriver> openCamera(const CameraConfig& config) {
#ifdef SPINNAKER
#ifdef SPINNAKER_AVAILABLE
if(config.driverType == "SPINNAKER")
return std::make_unique<SpinnakerDriver>(config);
#endif

#ifdef MVIMPACT
#ifdef MVIMPACT_AVAILABLE
if(config.driverType == "MVIMPACT")
return std::make_unique<MVImpactDriver>(config);
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/driver/mvimpactdriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <mvIMPACT_CPP/mvIMPACT_acquire_GenICam.h>
Expand Down
2 changes: 1 addition & 1 deletion src/driver/mvimpactdriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
limitations under the License.
*/
#pragma once
#ifdef MVIMPACT
#ifdef MVIMPACT_AVAILABLE

#include "cameradriver.h"
#include <mvIMPACT_CPP/mvIMPACT_acquire.h>
Expand Down
4 changes: 2 additions & 2 deletions src/driver/spinnakerdriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/driver/spinnakerdriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
limitations under the License.
*/
#pragma once
#ifdef SPINNAKER
#ifdef SPINNAKER_AVAILABLE

#include "cameradriver.h"
#include "Spinnaker.h"
Expand Down
2 changes: 1 addition & 1 deletion src/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
#pragma once
#include <iostream>

#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); }
8 changes: 4 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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);
Expand Down Expand Up @@ -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;
}
2 changes: 1 addition & 1 deletion src/opencl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ bool OpenCL::searchDevice(const std::vector<cl::Platform>& platforms, cl_device_

for(cl::Device& d : devices) {
device = d;
LOG("Using device: " << platform.getInfo<CL_PLATFORM_NAME>() << " » " << device.getInfo<CL_DEVICE_NAME>());
VP_LOG("Using device: " << platform.getInfo<CL_PLATFORM_NAME>() << " » " << device.getInfo<CL_DEVICE_NAME>());
return true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/rtpstreamer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/udpsocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void VisionSocket::geometryCheck() {
ballRadius = geometry.field().ball_radius();

geometryVersion++;
LOG("New geometry received");
VP_LOG("New geometry received");
}
geometryMutex.unlock();
}
Expand Down Expand Up @@ -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");
}
}
Loading