Browse Source

change driver/driver_map_xodrload. fix a bug in plan.

yuchuli 3 years ago
parent
commit
7442bb8566

+ 2 - 1
src/common/common/xodr/xodrfunc/xodrdijkstra.cpp

@@ -739,6 +739,7 @@ xodrdijkstra::xodrdijkstra(OpenDrive  * pxodr)
                     for(k=0;k<px->GetLaneSection(px->GetLaneSectionCount()-1)->GetLaneCount();k++)
                     for(k=0;k<px->GetLaneSection(px->GetLaneSectionCount()-1)->GetLaneCount();k++)
                     {
                     {
                         Lane * plane = px->GetLaneSection(px->GetLaneSectionCount()-1)->GetLane(k);
                         Lane * plane = px->GetLaneSection(px->GetLaneSectionCount()-1)->GetLane(k);
+                        if(plane->GetType() != "driving")continue;
                         if(plane->GetId() == 0)continue;
                         if(plane->GetId() == 0)continue;
                         if(plane->IsSuccessorSet())
                         if(plane->IsSuccessorSet())
                         {
                         {
@@ -1715,7 +1716,7 @@ std::vector<pathsection> xodrdijkstra::getgpspoint(int srcroadid, int nsrclr, in
             }
             }
             else
             else
             {
             {
-                if(nlr == 2)
+                if(nlr2 == 2)
                 {
                 {
                     if(pLane2->IsSuccessorSet())
                     if(pLane2->IsSuccessorSet())
                     {
                     {

+ 23 - 0
src/common/common/xodr/xodrfunc/xodrfunc.cpp

@@ -1348,6 +1348,7 @@ int xodrfunc::GetDrivingLane(Road *pRoad, const int nLS, const int nsuggestlane)
 
 
     nrtn = 1000;
     nrtn = 1000;
     int ndiff;
     int ndiff;
+
     for(i=0;i<nLaneCount;i++)
     for(i=0;i<nLaneCount;i++)
     {
     {
         Lane * pLane = pLS->GetLane(i);
         Lane * pLane = pLS->GetLane(i);
@@ -1361,6 +1362,28 @@ int xodrfunc::GetDrivingLane(Road *pRoad, const int nLS, const int nsuggestlane)
             }
             }
         }
         }
     }
     }
+
+    if(nrtn == 1000)
+    {
+        std::cout<<"Waring. Maybe no driving road in this side."<<std::endl;
+        for(i=0;i<nLaneCount;i++)
+        {
+            Lane * pLane = pLS->GetLane(i);
+            if((pLane->GetId()*nsuggestlane>0))
+            {
+                ndiff = pLane->GetId() - nrtn;
+                int xdiff = pLane->GetId() - nsuggestlane;
+                if(abs(xdiff)<abs(ndiff))
+                {
+                    nrtn = pLane->GetId();
+                }
+            }
+        }
+    }
+
+
+
+
     return nrtn;
     return nrtn;
 }
 }