Selaa lähdekoodia

fix(grpc_BS):add waittime,remaindistance and some other parameters.but not finished.

sunjiacheng 3 vuotta sitten
vanhempi
commit
a966eeee18

+ 2 - 0
src/driver/driver_cloud_grpc_client_BS/driver_cloud_grpc_client_BS.yaml

@@ -11,6 +11,8 @@ uploadmapinterval : 1000
 id : 1234567890123456789H
 plateNumber : 津A123456
 vehicleType : 0 #0 跑腿 1 导览 2 清扫
+speedWantAvg : 4.2 # m/s the speed used for calculate arrival time
+waitTime : 600 # s wait time after arriving
 
 pic_front:
   msgname: picfront

+ 13 - 0
src/driver/driver_cloud_grpc_client_BS/main.cpp

@@ -49,6 +49,9 @@ std::string gstrid = "1234567890123456789H";
 std::string gstrplateNumber = "津A123456";
 std::string gvehicleType = "0"; //0 delevery 1 guid 2 clear
 
+double gspeedWantAvg = 4.1; // m/s
+double gwaitTime = 600; // s
+
 char stryamlpath[256];
 
 void dec_yaml(const char * stryamlpath)
@@ -128,6 +131,16 @@ void dec_yaml(const char * stryamlpath)
         gvehicleType = config["vehicleType"].as<std::string>();
         std::cout<<"vehicleType:"<<gstrplateNumber<<std::endl;
     }
+    if(config["speedWantAvg"])
+    {
+        gspeedWantAvg = config["speedWantAvg"].as<double>();
+        std::cout<<"speedWantAvg: "<<gspeedWantAvg<<" m/s"<<std::endl;
+    }
+    if(config["waitTime"])
+    {
+        gwaitTime = config["waitTime"].as<double>();
+        std::cout<<"waitTime: "<<gwaitTime<<std::endl;
+    }
 
     return;
 }

+ 1 - 0
src/driver/driver_cloud_grpc_client_BS/vehicle_control.cpp

@@ -1,6 +1,7 @@
 #include "vehicle_control.h"
 
 #include <math.h>
+#include <thread>
 
 #include "modulecomm.h"
 #include "remotectrl.pb.h"

+ 1 - 0
src/driver/driver_cloud_grpc_client_BS/vehicle_patrol.cpp

@@ -2,6 +2,7 @@
 
 #include <QFile>
 #include <math.h>
+#include <thread>
 
 #include "modulecomm.h"
 #include "gpsimu.pb.h"

+ 9 - 0
src/driver/driver_cloud_grpc_client_BS/vehicle_upload.cpp

@@ -5,6 +5,7 @@
 #include <QStringList>
 #include <math.h>
 #include <iomanip>
+#include <thread>
 
 #include "modulecomm.h"
 #include "rawpic.pb.h"
@@ -19,6 +20,9 @@ extern std::string gstrid;
 extern std::string gstrplateNumber;
 extern std::string gvehicleType;
 
+extern double gspeedWantAvg; // m/s
+extern double gwaitTime; // s
+
 extern char stryamlpath[256];
 
 extern uint8_t gShift_Status;//3 p 4 r 5 n 6 d
@@ -524,6 +528,8 @@ std::string DataExchangeClient::uploadVehicleInfo(void)
     request.set_sensorstatuscamright(sensorStatusCamRight);
     request.set_isarrived(isArrived);
     request.set_platenumber(plateNumber);
+    request.set_usestatusfeedback(org::jeecg::defsDetails::grpc::UseStatus::ENABLING);
+    request.set_remainpathlength(500.0);
     request.set_classfeedback(vehicleType);
 
     // Container for the data we expect from the server.
@@ -569,6 +575,9 @@ std::string DataExchangeClient::uploadPath(void)
         request.add_pathpoints();
         request.mutable_pathpoints(i)->operator =(pathPoints.at(i));
     }
+    request.set_arrivedtime(500.0/gspeedWantAvg);
+    request.set_waittime(gwaitTime);
+    request.set_totalpathlength(500.0);
 
     // Container for the data we expect from the server.
     Empty reply;

+ 2 - 1
src/driver/driver_cloud_grpc_client_BS/vehicle_upload.h

@@ -157,7 +157,8 @@ private:
     int32_t isArrived; //0 no destination 1 not arrived 2 arrived
 
     std::string plateNumber;
-
+    org::jeecg::defsDetails::grpc::UseStatus useStatus = org::jeecg::defsDetails::grpc::UseStatus::ENABLING;
+    double remainPathLength = 0.0;
     org::jeecg::defsDetails::grpc::VehicleClass vehicleType = org::jeecg::defsDetails::grpc::VehicleClass::RUN_ERRANDS;
 
     org::jeecg::defsDetails::grpc::CtrlMode modeFeedback = org::jeecg::defsDetails::grpc::CtrlMode::CMD_EMERGENCY_STOP; //mode Feedback