소스 검색

添加对传感器融合结果的显示

fujiankuan 4 년 전
부모
커밋
f4682a5f45
3개의 변경된 파일95개의 추가작업 그리고 27개의 파일을 삭제
  1. 76 25
      src/ui/ui_ads_hmi/ADCIntelligentVehicle.cpp
  2. 13 0
      src/ui/ui_ads_hmi/ADCIntelligentVehicle.h
  3. 6 2
      src/ui/ui_ads_hmi/ui_ads_hmi.pro

+ 76 - 25
src/ui/ui_ads_hmi/ADCIntelligentVehicle.cpp

@@ -305,6 +305,8 @@ ADCIntelligentVehicle::ADCIntelligentVehicle(QWidget *parent)
     ModuleFun funplantrace_right = std::bind(&ADCIntelligentVehicle::UpdatePlanTrace_right,this,std::placeholders::_1,std::placeholders::_2,std::placeholders::_3,std::placeholders::_4,std::placeholders::_5);
     mpaplantrace_right = iv::modulecomm::RegisterRecvPlus("obstraceright",funplantrace_right);
 
+    ModuleFun funfusion = std::bind(&ADCIntelligentVehicle::UpdateFusion,this,std::placeholders::_1,std::placeholders::_2,std::placeholders::_3,std::placeholders::_4,std::placeholders::_5);
+    mpafusion = iv::modulecomm::RegisterRecvPlus("li_ra_fusion",funfusion);
 
 
     ModuleFun funmap = std::bind(&ADCIntelligentVehicle::UpdateMap,this,std::placeholders::_1,std::placeholders::_2,std::placeholders::_3,std::placeholders::_4,std::placeholders::_5);
@@ -1177,43 +1179,76 @@ void ADCIntelligentVehicle::paintEvent(QPaintEvent *)
         //									//
         //////////////////////////////////////
 
-        painter->setPen(QPen(Qt::black, 2));
-        painter->setBrush(Qt::blue);
-        QFont esr_font("Microsoft YaHei", 10, 75); //第一个属性是字体(微软雅黑),第二个是大小,第三个是加粗(权重是75)
-        painter->setFont(esr_font);
-        char coordinate_ear[100];
-        iv::radar::radarobjectarray xradararray;
-        if(mbradarUpdate)
+        if(ui->checkBox_8->isChecked())
         {
-            mMutexRadar.lock();
-            xradararray.CopyFrom(mradararray);
-            mMutexRadar.unlock();
-            for (int a = 0; a < xradararray.obj_size(); a++)
+            painter->setPen(QPen(Qt::black, 2));
+            painter->setBrush(Qt::blue);
+            QFont esr_font("Microsoft YaHei", 10, 75); //第一个属性是字体(微软雅黑),第二个是大小,第三个是加粗(权重是75)
+            painter->setFont(esr_font);
+            char coordinate_ear[100];
+            iv::radar::radarobjectarray xradararray;
+            if(mbradarUpdate)
             {
-                if (xradararray.obj(a).bvalid())
+                mMutexRadar.lock();
+                xradararray.CopyFrom(mradararray);
+                mMutexRadar.unlock();
+                for (int a = 0; a < xradararray.obj_size(); a++)
                 {
-                    painter->drawEllipse(xradararray.obj(a).x() * 10 + 450, -((xradararray.obj(a).y() + ServiceCarStatus.esr_y_offset) * 10) + 700, 10, 10);
-                    sprintf(coordinate_ear, "(%d, %d)", (int)xradararray.obj(a).x(), (int)xradararray.obj(a).y());
-                    painter->drawText(xradararray.obj(a).x() * 10 + 450, -((xradararray.obj(a).y() + ServiceCarStatus.esr_y_offset ) * 10) + 700, QString(coordinate_ear));
+                    if (xradararray.obj(a).bvalid())
+                    {
+                        painter->drawEllipse(xradararray.obj(a).x() * 10 + 450, -((xradararray.obj(a).y() + ServiceCarStatus.esr_y_offset) * 10) + 700, 10, 10);
+                        sprintf(coordinate_ear, "(%d, %d)", (int)xradararray.obj(a).x(), (int)xradararray.obj(a).y());
+                        painter->drawText(xradararray.obj(a).x() * 10 + 450, -((xradararray.obj(a).y() + ServiceCarStatus.esr_y_offset ) * 10) + 700, QString(coordinate_ear));
 
+                    }
                 }
+                //           mbradarUpdate = false;
             }
-            //           mbradarUpdate = false;
         }
 
 
