fix bug.
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
//
|
||||
// Created by xixiliadorabarry on 1/24/19.
|
||||
//
|
||||
#define LOG_LEVEL LOG_NONE
|
||||
|
||||
#include "energy/energy.h"
|
||||
#include "log.h"
|
||||
|
||||
using namespace cv;
|
||||
using std::cout;
|
||||
@@ -151,8 +154,8 @@ bool Energy::findCenterR(const cv::Mat src) {
|
||||
// cout << cur_rect.center << endl;
|
||||
return true;
|
||||
}
|
||||
cout << "find center R false!" << endl;
|
||||
// cv::waitKey(0);
|
||||
LOGM(STR_CTR(WORD_RED_CODE, "find center R false!"));
|
||||
// cv::waitKey(0);
|
||||
return false;
|
||||
|
||||
}
|
||||
@@ -198,7 +201,7 @@ bool Energy::findFlowStripFan(const cv::Mat src) {
|
||||
}
|
||||
// cout << "flow_strip_fans_cnt: " << flow_strip_fans.size() << endl;
|
||||
if (flow_strip_fans.empty()) {
|
||||
cout << "flow strip fan false!" << endl;
|
||||
LOGM(STR_CTR(WORD_RED_CODE, "flow strip fan false!"));
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
@@ -266,11 +269,11 @@ bool Energy::findFlowStrip(const cv::Mat src) {
|
||||
}
|
||||
// cout << "flow strip cnt: " << flow_strips.size() << endl;
|
||||
if (flow_strips.empty()) {
|
||||
cout << "flow strip false!" << endl;
|
||||
LOGM(STR_CTR(WORD_RED_CODE, "flow strip false!"));
|
||||
// waitKey(0);
|
||||
return false;
|
||||
} else if (flow_strips.size() > 1) {
|
||||
cout << "Too many flow strips!" << endl;
|
||||
LOGM(STR_CTR(WORD_RED_CODE, "Too many flow strips!"));
|
||||
// waitKey(0);
|
||||
return false;
|
||||
} else {
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
//
|
||||
// Created by xixiliadorabarry on 1/24/19.
|
||||
//
|
||||
#define LOG_LEVEL LOG_NONE
|
||||
|
||||
#include "energy/energy.h"
|
||||
#include "log.h"
|
||||
|
||||
using namespace cv;
|
||||
using std::cout;
|
||||
@@ -67,7 +70,7 @@ bool Energy::findTargetInFlowStripFan() {
|
||||
}
|
||||
// cout << "target armor cnt: " << target_armors.size() << endl;
|
||||
if (target_armors.empty()) {
|
||||
cout << "find target armor false" << endl;
|
||||
LOGM(STR_CTR(WORD_RED_CODE, "find target armor false"));
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
|
||||
@@ -21,5 +21,6 @@ void Energy::getAimPoint(cv::Point target_point) {
|
||||
pitch_rotation = atan(dy / FOCUS_PIXAL) * 180 / PI;
|
||||
// cout << "yaw: " << yaw_rotation << '\t' << "pitch: " << pitch_rotation << endl;
|
||||
// cout << "mcuData.delta_x: " << mcuData.delta_x << '\t' << "mcuData.delta_y: " << mcuData.delta_y << endl;
|
||||
// cout << "manual delta: " << manual_delta_x << '\t' << manual_delta_y << endl;
|
||||
|
||||
}
|
||||
|
||||
@@ -40,5 +40,5 @@ void Energy::judgeShootInGimbal() {
|
||||
} else
|
||||
shoot = 2;
|
||||
|
||||
cout << "yaw: " << yaw_rotation << '\t' << "pitch: " << pitch_rotation << endl;
|
||||
// cout << "yaw: " << yaw_rotation << '\t' << "pitch: " << pitch_rotation << endl;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ using namespace cv;
|
||||
// 此函数用于记录操作手的微调dx和dy
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
void Energy::writeDownSlightChange(cv::Mat &src) {
|
||||
if (findFans(src) == 4){
|
||||
if (findFans(src) >= 4) {
|
||||
FILE *fp_delta = fopen(PROJECT_DIR"/Mark/delta.txt", "w");
|
||||
if (fp_delta) {
|
||||
fprintf(fp_delta, "delta_x: %d, delta_y: %d\n", mcuData.delta_x, mcuData.delta_y);
|
||||
|
||||
@@ -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 << "fps:" << fps << ", (" << x << "," << y << "," << z << ")" << endl;
|
||||
cout << "energy fps:" << fps << ", (" << x << "," << y << "," << z << "," << u << ")" << endl;
|
||||
fps = 0;
|
||||
}
|
||||
fps += 1;
|
||||
|
||||
Reference in New Issue
Block a user