|
@@ -59,6 +59,7 @@ int NDSDataProc::ProcNDSData(std::string strlinepath,std::string strvehiclepath)
|
|
|
xline.lanewidth = badata[9].toDouble();
|
|
|
xline.laneheading = badata[10].toDouble();
|
|
|
xline.lanecurv = badata[11].toDouble();
|
|
|
+ xline.nlanetype = badata[23].toDouble();
|
|
|
if(xline.feature >=0)xvectorline.push_back(xline);
|
|
|
|
|
|
}
|
|
@@ -219,6 +220,41 @@ int NDSDataProc::ProcNDSData(std::string strlinepath,std::string strvehiclepath)
|
|
|
// if(fdis<0.6)std::cout<<" index "<<xvectorvl[i].mvehindex<<" dis "<<fdis<<" time "<<xvectorvehicle[xvectorvl[i].mvehindex].localtime<<std::endl;
|
|
|
}
|
|
|
|
|
|
+ for(i=0;i<nvlsize;i++)
|
|
|
+ {
|
|
|
+ iv::nds_vehicle *pv1 = &xvectorvehicle[xvectorvl[i].mvehindex];
|
|
|
+ double fhdg = (90-pv1->heading)*M_PI/360.0;
|
|
|
+ if(fhdg<0)fhdg = fhdg + 2.0*M_PI;
|
|
|
+ pv1->fhdg = fhdg;
|
|
|
+ iv::nds_line * pline1 = &xvectorline[xvectorvl[i].mvectorlineindex[0]];
|
|
|
+ iv::nds_line * pline2 = NULL;
|
|
|
+ if(xvectorvl[i].mvectorlineindex.size()>=2)
|
|
|
+ {
|
|
|
+ pline2 = &xvectorline[xvectorvl[i].mvectorlineindex[1]];
|
|
|
+ }
|
|
|
+ pv1->fx = pv1->frel_x + (pline1->lanewidth/2.0 - pline1->centerdeparture)*cos(fhdg + M_PI/2.0);
|
|
|
+ pv1->fy = pv1->frel_y + (pline1->lanewidth/2.0 - pline1->centerdeparture)*sin(fhdg + M_PI/2.0);
|
|
|
+ if(pline1->feature == 1)
|
|
|
+ {
|
|
|
+ pv1->nleftlanetype = pline1->nlanetype;
|
|
|
+ }
|
|
|
+ if(pline1->feature == 2)
|
|
|
+ {
|
|
|
+ pv1->nrightlanetype = pline1->nlanetype;
|
|
|
+ }
|
|
|
+ if(pline2 != NULL)
|
|
|
+ {
|
|
|
+ if(pline2->feature == 1)
|
|
|
+ {
|
|
|
+ pv1->nleftlanetype = pline2->nlanetype;
|
|
|
+ }
|
|
|
+ if(pline2->feature == 2)
|
|
|
+ {
|
|
|
+ pv1->nrightlanetype = pline2->nlanetype;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
std::cout<<" fdis "<<fS<<" min "<<fdismin<<" max "<<fdismax<<std::endl;
|
|
@@ -235,6 +271,10 @@ int NDSDataProc::ProcNDSData(std::string strlinepath,std::string strvehiclepath)
|
|
|
// double fXLast;
|
|
|
// double fYLast;
|
|
|
// bool bFirst = true;
|
|
|
+ bool bHaveLastxyhdg = false;
|
|
|
+ double fLastX,fLastY,fLastHdg;
|
|
|
+ double fEndX,fEndY,fEndHdg;
|
|
|
+ double fStartX,fStartY,fStartHdg;
|
|
|
while(bComplete == false)
|
|
|
{
|
|
|
|
|
@@ -242,8 +282,8 @@ int NDSDataProc::ProcNDSData(std::string strlinepath,std::string strvehiclepath)
|
|
|
VectorXd y_veh(nrange);
|
|
|
for(j=0;j<nrange;j++)
|
|
|
{
|
|
|
- x_veh[j] = xvectorvehicle[xvectorvl[j+ncurpos].mvehindex].frel_x;//mvectorrtkdata.at(j+ncurpos).mfrelx;
|
|
|
- y_veh[j] = xvectorvehicle[xvectorvl[j+ncurpos].mvehindex].frel_y;//mvectorrtkdata.at(j+ncurpos).mfrely;
|
|
|
+ x_veh[j] = xvectorvehicle[xvectorvl[j+ncurpos].mvehindex].fx;//mvectorrtkdata.at(j+ncurpos).mfrelx;
|
|
|
+ y_veh[j] = xvectorvehicle[xvectorvl[j+ncurpos].mvehindex].fy;//mvectorrtkdata.at(j+ncurpos).mfrely;
|
|
|
}
|
|
|
|
|
|
bool bArcOk = false;
|
|
@@ -282,8 +322,6 @@ int NDSDataProc::ProcNDSData(std::string strlinepath,std::string strvehiclepath)
|
|
|
std::cout<<" a line is ok "<<"pos is "<<ncurpos<<" range is "<<nrange<<" error is "<<dismax<<std::endl;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
if((nrange <= 2)||bLineOk||bArcOk)
|
|
|
{
|
|
|
if(bLineOk)
|
|
@@ -306,6 +344,12 @@ int NDSDataProc::ProcNDSData(std::string strlinepath,std::string strvehiclepath)
|
|
|
xgeo.mfY = y0;
|
|
|
xgeo.mfLen = sqrt(pow(x1-x0,2)+pow(y1-y0,2));
|
|
|
xgeo.mnType = 0;
|
|
|
+ fStartX = x0;
|
|
|
+ fStartX = y0;
|
|
|
+ fStartHdg = xgeo.mfHdg;
|
|
|
+ fEndX = x1;
|
|
|
+ fEndY = y1;
|
|
|
+ fEndHdg = fStartHdg;
|
|
|
// if(bFirst)
|
|
|
// {
|
|
|
// xgeo.mfX = x_veh[0];
|
|
@@ -339,6 +383,12 @@ int NDSDataProc::ProcNDSData(std::string strlinepath,std::string strvehiclepath)
|
|
|
xgeo.mfEndX = ep.x();
|
|
|
xgeo.mfEndY = ep.y();
|
|
|
xgeo.mR = fR;
|
|
|
+ fStartX = xgeo.mfX;
|
|
|
+ fStartY = xgeo.mfY;
|
|
|
+ fStartHdg = xgeo.mfHdgStart;
|
|
|
+ fEndX = xgeo.mfEndX;
|
|
|
+ fEndY = xgeo.mfEndY;
|
|
|
+ fEndHdg = xgeo.mfHdgEnd;
|
|
|
// if(bFirst)
|
|
|
// {
|
|
|
// xgeo.mfX = x_veh[0];
|
|
@@ -360,13 +410,33 @@ int NDSDataProc::ProcNDSData(std::string strlinepath,std::string strvehiclepath)
|
|
|
}
|
|
|
}
|
|
|
// std::cout<<" a line is ok "<<"pos is "<<ncurpos<<" range is "<<nrange<<" error is "<<dismax<<std::endl;
|
|
|
- ncurpos = ncurpos + nrange -1;
|
|
|
+
|
|
|
+ if(bHaveLastxyhdg)
|
|
|
+ {
|
|
|
+ std::vector<geobase> xvectorgeobe = geofit::CreateBezierGeo(fLastX,fLastY,
|
|
|
+ fLastHdg,fStartX,fStartY,fStartHdg);
|
|
|
+ if(xvectorgeobe.size()>0)
|
|
|
+ {
|
|
|
+ xvectorgeo.insert(xvectorgeo.begin()+(xvectorgeo.size()-1),xvectorgeobe[0]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ bHaveLastxyhdg = true;
|
|
|
+ fLastX = fEndX;
|
|
|
+ fLastY = fEndY;
|
|
|
+ fLastHdg = fEndHdg;
|
|
|
+
|
|
|
+
|
|
|
+ // ncurpos = ncurpos + nrange -1;
|
|
|
+ ncurpos = ncurpos + nrange; //Skip 1 point, use bezier
|
|
|
nrange = xvectorvl.size() - ncurpos;
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- nrange = nrange/2;
|
|
|
+ if(nrange > 30)
|
|
|
+ nrange = nrange/2;
|
|
|
+ else
|
|
|
+ nrange = nrange -1;
|
|
|
if(nrange<2)nrange = 2;
|
|
|
}
|
|
|
if(ncurpos>=(xvectorvl.size()-1))bComplete = true;
|