Browse Source

change ADCIntelligentShow_grpc. for show radar obs. and load xml.

yuchuli 4 years ago
parent
commit
c5cd545bf0

+ 4 - 0
src/driver/driver_grpc_client/grpcclientthread.cpp

@@ -261,12 +261,16 @@ void grpcclientthread::run()
 //                }
             }
         } else {
+#ifndef Android
           std::cout << status.error_code() << ": " << status.error_message()
                     << std::endl;
           std::cout<<"RPC failed"<<std::endl;
+#endif
           if(status.error_code() == 4)
           {
+#ifndef Android
               std::cout<<" RPC Exceed Time, Create New stub_"<<std::endl;
+#endif
               channel = grpc::CreateCustomChannel(
                        target_str, grpc::InsecureChannelCredentials(),cargs);
 

+ 4 - 1
src/ui/ADCIntelligentShow_grpc/ivmapview.cpp

@@ -273,13 +273,16 @@ void ivmapview::paint()
         QFont esr_font("Microsoft YaHei", 10, 75); //第一个属性是字体(微软雅黑),第二个是大小,第三个是加粗(权重是75)
         painter->setFont(esr_font);
         char coordinate_ear[20];
-        for (unsigned int i; i < xradarobj.obj_size(); i++)
+        for (unsigned int i = 0 ; i < xradarobj.obj_size(); i++)
         {
             iv::radar::radarobject * pobj = xradarobj.mutable_obj(i);
 
+            if(pobj->bvalid())
+            {
             painter->drawEllipse(pobj->x() * 10 + 450, -pobj->y() * 10 + 700, 10, 10);
             sprintf(coordinate_ear, "(%d, %d)", (int)pobj->x(), (int)pobj->y());
             painter->drawText(pobj->x() * 10 + 450, -pobj->y() * 10 + 700, QString(coordinate_ear));
+            }
 
         }
     }

+ 15 - 10
src/ui/ADCIntelligentShow_grpc/main.cpp

@@ -12,7 +12,7 @@
 #endif
 
 #include <iostream>
-//#include "xmlparam.h"
+#include "xmlparam.h"
 
 #include "grpcclientthread.h"
 
@@ -110,18 +110,22 @@ int main(int argc, char *argv[])
 
     QString strpath = QCoreApplication::applicationDirPath();
 
-//   if(argc < 2)
-//       strpath = strpath + "/ADCIntelligentShow_grpc.xml";
-//   else
-//       strpath = argv[1];
+   if(argc < 2)
+       strpath = strpath + "/ADCIntelligentShow_grpc.xml";
+   else
+       strpath = argv[1];
 //   std::cout<<strpath.toStdString()<<std::endl;
 
-//   iv::xmlparam::Xmlparam xp(strpath.toStdString());
+#ifdef Android
+   strpath = "/storage/emulated/0/ADCIntelligentShow_grpc.xml";
+#endif
+
+   iv::xmlparam::Xmlparam xp(strpath.toStdString());
 
-//   gstrmode = xp.GetParam("useoutgrpc","false");
-//   gstrserverip = xp.GetParam("serverip","192.168.1.102");
-//   gstrserverport = xp.GetParam("serverport","30051");
-//   gstrqueryinterval = xp.GetParam("queryinterval","10");
+   gstrmode = xp.GetParam("useoutgrpc","false");
+   gstrserverip = xp.GetParam("serverip","192.168.1.102");
+   gstrserverport = xp.GetParam("serverport","30051");
+   gstrqueryinterval = xp.GetParam("queryinterval","10");
 
    grpcclientthread xrpcthread;
 
@@ -139,6 +143,7 @@ int main(int argc, char *argv[])
        xrpcthread.addquerymsgunit("lidar_obs",20000000,1);
        xrpcthread.addquerymsgunit("brainstate",10000,1);
        xrpcthread.addquerymsgunit("deciton",10000,1);
+       xrpcthread.addquerymsgunit("radar",100000,1);
        xrpcthread.addctrlmsgunit("pad",1000,1);
        xrpcthread.addctrlmsgunit("xodrreq",1000,1);