|
@@ -19,6 +19,8 @@ extern "C"
|
|
|
#include "dubins.h"
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+static void AddSignalMark(Road * pRoad, int nlane,std::vector<PlanPoint> & xvectorPP);
|
|
|
/**
|
|
|
* @brief GetLineDis 获得点到直线Geometry的距离。
|
|
|
* @param pline
|
|
@@ -1916,7 +1918,9 @@ std::vector<PlanPoint> GetLanePoint(pathsection xps,std::vector<PlanPoint> xvPP)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- Road * pRoad = xps.mpRoad;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
if(xps.mnStartLaneSel > 0)
|
|
@@ -1927,14 +1931,64 @@ std::vector<PlanPoint> GetLanePoint(pathsection xps,std::vector<PlanPoint> xvPP)
|
|
|
{
|
|
|
xvvPP.push_back(xvectorPP.at(nvsize-1-i));
|
|
|
}
|
|
|
+ AddSignalMark(xps.mpRoad,xps.mainsel,xvvPP);
|
|
|
return xvvPP;
|
|
|
}
|
|
|
|
|
|
// pRoad->GetLaneSection(xps.msectionid)
|
|
|
|
|
|
+ AddSignalMark(xps.mpRoad,xps.mainsel,xvectorPP);
|
|
|
return xvectorPP;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+static void AddSignalMark(Road * pRoad, int nlane,std::vector<PlanPoint> & xvectorPP)
|
|
|
+{
|
|
|
+ if(pRoad->GetSignalCount() == 0)return;
|
|
|
+ int nsigcount = pRoad->GetSignalCount();
|
|
|
+ int i;
|
|
|
+ for(i=0;i<nsigcount;i++)
|
|
|
+ {
|
|
|
+ Signal * pSig = pRoad->GetSignal(i);
|
|
|
+ int nfromlane = -100;
|
|
|
+ int ntolane = 100;
|
|
|
+ signal_laneValidity * pSig_laneValidity = pSig->GetlaneValidity();
|
|
|
+ if(pSig_laneValidity != 0)
|
|
|
+ {
|
|
|
+ nfromlane = pSig_laneValidity->GetfromLane();
|
|
|
+ ntolane = pSig_laneValidity->GettoLane();
|
|
|
+ }
|
|
|
+ if((nlane < 0)&&(nfromlane >= 0))
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if((nlane > 0)&&(ntolane<=0))
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ double s = pSig->Gets();
|
|
|
+ double fpos = s/pRoad->GetRoadLength();
|
|
|
+ if(nlane > 0)fpos = 1.0 -fpos;
|
|
|
+ int npos = fpos *xvectorPP.size();
|
|
|
+ if(npos <0)npos = 0;
|
|
|
+ if(npos>=xvectorPP.size())npos = xvectorPP.size()-1;
|
|
|
+ while(xvectorPP.at(npos).nSignal != -1)
|
|
|
+ {
|
|
|
+ if(npos > 0)npos--;
|
|
|
+ else break;
|
|
|
+ }
|
|
|
+ while(xvectorPP.at(npos).nSignal != -1)
|
|
|
+ {
|
|
|
+ if(npos < (xvectorPP.size()-1))npos++;
|
|
|
+ else break;
|
|
|
+ }
|
|
|
+ xvectorPP.at(npos).nSignal = atoi(pSig->Gettype().data());
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
static std::vector<PlanPoint> GetPlanPoint(std::vector<pathsection> xpathsection,Road * pRoad,GeometryBlock * pgeob,
|
|
|
Road * pRoad_obj,GeometryBlock * pgeob_obj,
|
|
|
const double x_now,const double y_now,const double head,
|
|
@@ -1949,6 +2003,7 @@ static std::vector<PlanPoint> GetPlanPoint(std::vector<pathsection> xpathsection
|
|
|
int indexstart = indexinroadpoint(xvectorPP,nearx,neary);
|
|
|
int i;
|
|
|
std::vector<PlanPoint> xvPP = GetLanePoint(xpathsection[0],xvectorPP);
|
|
|
+
|
|
|
if(xpathsection[0].mainsel < 0)
|
|
|
{
|
|
|
for(i=indexstart;i<xvPP.size();i++)
|
|
@@ -2255,6 +2310,7 @@ int MakePlan(xodrdijkstra * pxd,OpenDrive * pxodr,const double x_now,const doubl
|
|
|
int nindexstart = indexinroadpoint(xvPP,nearx,neary);
|
|
|
int nindexend = indexinroadpoint(xvPP,nearx_obj,neary_obj);
|
|
|
int nlane = getlanesel(nlanesel,pRoad->GetLaneSection(0),lr_start);
|
|
|
+ AddSignalMark(pRoad,nlane,xvPP);
|
|
|
if((nindexend >nindexstart)&&(lr_start == 2))
|
|
|
{
|
|
|
bNeedDikstra = false;
|