Forráskód Böngészése

fix(grpc_BS):pass test. tracemap can be planed.

sunjiacheng 3 éve
szülő
commit
768b49fa83

+ 1 - 1
src/detection/detection_chassis/main.cpp

@@ -125,7 +125,7 @@ int main(int argc, char *argv[])
     iv::xmlparam::Xmlparam xp(strpath.toStdString());
 
     std::string strmemcan = xp.GetParam("canrecv","canrecv0");
-    std::string strvehicletype = xp.GetParam("vehicletype","GE3");
+    std::string strvehicletype = xp.GetParam("vehicletype","JSRunlegs");
     std::string strmodulename = xp.GetParam("modulename","chassis"); //chassismsgname
     std::string strchassismsgname = xp.GetParam("chassismsgname","chassis");
 

+ 2 - 2
src/driver/driver_cloud_grpc_client_BS/main.cpp

@@ -189,8 +189,8 @@ int main(int argc, char *argv[])
     vehicleuploadmap->start();
 
 //    std::cout<<patrol_str<<std::endl;
-    VehiclePatrolExceptionClient vehiclepatrol(grpc::CreateChannel(patrol_str, grpc::InsecureChannelCredentials()));
-    vehiclepatrol.start();
+//    VehiclePatrolExceptionClient vehiclepatrol(grpc::CreateChannel(patrol_str, grpc::InsecureChannelCredentials()));
+//    vehiclepatrol.start();
 
     return a.exec();
 }

+ 2 - 2
src/driver/driver_cloud_grpc_client_BS/vehicle_control.cpp

@@ -350,9 +350,9 @@ std::string VehicleUploadMapClient::uploadMap(void)
             POIPoints.clear();
 
             isNeedMap = reply.isneedmap();
-//            std::cout<<reply.isneedmap()<<std::endl;
+//            std::cout<<"isneedmap: "<<reply.isneedmap()<<std::endl;
             patrolPathID = reply.patrolpathid();
