Przeglądaj źródła

change OpenDrive.

yuchuli 2 lat temu
rodzic
commit
a0d176b7c8

+ 7 - 2
src/common/common/xodr/OpenDrive/ObjectSignal.cpp

@@ -2476,7 +2476,7 @@ Signal::Signal(double s, double t, std::string id, std::string name, bool dynami
     mwidth = width;
     mpsignal_laneValidity = 0;
     mpsignal_positionInertial = 0;
-    mpsignal_positionRoad = new signal_positionRoad("",s,t,zOffset,hOffset);
+    mpsignal_positionRoad = 0;//new signal_positionRoad("",s,t,zOffset,hOffset);
 }
 
 Signal::Signal()
@@ -2514,6 +2514,8 @@ Signal& Signal::operator=(const Signal& x)
         this->mheight = x.mheight;
         this->mwidth = x.mwidth;
         this->mpsignal_positionInertial = 0;
+        this->mpsignal_positionRoad = 0;
+        this->mpsignal_laneValidity = 0;
         if(x.mpsignal_positionInertial != 0)
         {
             this->mpsignal_positionInertial = new signal_positionInertial(x.mpsignal_positionInertial->Getx(),
@@ -2576,6 +2578,9 @@ Signal::Signal(const Signal &x)
     mroll = x.mroll;
     mheight = x.mheight;
     mwidth = x.mwidth;
+    mpsignal_laneValidity = 0;
+    mpsignal_positionInertial = 0;
+    mpsignal_positionRoad = 0;
     if(x.mpsignal_positionInertial != 0)
     {
         this->mpsignal_positionInertial = new signal_positionInertial(x.mpsignal_positionInertial->Getx(),
@@ -2816,7 +2821,7 @@ void Signal::SetpositionRoad(std::string roadid,double s, double t, double zOffs
         mpsignal_positionRoad->SethOffset(hOffset);
 
     }
-    mpsignal_positionInertial = NULL;
+    mpsignal_positionInertial = 0;
 }
 
 void Signal::SetpositionInertial(double x, double y, double z, double hdg)

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

@@ -682,8 +682,8 @@ Objects_tunnel* Road::GetLastAddedObjectsTunnel()
 }
 Objects_objectReference* Road::GetLastAddedObjectsObjectReference()
 {
-    if(mLastAddedObject<mObjectsObjectReferenceVector.size())
-        return &mObjectsObjectReferenceVector.at(mLastAddedObject);
+    if(mLastAddedObjectsObjectReference<mObjectsObjectReferenceVector.size())
+        return &mObjectsObjectReferenceVector.at(mLastAddedObjectsObjectReference);
     else
         return NULL;
 }

+ 2 - 1
src/driver/driver_ntrip_client/ntrip_client.cpp

@@ -73,6 +73,7 @@ void ntrip_client::readyReadSlot()
 
     case 4:
         str = (char *)message.data();
+        qDebug(str);
         if(strstr(str,"ICY 200 OK") != NULL)
         {
             mFindCMState = 5;
@@ -80,7 +81,7 @@ void ntrip_client::readyReadSlot()
         }
         else
         {
-            if(strstr(str,"HTTP 401 Unauthorized") != NULL)
+            if(strstr(str,"401 Unauthorized") != NULL)
             {
                 mFindCMState = -1;
                 qDebug("Authorize Fail. message is %s",message.data());

+ 7 - 5
src/tool/RemoteCtrl_Wide/mainthree.cpp

@@ -11,14 +11,16 @@
 #include "xmlparam.h"
 #include "ivversion.h"
 
-std::string gstrmem_gpsimu;
-std::string gstrmem_pic[CAMERA_NUM];
+extern std::string gstryaml_path;
+extern std::string gstrjoy_path;
+extern std::vector<iv::pos_def> gvectorpos;
+extern MainWindowLeft * gwleft,*gwright;
+
+static std::string gstrmem_gpsimu;
+static std::string gstrmem_pic[CAMERA_NUM];
 std::string gstryaml_path;
 std::string gstrjoy_path;
-
 std::vector<iv::pos_def> gvectorpos;
-
-
 MainWindowLeft * gwleft,*gwright;
 void LoadPos(std::string strfilepath)
 {

+ 57 - 45
src/tool/RemoteCtrl_Wide/mainwindowcenter.cpp

@@ -6,7 +6,7 @@
 
 #include "mainwindowleft.h"
 
-MainWindow * gw;
+static MainWindow * gw;
 
 extern MainWindowLeft * gwleft,*gwright;
 //#include "QStringLiteral"
@@ -19,12 +19,12 @@ extern MainWindowLeft * gwleft,*gwright;
 #include <opencv2/opencv.hpp>
 #include <opencv2/core.hpp>
 
-iv::gps::gpsimu ggpsimu;
-qint64 gTimeGPSIMUUpdate = 0;
+static iv::gps::gpsimu ggpsimu;
+static qint64 gTimeGPSIMUUpdate = 0;
 
-iv::vision::rawpic grawpic[CAMERA_NUM];
-qint64 gTimeRawPic[CAMERA_NUM] = {0,0,0,0};
-QMutex gMutexPic[CAMERA_NUM];
+static iv::vision::rawpic grawpic[CAMERA_NUM];
+//static qint64 gTimeRawPic[CAMERA_NUM] = {0,0,0,0};
+static QMutex gMutexPic[CAMERA_NUM];
 
 extern std::string gstrmem_gpsimu;
 extern std::string gstrmem_pic[CAMERA_NUM];
@@ -57,18 +57,20 @@ struct simpletrace
 };
 }
 
-std::vector<iv::simpletrace> gvectorsimplerace;
-QMutex gMutexTrace;
-qint64 gTimeTrace = 0;
+static std::vector<iv::simpletrace> gvectorsimplerace;
+static QMutex gMutexTrace;
+static qint64 gTimeTrace = 0;
 
 
-void * gpaframe;
+static void * gpaframe;
 
 MainWindow::MainWindow(QWidget *parent)
     : QMainWindow(parent)
     , ui(new Ui::MainWindowCenter)
 {
 
+    //Load Language
+
     m_translator = new QTranslator(this);
     QString strLanguageFile = ":/zh_CN.qm";
     if(ServiceRCIni.GetLanguage() == "Chinese")
@@ -86,13 +88,14 @@ MainWindow::MainWindow(QWidget *parent)
     }
 
 
+    ui->setupUi(this);
     gpaframe = iv::modulecomm::RegisterSend("h264frame",1000000,1);
     gw = this;
 
-    ui->setupUi(this);
 
 
 
+    //Load Param From .ini
     mstrserverip = ServiceRCIni.GetServerIP();
     mstrserverport = ServiceRCIni.GetServerPort();
     mstruploadinterval = ServiceRCIni.GetInterval();
@@ -101,21 +104,22 @@ MainWindow::MainWindow(QWidget *parent)
     mstrctrlMD5 = ServiceRCIni.GetCtrlMD5();
 
 
+    //Start JoyTick(G29)
     mpJRT = new JoyReadThread();
     mpJRT->start();
 
-    unsigned int i;
-
     CreateView();
 
+    //Add Station
+    unsigned int i;
     unsigned int nstation = static_cast<unsigned int>(gvectorpos.size()) ;
     for(i=0;i<nstation;i++)
     {
         ui->comboBox_Station->addItem(gvectorpos[i].mstrstationname.data());
     }
-
     ui->radioButton_auto->setChecked(true);
 
+    //ReomoteCtrl Message
     mpa = iv::modulecomm::RegisterSend("remotectrl",10000,1);
 
     mpTimerManual = new QTimer(this);
@@ -136,6 +140,7 @@ MainWindow::MainWindow(QWidget *parent)
     mpadst = iv::modulecomm::RegisterSend("xodrreq",1000,1);
 
 
+    //grpc for vehicle Information & Send RemoteCtrl
     mgrpcpc = new grpcpc(gstryaml_path);
     mgrpcpc->setserverip(mstrserverip);
     mgrpcpc->setserverport(mstrserverport);
@@ -146,6 +151,8 @@ MainWindow::MainWindow(QWidget *parent)
     mgrpcpc->StartRTSP();
     mgrpcpc->start();
 
+
+    //Frame Width & Height
     for(i=0;i<NUM_CAM;i++)
     {
         mpImageCam[i] = new QImage(640, 360, QImage::Format_RGB32);
@@ -171,7 +178,6 @@ MainWindow::MainWindow(QWidget *parent)
 
     connect(this,SIGNAL(CamUpdate(int)),this,SLOT(onCamUpdate(int)));
 
-
     setWindowTitle(mstrProgName +mstrVIN+  mstrGPSTime + mstrPicTime);
 
 }
@@ -304,7 +310,7 @@ void MainWindow::resizeEvent(QResizeEvent *event)
 
 
         double fMainRatio = 0.8;
-        mpVehSpeed->setVisible(false);
+
 
         double fVideoRatio = 9.0/16.0;
 
@@ -411,6 +417,11 @@ void MainWindow::resizeEvent(QResizeEvent *event)
         ui->label_gpssat->setGeometry(10,nypos,lablewidth,leheight);
         ui->lineEdit_gpssat->setGeometry(20+lablewidth,nypos,lewidth,leheight);
 
+        int nvehwidth = speed_width;
+        if(nvehwidth>nrearsize_y)nvehwidth = nrearsize_y;
+        mpVehSpeed->setVisible(true);
+        mpVehSpeed->setGeometry(grouppos_x,0,nvehwidth,nvehwidth);
+
 
         double fscale = nfrontsize_x*0.99/mnframewidth;
         double fscale2 = nrearsize_x*0.99/mnframewidth;
@@ -475,9 +486,9 @@ void MainWindow::onTimerManual()
         mfWheel = mpJRT->GetWheel() * (-100.0)/32768.0;
         mfAcc = ((mpJRT->GetAcc()-32767.0)/65535)*(-100.0);
         mfBrake = ((mpJRT->GetBrake()-32767.0)/65535)*(-100.0);
-        if(mfWheel != fOldWheel)mpWheel->updatevalue(mfWheel*5.5);
-        if(mfAcc != fOldAcc)mpAcc->updatevalue(mfAcc);
-        if(mfBrake != fOldBrake)mpBrake->updatevalue(mfBrake);
+        if(fabs(mfWheel - fOldWheel)>0.0000001)mpWheel->updatevalue(mfWheel*5.5);
+        if(fabs(mfAcc - fOldAcc)>0.0000001)mpAcc->updatevalue(mfAcc);
+        if(fabs(mfBrake - fOldBrake)>0.0000001)mpBrake->updatevalue(mfBrake);
 
         int x = mpJRT->GetShift();
         if(x > 0)mnShift = 1;
@@ -516,7 +527,7 @@ void MainWindow::onTimerManual()
 
     if(mPressKeys.contains(Qt::Key_A)&&(mPressKeys.contains((Qt::Key_D))))
     {
-        mfWheel = mfWheel;
+        mfWheel = mfWheel + 0.0;
     }
     else
     {
@@ -552,7 +563,7 @@ void MainWindow::onTimerManual()
 
     if(!mPressKeys.contains(Qt::Key_A)&&(!mPressKeys.contains((Qt::Key_D)))&&(bInKeepMode == false))
     {
-        if(mfWheel != 0)
+        if(fabs(mfWheel)>0.0)
         {
             if(mfWheel > 0)mfWheel = mfWheel - timediff*mfWheelAutoDownSpeed/1000;
             else mfWheel = mfWheel + timediff*mfWheelAutoDownSpeed/1000;
@@ -640,14 +651,14 @@ void MainWindow::onTimerManual()
 
     if(!mPressKeys.contains(Qt::Key_W)&&(!mPressKeys.contains((Qt::Key_S)))&&(bInKeepMode == false))
     {
-        if(mfBrake != 0)
+        if(fabs(mfBrake) >0)
         {
 //            mfBrake = mfBrake - timediff*mfBrakeAutoDownSpeed/1000;
 //            if(mfBrake<0)mfBrake = 0;
 //            if(mfBrake > 100)mfBrake = 100;
         }
 
-        if(mfAcc != 0)
+        if(fabs(mfAcc) > 0)
         {
             mfAcc = mfAcc - timediff*mfAccAutoDownSpeed/1000;
             if(mfAcc<0)mfAcc = 0;
@@ -655,9 +666,9 @@ void MainWindow::onTimerManual()
         }
     }
 
-    if(mfWheel != fOldWheel)mpWheel->updatevalue(mfWheel*4.5);
-    if(mfAcc != fOldAcc)mpAcc->updatevalue(mfAcc);
-    if(mfBrake != fOldBrake)mpBrake->updatevalue(mfBrake);
+    if(fabs(mfWheel - fOldWheel)>0)mpWheel->updatevalue(mfWheel*4.5);
+    if(fabs(mfAcc - fOldAcc)>0)mpAcc->updatevalue(mfAcc);
+    if(fabs(mfBrake -fOldBrake)>0)mpBrake->updatevalue(mfBrake);
 }
 
 void MainWindow::on_radioButton_auto_clicked()
@@ -695,22 +706,22 @@ void MainWindow::onTimerRemote()
     mremotectrl.set_shift(mnShift);
 
 
-    int nsersize = mremotectrl.ByteSize();
+    int nsersize = static_cast<int>(mremotectrl.ByteSize()) ;
     char * strbuf = new char[nsersize];
     if(mremotectrl.SerializeToArray(strbuf,nsersize))
     {
         mgrpcpc->SetCtrlMsg("remotectrl",strbuf,nsersize);
 //        iv::modulecomm::ModuleSendMsg(mpa,strbuf,nsersize);
     }
-    delete strbuf;
+    delete  [] strbuf;
 }
 
 void MainWindow::onTimerUpdatePic()
 {
-    static qint64 time_pic = 0;
+//    static qint64 time_pic = 0;
 
     static qint64 time_trace = 0;
-    static int pos = 0;
+//    static int pos = 0;
     static std::vector<iv::simpletrace> xvectorsimpletrace;
 
 
@@ -722,14 +733,14 @@ void MainWindow::onTimerUpdatePic()
         gMutexTrace.lock();
         xvectorsimpletrace = gvectorsimplerace;
         gMutexTrace.unlock();
-        pos = 0;
+ //       pos = 0;
         if(xvectorsimpletrace.size()> 0)
         {
             QJsonArray num_json,num2_json;                       //声明QJsonArray
             QJsonDocument num_document,num2_document;    //将QJsonArray改为QJsonDocument类
             QByteArray num_byteArray,num2_byteArray;      //
 
-            int i=0;
+            unsigned int i=0;
             for(i=0;i<xvectorsimpletrace.size();i++)                            //将数组传入压入num_json
             {
                 num_json.append(xvectorsimpletrace[i].gps_lng);
@@ -769,15 +780,15 @@ void MainWindow::onTimerUpdateView()
 {
     static qint64 time_gps = 0;
 
-    unsigned int i;
+ //   unsigned int i;
 
    char strlatency[1000];
    char strtem[100];
    snprintf(strlatency,1000,"Latency(Up|FrameRate|Down): ");
-   snprintf(strtem,100,"FT(%d|%d|%d) ",mgrpcpc->GetPicLatency(0),mgrpcpc->GetFrameRate(0),mgrpcpc->GetPicDownLatency(0));strncat(strlatency,strtem,1000);
-   snprintf(strtem,100,"RR(%d|%d|%d) ",mgrpcpc->GetPicLatency(1),mgrpcpc->GetFrameRate(1),mgrpcpc->GetPicDownLatency(1));strncat(strlatency,strtem,1000);
-   snprintf(strtem,100,"LT(%d|%d|%d) ",mgrpcpc->GetPicLatency(2),mgrpcpc->GetFrameRate(2),mgrpcpc->GetPicDownLatency(2));strncat(strlatency,strtem,1000);
-   snprintf(strtem,100,"RT(%d|%d|%d) ",mgrpcpc->GetPicLatency(3),mgrpcpc->GetFrameRate(3),mgrpcpc->GetPicDownLatency(3));strncat(strlatency,strtem,1000);
+   snprintf(strtem,100,"FT(%lld|%d|%lld) ",mgrpcpc->GetPicLatency(0),mgrpcpc->GetFrameRate(0),mgrpcpc->GetPicDownLatency(0));strncat(strlatency,strtem,1000);
+   snprintf(strtem,100,"RR(%lld|%d|%lld) ",mgrpcpc->GetPicLatency(1),mgrpcpc->GetFrameRate(1),mgrpcpc->GetPicDownLatency(1));strncat(strlatency,strtem,1000);
+   snprintf(strtem,100,"LT(%lld|%d|%lld) ",mgrpcpc->GetPicLatency(2),mgrpcpc->GetFrameRate(2),mgrpcpc->GetPicDownLatency(2));strncat(strlatency,strtem,1000);
+   snprintf(strtem,100,"RT(%lld|%d|%lld) ",mgrpcpc->GetPicLatency(3),mgrpcpc->GetFrameRate(3),mgrpcpc->GetPicDownLatency(3));strncat(strlatency,strtem,1000);
 
    mpLabelLatency->setText(strlatency);
 
@@ -914,12 +925,12 @@ void MainWindow::on_pushButton_Go_clicked()
     if(ui->comboBox_Station->currentIndex() < 0)return;
     int index = ui->comboBox_Station->currentIndex();
 
-    if(index<0 ||  index>= gvectorpos.size())
+    if(index<0 ||  index>= static_cast<int>(gvectorpos.size()) )
     {
         std::cout<<"out range."<<std::endl;
         return;
     }
-    iv::pos_def xpos = gvectorpos[index];
+    iv::pos_def xpos = gvectorpos[static_cast<unsigned int>(index) ];
 
     double lon,lat;
     lon = xpos.mflon;
@@ -931,18 +942,18 @@ void MainWindow::on_pushButton_Go_clicked()
     xo.lane = 3;
 
 
-    mgrpcpc->SetCtrlMsg("xodrreq",(char *)&xo,sizeof(xodrobj));
+    mgrpcpc->SetCtrlMsg("xodrreq",   reinterpret_cast<char *>(&xo),sizeof(xodrobj));
 //    iv::modulecomm::ModuleSendMsg(mpadst,(char *)&xo,sizeof(xodrobj));
 }
 
 void MainWindow::on_comboBox_Station_currentIndexChanged(int index)
 {
-    if(index<0 ||  index>= gvectorpos.size())
+    if(index<0 ||  index>= static_cast<int>(gvectorpos.size()))
     {
         std::cout<<"out range."<<std::endl;
         return;
     }
-    iv::pos_def xpos = gvectorpos[index];
+    iv::pos_def xpos = gvectorpos[static_cast<unsigned int>(index) ];
 
     char strscript[256];
     snprintf(strscript,255,"objLocation(%11.7f,%11.7f);",xpos.mflon,xpos.mflat);
@@ -953,7 +964,7 @@ void MainWindow::on_comboBox_Station_currentIndexChanged(int index)
 
 void MainWindow::on_checkBox_Drive_stateChanged(int arg1)
 {
-
+    (void)arg1;
 }
 
 void MainWindow::on_checkBox_Drive_clicked()
@@ -1047,6 +1058,7 @@ void MainWindow::threadinfo()
     while(mbThreadrun)
     {
         nrtn = mgrpcpc->GetQueryMsg(xcloudmsg,1000);
+        std::cout<<" thread info message."<<std::endl;
         if(nrtn == 1)
         {
             int i;
@@ -1056,7 +1068,7 @@ void MainWindow::threadinfo()
                 if(punit->msgname() == "hcp2_gpsimu")
                 {
                     iv::gps::gpsimu xgpsimu;
-                    if(!xgpsimu.ParseFromArray(punit->data().data(),punit->data().size()))
+                    if(!xgpsimu.ParseFromArray(punit->data().data(),static_cast<int>(punit->data().size()) ))
                     {
                         std::cout<<"ListenRaw Parse error."<<std::endl;
                         continue;
@@ -1120,7 +1132,7 @@ void MainWindow::threadpic(int ncampos)
 #endif
         mph264decode[ncampos]->UnlockReadBuff(nindex);
 
-        QImage image2 = QImage((uchar*)(rgbImg.data), rgbImg.cols, rgbImg.rows,  QImage::Format_RGB888);
+        QImage image2 = QImage(static_cast<uchar*>(rgbImg.data), rgbImg.cols, rgbImg.rows,  QImage::Format_RGB888);
 
 #ifndef TESTH264
         mMutexCam[ncampos].lock();