Skip to content

Commit

Permalink
disable debug windows on linux
Browse files Browse the repository at this point in the history
  • Loading branch information
ElliotScher committed Dec 14, 2024
1 parent 1cf2b04 commit 9986f4a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
12 changes: 9 additions & 3 deletions wpical/src/main/native/cpp/WPIcal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ namespace gui = wpi::gui;

const char* GetWPILibVersion();

#ifdef __linux__
const bool showDebug = false;
#else
const bool showDebug = true;
#endif

namespace wpical {
std::string_view GetResource_wpical_16_png();
std::string_view GetResource_wpical_32_png();
Expand Down Expand Up @@ -202,7 +208,7 @@ static void DisplayGui() {
int calibrationOutput = fieldcalibration::calibrate(
selected_field_calibration_directory.c_str(), calibration_json_path,
selected_camera_intrinsics, selected_field_map.c_str(), pinnedTag,
true);
showDebug);

if (calibrationOutput == 1) {
ImGui::OpenPopup("Field Calibration Error");
Expand Down Expand Up @@ -328,7 +334,7 @@ static void DisplayGui() {
std::cout << "calibration button pressed" << std::endl;
int ret = cameracalibration::calibrate(
selected_camera_intrinsics.c_str(), squareWidth, markerWidth,
boardWidth, boardHeight, imagerWidth, imagerHeight, true);
boardWidth, boardHeight, imagerWidth, imagerHeight, showDebug);
if (ret == 0) {
size_t lastSeparatorPos =
selected_camera_intrinsics.find_last_of("/\\");
Expand Down Expand Up @@ -381,7 +387,7 @@ static void DisplayGui() {
std::cout << "calibration button pressed" << std::endl;
int ret = cameracalibration::calibrate(
selected_camera_intrinsics.c_str(), squareWidth, markerWidth,
boardWidth, boardHeight, true);
boardWidth, boardHeight, showDebug);
if (ret == 0) {
size_t lastSeparatorPos =
selected_camera_intrinsics.find_last_of("/\\");
Expand Down
6 changes: 4 additions & 2 deletions wpical/src/main/native/cpp/fieldcalibration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,10 @@ bool fieldcalibration::process_video_file(
tag_detection_i, camera_matrix, camera_distortion, tag_size);

// Draw debug cube
draw_tag_cube(frame_debug, caamera_to_tag, camera_matrix,
camera_distortion, tag_size);
if (show_debug_window) {
draw_tag_cube(frame_debug, caamera_to_tag, camera_matrix,
camera_distortion, tag_size);
}

// Skip finding transformation from smallest tag ID to itself
if (tag_detection_i->id == tag_detection_min->id) {
Expand Down

0 comments on commit 9986f4a

Please sign in to comment.