Bladeren bron

grpc_BS添加共享内存发送。。

fujiankuan 4 jaren geleden
bovenliggende
commit
ae926ea508

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

@@ -24,6 +24,13 @@ VehicleControlClient::~VehicleControlClient(void)
 
 }
 
+void VehicleControlClient::VehicleControlClientSend(void)
+{
+    mpa = new iv::modulecommext::modulecommmsg<iv::remotectrl>();
+
+    mpa->RegisterSend("remotectrl",10000,1);
+}
+
 std::string VehicleControlClient::vehicleControl(void)
 {
     // Data we are sending to the server.
@@ -77,10 +84,19 @@ std::string VehicleControlClient::vehicleControl(void)
 
 void VehicleControlClient::updateControlData(void)
 {
+#if 0
     std::cout<<"shift:"<<shiftCMD<<std::endl;
     std::cout<<"steeringWheelAngle:"<<steeringWheelAngleCMD<<std::endl;
     std::cout<<"throttle:"<<throttleCMD<<std::endl;
     std::cout<<"brake:"<<brakeCMD<<std::endl;
+#endif
+    iv::remotectrl xmsg;
+    xmsg.set_ntype(iv::remotectrl::CtrlType::remotectrl_CtrlType_REMOTE);
+    xmsg.set_acc(0.0);
+    xmsg.set_brake(0.0);
+    xmsg.set_wheel(0.0);
+    xmsg.set_shift(0);
+    mpa->ModuleSendMsg(xmsg);
 }
 
 void VehicleControlClient::run()

+ 5 - 0
src/driver/driver_cloud_grpc_client_BS/vehicle_control.h

@@ -15,6 +15,8 @@
 
 #include "VehicleControl_service.grpc.pb.h"
 #include "VehicleControl.grpc.pb.h"
+#include "modulecommext.h"
+#include "remotectrl.pb.h"
 
 using grpc::Channel;
 using grpc::ClientContext;
@@ -37,6 +39,9 @@ public:
     std::string vehicleControl(void);
     void updateControlData(void);
 
+    void VehicleControlClientSend();
+    iv::modulecommext::modulecommmsg<iv::remotectrl> * mpa;
+
 protected:
     void run();
 

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

@@ -15,6 +15,7 @@
 
 #include "VehiclePatrol_service.grpc.pb.h"
 #include "VehiclePatrol.grpc.pb.h"
+#include "modulecommext.h"
 
 using grpc::Channel;
 using grpc::ClientContext;

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

@@ -15,7 +15,7 @@
 
 #include "VehicleUpload_service.grpc.pb.h"
 #include "VehicleUpload.grpc.pb.h"
-
+#include "modulecommext.h"
 using grpc::Channel;
 using grpc::ClientContext;
 using grpc::Status;