|
@@ -12,6 +12,8 @@
|
|
|
|
|
|
#include "gpsimu.pb.h"
|
|
|
|
|
|
+#include "mapdata.pb.h"
|
|
|
+
|
|
|
#include "v2x.pb.h"
|
|
|
|
|
|
#include "modulecomm.h"
|
|
@@ -48,6 +50,7 @@ void * gpmap;
|
|
|
void * gpagps;
|
|
|
void * gpasimple;
|
|
|
void * gpav2x;
|
|
|
+static void * gpanewtrace;
|
|
|
|
|
|
iv::Ivfault *gfault = nullptr;
|
|
|
iv::Ivlog *givlog = nullptr;
|
|
@@ -508,6 +511,8 @@ void SetPlan(xodrobj xo)
|
|
|
}
|
|
|
|
|
|
|
|
|
+ iv::map::tracemap xtrace;
|
|
|
+
|
|
|
nSize = xPlan.size();
|
|
|
|
|
|
std::vector<iv::GPSData> mapdata;
|
|
@@ -529,19 +534,78 @@ void SetPlan(xodrobj xo)
|
|
|
|
|
|
for(i=0;i<nSize;i++)
|
|
|
{
|
|
|
- iv::GPSData data(new iv::GPS_INS);
|
|
|
- CalcLatLon(glat0,glon0,ghead0,xPlan[i].x,xPlan[i].y,xPlan[i].hdg,data->gps_lat,
|
|
|
- data->gps_lng,data->ins_heading_angle);
|
|
|
+ iv::map::mappoint * pmappoint = xtrace.add_point();
|
|
|
+ double gps_lon,gps_lat,gps_lon_avoidleft,gps_lat_avoidleft,gps_lat_avoidright,gps_lon_avoidright,gps_heading;
|
|
|
+ CalcLatLon(glat0,glon0,ghead0,xPlan[i].x,xPlan[i].y,xPlan[i].hdg,gps_lat,
|
|
|
+ gps_lon,gps_heading);
|
|
|
CalcLatLon(glat0,glon0,xPlan[i].mx_left,xPlan[i].my_left,
|
|
|
- data->gps_lat_avoidleft,data->gps_lng_avoidleft);
|
|
|
+ gps_lat_avoidleft,gps_lon_avoidleft);
|
|
|
CalcLatLon(glat0,glon0,xPlan[i].mx_right,xPlan[i].my_right,
|
|
|
- data->gps_lat_avoidright,data->gps_lng_avoidright);
|
|
|
+ gps_lat_avoidright,gps_lon_avoidright);
|
|
|
+
|
|
|
+ pmappoint->set_gps_lat(gps_lat);
|
|
|
+ pmappoint->set_gps_lat_avoidleft(gps_lat_avoidleft);
|
|
|
+ pmappoint->set_gps_lat_avoidright(gps_lat_avoidright);
|
|
|
+ pmappoint->set_gps_lng(gps_lon);
|
|
|
+ pmappoint->set_gps_lat_avoidleft(gps_lat_avoidleft);
|
|
|
+ pmappoint->set_gps_lng_avoidright(gps_lon_avoidright);
|
|
|
+ pmappoint->set_ins_heading_angle(gps_heading);
|
|
|
+
|
|
|
+ double gps_x,gps_y,gps_x_avoidleft,gps_y_avoidleft,gps_x_avoidright,gps_y_avoidright;
|
|
|
+
|
|
|
+ GaussProjCal(gps_lon,gps_lat,&gps_x,&gps_y);
|
|
|
+ GaussProjCal(gps_lon_avoidleft,gps_lat_avoidleft,&gps_x_avoidleft,&gps_y_avoidleft);
|
|
|
+ GaussProjCal(gps_lon_avoidright,gps_lat_avoidright,&gps_x_avoidright,&gps_y_avoidright);
|
|
|
+
|
|
|
+ pmappoint->set_gps_x(gps_x);
|
|
|
+ pmappoint->set_gps_x_avoidleft(gps_x_avoidleft);
|
|
|
+ pmappoint->set_gps_x_avoidright(gps_x_avoidright);
|
|
|
+ pmappoint->set_gps_y(gps_y);
|
|
|
+ pmappoint->set_gps_y_avoidleft(gps_y_avoidleft);
|
|
|
+ pmappoint->set_gps_y_avoidright(gps_y_avoidright);
|
|
|
+
|
|
|
+ pmappoint->set_speed(xPlan[i].speed);
|
|
|
+ pmappoint->set_index(i);
|
|
|
+
|
|
|
+ pmappoint->set_roadori(xPlan[i].mnLaneori);
|
|
|
+ pmappoint->set_roadsum(xPlan[i].mnLaneTotal);
|
|
|
+ pmappoint->set_mfdistolaneleft(xPlan[i].mfDisToLaneLeft);
|
|
|
+ pmappoint->set_mfdistoroadleft(xPlan[i].mfDisToRoadLeft);
|
|
|
+ pmappoint->set_mflanewidth(xPlan[i].mWidth);
|
|
|
+ pmappoint->set_mfroadwidth(xPlan[i].mfRoadWidth);
|
|
|
+ pmappoint->set_mbinlaneavoid(xPlan[i].bInlaneAvoid);
|
|
|
+
|
|
|
+
|
|
|
+ iv::GPSData data(new iv::GPS_INS);
|
|
|
+ data->gps_lat = gps_lat;
|
|
|
+ data->gps_lat_avoidleft = gps_lat_avoidleft;
|
|
|
+ data->gps_lat_avoidright = gps_lat_avoidright;
|
|
|
+ data->gps_lng = gps_lon;
|
|
|
+ data->gps_lng_avoidleft = gps_lon_avoidleft;
|
|
|
+ data->gps_lng_avoidright = gps_lon_avoidright;
|
|
|
+ data->ins_heading_angle = gps_heading;
|
|
|
+ data->gps_x = gps_x;
|
|
|
+ data->gps_x_avoidleft = gps_x_avoidleft;
|
|
|
+ data->gps_x_avoidright = gps_x_avoidright;
|
|
|
+ data->gps_y = gps_y;
|
|
|
+ data->gps_y_avoidleft = gps_y_avoidleft;
|
|
|
+ data->gps_y_avoidright = gps_y_avoidright;
|
|
|
+ pmappoint->set_mbnoavoid(xPlan[i].mbNoavoid);
|
|
|
+ pmappoint->set_mfcurvature(xPlan[i].mfCurvature);
|
|
|
+
|
|
|
+
|
|
|
+// CalcLatLon(glat0,glon0,ghead0,xPlan[i].x,xPlan[i].y,xPlan[i].hdg,data->gps_lat,
|
|
|
+// data->gps_lng,data->ins_heading_angle);
|
|
|
+// CalcLatLon(glat0,glon0,xPlan[i].mx_left,xPlan[i].my_left,
|
|
|
+// data->gps_lat_avoidleft,data->gps_lng_avoidleft);
|
|
|
+// CalcLatLon(glat0,glon0,xPlan[i].mx_right,xPlan[i].my_right,
|
|
|
+// data->gps_lat_avoidright,data->gps_lng_avoidright);
|
|
|
data->index = i;
|
|
|
data->speed = xPlan[i].speed;
|
|
|
// ZBGaussProjCal(data->gps_lng,data->gps_lat,&data->gps_x,&data->gps_y);
|
|
|
- GaussProjCal(data->gps_lng,data->gps_lat,&data->gps_x,&data->gps_y);
|
|
|
- GaussProjCal(data->gps_lng_avoidleft,data->gps_lat_avoidleft,&data->gps_x_avoidleft,&data->gps_y_avoidleft);
|
|
|
- GaussProjCal(data->gps_lng_avoidright,data->gps_lat_avoidright,&data->gps_x_avoidright,&data->gps_y_avoidright);
|
|
|
+// GaussProjCal(data->gps_lng,data->gps_lat,&data->gps_x,&data->gps_y);
|
|
|
+// GaussProjCal(data->gps_lng_avoidleft,data->gps_lat_avoidleft,&data->gps_x_avoidleft,&data->gps_y_avoidleft);
|
|
|
+// GaussProjCal(data->gps_lng_avoidright,data->gps_lat_avoidright,&data->gps_x_avoidright,&data->gps_y_avoidright);
|
|
|
|
|
|
givlog->verbose(" %d %11.7f %11.7f %11.3f ",i,data->gps_lat,
|
|
|
data->gps_lng,data->ins_heading_angle);
|
|
@@ -560,8 +624,11 @@ void SetPlan(xodrobj xo)
|
|
|
{
|
|
|
data->roadOri = 0;
|
|
|
data->roadSum = 2;
|
|
|
+ pmappoint->set_roadori(0);
|
|
|
+ pmappoint->set_roadsum(2);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
data->mbnoavoid = xPlan[i].mbNoavoid;
|
|
|
if(data->mbnoavoid)
|
|
|
{
|
|
@@ -597,6 +664,14 @@ void SetPlan(xodrobj xo)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ pmappoint->set_mode2(data->mode2);
|
|
|
+ pmappoint->set_rel_x(xPlan[i].x);
|
|
|
+ pmappoint->set_rel_y(xPlan[i].y);
|
|
|
+ pmappoint->set_rel_z(0);
|
|
|
+ pmappoint->set_rel_yaw(xPlan[i].hdg);
|
|
|
+ pmappoint->set_laneid(-1);
|
|
|
+ pmappoint->set_roadid(xPlan[i].nRoadID);
|
|
|
+
|
|
|
#ifdef BOAVOID
|
|
|
if(isboringroad(xPlan[i].nRoadID))
|
|
|
{
|
|
@@ -633,14 +708,9 @@ void SetPlan(xodrobj xo)
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
-// data->roadSum = 1;
|
|
|
-// data->roadMode = 0;
|
|
|
-// data->roadOri = 0;
|
|
|
+ mapdata.push_back(data);
|
|
|
|
|
|
-// if(xPlan[i].lanmp == -1)data->roadMode = 15;
|
|
|
-// if(xPlan[i].lanmp == 1)data->roadMode = 14;
|
|
|
|
|
|
- mapdata.push_back(data);
|
|
|
|
|
|
|
|
|
// char strline[255];
|
|
@@ -669,6 +739,17 @@ void SetPlan(xodrobj xo)
|
|
|
xfile_1.close();
|
|
|
ShareMap(mapdata);
|
|
|
|
|
|
+ int nnewmapsize = xtrace.ByteSize();
|
|
|
+ std::shared_ptr<char> str_ptr = std::shared_ptr<char>(new char[nnewmapsize]);
|
|
|
+ if(xtrace.SerializeToArray(str_ptr.get(),nnewmapsize))
|
|
|
+ {
|
|
|
+ iv::modulecomm::ModuleSendMsg(gpanewtrace ,str_ptr.get(),nnewmapsize);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ std::cout<<" new trace map serialize fail."<<std::endl;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -961,12 +1042,16 @@ int main(int argc, char *argv[])
|
|
|
LoadXODR(strmapth);
|
|
|
|
|
|
gpmap = iv::modulecomm::RegisterSend("tracemap",20000000,1);
|
|
|
+ gpasimple = iv::modulecomm::RegisterSend("simpletrace",100000,1);
|
|
|
+ gpanewtrace = iv::modulecomm::RegisterSend("newtracemap",20000000,1);
|
|
|
+
|
|
|
+
|
|
|
gpa = iv::modulecomm::RegisterRecv("xodrreq",ListenCmd);
|
|
|
gpasrc =iv::modulecomm::RegisterRecv("xodrsrc",ListenSrc);
|
|
|
gpagps = iv::modulecomm::RegisterRecv(strgpsmsg.data(),UpdateGPSIMU);
|
|
|
gpav2x = iv::modulecomm::RegisterRecv(strv2xmsg.data(),ListenV2X);
|
|
|
|
|
|
- gpasimple = iv::modulecomm::RegisterSend("simpletrace",100000,1);
|
|
|
+
|
|
|
|
|
|
|
|
|
double x_src,y_src,x_dst,y_dst;
|