-//            std::cout<<reply.patrolpathid()<<std::endl;
+//            std::cout<<"pathid: "<<reply.patrolpathid()<<std::endl;
             for(int i = 0;i < reply.mappoints_size();i++)
             {
                 POIPoints.append(reply.mappoints(i));

+ 1 - 1
src/driver/driver_cloud_grpc_client_BS/vehicle_control.h

@@ -95,7 +95,7 @@ protected:
 private:
     std::unique_ptr<VehicleControl::Stub> stub_;
 
-    org::jeecg::defsControl::grpc::CtrlMode modeCMD = org::jeecg::defsControl::grpc::CtrlMode::CMD_EMERGENCY_STOP;
+    org::jeecg::defsControl::grpc::CtrlMode modeCMD = org::jeecg::defsControl::grpc::CtrlMode::CMD_AUTO;
     org::jeecg::defsControl::grpc::UseStatus useStatusCMD = org::jeecg::defsControl::grpc::UseStatus::ENABLING;//使用状态修改命令
     org::jeecg::defsControl::grpc::GPSPoint deactivatePosition; //停用站点
     double speedCMD = 0.0; //平台设定的期望运行速度

+ 3 - 3
src/driver/driver_cloud_grpc_client_BS/vehicle_patrol.cpp

@@ -29,10 +29,10 @@ VehiclePatrolExceptionClient::VehiclePatrolExceptionClient(std::shared_ptr<Chann
 
     ModuleFun funupdate = std::bind(&VehiclePatrolExceptionClient::ListenGPSIMUMsg,this,std::placeholders::_1,std::placeholders::_2,std::placeholders::_3,std::placeholders::_4,std::placeholders::_5);
     shmGPSIMU.mpa = iv::modulecomm::RegisterRecvPlus(shmGPSIMU.mstrmsgname,funupdate);
-    funupdate = std::bind(&VehiclePatrolExceptionClient::ListenTurnstileMsg,this,std::placeholders::_1,std::placeholders::_2,std::placeholders::_3,std::placeholders::_4,std::placeholders::_5);
-    shmTurnstile.mpa = iv::modulecomm::RegisterRecvPlus(shmTurnstile.mstrmsgname,funupdate);
+//    funupdate = std::bind(&VehiclePatrolExceptionClient::ListenTurnstileMsg,this,std::placeholders::_1,std::placeholders::_2,std::placeholders::_3,std::placeholders::_4,std::placeholders::_5);
+//    shmTurnstile.mpa = iv::modulecomm::RegisterRecvPlus(shmTurnstile.mstrmsgname,funupdate);
 
-    shmStartTurnstile.mpa = iv::modulecomm::RegisterSend(shmStartTurnstile.mstrmsgname,shmStartTurnstile.mnBufferSize,shmStartTurnstile.mnBufferCount);
+//    shmStartTurnstile.mpa = iv::modulecomm::RegisterSend(shmStartTurnstile.mstrmsgname,shmStartTurnstile.mnBufferSize,shmStartTurnstile.mnBufferCount);
 }
 
 VehiclePatrolExceptionClient::~VehiclePatrolExceptionClient(void)

+ 8 - 5
src/driver/driver_cloud_grpc_client_BS/vehicle_upload.cpp

@@ -371,6 +371,7 @@ void DataExchangeClient::ListenGPSIMUMsg(const char * strdata,const unsigned int
     }
 
     double GPS_Speed = sqrt(xdata.ve()*xdata.ve()+xdata.vd()*xdata.vd()+xdata.vn()*xdata.vn());
+    if (GPS_Speed < 0.01)GPS_Speed = 0.0;
 
     gMutex_GPSIMU.lock();
     GPSRTKStatus = xdata.rtk_state();
@@ -472,6 +473,7 @@ void DataExchangeClient::ListenTraceMapMsg(const char * strdata,const unsigned i
         pathPoints.append(onePoint);
 //        std::cout<<pathPoints.at(i).index()<<std::endl;
     }
+//    std::cout<<"get a tracemap"<<std::endl;
 
     totalPathLength = 0.0;
     double localPositionX = 0.0;
@@ -506,8 +508,8 @@ std::string DataExchangeClient::uploadVehicleInfo(void)
     gMutex_Chassis.unlock();
 
     gMutex_PlatformFeedback.lock();
-    request.set_statusfeedback(statusFeedback);
-    request.set_modefeedback(modeFeedback);
+    request.set_statusfeedback(statusFeedback);//statusFeedback
+    request.set_modefeedback(modeFeedback);//modeFeedback
     request.set_shiftfeedback(shiftFeedback);
     request.set_steeringwheelanglefeedback(steeringWheelAngleFeedback);
     request.set_throttlefeedback(throttleFeedback);
@@ -544,7 +546,7 @@ std::string DataExchangeClient::uploadVehicleInfo(void)
     request.set_sensorstatuscamrear(sensorStatusCamRear);
     request.set_sensorstatuscamleft(sensorStatusCamLeft);
     request.set_sensorstatuscamright(sensorStatusCamRight);
-    request.set_isarrived(isArrived);
+    request.set_isarrived(isArrived);//isArrived
     request.set_platenumber(plateNumber);
     request.set_usestatusfeedback(useStatus);
     request.set_remainpathlength(remainPathLength);
@@ -700,7 +702,7 @@ void DataExchangeClient::updateData(uint64_t timeInterval_ms)
     if(useStatus == org::jeecg::defsDetails::grpc::UseStatus::DEACTIVATING)
     {
         remainPathLength = 0.0;
-        isArrived = 0;
+        isArrived = 1;
     }
 
     remainPathLength -= (speed * timeInterval_ms/1000.0);
@@ -842,6 +844,7 @@ void DataExchangeClient::destination_Recieved_Slot(void)
     if(fabs(destinationPosition.latitude()) > 0.000001 \
             && fabs(destinationPosition.longitude()) > 0.000001)
     {
+//        std::cout<<"get destination"<<std::endl;
         if(destinationRefreshed == true)
         {
             xodrobj xodrDest;
@@ -850,7 +853,7 @@ void DataExchangeClient::destination_Recieved_Slot(void)
             xodrDest.lane = 1;
 
             iv::modulecomm::ModuleSendMsg(shmXodrRequest.mpa,(char *)&xodrDest,sizeof(xodrobj)); ///< send request msg
-            destinationRefreshed = false;
+//            std::cout<<"modulesend xodr request"<<std::endl;
         }
     }
 }

