|
@@ -14,6 +14,8 @@
|
|
|
|
|
|
#include "mapdata.pb.h"
|
|
|
|
|
|
+#include "mapglobal.pb.h"
|
|
|
+
|
|
|
#include "v2x.pb.h"
|
|
|
|
|
|
#include "modulecomm.h"
|
|
@@ -50,13 +52,14 @@ bool gbExtendMap = true;
|
|
|
static bool gbSideEnable = false;
|
|
|
static bool gbSideLaneEnable = false;
|
|
|
|
|
|
-void * gpa;
|
|
|
-void * gpasrc;
|
|
|
-void * gpmap;
|
|
|
-void * gpagps;
|
|
|
-void * gpasimple;
|
|
|
-void * gpav2x;
|
|
|
+static void * gpa;
|
|
|
+static void * gpasrc;
|
|
|
+static void * gpmap;
|
|
|
+static void * gpagps;
|
|
|
+static void * gpasimple;
|
|
|
+static void * gpav2x;
|
|
|
static void * gpanewtrace;
|
|
|
+static void * gpamapglobal;
|
|
|
|
|
|
iv::Ivfault *gfault = nullptr;
|
|
|
iv::Ivlog *givlog = nullptr;
|
|
@@ -334,7 +337,60 @@ public:
|
|
|
int lane;
|
|
|
};
|
|
|
|
|
|
-xodrobj gsrc;
|
|
|
+static xodrobj gsrc;
|
|
|
+
|
|
|
+void ShareMapGlobal(std::vector<PlanPoint> & xvectorPlan)
|
|
|
+{
|
|
|
+ iv::map::mapglobal xglobal;
|
|
|
+ unsigned int i;
|
|
|
+ unsigned int nsize = static_cast<unsigned int >(xvectorPlan.size());
|
|
|
+ for(i=0;i<nsize;i++)
|
|
|
+ {
|
|
|
+ iv::map::pointglobal * ppoint = xglobal.add_point();
|
|
|
+ double gps_lon,gps_lat,gps_heading;
|
|
|
+ CalcLatLon(glat0,glon0,ghead0,xvectorPlan[i].x,xvectorPlan[i].y,xvectorPlan[i].hdg,gps_lat,
|
|
|
+ gps_lon,gps_heading);
|
|
|
+ ppoint->set_gps_lat(gps_lat);
|
|
|
+ ppoint->set_gps_lng(gps_lon);
|
|
|
+ ppoint->set_ins_heading_angle(gps_heading);
|
|
|
+
|
|
|
+ double gps_x,gps_y;
|
|
|
+ GaussProjCal(gps_lon,gps_lat,&gps_x,&gps_y);
|
|
|
+ ppoint->set_gps_x(gps_x);
|
|
|
+ ppoint->set_gps_y(gps_y);
|
|
|
+ ppoint->set_gps_z(0);
|
|
|
+
|
|
|
+ ppoint->set_mfcurvature(xvectorPlan[i].mfCurvature);
|
|
|
+ ppoint->set_mfdistolaneleft(xvectorPlan[i].mfDisToLaneLeft);
|
|
|
+ ppoint->set_mfdistoroadleft(xvectorPlan[i].mfDisToRoadLeft);
|
|
|
+ ppoint->set_mflanewidth(xvectorPlan[i].mWidth);
|
|
|
+ ppoint->set_mfroadwidth(xvectorPlan[i].mfRoadWidth);
|
|
|
+ ppoint->set_speed(xvectorPlan[i].speed);
|
|
|
+ unsigned int nlanecount = static_cast<unsigned int>(xvectorPlan[i].mVectorLaneWidth.size());
|
|
|
+ unsigned int j;
|
|
|
+ for(j=0;j<nlanecount;j++)
|
|
|
+ {
|
|
|
+ ppoint->add_mfvectorlanewidth(xvectorPlan[i].mVectorLaneWidth[j]);
|
|
|
+ }
|
|
|
+ ppoint->set_mlanecount(xvectorPlan[i].mLaneCount);
|
|
|
+ ppoint->set_mlanecur(xvectorPlan[i].mLaneCur);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ int bytesize = static_cast<int>(xglobal.ByteSizeLong()) ;
|
|
|
+
|
|
|
+ std::shared_ptr<char> pstr_ptr = std::shared_ptr<char>(new char[bytesize]);
|
|
|
+ if(xglobal.SerializePartialToArray(pstr_ptr.get(),bytesize))
|
|
|
+ {
|
|
|
+ iv::modulecomm::ModuleSendMsg(gpamapglobal,pstr_ptr.get(),static_cast<unsigned int>(bytesize) );
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ std::cout<<" ShareMapGlobal Serialzie Fail."<<std::endl;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
|
|
|
void ShareMap(std::vector<iv::GPSData> navigation_data)
|
|
|
{
|
|
@@ -554,6 +610,7 @@ void CalcSide(std::vector<PlanPoint> & xPlan)
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
void SetPlan(xodrobj xo)
|
|
|
{
|
|
|
|
|
@@ -843,6 +900,8 @@ void SetPlan(xodrobj xo)
|
|
|
xfile_1.close();
|
|
|
ShareMap(mapdata);
|
|
|
|
|
|
+ ShareMapGlobal(xPlan);
|
|
|
+
|
|
|
int nnewmapsize = xtrace.ByteSize();
|
|
|
std::shared_ptr<char> str_ptr = std::shared_ptr<char>(new char[nnewmapsize]);
|
|
|
if(xtrace.SerializeToArray(str_ptr.get(),nnewmapsize))
|
|
@@ -1194,6 +1253,7 @@ int main(int argc, char *argv[])
|
|
|
gpmap = iv::modulecomm::RegisterSend("tracemap",20000000,1);
|
|
|
gpasimple = iv::modulecomm::RegisterSend("simpletrace",100000,1);
|
|
|
gpanewtrace = iv::modulecomm::RegisterSend("newtracemap",20000000,1);
|
|
|
+ gpamapglobal = iv::modulecomm::RegisterSend("mapglobal",20000000,1);
|
|
|
|
|
|
|
|
|
gpa = iv::modulecomm::RegisterRecv("xodrreq",ListenCmd);
|