Browse Source

fix anti-coll bug

zhuyf 2 years ago
parent
commit
33170e259c
1 changed files with 3 additions and 2 deletions
  1. 3 2
      card_car.cpp

+ 3 - 2
card_car.cpp

@@ -81,14 +81,15 @@ void car::handle_anti_coll(const point& pt, const int& sid)
 
 			// 避免历史定位数据的影响
 			uint64_t now = time(0)*1000;
-			if(c.second.m_time - now > 60){
+			if(m_time - now > 60){
 				continue;
 			}
 
             bool s = false;
             int d = (c.second->m_timeval >= m_timeval ? (c.second->m_timeval - m_timeval) : (m_timeval - c.second->m_timeval)) / 1000.0;
             s = ((c.second->m_timeval >= m_timeval ? (c.second->m_timeval - m_timeval) : (m_timeval - c.second->m_timeval)) /1000.0 <= 30);
-            float dist = pt.dist(*c.second);
+            //float dist = pt.dist(*c.second);
+			float dist = pt.dist(*c.second.m_v_point);
             if(dist < k.second && s){
                 int call_level = 5 - k.first;
                 log_info("[anti_coll] distance=%.3f, level=%d, thre_value=%.3f, time_diff=%d", dist, call_level, k.second, d);