|
@@ -704,9 +704,10 @@ int nmode = 0; //0 same direciion dis zero 1 oposite dis = 0 2 same direction
|
|
|
int GetNearPointWithHead(const double x,const double y,const double hdg,OpenDrive * pxodr,std::vector<iv::nearroad> & xvectornear,
|
|
|
const double nearthresh,bool bhdgvalid = true)
|
|
|
{
|
|
|
+ std::cout<<" near thresh "<<nearthresh<<std::endl;
|
|
|
int i;
|
|
|
double frels;
|
|
|
- int nminmode = 5;
|
|
|
+ int nminmode = 6;
|
|
|
for(i=0;i<pxodr->GetRoadCount();i++)
|
|
|
{
|
|
|
int j;
|
|
@@ -722,10 +723,11 @@ int GetNearPointWithHead(const double x,const double y,const double hdg,OpenDriv
|
|
|
double locals = 0;
|
|
|
double localfrels = 0;
|
|
|
GeometryBlock * pgeolocal;
|
|
|
+ localdismin = std::numeric_limits<double>::infinity();
|
|
|
|
|
|
for(j=0;j<proad->GetGeometryBlockCount();j++)
|
|
|
{
|
|
|
- localdismin = std::numeric_limits<double>::infinity();
|
|
|
+
|
|
|
GeometryBlock * pgb = proad->GetGeometryBlock(j);
|
|
|
double dis;
|
|
|
RoadGeometry * pg;
|
|
@@ -769,6 +771,7 @@ int GetNearPointWithHead(const double x,const double y,const double hdg,OpenDriv
|
|
|
|
|
|
}
|
|
|
|
|
|
+ std::cout<<" local dismin "<<localdismin<<std::endl;
|
|
|
if(localdismin < nearthresh)
|
|
|
{
|
|
|
iv::nearroad xnear;
|
|
@@ -908,15 +911,34 @@ int GetNearPointWithHead(const double x,const double y,const double hdg,OpenDriv
|
|
|
}
|
|
|
}
|
|
|
if(xnear.nmode < nminmode)nminmode = xnear.nmode;
|
|
|
+
|
|
|
+ if(xnear.pObjRoad->GetLaneSectionCount()>0)
|
|
|
+ {
|
|
|
+ LaneSection * pLS = xnear.pObjRoad->GetLaneSection(0);
|
|
|
+ if((pLS->GetRightLaneCount()>0)&& ((pLS->GetLeftLaneCount()==0)) && (xnear.lr == 1))
|
|
|
+ {
|
|
|
+ xnear.lr = 2;
|
|
|
+ }
|
|
|
+ if((pLS->GetRightLaneCount() == 0)&& ((pLS->GetLeftLaneCount()>0)) && (xnear.lr == 2))
|
|
|
+ {
|
|
|
+ xnear.lr = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
xvectornear.push_back(xnear);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
- if(xvectornear.size() == 0)return -1;
|
|
|
+ if(xvectornear.size() == 0)
|
|
|
+ {
|
|
|
+ std::cout<<" no near. "<<std::endl;
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
+// std::cout<<" near size: "<<xvectornear.size()<<std::endl;
|
|
|
if(xvectornear.size() > 1)
|
|
|
{
|
|
|
int i;
|
|
@@ -929,6 +951,7 @@ int GetNearPointWithHead(const double x,const double y,const double hdg,OpenDriv
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+// std::cout<<" after size: "<<xvectornear.size()<<std::endl;
|
|
|
if((xvectornear.size()>1)&&(nminmode>=4)) //if dis > 5 select small dis
|
|
|
{
|
|
|
int i;
|
|
@@ -2864,6 +2887,9 @@ int MakePlan(xodrdijkstra * pxd,OpenDrive * pxodr,const double x_now,const doubl
|
|
|
return -2;
|
|
|
}
|
|
|
|
|
|
+ std::cout<<" start size: "<<xvectornearstart.size()<<std::endl;
|
|
|
+ std::cout<<" end size: "<<xvectornearend.size()<<std::endl;
|
|
|
+
|
|
|
std::vector<std::vector<PlanPoint>> xvectorplans;
|
|
|
std::vector<double> xvectorroutedis;
|
|
|
|
|
@@ -2882,6 +2908,8 @@ int MakePlan(xodrdijkstra * pxd,OpenDrive * pxodr,const double x_now,const doubl
|
|
|
lr_start = pnearstart->lr;
|
|
|
lr_end = pnearend->lr;
|
|
|
|
|
|
+ std::cout<<" lr start: "<<lr_start<<" lr end "<<lr_end<<std::endl;
|
|
|
+
|
|
|
nearx = pnearstart->nearx;
|
|
|
neary = pnearstart->neary;
|
|
|
|