From b8c6a1671ca8867d634a8d76304862e8cfd74227 Mon Sep 17 00:00:00 2001 From: sun Date: Thu, 25 Jul 2019 09:21:08 +0800 Subject: [PATCH] energy change --- armor/src/armor_finder/send_target/send_target.cpp | 2 +- energy/src/energy/find/energy_finder.cpp | 10 ++++------ energy/src/energy/find/target_finder.cpp | 3 +-- energy/src/energy/send/send.cpp | 4 ++-- others/include/options/options.h | 1 + others/src/options/options.cpp | 9 ++++++++- 6 files changed, 17 insertions(+), 12 deletions(-) diff --git a/armor/src/armor_finder/send_target/send_target.cpp b/armor/src/armor_finder/send_target/send_target.cpp index e2c8729..19169be 100644 --- a/armor/src/armor_finder/send_target/send_target.cpp +++ b/armor/src/armor_finder/send_target/send_target.cpp @@ -16,7 +16,7 @@ static bool sendTarget(Serial &serial, double x, double y, double z, uint16_t sh time_t t = time(nullptr); if (last_time != t) { last_time = t; - cout << "fps:" << fps << ", (" << x << "," << y << "," << z << ")" << endl; + cout << "Armor: fps:" << fps << ", (" << x << "," << y << "," << z << ")" << endl; fps = 0; } fps += 1; diff --git a/energy/src/energy/find/energy_finder.cpp b/energy/src/energy/find/energy_finder.cpp index d87fb85..8c96e9d 100644 --- a/energy/src/energy/find/energy_finder.cpp +++ b/energy/src/energy/find/energy_finder.cpp @@ -1,8 +1,6 @@ // // Created by xixiliadorabarry on 1/24/19. // -#define LOG_LEVEL LOG_NONE - #include "energy/energy.h" #include "log.h" @@ -154,7 +152,7 @@ bool Energy::findCenterR(const cv::Mat src) { // cout << cur_rect.center << endl; return true; } - LOGM(STR_CTR(WORD_RED_CODE, "find center R false!")); + if (show_info)cout << "find center R false!" << endl; // cv::waitKey(0); return false; @@ -201,7 +199,7 @@ bool Energy::findFlowStripFan(const cv::Mat src) { } // cout << "flow_strip_fans_cnt: " << flow_strip_fans.size() << endl; if (flow_strip_fans.empty()) { - LOGM(STR_CTR(WORD_RED_CODE, "flow strip fan false!")); + if (show_info)cout << "flow strip fan false!" << endl; return false; } else { return true; @@ -269,11 +267,11 @@ bool Energy::findFlowStrip(const cv::Mat src) { } // cout << "flow strip cnt: " << flow_strips.size() << endl; if (flow_strips.empty()) { - LOGM(STR_CTR(WORD_RED_CODE, "flow strip false!")); + if (show_info)cout << "flow strip false!" << endl; // waitKey(0); return false; } else if (flow_strips.size() > 1) { - LOGM(STR_CTR(WORD_RED_CODE, "Too many flow strips!")); + if (show_info)cout << "Too many flow strips!" << endl; // waitKey(0); return false; } else { diff --git a/energy/src/energy/find/target_finder.cpp b/energy/src/energy/find/target_finder.cpp index 980ad57..0dff96f 100644 --- a/energy/src/energy/find/target_finder.cpp +++ b/energy/src/energy/find/target_finder.cpp @@ -1,7 +1,6 @@ // // Created by xixiliadorabarry on 1/24/19. // -#define LOG_LEVEL LOG_NONE #include "energy/energy.h" #include "log.h" @@ -70,7 +69,7 @@ bool Energy::findTargetInFlowStripFan() { } // cout << "target armor cnt: " << target_armors.size() << endl; if (target_armors.empty()) { - LOGM(STR_CTR(WORD_RED_CODE, "find target armor false")); + if (show_info)cout << "find target armor false" << endl; return false; } else { return true; diff --git a/energy/src/energy/send/send.cpp b/energy/src/energy/send/send.cpp index f109ebd..1f49b81 100644 --- a/energy/src/energy/send/send.cpp +++ b/energy/src/energy/send/send.cpp @@ -51,7 +51,7 @@ void Energy::sendTarget(Serial &serial, float x, float y, float z) { time_t t = time(nullptr); if (last_time != t) { last_time = t; -// cout << "fps:" << fps << ", (" << x << "," << y << "," << z << ")" << endl; + cout << "Energy: fps:" << fps << ", (" << x << "," << y << "," << z << ")" << endl; fps = 0; } fps += 1; @@ -87,7 +87,7 @@ void Energy::sendTarget(Serial &serial, float x, float y, uint16_t z, uint16_t u time_t t = time(nullptr); if (last_time != t) { last_time = t; - cout << "energy fps:" << fps << ", (" << x << "," << y << "," << z << "," << u << ")" << endl; + cout << "Energy: fps:" << fps << ", (" << x << "," << y << "," << z << "," << u << ")" << endl; fps = 0; } fps += 1; diff --git a/others/include/options/options.h b/others/include/options/options.h index ed49689..716ae5b 100644 --- a/others/include/options/options.h +++ b/others/include/options/options.h @@ -18,6 +18,7 @@ extern bool save_labelled_boxes; extern bool show_process; extern bool show_energy; extern bool save_mark; +extern bool show_info; void process_options(int argc, char *argv[]); diff --git a/others/src/options/options.cpp b/others/src/options/options.cpp index 0b7c7a5..6dcaf4c 100644 --- a/others/src/options/options.cpp +++ b/others/src/options/options.cpp @@ -17,6 +17,7 @@ bool save_labelled_boxes = false; bool show_process = false; bool show_energy = false; bool save_mark = false; +bool show_info = false; void process_options(int argc, char *argv[]) { if (argc >= 2) { @@ -54,6 +55,8 @@ void process_options(int argc, char *argv[]) { LOGM("Enable show processed image"); show_energy = true; LOGM("Enable show energy part"); + show_info = true; + LOGM("Show information!"); } else if (strcmp(argv[i], "--run-with-camera") == 0) { run_with_camera = true; LOGM("Run with camera!"); @@ -70,14 +73,18 @@ void process_options(int argc, char *argv[]) { show_process = true; LOGM("Enable show processed image!"); } else if (strcmp(argv[i], "--show-energy") == 0) { - show_energy= true; + show_energy = true; LOGM("Enable show energy part!"); } else if (strcmp(argv[i], "--save-mark") == 0) { save_mark = true; LOGM("Write down mark"); + } else if (strcmp(argv[i], "--show-info") == 0) { + show_info = true; + LOGM("Show information!"); } else { LOGW("Unknown option: %s. Use --help to see options.", argv[i]); } } } } +