-        ServiceLidar.copylidarto(Lidar_read);		//激光雷达障碍物
-        ServiceLidar.copylidarobsto(Lidar_obsread);
-        painter->setPen(QColor(255, 0, 0));
-        for (unsigned int x = 0; x < Lidar_read->size(); x++)
+        if(ui->checkBox_9->isChecked())
         {
-            //painter->drawPoint(((*Lidar_read)[x].nomal_x) * 10 + 450, -(*Lidar_read)[x].nomal_y * 10 + 700);
+            ServiceLidar.copylidarto(Lidar_read);		//激光雷达障碍物
+            ServiceLidar.copylidarobsto(Lidar_obsread);
+            painter->setPen(QColor(255, 0, 0));
+            for (unsigned int x = 0; x < Lidar_read->size(); x++)
+            {
+                //painter->drawPoint(((*Lidar_read)[x].nomal_x) * 10 + 450, -(*Lidar_read)[x].nomal_y * 10 + 700);
+            }
+            painter->setPen(QColor(255,0,0));
+            for (unsigned int x = 0; x < Lidar_obsread->size(); x++)
+            {
+                painter->drawPoint(((*Lidar_obsread)[x].nomal_x) * 10 + 450, -((*Lidar_obsread)[x].nomal_y + ServiceCarStatus.lidar_y_offset) * 10 + 700);
+            }
         }
-        painter->setPen(QColor(255,0,0));
-        for (unsigned int x = 0; x < Lidar_obsread->size(); x++)
+
+
+        //////////////////////////////////////
+        //                                  //
+        //	          显示融合的信息          //
+        //									//
+        //////////////////////////////////////
+
+        if(ui->checkBox_10->isChecked())
         {
-            painter->drawPoint(((*Lidar_obsread)[x].nomal_x) * 10 + 450, -((*Lidar_obsread)[x].nomal_y + ServiceCarStatus.lidar_y_offset) * 10 + 700);
-        }
+            painter->setPen(QColor(0,255,0));
+            iv::fusion::fusionobjectarray xfusionarray;
+            if(mbfusionUpdate)
+            {
+                mMutexFusion.lock();
+                xfusionarray.CopyFrom(mfusionarray);
+                mMutexFusion.unlock();
+                for(int a = 0; a < xfusionarray.obj_size(); a++)
+                {
+                    for(int b = 0; b < xfusionarray.obj(a).nomal_centroid_size(); b++)
+                    {
+                        painter->drawPoint((xfusionarray.obj(a).nomal_centroid(b).nomal_x())*10 + 450, -(xfusionarray.obj(a).nomal_centroid(b).nomal_y())*10 + 700);
+                    }
+                }
+            }
+         }
+
 
 
 
@@ -1477,6 +1512,22 @@ void ADCIntelligentVehicle::UpdatePlanTrace_right(const char * strdata,const uns
 }
 
 
+void ADCIntelligentVehicle::UpdateFusion(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
+{
+    iv::fusion::fusionobjectarray xfusionarray;
+    if(!xfusionarray.ParseFromArray(strdata,nSize))
+    {
+        gIvlog->warn("ADCIntelligentVehicle::UpdateFusion Parse Error.");
+        return;
+    }
+    mMutexFusion.lock();
+    mfusionarray.CopyFrom(xfusionarray);
+    mbfusionUpdate = true;
+    mMutexFusion.unlock();
+
+}
+
+
 /**
  * @brief ADCIntelligentVehicle::UpdateMap
  * @param strdata

+ 13 - 0
src/ui/ui_ads_hmi/ADCIntelligentVehicle.h

@@ -64,6 +64,8 @@
 #include "ivlog.h"
 #include "mapreq.pb.h"
 #include "vbox.pb.h"
+#include "fusionobject.pb.h"
+#include "fusionobjectarray.pb.h"
 
 extern iv::Ivlog * gIvlog;
 
@@ -201,6 +203,7 @@ private slots:
 
     void on_pb_v2xEn_clicked();
 
+
 private:
     Ui::ADCIntelligentVehicle *ui;
     //    boost::shared_ptr<iv::decition::BrainDecition> brain;
@@ -326,6 +329,16 @@ private:
     void * mpaplantrace_left;
     void * mpaplantrace_right;
 /**************************/
+/**********20210429***********************/
+public:
+    void UpdateFusion(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
+    QMutex mMutexFusion;
+private:
+    iv::fusion::fusionobjectarray mfusionarray;
+    bool mbfusionUpdate = false;
+    void * mpafusion;
+/*****************************************/
+
 private:
     void * mpaLidar;
 

+ 6 - 2
src/ui/ui_ads_hmi/ui_ads_hmi.pro

@@ -52,7 +52,9 @@ SOURCES += \
     ../../include/msgtype/v2x.pb.cc \
     ../../include/msgtype/chassis.pb.cc \
     ../../include/msgtype/mapreq.pb.cc  \
-    ../../include/msgtype/vbox.pb.cc
+    ../../include/msgtype/vbox.pb.cc \
+    ../../include/msgtype/fusionobjectarray.pb.cc \
+    ../../include/msgtype/fusionobject.pb.cc
 
 HEADERS += \
         ADCIntelligentVehicle.h \
@@ -71,7 +73,9 @@ HEADERS += \
     ../../include/msgtype/v2x.pb.h \
     ../../include/msgtype/chassis.pb.h \
     ../../include/msgtype/mapreq.pb.h \
-    ../../include/msgtype/vbox.pb.h
+    ../../include/msgtype/vbox.pb.h \
+    ../../include/msgtype/fusionobjectarray.pb.h \
+    ../../include/msgtype/fusionobject.pb.h
 
 
 FORMS += \