zhuyf 2 years ago
parent
commit
b84e6c5884
3 changed files with 71 additions and 8 deletions
  1. 7 7
      card_message_handle.cpp
  2. 63 1
      select_tool.cpp
  3. 1 0
      select_tool.h

+ 7 - 7
card_message_handle.cpp

@@ -494,7 +494,7 @@ struct one_ct_message_handle
             log_info("[pdoa] trans_pdoa_msg: 分站信息缺失,site_id=%d", loc.m_site_id);
             return nullptr;
         }
-        return std::move(std::make_shared<loc_message>(s, loc.m_tof, loc.m_time_stamp, loc.m_card_id, loc.m_card_ct, loc.m_card_type, loc.m_ant_id, loc.m_rav, loc.m_acc, 0, loc.m_rssi, loc.m_batty_status, loc.m_loc_type, loc.m_loc_dimension, loc.m_poa[0], loc.m_poa[1], loc.m_poa[2]));
+        return std::move(std::make_shared<loc_message>(s, loc.m_tof, loc.m_time_stamp, loc.m_card_id, loc.m_card_ct, loc.m_card_type, loc.m_ant_id, loc.m_rav, loc.m_acc, loc.m_sync_ct, loc.m_rssi, loc.m_batty_status, loc.m_loc_type, loc.m_loc_dimension, loc.m_poa[0], loc.m_poa[1], loc.m_poa[2]));
     }
 
     // tdoa 定位数据
@@ -566,7 +566,7 @@ void card_message_handle::on_message(zloop<task*> * loop,const message_locinfo&l
 		log_warn("%s","当前代码没有处理历史消息记录。");
 		return;
 	}
-	int c_status = STATUS_POWER_NOMARL;
+	/*int c_status = STATUS_POWER_NOMARL;
 	if(loc.m_batty_status == 2)
 	{
 		c_status ^= STATUS_POWER_NOMARL;
@@ -583,7 +583,7 @@ void card_message_handle::on_message(zloop<task*> * loop,const message_locinfo&l
 		c_status  |= STATUS_CALL;
 	}
 
-	m_card->do_status(c_status);
+	m_card->do_status(c_status);*/
 	m_ct_list[loc.m_card_ct&(m_ct_list.size()-1)]->on_message(loop,loc);
 }
 
@@ -600,7 +600,7 @@ void card_message_handle::on_message(zloop<task*>* loop, const message_tdoa_loci
         return;
     }
 
-    int c_status = STATUS_POWER_LOWER_SERIOUS;
+    /*int c_status = STATUS_POWER_LOWER_SERIOUS;
 
     if(loc.m_card_msg.m_call_info & 0x80)
     {
@@ -614,7 +614,7 @@ void card_message_handle::on_message(zloop<task*>* loop, const message_tdoa_loci
     
     //处理卡呼叫/呼救业务
     m_card->do_status(c_status);
-
+	*/
     m_ct_list[loc.m_card_msg.m_sync_num & (m_ct_list.size()-1)]->on_message(loop, loc);
 }
 
@@ -631,7 +631,7 @@ void card_message_handle::on_message(zloop<task*>* loop, const message_pdoa_loci
         return;
     }
 
-    int c_status = STATUS_POWER_LOWER_SERIOUS;
+    /*int c_status = STATUS_POWER_LOWER_SERIOUS;
     if(loc.m_callinfo & 0x80)
     {
         c_status |= STATUS_HELP;
@@ -643,7 +643,7 @@ void card_message_handle::on_message(zloop<task*>* loop, const message_pdoa_loci
     }
     
     //处理卡呼叫/呼救业务
-    m_card->do_status(c_status);
+    m_card->do_status(c_status);*/
     //根据取模结果调用响应的子模块处理
     m_ct_list[loc.m_card_ct & (m_ct_list.size()-1)]->on_message(loop, loc);
 }

+ 63 - 1
select_tool.cpp

