Quellcode durchsuchen

change pad program, add fusion show.

yuchuli vor 2 Jahren
Ursprung
Commit
84294a4de5

+ 167 - 0
src/common/common/xodr/OpenDrive/ObjectSignal.cpp

@@ -2,6 +2,173 @@
 
 
 #include <iostream>
 #include <iostream>
 
 
+Objects_tunnel::Objects_tunnel(double s,double length,std::string strid,std::string strtype)
+{
+    mS = s;
+    mlength = length;
+    mstrid = strid;
+    mstrtype = strtype;
+}
+
+double Objects_tunnel::GetS()
+{
+    return mS;
+}
+
+double Objects_tunnel::Getlength()
+{
+    return mlength;
+}
+
+int Objects_tunnel::GetName(std::string name)
+{
+    if(mname.size() == 0)return 0;
+    name = mname[0];
+    return 1;
+}
+
+std::string Objects_tunnel::Getid()
+{
+    return mstrid;
+}
+
+std::string Objects_tunnel::Gettype()
+{
+    return mstrtype;
+}
+
+void Objects_tunnel::SetS(double s)
+{
+    mS = s;
+}
+
+void Objects_tunnel::Setlength(double length)
+{
+    mlength = length;
+}
+
+void Objects_tunnel::Setname(std::string name)
+{
+    if(mname.size() == 0)mname.clear();
+    mname.push_back(name);
+}
+
+void Objects_tunnel::Resetname()
+{
+    if(mname.size() == 0)mname.clear();
+}
+
+void Objects_tunnel::Setid(std::string id)
+{
+    mstrid = id;
+}
+
+void Objects_tunnel::Settype(std::string type)
+{
+    mstrtype = type;
+}
+
+int Objects_tunnel::Getlighting(int & lighting)
+{
+    if(mvectorlighting.size() == 0)return 0;
+    lighting = mvectorlighting[0];
+    return 1;
+}
+
+int Objects_tunnel::Getdaylight(int & daylight)
+{
+    if(mvectordaylight.size() == 0)return 0;
+    daylight = mvectordaylight[0];
+    return 1;
+}
+
+void Objects_tunnel::Setlighting(int lighting)
+{
+    if(mvectorlighting.size() > 0)mvectorlighting.clear();
+    mvectorlighting.push_back(lighting);
+}
+
+void Objects_tunnel::Setdaylight(int daylight)
+{
+    if(mvectordaylight.size() > 0)mvectordaylight.clear();
+    mvectordaylight.push_back(daylight);
+}
+
+void Objects_tunnel::Resetlighting()
+{
+    if(mvectorlighting.size() > 0)mvectorlighting.clear();
+}
+
+void Objects_tunnel::Resetdaylight()
+{
+    if(mvectordaylight.size() > 0)mvectordaylight.clear();
+}
+
+
+vector<Object_laneValidity> * Objects_tunnel::GetObjectlaneValidityVector()
+{
+    return &mObject_laneValidity;
+}
+
+Object_laneValidity* Objects_tunnel::GetObjectlaneValidity(unsigned int i)
+{
+    if ((mObject_laneValidity.size()>0)&&(i<(mObject_laneValidity.size())))
+        return &(mObject_laneValidity.at(i));
+    else
+        return NULL;
+}
+
+unsigned int Objects_tunnel::GetObjectlaneValidityCount()
+{
+    return static_cast<unsigned int>(mObject_laneValidity.size());
+}
+
+Object_laneValidity*			Objects_tunnel::GetLastObjectlaneValidity()
+{
+    if (mObject_laneValidity.size()>0)
+        return &mObject_laneValidity.at(mObject_laneValidity.size()-1);
+    else
+        return NULL;
+}
+
+Object_laneValidity*			Objects_tunnel::GetLastAddedObjectlaneValidity()
+{
+    if(mLastAddedObjectlaneValidity<mObject_laneValidity.size())
+        return &mObject_laneValidity.at(mLastAddedObjectlaneValidity);
+    else
+        return NULL;
+}
+
+unsigned int Objects_tunnel::AddObjectlaneValidity(int fromLane, int toLane)
+{
+    mObject_laneValidity.push_back(Object_laneValidity(fromLane,toLane));
+    mLastAddedObjectlaneValidity = static_cast<unsigned int>(mObject_laneValidity.size()-1) ;
+    return mLastAddedObjectlaneValidity;
+}
+
+unsigned int Objects_tunnel::CloneObjectlaneValidity(unsigned int index)
+{
+    if(index<(mObject_laneValidity.size()-1))
+        mObject_laneValidity.insert(mObject_laneValidity.begin()+index+1, mObject_laneValidity[index]);
+    else if(index==mObject_laneValidity.size()-1)
+        mObject_laneValidity.push_back(mObject_laneValidity[index]);
+    mLastAddedObjectlaneValidity=index+1;
+    return mLastAddedObjectlaneValidity;
+}
+void Objects_tunnel::DeleteObjectlaneValidity(unsigned int index)
+{
+    mObject_laneValidity.erase(mObject_laneValidity.begin()+index);
+}
+
+bool Objects_tunnel::CheckInterval(double s_check)
+{
+    if (s_check>=mS)
+        return true;
+    else
+        return false;
+}
+
+
 Objects_bridge::Objects_bridge(double s,double length,std::string strid,std::string strtype)
 Objects_bridge::Objects_bridge(double s,double length,std::string strid,std::string strtype)
 {
 {
     mS = s;
     mS = s;

+ 51 - 0
src/common/common/xodr/OpenDrive/ObjectSignal.h

@@ -12,6 +12,57 @@ class Object_markings_marking_cornerReference;
 class Object_laneValidity;
 class Object_laneValidity;
 
 
 
 
+class Objects_tunnel
+{
+    double mS;
+    double mlength;
+    std::vector<std::string> mname;
+    std::string mstrid;
+    std::string mstrtype;
+
+    std::vector<int> mvectorlighting;
+    std::vector<int> mvectordaylight;
+
+    vector<Object_laneValidity> mObject_laneValidity;
+
+    unsigned int mLastAddedObjectlaneValidity;
+
+public:
+    Objects_tunnel(double s,double length,std::string strid,std::string strtype);
+    double GetS();
+    double Getlength();
+    int GetName(std::string name);
+    std::string Getid();
+    std::string Gettype();
+
+
+    void SetS(double s);
+    void Setlength(double length);
+    void Setname(std::string name);
+    void Resetname();
+    void Setid(std::string id);
+    void Settype(std::string type);
+
+    int Getlighting(int & lighting);
+    int Getdaylight(int & daylight);
+    void Setlighting(int lighting);
+    void Setdaylight(int daylight);
+    void Resetlighting();
+    void Resetdaylight();
+
+    vector<Object_laneValidity> * GetObjectlaneValidityVector();
+    Object_laneValidity* GetObjectlaneValidity(unsigned int i);
+    unsigned int GetObjectlaneValidityCount();
+    Object_laneValidity*			GetLastObjectlaneValidity();
+    Object_laneValidity*			GetLastAddedObjectlaneValidity();
+    unsigned int AddObjectlaneValidity(int fromLane,int toLane);
+    unsigned int CloneObjectlaneValidity(unsigned int index);
+    void DeleteObjectlaneValidity(unsigned int index);
+
+    bool CheckInterval(double s_check);
+
+};
+
 class Objects_bridge
 class Objects_bridge
 {
 {
 private:
 private:

+ 5 - 0
src/driver/driver_grpc_server/driver_grpc_server.yaml

@@ -35,6 +35,11 @@ querymessage:
     msgname: otavehinfo
     msgname: otavehinfo
     buffersize: 1000
     buffersize: 1000
     buffercount: 1
     buffercount: 1
+      
+  li_ra_fusion:
+    msgname: li_ra_fusion
+    buffersize: 10000000
+    buffercount: 1
 
 
 
 
 ctrlmessage:
 ctrlmessage:

+ 4 - 0
src/ui/ADCIntelligentShow_grpc/ADCIntelligentShow_grpc_android.pro

@@ -46,6 +46,8 @@ SOURCES += \
         main.cpp \
         main.cpp \
     adcintelligentshow.cpp \
     adcintelligentshow.cpp \
     myview.cpp \
     myview.cpp \
+    proto1804/msgtype/fusionobject.pb.cc \
+    proto1804/msgtype/fusionobjectarray.pb.cc \
     proto1804/msgtype/vehinfo.pb.cc
     proto1804/msgtype/vehinfo.pb.cc
 
 
 HEADERS += \
 HEADERS += \
@@ -68,6 +70,8 @@ HEADERS += \
         ivview.h \
         ivview.h \
         myview.h \
         myview.h \
         pos_def.h \
         pos_def.h \
+        proto1804/msgtype/fusionobject.pb.h \
+        proto1804/msgtype/fusionobjectarray.pb.h \
         proto1804/msgtype/vehinfo.pb.h
         proto1804/msgtype/vehinfo.pb.h
 
 
 FORMS += \
 FORMS += \

+ 25 - 0
src/ui/ADCIntelligentShow_grpc/adcintelligentshow.cpp

@@ -112,6 +112,21 @@ void ListenDection(const char * strdata,const unsigned int nSize,const unsigned
    gAShow->UpdateDection(xdecision);
    gAShow->UpdateDection(xdecision);
 }
 }
 
 
+void ListenFusion(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
+{
+    (void)&index;
+    (void)dt;
+    (void)strmemname;
+    iv::fusion::fusionobjectarray xfusionarray;
+    if(!xfusionarray.ParseFromArray(strdata, static_cast<int>(nSize) ))
+    {
+        qDebug("listen fusion fail.");
+        return;
+    }
+
+    gAShow->UpdateFusion(xfusionarray);
+}
+
 void ListenBrainState(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
 void ListenBrainState(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
 {
 {
     (void)&index;
     (void)&index;
@@ -179,6 +194,10 @@ void ListenTraceMap(const char * strdata,const unsigned int nSize,const unsigned
         {
         {
             ListenVehInfo(strdata,nDataLen,0,0,0);
             ListenVehInfo(strdata,nDataLen,0,0,0);
         }
         }
+        if(strncmp(msgname,"li_ra_fusion",256) == 0)
+        {
+            ListenFusion(strdata,nDataLen,0,0,0);
+        }
     }
     }
 #endif
 #endif
 
 
@@ -276,6 +295,7 @@ ADCIntelligentShow::ADCIntelligentShow(QWidget *parent) :
     mparadar = pa;
     mparadar = pa;
 
 
     pa = iv::modulecomm::RegisterRecv("otavehinfo",ListenVehInfo);
     pa = iv::modulecomm::RegisterRecv("otavehinfo",ListenVehInfo);
+    pa = iv::modulecomm::RegisterRecv("li_ra_fusion",ListenFusion);
 
 
     mpadst = iv::modulecomm::RegisterSend("xodrreq",1000,1);
     mpadst = iv::modulecomm::RegisterSend("xodrreq",1000,1);
 
 
@@ -1459,3 +1479,8 @@ void ADCIntelligentShow::onOTAVehInfoUpdate()
     snprintf(strout,1000,"Type:%s   Version:%s   VIN:%s",xvehinfo.type().data(),xvehinfo.version().data(),xvehinfo.vin().data());
     snprintf(strout,1000,"Type:%s   Version:%s   VIN:%s",xvehinfo.type().data(),xvehinfo.version().data(),xvehinfo.vin().data());
     ui->label_vehinfo->setText(strout);
     ui->label_vehinfo->setText(strout);
 }
 }
+
+void ADCIntelligentShow::UpdateFusion(iv::fusion::fusionobjectarray &xfusion)
+{
+    mpivmapview->setfusion(xfusion);
+}

+ 2 - 0
src/ui/ADCIntelligentShow_grpc/adcintelligentshow.h

@@ -30,6 +30,7 @@
 #include "hmi.pb.h"
 #include "hmi.pb.h"
 #include "radarobjectarray.pb.h"
 #include "radarobjectarray.pb.h"
 #include "vehinfo.pb.h"
 #include "vehinfo.pb.h"
+#include "fusionobjectarray.pb.h"
 
 
 #include "gps_nbtype.h"
 #include "gps_nbtype.h"
 #include "myview.h"
 #include "myview.h"
@@ -236,6 +237,7 @@ public:
     void UpdateDection(iv::brain::decition xdecision);
     void UpdateDection(iv::brain::decition xdecision);
     void UpdateRADAR(iv::radar::radarobjectarray * pxobj);
     void UpdateRADAR(iv::radar::radarobjectarray * pxobj);
     void UpdateOTAVehInfo(iv::veh::vehinfo & pvehinfo);
     void UpdateOTAVehInfo(iv::veh::vehinfo & pvehinfo);
+    void UpdateFusion(iv::fusion::fusionobjectarray & xfusion);
 
 
 
 
 #ifdef Android
 #ifdef Android

+ 29 - 2
src/ui/ADCIntelligentShow_grpc/ivmapview.cpp

@@ -253,7 +253,7 @@ void ivmapview::paint()
     }
     }
 
 
 
 
-    if((xTime - mnTimeLidarOBS)<3000)
+    if(abs(xTime - mnTimeLidarOBS)<3000)
     {
     {
         std::shared_ptr<std::vector<iv::ObstacleBasic>> xobs;
         std::shared_ptr<std::vector<iv::ObstacleBasic>> xobs;
         mMutexOBS.lock();
         mMutexOBS.lock();
@@ -268,7 +268,7 @@ void ivmapview::paint()
         }
         }
     }
     }
 
 
-    if((xTime-mnTimeRADAR)<3000)
+    if(abs(xTime-mnTimeRADAR)<3000)
     {
     {
         iv::radar::radarobjectarray xradarobj;
         iv::radar::radarobjectarray xradarobj;
         mMutexRadar.lock();
         mMutexRadar.lock();
@@ -292,6 +292,25 @@ void ivmapview::paint()
             }
             }
 
 
         }
         }
