This commit is contained in:
xinyang
2019-08-03 23:16:32 +08:00
parent 81ab17afa5
commit 2b83305eb9

View File

@@ -88,7 +88,7 @@ void ArmorFinder::antiTop() {
LOGM(STR_CTR(WORD_YELLOW, "switch to normal")); LOGM(STR_CTR(WORD_YELLOW, "switch to normal"));
} }
// cout << getPointLength(last_box.getCenter() - target_box.getCenter()) << endl; // cout << getPointLength(last_box.getCenter() - target_box.getCenter()) << endl;
if (getPointLength(last_box.getCenter() - target_box.getCenter()) > last_box.rect.height * 1.0) { if (getPointLength(last_box.getCenter() - target_box.getCenter()) > last_box.rect.height * 2.0) {
LOGM("switch!"); LOGM("switch!");
if (150 < interval && interval < 700) { if (150 < interval && interval < 700) {
if (anti_top_state == ANTI_TOP) { if (anti_top_state == ANTI_TOP) {
@@ -98,6 +98,7 @@ void ArmorFinder::antiTop() {
getsystime(curr_time); getsystime(curr_time);
auto calculate_time = getTimeIntervalms(curr_time, frame_time); auto calculate_time = getTimeIntervalms(curr_time, frame_time);
shoot_delay = mean(top_periodms) - calculate_time; shoot_delay = mean(top_periodms) - calculate_time;
sendBoxPosition(shoot_delay);
} else { } else {
if (++anti_top_cnt > 4) { if (++anti_top_cnt > 4) {
anti_top_state = ANTI_TOP; anti_top_state = ANTI_TOP;
@@ -110,7 +111,7 @@ void ArmorFinder::antiTop() {
if (anti_top_state == NORMAL) { if (anti_top_state == NORMAL) {
sendBoxPosition(0); sendBoxPosition(0);
} else if (interval < top_periodms[-1] * 0.2){ } else if (interval < top_periodms[-1] * 0.2){
sendBoxPosition(shoot_delay); sendBoxPosition(0);
} }
last_box = target_box; last_box = target_box;
} }