From 2b83305eb9e24d10dbead20365146813b2c82006 Mon Sep 17 00:00:00 2001 From: xinyang Date: Sat, 3 Aug 2019 23:16:32 +0800 Subject: [PATCH] fix bug. --- armor/src/armor_finder/anti_top/anti_top.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/armor/src/armor_finder/anti_top/anti_top.cpp b/armor/src/armor_finder/anti_top/anti_top.cpp index c3463f0..985cbed 100644 --- a/armor/src/armor_finder/anti_top/anti_top.cpp +++ b/armor/src/armor_finder/anti_top/anti_top.cpp @@ -88,7 +88,7 @@ void ArmorFinder::antiTop() { LOGM(STR_CTR(WORD_YELLOW, "switch to normal")); } // 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!"); if (150 < interval && interval < 700) { if (anti_top_state == ANTI_TOP) { @@ -98,6 +98,7 @@ void ArmorFinder::antiTop() { getsystime(curr_time); auto calculate_time = getTimeIntervalms(curr_time, frame_time); shoot_delay = mean(top_periodms) - calculate_time; + sendBoxPosition(shoot_delay); } else { if (++anti_top_cnt > 4) { anti_top_state = ANTI_TOP; @@ -110,7 +111,7 @@ void ArmorFinder::antiTop() { if (anti_top_state == NORMAL) { sendBoxPosition(0); } else if (interval < top_periodms[-1] * 0.2){ - sendBoxPosition(shoot_delay); + sendBoxPosition(0); } last_box = target_box; }