Bläddra i källkod

change some plan code.

yuchuli 2 år sedan
förälder
incheckning
9a789a8712

+ 30 - 2
src/common/common/xodr/OpenDrive/Road.cpp

@@ -1473,7 +1473,7 @@ double Road::GetRoadRightWidth(double s_check)
     LaneSection * pLS =&mLaneSectionsVector[0];
     if(mLaneSectionsVector.size() > 1)
     {
-        unsigned int nLSCount = mLaneSectionsVector.size();
+        unsigned int nLSCount = static_cast<unsigned int>(mLaneSectionsVector.size()) ;
         unsigned int i;
         for(i=0;i<(nLSCount -1);i++)
         {
@@ -1487,7 +1487,7 @@ double Road::GetRoadRightWidth(double s_check)
 double Road::GetLaneOffsetValue(double s_check)
 {
     if(mLaneOffsetVector.size() == 0)return 0.0;
-    unsigned int noffsetcount = mLaneOffsetVector.size();
+    unsigned int noffsetcount = static_cast<unsigned int >(mLaneOffsetVector.size()) ;
     unsigned int i;
     LaneOffset * pLO = NULL;
     for(i=0;i<noffsetcount;i++)
@@ -2004,6 +2004,34 @@ void Road::ResetPriority()
     if(mRoadPriorityVector.size()>0)mRoadPriorityVector.clear();
 }
 
+//-------------------------------------------------
+
+double Road::GetDis(const double x,const double y, const double hdg, double & fRefDis, double & fHdgDiff, int & nlane,double & s,double & refx,double & refy,double & refhdg)
+{
+//    unsigned int ngbsize = static_cast<unsigned int >(mGeometryBlockVector.size());
+//    unsigned int i;
+//    double fdismin = 1000000.0;
+//    for(i=0;i<ngbsize;i++)
+//    {
+//        GeometryBlock * pgb = GetGeometryBlock(i);
+//        RoadGeometry * pg;
+//        pg = pgb->GetGeometryAt(0);
+//        double xstart,ystart;
+//        xstart = pg->GetX();
+//        ystart = pg->GetY();
+//        double fdisstart = sqrt(pow(xstart - x,2) + pow(ystart - y,2));
+
+//        if(fdis)
+
+//        if(fdisstart<(100.0 + pg->GetLength()))
+//        {
+
+//        }
+//    }
+}
+
+
+
 
 //-------------------------------------------------
 

+ 2 - 0
src/common/common/xodr/OpenDrive/Road.h

@@ -455,6 +455,8 @@ public:
     int GetRoadPriority(int & nPriority);
     void ResetPriority();
 
+    double GetDis(const double x,const double y, const double hdg, double & fRefDis, double & fHdgDiff, int & nlane,double & s,double & refx,double & refy,double & refhdg); //fRefDis distance to reference line,  nlane if dis is 0, nlane which lane is distance is 0
+
 	
 	//-------------------------------------------------
 

+ 4 - 2
src/driver/driver_map_xodrload/driver_map_xodrload.pro

@@ -28,7 +28,8 @@ SOURCES += main.cpp     \
     gnss_coordinate_convert.cpp \
     service_roi_xodr.cpp \
     xodrplan.cpp \
-    ../../include/msgtype/mapglobal.pb.cc
+    ../../include/msgtype/mapglobal.pb.cc \
+    planglobal.cpp
 
 HEADERS += \
     ../../../include/ivexit.h \
@@ -40,7 +41,8 @@ HEADERS += \
     planpoint.h \
     service_roi_xodr.h \
     xodrplan.h \
-    ../../include/msgtype/mapglobal.pb.h
+    ../../include/msgtype/mapglobal.pb.h \
+    planglobal.h
 
 
 !include(../../../include/common.pri ) {

+ 1 - 14
src/driver/driver_map_xodrload/globalplan.cpp

@@ -686,20 +686,7 @@ int GetNearPoint(const double x,const double y,OpenDrive * pxodr,Road ** pObjRoa
 }
 
 
-namespace iv {
-struct nearroad
-{
-Road * pObjRoad;
-GeometryBlock * pgeob;
-double nearx;
-double neary;
-double nearhead;
-double frels;
-double fdis;
-int lr = 2; //1 left 2 right;
-int nmode = 0; //0 same direciion dis zero   1 oposite dis = 0 2 same direction dis<5 3 oposite  dis <5   4 same direction > 5 5 oposite 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)

+ 15 - 0
src/driver/driver_map_xodrload/planglobal.cpp

@@ -0,0 +1,15 @@
+#include "planglobal.h"
+
+PlanGlobal::PlanGlobal()
+{
+
+}
+
+
+int PlanGlobal::MakePlan(xodrdijkstra * pxd,OpenDrive * pxodr,const double x_now,const double y_now,const double head,
+                    const double x_obj,const double y_obj,const double & obj_dis,
+                    const double srcnearthresh,const double dstnearthresh,
+                    const int nlanesel,std::vector<PlanPoint> & xPlan,const double fvehiclewidth)
+{
+    return 0;
+}

+ 22 - 0
src/driver/driver_map_xodrload/planglobal.h

@@ -0,0 +1,22 @@
+#ifndef PLANGLOBAL_H
+#define PLANGLOBAL_H
+
+#include "xodrfunc.h"
+
+#include "xodrdijkstra.h"
+
+#include "planpoint.h"
+
+class PlanGlobal
+{
+public:
+    PlanGlobal();
+
+public:
+    static int MakePlan(xodrdijkstra * pxd,OpenDrive * pxodr,const double x_now,const double y_now,const double head,
+                        const double x_obj,const double y_obj,const double & obj_dis,
+                        const double srcnearthresh,const double dstnearthresh,
+                        const int nlanesel,std::vector<PlanPoint> & xPlan,const double fvehiclewidth = 2.0);
+};
+
+#endif // PLANGLOBAL_H

+ 18 - 0
src/driver/driver_map_xodrload/planpoint.h

@@ -45,4 +45,22 @@ public:
     std::vector<double> mVectorLaneWidth; //Lane Width
 };
 
+
+#include <OpenDrive/OpenDrive.h>
+
+namespace iv {
+struct nearroad
+{
+Road * pObjRoad;
+GeometryBlock * pgeob;
+double nearx;
+double neary;
+double nearhead;
+double frels;
+double fdis;
+int lr = 2; //1 left 2 right;
+int nmode = 0; //0 same direciion dis zero   1 oposite dis = 0 2 same direction dis<5 3 oposite  dis <5   4 same direction > 5 5 oposite direction;
+};
+}
+
 #endif // PLANPOINT_H