+
+        if(abs(xTime-mnTimeFusion)<3000)
+        {
+            iv::fusion::fusionobjectarray xfusion;
+            mMutexFusion.lock();
+            xfusion.CopyFrom(mfusion);
+            mMutexFusion.unlock();
+
+            painter->setPen(QColor(255,0,0));
+
+            for(int a = 0; a < xfusion.obj_size(); a++)
+            {
+                for(int b = 0; b < xfusion.obj(a).nomal_centroid_size(); b++)
+                {
+                    painter->drawPoint((xfusion.obj(a).nomal_centroid(b).nomal_x())*10 + 450, -(xfusion.obj(a).nomal_centroid(b).nomal_y() + 0)*10 + 700);
+                }
+            }
+
+        }
     }
     }
 
 
     QPixmap pix;
     QPixmap pix;
@@ -404,4 +423,12 @@ void ivmapview::setradar(iv::radar::radarobjectarray *pradarobj)
     mnTimeRADAR = QDateTime::currentMSecsSinceEpoch();
     mnTimeRADAR = QDateTime::currentMSecsSinceEpoch();
 }
 }
 
 
+void ivmapview::setfusion(iv::fusion::fusionobjectarray &xfusion)
+{
+    mMutexFusion.lock();
+    mfusion.CopyFrom(xfusion);
+    mMutexFusion.unlock();
+    mnTimeFusion = QDateTime::currentMSecsSinceEpoch();
+}
+
 
 

