|
@@ -76,6 +76,9 @@ static void * gpasimple;
|
|
|
static void * gpav2x;
|
|
|
static void * gpanewtrace;
|
|
|
static void * gpamapglobal;
|
|
|
+static void * gpaxodrrawreq;
|
|
|
+static void * gpaxodrrawrep;
|
|
|
+
|
|
|
|
|
|
iv::Ivfault *gfault = nullptr;
|
|
|
iv::Ivlog *givlog = nullptr;
|
|
@@ -99,7 +102,16 @@ struct simpletrace
|
|
|
double ins_heading_angle = 0; //航向角
|
|
|
};
|
|
|
|
|
|
+struct xodrrawdata
|
|
|
+{
|
|
|
+ std::shared_ptr<char> mpstr_ptr;
|
|
|
+ int ndatasize;
|
|
|
+};
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
+iv::xodrrawdata gxodrraw;
|
|
|
+
|
|
|
/**
|
|
|
*
|
|
|
*
|
|
@@ -108,8 +120,25 @@ struct simpletrace
|
|
|
* */
|
|
|
bool LoadXODR(std::string strpath)
|
|
|
{
|
|
|
+ QFile xFile;
|
|
|
+ xFile.setFileName(strpath.data());
|
|
|
+ if(xFile.open(QIODevice::ReadOnly))
|
|
|
+ {
|
|
|
+ QByteArray ba = xFile.readAll();
|
|
|
+ if(ba.size() > 0)
|
|
|
+ {
|
|
|
+ iv::xodrrawdata xraw;
|
|
|
+ xraw.ndatasize = ba.size();
|
|
|
+ xraw.mpstr_ptr = std::shared_ptr<char>(new char[xraw.ndatasize]);
|
|
|
+ memcpy(xraw.mpstr_ptr.get(),ba.data(),xraw.ndatasize);
|
|
|
+ gxodrraw = xraw;
|
|
|
+ }
|
|
|
+ xFile.close();
|
|
|
+ }
|
|
|
+
|
|
|
OpenDriveXmlParser xp(&mxodr);
|
|
|
xp.ReadFile(strpath);
|
|
|
+
|
|
|
std::cout<<"road cout is "<<mxodr.GetRoadCount()<<std::endl;
|
|
|
if(mxodr.GetRoadCount() < 1)
|
|
|
{
|
|
@@ -1340,6 +1369,9 @@ void ListenV2X(const char * strdata,const unsigned int nSize,const unsigned int
|
|
|
void ListenSrc(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
|
|
|
{
|
|
|
|
|
|
+ (void)index;
|
|
|
+ (void)dt;
|
|
|
+ (void)strmemname;
|
|
|
if(nSize<sizeof(xodrobj))
|
|
|
{
|
|
|
givlog->warn("ListenSrc small");
|
|
@@ -1354,6 +1386,25 @@ void ListenSrc(const char * strdata,const unsigned int nSize,const unsigned int
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+static void ShareXODRRaw()
|
|
|
+{
|
|
|
+ if(gxodrraw.ndatasize > 0)
|
|
|
+ {
|
|
|
+ iv::modulecomm::ModuleSendMsg(gpaxodrrawrep,gxodrraw.mpstr_ptr.get(),gxodrraw.ndatasize);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void ListenXODRRawReq(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
|
|
|
+{
|
|
|
+ (void)index;
|
|
|
+ (void)dt;
|
|
|
+ (void)strmemname;
|
|
|
+ (void)strdata;
|
|
|
+ (void)nSize;
|
|
|
+ ShareXODRRaw();
|
|
|
+}
|
|
|
+
|
|
|
void UpdateGPSIMU(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
|
|
|
{
|
|
|
|
|
@@ -1432,6 +1483,7 @@ int main(int argc, char *argv[])
|
|
|
showversion("driver_map_xodrload");
|
|
|
QCoreApplication a(argc, argv);
|
|
|
gApp = &a;
|
|
|
+ gxodrraw.ndatasize = 0;
|
|
|
|
|
|
RegisterIVBackTrace();
|
|
|
|
|
@@ -1554,6 +1606,9 @@ int main(int argc, char *argv[])
|
|
|
gpagps = iv::modulecomm::RegisterRecv(strgpsmsg.data(),UpdateGPSIMU);
|
|
|
gpav2x = iv::modulecomm::RegisterRecv(strv2xmsg.data(),ListenV2X);
|
|
|
|
|
|
+ gpaxodrrawreq = iv::modulecomm::RegisterRecv("xodrrawreq",ListenXODRRawReq);
|
|
|
+ gpaxodrrawrep = iv::modulecomm::RegisterSend("xodrrawrep",30000000,1);
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -1598,6 +1653,8 @@ int main(int argc, char *argv[])
|
|
|
|
|
|
signal(SIGINT,signal_handler);
|
|
|
|
|
|
+ ShareXODRRaw();
|
|
|
+
|
|
|
int nrc = a.exec();
|
|
|
|
|
|
std::cout<<"driver_map_xodr app exit. code :"<<nrc<<std::endl;
|