#ifndef VEHICLE_CONTROL_H #define VEHICLE_CONTROL_H #include #include #include #include #include #include #include #include #include #include #include "VehicleControl_service.grpc.pb.h" #include "VehicleControl.grpc.pb.h" #ifndef IV_MSGUNIT #define IV_MSGUNIT namespace iv { struct msgunit { char mstrmsgname[256]; int mnBufferSize = 10000; int mnBufferCount = 1; void * mpa = nullptr; std::shared_ptr mpstrmsgdata; int mndatasize = 0; bool mbRefresh = false; bool mbImportant = false; int mnkeeptime = 100; }; } #endif using grpc::Channel; using grpc::ClientContext; using grpc::Status; using org::jeecg::defsControl::grpc::VehicleControl; ///< service name using org::jeecg::defsControl::grpc::ControlReply; ///< rpc fuction parameter and return using org::jeecg::defsControl::grpc::UploadMapReply; using org::jeecg::defsControl::grpc::CtrlModeReply; class VehicleControlClient : public QThread{ Q_OBJECT public: VehicleControlClient(std::shared_ptr channel); ~VehicleControlClient(void); std::string vehicleControl(void); void updateControlData(void); void dec_yaml(const char * stryamlpath); protected: void run(); private: std::unique_ptr stub_; iv::msgunit shmRemoteCtrl; org::jeecg::defsControl::grpc::ShiftStatus shiftCMD = org::jeecg::defsControl::grpc::ShiftStatus::SHIFT_PARKING; double steeringWheelAngleCMD = 0; double throttleCMD = 0; double brakeCMD = 0; org::jeecg::defsControl::grpc::CtrlMode modeCMD = org::jeecg::defsControl::grpc::CtrlMode::CMD_AUTO; ///< update by slot function public slots: void ctrlMode_Changed_Slot(org::jeecg::defsControl::grpc::CtrlMode ctrlMode); }; class VehicleChangeCtrlModeClient : public QThread{ Q_OBJECT public: VehicleChangeCtrlModeClient(std::shared_ptr channel); ~VehicleChangeCtrlModeClient(void); std::string changeCtrlMode(void); void updateCtrolMode(void); protected: void run(); private: std::unique_ptr stub_; 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; //平台设定的期望运行速度 org::jeecg::defsControl::grpc::NavSwitch navagationSwitch = org::jeecg::defsControl::grpc::NavSwitch::NAV_STOP; //开始-停止导航 signals: void ctrlMode_Changed(org::jeecg::defsControl::grpc::CtrlMode ctrlMode); }; class VehicleUploadMapClient : public QThread{ Q_OBJECT public: VehicleUploadMapClient(std::shared_ptr channel); ~VehicleUploadMapClient(void); std::string uploadMap(void); void updateMapPOIData(void); protected: void run(); private: std::unique_ptr stub_; bool isNeedMap = false; std::string patrolPathID; QVector POIPoints; signals: void patrolPOI_Recieved(std::string pathID); public slots: void uploadPath_Finished_Slot(std::string pathID); }; #endif // VEHICLE_CONTROL_H