1
0
Bläddra i källkod

fix anti coll

zhuyf 2 år sedan
förälder
incheckning
2cfbdf1c31
1 ändrade filer med 3 tillägg och 2 borttagningar
  1. 3 2
      card_car.cpp

+ 3 - 2
card_car.cpp

@@ -177,7 +177,7 @@ void car::handle_anti_coll(const point& pt, const int& sid)
 
             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);
+            s = (d <= 30);
             //float dist = pt.dist(*c.second);
 			float dist = pt.dist(c.second->m_v_point);
 			log_info("[anti_coll] vid=%d, pid=%d, dist=%.2f", m_id, c.second->m_id, dist);
@@ -229,7 +229,8 @@ void car::handle_anti_coll(const point& pt, const int& sid)
             //}
             ++i;
         }
-		desc += "]";
+		
+		desc = desc.sub_str(0, desc.length()-1) + "]";
         log_info("[anti_coll] the distance's list between person and vehicle : %s", desc.c_str());
 		event_tool::instance()->handle_event(OT_CARD, ET_PERSON_VEHICLE_ANTI_COLLISION, id, min_d, cur_v, true, DT_COMMON, desc);
     }