@@ -88,7 +88,11 @@ bool select_point_object::select_pdoa_solution_impl(const std::vector<point> vp,
 {
     switch(get_algo_index(lm[0].tool_index())){
         case 6:
-            return select_pdoa_1d_solution(vp, lm, lp);
+			if(lm[0].m_sync_ct){
+				return select_pdoa_1d_solution_original(vp, lm, lp);
+			}else{
+				return select_pdoa_1d_solution(vp, lm, lp);
+			}
             break;
         case 7:
             return select_pdoa_2d_solution(vp, lm, lp);
@@ -503,6 +507,64 @@ bool select_point_object::select_pdoa_solution2(const std::vector<point> vp, con
 	return true;
 }*/
 
+/*
+ * 选择一维定位的解,不采用任何优化方法
+ *
+ * 参数
+ *		const std::vector<point> vp			可能定位解
+ *		const std::vector<loc_message>& lm	定位原始数据集
+ *		loc_point& lp						保存最终定位解
+ *
+ * 返回值
+ *		true表示成功选解,false表示选解失败
+ *
+ * */
+bool select_point_object::select_pdoa_1d_solution_original(const std::vector<point> vp, const std::vector<loc_message>& lm, loc_point& lp)
+{
+	uint64_t id = lm[0].m_card_type;
+	id = ((id<<32)|lm[0].m_card_id);
+
+	auto card= card_list::instance()->get(id);
+    double dist = lm[0].m_num_ticks * 15.65 * 2.996 * 1e-4;
+
+	double pdoa = get_pdoa(lm[0].m_poa, lm[0].m_sit->m_pdoa_offset);
+	logn_info(3, "[pdoa_o] card_id=%d, pdoa=%.2f, dist=%.2f, vp0x=%.2f, vp0y=%.2f, vp1x=%.2f, vp2y=%.2f", lm[0].m_card_id, pdoa, dist, vp[0].x, vp[0].y, vp[1].x, vp[1].y);
+
+	double dt = (lm[0].m_loc_time - card->m_last_recv_time)*1.0/1000.0;
+	double speed = fabs(dist - card->m_last_dist)/dt;
+
+	if(!select_pdoa_solution2(vp, lm, lp, pdoa)){
+		return false;
+	}
+
+	logn_info(3, "[pdoa_o] card_id=%d, ct=%d, useless=%d, x=%.4f, y=%.4f, speed=%.3f, d=%.2f", lm[0].m_card_id, lm[0].m_card_ct, 1, lp.x, lp.y, speed);
+
+	lp.m_useless			= true;
+	card->m_last_pdoa_diff	= pdoa;
+	card->m_last_ct			= lm[0].m_card_ct;
+	card->m_last_dist		= dist;
+	card->m_last_site_id	= lm[0].m_sit->m_id;
+	card->m_last_site_dir	= lm[0].m_sit->m_pdoa_direction;
+	card->m_last_point.x	= lp.x;
+	card->m_last_point.y	= lp.y;
+	lp.m_speed = card->m_speed = speed;
+	card->m_cb_point.push_back(lp);
+	card->m_vtp_dist.push_back(dist);
+
+	return true;
+}
+/*
+ * 选择一维定位的解
+ *
+ * 参数
+ *		const std::vector<point> vp			可能定位解
+ *		const std::vector<loc_message>& lm	定位原始数据集
+ *		loc_point& lp						保存最终定位解
+ *
+ * 返回值
+ *		true表示成功选解,false表示选解失败
+ *
+ * */
 bool select_point_object::select_pdoa_1d_solution(const std::vector<point> vp, const std::vector<loc_message>& lm, loc_point& lp)
 {
     uint64_t id = lm[0].m_card_type;

+ 1 - 0
select_tool.h

@@ -161,6 +161,7 @@ public:
 		bool select_pdoa_1d_solution(const std::vector<point> p, const std::vector<loc_message>& lm, loc_point& lp);
 		bool select_pdoa_2d_solution(const std::vector<point> p, const std::vector<loc_message>& lm, loc_point& lp);
 		bool select_pdoa_3d_solution(const std::vector<point> p, const std::vector<loc_message>& lm, loc_point& lp);
+		bool select_pdoa_1d_solution_original(const std::vector<point> p, const std::vector<loc_message>& lm, loc_point& lp);
 		fit_result* best_fit_raw(int num_point=0,int start=0,int end=-1);
 		bool filter_by_acc(loc_point&c,std::array<solpoint,4>&v,double a);
 		bool filter_by_fit(loc_point & c,const std::vector<point> & vp,const double scale);