+ 6 - 0
src/ui/ADCIntelligentShow_grpc/ivmapview.h

@@ -8,6 +8,7 @@
 #include "gpsimu.pb.h"
 #include "gpsimu.pb.h"
 #include "gps_nbtype.h"
 #include "gps_nbtype.h"
 #include "obstacle_type.h"
 #include "obstacle_type.h"
+#include "fusionobjectarray.pb.h"
 
 
 #include "radarobjectarray.pb.h"
 #include "radarobjectarray.pb.h"
 
 
@@ -52,12 +53,17 @@ private:
     QMutex mMutexRadar;
     QMutex mMutexRadar;
     qint64 mnTimeRADAR = 0;
     qint64 mnTimeRADAR = 0;
 
 
+    iv::fusion::fusionobjectarray mfusion;
+    QMutex mMutexFusion;
+    qint64 mnTimeFusion = 0;
+
 
 
 public:
 public:
     void setgps(iv::gps::gpsimu * pxgpsimu);
     void setgps(iv::gps::gpsimu * pxgpsimu);
     void setmap(std::vector<iv::MAP_GPS_INS> xnavigation_data);
     void setmap(std::vector<iv::MAP_GPS_INS> xnavigation_data);
     void setobs(std::shared_ptr<std::vector<iv::ObstacleBasic>> xobs);
     void setobs(std::shared_ptr<std::vector<iv::ObstacleBasic>> xobs);
     void setradar(iv::radar::radarobjectarray * pradarobj);
     void setradar(iv::radar::radarobjectarray * pradarobj);
+    void setfusion(iv::fusion::fusionobjectarray & xfusion);
 };
 };
 
 
 #endif // IVMAPVIEW_H
 #endif // IVMAPVIEW_H

+ 1 - 0
src/ui/ADCIntelligentShow_grpc/main.cpp

@@ -212,6 +212,7 @@ int main(int argc, char *argv[])
        xrpcthread.addctrlmsgunit("pad",1000,1);
        xrpcthread.addctrlmsgunit("pad",1000,1);
        xrpcthread.addctrlmsgunit("xodrreq",1000,1);
        xrpcthread.addctrlmsgunit("xodrreq",1000,1);
        xrpcthread.addquerymsgunit("otavehinfo",1000,1);
        xrpcthread.addquerymsgunit("otavehinfo",1000,1);
+       xrpcthread.addquerymsgunit("li_ra_fusion",10000000,1);
 
 
 #ifndef Android
 #ifndef Android
        xrpcthread.startlisten();
        xrpcthread.startlisten();