small change

This commit is contained in:
xinyang
2019-08-04 01:45:55 +08:00
parent 0b24c6a5af
commit bbe05a7db8

View File

@@ -81,18 +81,16 @@ void ArmorFinder::antiTop() {
void ArmorFinder::antiTop() {
if (target_box.rect == cv::Rect2d()) return;
static int fps = 0;
uint16_t shoot_delay = 0;
auto interval = getTimeIntervalms(frame_time, last_front_time);
if (anti_top_state == ANTI_TOP && interval > 700) {
if (anti_top_state == ANTI_TOP && interval > 500) {
anti_top_state = NORMAL;
LOGM(STR_CTR(WORD_YELLOW, "switch to normal"));
}
fps++;
if (last_box.rect != cv::Rect2d() &&
getPointLength(last_box.getCenter() - target_box.getCenter()) > last_box.rect.height * 1.0) {
LOGM("switch %d! %lf", fps, getPointLength(last_box.getCenter() - target_box.getCenter()) / last_box.rect.height);
if (150 < interval && interval < 700) {
LOGM("switch! %lf", getPointLength(last_box.getCenter() - target_box.getCenter()) / last_box.rect.height);
if (150 < interval && interval < 500) {
if (anti_top_state == ANTI_TOP) {
top_periodms.push(interval);
LOGM(STR_CTR(WORD_LIGHT_GREEN, "top period: %.1lf ms"), interval);
@@ -113,7 +111,7 @@ void ArmorFinder::antiTop() {
}
if (anti_top_state == NORMAL) {
sendBoxPosition(0);
} else if (interval < top_periodms[-1] * 0.2) {
} else if (interval < top_periodms[-1] * 0.15) {
sendBoxPosition(0);
}
last_box = target_box;