|
@@ -6,6 +6,7 @@
|
|
|
|
|
|
GlobalRelocation::GlobalRelocation()
|
|
GlobalRelocation::GlobalRelocation()
|
|
{
|
|
{
|
|
|
|
+// std::cout<<" run hear."<<std::endl;
|
|
if(mnThreadNum > MAX_NDT)mnThreadNum = MAX_NDT;
|
|
if(mnThreadNum > MAX_NDT)mnThreadNum = MAX_NDT;
|
|
int i;
|
|
int i;
|
|
for(i=0;i<MAX_NDT;i++)mpthread[i] = NULL;
|
|
for(i=0;i<MAX_NDT;i++)mpthread[i] = NULL;
|
|
@@ -408,69 +409,70 @@ void GlobalRelocation::setndtmap(std::vector<iv::ndtmaptrace> & xvectorndtmap)
|
|
mbRelocAvail = true;
|
|
mbRelocAvail = true;
|
|
mndt[i].setInputTarget(xmap);
|
|
mndt[i].setInputTarget(xmap);
|
|
mthreadcomplete[i] = true;
|
|
mthreadcomplete[i] = true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
- int i;
|
|
|
|
- int npointsize = mvectorndtmap[0].mvector_trace.size();
|
|
|
|
- if(npointsize == 0)
|
|
|
|
|
|
+ int npointsize = mvectorndtmap[0].mvector_trace.size();
|
|
|
|
+ if(npointsize == 0)
|
|
|
|
+ {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ mvectorseedpoint.clear();
|
|
|
|
+ std::cout<<" load trace seed."<<std::endl;
|
|
|
|
+ iv::ndttracepoint ntp = mvectorndtmap[0].mvector_trace[0];
|
|
|
|
+ mvectorseedpoint.push_back(ntp);
|
|
|
|
+
|
|
|
|
+ for(i=1;i<npointsize;i++)
|
|
|
|
+ {
|
|
|
|
+ iv::ndttracepoint ntpnow = mvectorndtmap[0].mvector_trace[i];
|
|
|
|
+ iv::ndttracepoint ntplast = mvectorseedpoint[mvectorseedpoint.size() -1];
|
|
|
|
+ double fdis = sqrt(pow(ntpnow.x - ntplast.x,2) + pow(ntpnow.y - ntplast.y,2));
|
|
|
|
+ double fyawdiff = ntpnow.yaw - ntplast.yaw;
|
|
|
|
+ while(fyawdiff<(-M_PI))fyawdiff = fyawdiff + 2.0*M_PI;
|
|
|
|
+ while(fyawdiff >(M_PI))fyawdiff = fyawdiff - 2.0*M_PI;
|
|
|
|
+ if(fdis>=mfSeedDisThresh)
|
|
{
|
|
{
|
|
- return;
|
|
|
|
|
|
+ mvectorseedpoint.push_back(ntpnow);
|
|
}
|
|
}
|
|
- mvectorseedpoint.clear();
|
|
|
|
- std::cout<<" load trace seed."<<std::endl;
|
|
|
|
- iv::ndttracepoint ntp = mvectorndtmap[0].mvector_trace[0];
|
|
|
|
- mvectorseedpoint.push_back(ntp);
|
|
|
|
-
|
|
|
|
- for(i=1;i<npointsize;i++)
|
|
|
|
|
|
+ else
|
|
{
|
|
{
|
|
- iv::ndttracepoint ntpnow = mvectorndtmap[0].mvector_trace[i];
|
|
|
|
- iv::ndttracepoint ntplast = mvectorseedpoint[mvectorseedpoint.size() -1];
|
|
|
|
- double fdis = sqrt(pow(ntpnow.x - ntplast.x,2) + pow(ntpnow.y - ntplast.y,2));
|
|
|
|
- double fyawdiff = ntpnow.yaw - ntplast.yaw;
|
|
|
|
- while(fyawdiff<(-M_PI))fyawdiff = fyawdiff + 2.0*M_PI;
|
|
|
|
- while(fyawdiff >(M_PI))fyawdiff = fyawdiff - 2.0*M_PI;
|
|
|
|
- if(fdis>=mfSeedDisThresh)
|
|
|
|
|
|
+ if(fabs(fyawdiff)>0.1)
|
|
{
|
|
{
|
|
mvectorseedpoint.push_back(ntpnow);
|
|
mvectorseedpoint.push_back(ntpnow);
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- if(fabs(fyawdiff)>0.1)
|
|
|
|
|
|
+ if(i== (npointsize -1))
|
|
{
|
|
{
|
|
mvectorseedpoint.push_back(ntpnow);
|
|
mvectorseedpoint.push_back(ntpnow);
|
|
}
|
|
}
|
|
- else
|
|
|
|
- {
|
|
|
|
- if(i== (npointsize -1))
|
|
|
|
- {
|
|
|
|
- mvectorseedpoint.push_back(ntpnow);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ }
|
|
|
|
|
|
- if(mvectorseedpoint.size()>0)
|
|
|
|
|
|
+ if(mvectorseedpoint.size()>0)
|
|
|
|
+ {
|
|
|
|
+ const int nfrontadd = 3;
|
|
|
|
+ const int nrearadd = 3;
|
|
|
|
+ iv::ndttracepoint ntpfirst = mvectorseedpoint[0];
|
|
|
|
+ iv::ndttracepoint ntplast = mvectorseedpoint[mvectorseedpoint.size() -1];
|
|
|
|
+ for(i=0;i<nfrontadd;i++)
|
|
{
|
|
{
|
|
- const int nfrontadd = 3;
|
|
|
|
- const int nrearadd = 3;
|
|
|
|
- iv::ndttracepoint ntpfirst = mvectorseedpoint[0];
|
|
|
|
- iv::ndttracepoint ntplast = mvectorseedpoint[mvectorseedpoint.size() -1];
|
|
|
|
- for(i=0;i<nfrontadd;i++)
|
|
|
|
- {
|
|
|
|
- iv::ndttracepoint ntpnow = ntpfirst;
|
|
|
|
- double foff = (i+1)*mfSeedDisThresh;
|
|
|
|
- ntpnow.x = ntpfirst.x + foff*cos(ntpfirst.yaw + M_PI);
|
|
|
|
- ntpnow.y = ntpfirst.y + foff*sin(ntpfirst.yaw + M_PI);
|
|
|
|
- mvectorseedpoint.insert(mvectorseedpoint.begin(),ntpnow);
|
|
|
|
- }
|
|
|
|
- for(i=0;i<nrearadd;i++)
|
|
|
|
- {
|
|
|
|
- iv::ndttracepoint ntpnow = ntplast;
|
|
|
|
- double foff = (i+1)*mfSeedDisThresh;
|
|
|
|
- ntpnow.x = ntpfirst.x + foff*cos(ntpfirst.yaw);
|
|
|
|
- ntpnow.y = ntpfirst.y + foff*sin(ntpfirst.yaw );
|
|
|
|
- mvectorseedpoint.push_back(ntpnow);
|
|
|
|
- }
|
|
|
|
|
|
+ iv::ndttracepoint ntpnow = ntpfirst;
|
|
|
|
+ double foff = (i+1)*mfSeedDisThresh;
|
|
|
|
+ ntpnow.x = ntpfirst.x + foff*cos(ntpfirst.yaw + M_PI);
|
|
|
|
+ ntpnow.y = ntpfirst.y + foff*sin(ntpfirst.yaw + M_PI);
|
|
|
|
+ mvectorseedpoint.insert(mvectorseedpoint.begin(),ntpnow);
|
|
|
|
+ }
|
|
|
|
+ for(i=0;i<nrearadd;i++)
|
|
|
|
+ {
|
|
|
|
+ iv::ndttracepoint ntpnow = ntplast;
|
|
|
|
+ double foff = (i+1)*mfSeedDisThresh;
|
|
|
|
+ ntpnow.x = ntplast.x + foff*cos(ntpfirst.yaw);
|
|
|
|
+ ntpnow.y = ntplast.y + foff*sin(ntpfirst.yaw );
|
|
|
|
+ mvectorseedpoint.push_back(ntpnow);
|
|
}
|
|
}
|
|
|
|
+ }
|
|
|
|
|
|
// for(i=0;i<mvectorseedpoint.size();i++)
|
|
// for(i=0;i<mvectorseedpoint.size();i++)
|
|
// {
|
|
// {
|
|
@@ -478,5 +480,5 @@ void GlobalRelocation::setndtmap(std::vector<iv::ndtmaptrace> & xvectorndtmap)
|
|
// mvectorseedpoint[i].y = mvectorseedpoint[i].y + 10.0;
|
|
// mvectorseedpoint[i].y = mvectorseedpoint[i].y + 10.0;
|
|
// }
|
|
// }
|
|
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
}
|
|
}
|