+ 19 - 19
src/driver/driver_cloud_grpc_client_BS/vehicle_upload.h

@@ -118,20 +118,20 @@ private:
 
     std::string id;
     uint64_t timeStamp = QDateTime::currentMSecsSinceEpoch();
-    double SOC; //0.0-100.0%
-    VehicleStatus statusFeedback = VehicleStatus::STATUS_EMERGENCY_STOP;
+    double SOC = 0.0; //0.0-100.0%
+    VehicleStatus statusFeedback = VehicleStatus::STATUS_AUTO;
     double mileage = 0.0; // kilometer
     uint64_t timeMileageRecord = QDateTime::currentMSecsSinceEpoch();
     double speed; // m/s
     org::jeecg::defsDetails::grpc::ShiftStatus shiftFeedback = org::jeecg::defsDetails::grpc::ShiftStatus::SHIFT_PARKING;
-    double steeringWheelAngleFeedback; //+/-540 degree
-    double throttleFeedback;
-    double brakeFeedback;
-    int32_t GPSRTKStatus; //GPS-RTK status 0-6 6 is best
+    double steeringWheelAngleFeedback = 0.0; //+/-540 degree
+    double throttleFeedback = 0.0;
+    double brakeFeedback = 0.0;
+    int32_t GPSRTKStatus = 0; //GPS-RTK status 0-6 6 is best
     org::jeecg::defsDetails::grpc::GPSPoint positionFeedback;
-    double pitch;
-    double roll;
-    double heading;
+    double pitch = 0.0;
+    double roll = 0.0;
+    double heading = 0.0;
 
     QMutex gMutex_Chassis;
     QMutex gMutex_GPSIMU;
@@ -146,18 +146,18 @@ private:
     QByteArray cameraImageRight;
     QMutex gMutex_ImageRight;
 
-    bool sensorStatusGPSIMU; ///< 0 GPS-IMU ok 1 GPS-IMU error
-    bool sensorStatusLidar;
-    bool sensorStatusRadar;
-    bool sensorStatusCamFront;
-    bool sensorStatusCamRear;
-    bool sensorStatusCamLeft;
-    bool sensorStatusCamRight;
+    bool sensorStatusGPSIMU = false; ///< 0 GPS-IMU ok 1 GPS-IMU error
+    bool sensorStatusLidar = false;
+    bool sensorStatusRadar = false;
+    bool sensorStatusCamFront = false;
+    bool sensorStatusCamRear = false;
+    bool sensorStatusCamLeft = false;
+    bool sensorStatusCamRight = false;
 
-    int32_t isArrived = 0; ///< 0 no destination 1 not arrived 2 arrived
+    int32_t isArrived = 1; ///< 0 no destination 1 not arrived 2 arrived ,20220414 remove 0
 
-    std::string plateNumber;
-    org::jeecg::defsDetails::grpc::CtrlMode modeFeedback = org::jeecg::defsDetails::grpc::CtrlMode::CMD_EMERGENCY_STOP; //mode Feedback
+    std::string plateNumber = "津A123456";
+    org::jeecg::defsDetails::grpc::CtrlMode modeFeedback = org::jeecg::defsDetails::grpc::CtrlMode::CMD_AUTO; //mode Feedback
 
     org::jeecg::defsDetails::grpc::UseStatus useStatus = org::jeecg::defsDetails::grpc::UseStatus::ENABLING;
     double remainPathLength = 0.0;