|
@@ -143,8 +143,30 @@ Card::Card( void )
|
|
|
|
|
|
void Card::reset()
|
|
|
{
|
|
|
+ //以下参数与算法相关
|
|
|
//坐标初始值为0
|
|
|
m_nLastLocateT = 0;
|
|
|
+ time_stamp_last = 0;
|
|
|
+ b_long_interval = false;
|
|
|
+ is_first_location = false;
|
|
|
+ last_locate.x = last_locate.y = last_locate.z = 0;
|
|
|
+ last_locate.sync_num = 0;
|
|
|
+
|
|
|
+ if (m_syncNumList.size() > 0)
|
|
|
+ {
|
|
|
+ m_syncNumList.erase(m_syncNumList.begin(),m_syncNumList.end());
|
|
|
+ m_syncNumList.resize(0);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (vt_his_speed.size()>0)
|
|
|
+ {
|
|
|
+ vt_his_speed.erase(vt_his_speed.begin(),vt_his_speed.end());
|
|
|
+ vt_his_speed.resize(0);
|
|
|
+ }
|
|
|
+
|
|
|
+ //卡尔曼参数重置
|
|
|
+ m_pKalmanFilter->m_nCounts = 0;
|
|
|
+ m_pKalmanFilter->Initial(0.2);
|
|
|
}
|
|
|
|
|
|
void Card::set_reader(std::shared_ptr<Reader> preader) // 设置卡时间
|
|
@@ -520,16 +542,16 @@ void Card::algo_tdoa(int cnt)
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ //time_stamp_last特指卡的计数序号,非分站的
|
|
|
//当卡需要新定位的计数序列号小于上一次成功定位的序列号,则此次不定位,避免定位结果的回退
|
|
|
- if (this->time_stamp_last != 0 && this->time_stamp_last > this->time_stamp_cal)
|
|
|
+ if (this->time_stamp_last != 0 && this->time_stamp_last > time_stamp_cal)
|
|
|
{
|
|
|
string str_last = "";
|
|
|
string str_cur = "";
|
|
|
|
|
|
str_last = CFunctions::int2string(this->time_stamp_last);
|
|
|
- str_cur = CFunctions::int2string(this->time_stamp_cal);
|
|
|
+ str_cur = CFunctions::int2string(time_stamp_cal);
|
|
|
|
|
|
- //if ((this->time_stamp_last + this->time_stamp_cal)%65535 < 2)//120
|
|
|
if (str_last.length() == 5 && str_cur.length() <= 2)
|
|
|
{
|
|
|
//满足此条件,表示标示卡的计数序号走完了65535的周期
|
|
@@ -542,7 +564,7 @@ void Card::algo_tdoa(int cnt)
|
|
|
this->z = 0;
|
|
|
m_afmData.bStatus = true;
|
|
|
m_afmData.strCardId = this->card_id;
|
|
|
- m_afmData.nCardStamp = this->time_stamp_cal;
|
|
|
+ m_afmData.nCardStamp = maxSyncTimes;
|
|
|
m_afmData.nType = ALGO_FAILED_CONDITION_4;
|
|
|
ALGORITHM_FAILED(ALGO_FAILED_CONDITION_4);
|
|
|
//此处需要输出计数
|
|
@@ -728,20 +750,20 @@ void Card::algo_tdoa(int cnt)
|
|
|
break;
|
|
|
case CT_VEHICLE:
|
|
|
LOCATION_SYSTEM_BRANCH(LOCATION_SYSTEM_BRANCH_159);
|
|
|
- if(av > VECHILE_ACCELERATE_THRESHOLD){
|
|
|
- LOCATION_SYSTEM_BRANCH(LOCATION_SYSTEM_BRANCH_160);
|
|
|
- //保留上次结果
|
|
|
- this->x = this->last_locate.x;
|
|
|
- this->y = this->last_locate.y;
|
|
|
- this->b_long_interval = false;
|
|
|
- pRdm->clear();
|
|
|
-
|
|
|
- m_afmData.bStatus = true;
|
|
|
- m_afmData.strCardId = this->card_id;
|
|
|
- m_afmData.nType = ALGO_FAILED_CONDITION_6;
|
|
|
- ALGORITHM_FAILED(ALGO_FAILED_CONDITION_6);
|
|
|
- return;
|
|
|
- }
|
|
|
+ //if(av > VECHILE_ACCELERATE_THRESHOLD){
|
|
|
+ // LOCATION_SYSTEM_BRANCH(LOCATION_SYSTEM_BRANCH_160);
|
|
|
+ // //保留上次结果
|
|
|
+ // this->x = this->last_locate.x;
|
|
|
+ // this->y = this->last_locate.y;
|
|
|
+ // this->b_long_interval = false;
|
|
|
+ // pRdm->clear();
|
|
|
+
|
|
|
+ // m_afmData.bStatus = true;
|
|
|
+ // m_afmData.strCardId = this->card_id;
|
|
|
+ // m_afmData.nType = ALGO_FAILED_CONDITION_6;
|
|
|
+ // ALGORITHM_FAILED(ALGO_FAILED_CONDITION_6);
|
|
|
+ // return;
|
|
|
+ //}
|
|
|
break;
|
|
|
}
|
|
|
deltaT = 0;
|
|
@@ -837,19 +859,19 @@ void Card::algo_tdoa(int cnt)
|
|
|
break;
|
|
|
case CT_VEHICLE:
|
|
|
LOCATION_SYSTEM_BRANCH(LOCATION_SYSTEM_BRANCH_170);
|
|
|
- if(av > VECHILE_ACCELERATE_THRESHOLD){
|
|
|
- LOCATION_SYSTEM_BRANCH(LOCATION_SYSTEM_BRANCH_171);
|
|
|
- //保留上次结果
|
|
|
- this->x = this->last_locate.x;
|
|
|
- this->y = this->last_locate.y;
|
|
|
- pRdm->clear();
|
|
|
-
|
|
|
- m_afmData.bStatus = true;
|
|
|
- m_afmData.strCardId = this->card_id;
|
|
|
- m_afmData.nType = ALGO_FAILED_CONDITION_6;
|
|
|
- ALGORITHM_FAILED(ALGO_FAILED_CONDITION_6);
|
|
|
- return;
|
|
|
- }
|
|
|
+ //if(av > VECHILE_ACCELERATE_THRESHOLD){
|
|
|
+ // LOCATION_SYSTEM_BRANCH(LOCATION_SYSTEM_BRANCH_171);
|
|
|
+ // //保留上次结果
|
|
|
+ // this->x = this->last_locate.x;
|
|
|
+ // this->y = this->last_locate.y;
|
|
|
+ // pRdm->clear();
|
|
|
+
|
|
|
+ // m_afmData.bStatus = true;
|
|
|
+ // m_afmData.strCardId = this->card_id;
|
|
|
+ // m_afmData.nType = ALGO_FAILED_CONDITION_6;
|
|
|
+ // ALGORITHM_FAILED(ALGO_FAILED_CONDITION_6);
|
|
|
+ // return;
|
|
|
+ //}
|
|
|
break;
|
|
|
}
|
|
|
this->last_locate.acceleration = av;
|
|
@@ -860,7 +882,7 @@ void Card::algo_tdoa(int cnt)
|
|
|
//速度的限制
|
|
|
if(fabs(cv) > MAX_VECHILE_SPEED){
|
|
|
LOCATION_SYSTEM_BRANCH(LOCATION_SYSTEM_BRANCH_173);
|
|
|
- this->x = this->last_locate.x;
|
|
|
+ /*this->x = this->last_locate.x;
|
|
|
this->y = this->last_locate.y;
|
|
|
pRdm->clear();
|
|
|
|
|
@@ -868,7 +890,7 @@ void Card::algo_tdoa(int cnt)
|
|
|
m_afmData.strCardId = this->card_id;
|
|
|
m_afmData.nType = ALGO_FAILED_CONDITION_7;
|
|
|
ALGORITHM_FAILED(ALGO_FAILED_CONDITION_7);
|
|
|
- return;
|
|
|
+ return;*/
|
|
|
}
|
|
|
|
|
|
//删除第一个元素到tmp(含)之间的所有元素
|