Эх сурвалжийг харах

add groupctrl_grpc for groupctrl use grpc, not complete.

yuchuli 1 жил өмнө
parent
commit
bc6299fa32

+ 12 - 0
src/driver/driver_cloud_swap_client/grpcclient.cpp

@@ -414,3 +414,15 @@ void grpcclient::UpdateData(const char *strdata, const unsigned int nSize, const
     mmutexmsg.unlock();
 
 }
+
+void grpcclient::SetServerPort(std::string strServer,std::string strPort)
+{
+    gstrserverip = strServer;
+    gstrserverport = strPort;
+}
+
+void grpcclient::SetNodeId(std::string strnodeid,std::string strobjnodeid)
+{
+    mstrnodeid = strnodeid;
+    mstrobjnodeid = strobjnodeid;
+}

+ 4 - 0
src/driver/driver_cloud_swap_client/grpcclient.h

@@ -94,6 +94,10 @@ private:
     void sendcloudmsg(iv::cloud::cloudmsg & xmsg,std::shared_ptr<::grpc::ClientReaderWriter<iv::CloudSwapRequestStream, iv::CloudSwapReplyStream> > writer);
 public:
     void UpdateData(const char * strdata,const unsigned int nSize,const char * strmemname);
+
+    void SetServerPort(std::string strServer,std::string strPort);
+    void SetNodeId(std::string strnodeid,std::string strobjnodeid);
+
 private:
     void run();
     void dec_yaml(const char * stryamlpath);

+ 67 - 0
src/tool/groupctrl_grpc/groupctrl_grpc.pro

@@ -0,0 +1,67 @@
+#-------------------------------------------------
+#
+# Project created by QtCreator 2023-06-02T14:52:41
+#
+#-------------------------------------------------
+
+QT       += core gui
+
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+
+TARGET = groupctrl_grpc
+TEMPLATE = app
+
+# The following define makes your compiler emit warnings if you use
+# any feature of Qt which has been marked as deprecated (the exact warnings
+# depend on your compiler). Please consult the documentation of the
+# deprecated API in order to know how to port your code away from it.
+DEFINES += QT_DEPRECATED_WARNINGS
+
+# You can also make your code fail to compile if you use deprecated APIs.
+# In order to do so, uncomment the following line.
+# You can also select to disable deprecated APIs only up to a certain version of Qt.
+#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
+
+
+SOURCES += \
+        ../../include/msgtype/cloud.pb.cc \
+    ../../include/msgtype/cloudswap.pb.cc \
+        main.cpp \
+        mainwindow.cpp \
+    ../../driver/driver_cloud_swap_client/calcping.cpp \
+    ../../driver/driver_cloud_swap_client/cloudswap.grpc.pb.cc \
+    ../../driver/driver_cloud_swap_client/grpcclient.cpp
+
+HEADERS += \
+    ../../include/msgtype/cloud.pb.h \
+    ../../include/msgtype/cloudswap.pb.h \
+        mainwindow.h \
+    ../../driver/driver_cloud_swap_client/calcping.h \
+    ../../driver/driver_cloud_swap_client/cloudswap.grpc.pb.h \
+    ../../driver/driver_cloud_swap_client/grpcclient.h
+
+FORMS += \
+        mainwindow.ui
+
+
+!include(../../../include/common.pri ) {
+    error( "Couldn't find the common.pri file!" )
+}
+
+!include(../../../include/ivprotobuf.pri ) {
+    error( "Couldn't find the ivprotobuf.pri file!" )
+}
+
+!include(../../../include/ivboost.pri ) {
+    error( "Couldn't find the ivboost.pri file!" )
+}
+
+!include(../../../include/ivgrpc.pri ) {
+    error( "Couldn't find the ivgrpc.pri file!" )
+}
+
+!include(../../../include/ivyaml-cpp.pri ) {
+    error( "Couldn't find the ivyaml-cpp.pri file!" )
+}
+
+INCLUDEPATH += ./../../driver/driver_cloud_swap_client

+ 11 - 0
src/tool/groupctrl_grpc/main.cpp

@@ -0,0 +1,11 @@
+#include "mainwindow.h"
+#include <QApplication>
+
+int main(int argc, char *argv[])
+{
+    QApplication a(argc, argv);
+    MainWindow w;
+    w.show();
+
+    return a.exec();
+}

+ 17 - 0
src/tool/groupctrl_grpc/mainwindow.cpp

@@ -0,0 +1,17 @@
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+
+MainWindow::MainWindow(QWidget *parent) :
+    QMainWindow(parent),
+    ui(new Ui::MainWindow)
+{
+    ui->setupUi(this);
+
+    setWindowTitle(tr("群控控制程序"));
+
+}
+
+MainWindow::~MainWindow()
+{
+    delete ui;
+}

+ 24 - 0
src/tool/groupctrl_grpc/mainwindow.h

@@ -0,0 +1,24 @@
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QMainWindow>
+
+#include "grpcclient.h"
+
+namespace Ui {
+class MainWindow;
+}
+
+class MainWindow : public QMainWindow
+{
+    Q_OBJECT
+
+public:
+    explicit MainWindow(QWidget *parent = 0);
+    ~MainWindow();
+
+private:
+    Ui::MainWindow *ui;
+};
+
+#endif // MAINWINDOW_H

+ 286 - 0
src/tool/groupctrl_grpc/mainwindow.ui

@@ -0,0 +1,286 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>1600</width>
+    <height>900</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>MainWindow</string>
+  </property>
+  <widget class="QWidget" name="centralWidget">
+   <widget class="QGroupBox" name="groupBox">
+    <property name="geometry">
+     <rect>
+      <x>40</x>
+      <y>40</y>
+      <width>1001</width>
+      <height>251</height>
+     </rect>
+    </property>
+    <property name="font">
+     <font>
+      <pointsize>30</pointsize>
+     </font>
+    </property>
+    <property name="title">
+     <string>车速控制</string>
+    </property>
+    <widget class="QRadioButton" name="radioButton_5kmh">
+     <property name="geometry">
+      <rect>
+       <x>40</x>
+       <y>60</y>
+       <width>181</width>
+       <height>61</height>
+      </rect>
+     </property>
+     <property name="font">
+      <font>
+       <pointsize>30</pointsize>
+      </font>
+     </property>
+     <property name="text">
+      <string>5km/h</string>
+     </property>
+    </widget>
+    <widget class="QRadioButton" name="radioButton_10kmh">
+     <property name="geometry">
+      <rect>
+       <x>280</x>
+       <y>60</y>
+       <width>181</width>
+       <height>61</height>
+      </rect>
+     </property>
+     <property name="font">
+      <font>
+       <pointsize>30</pointsize>
+      </font>
+     </property>
+     <property name="text">
+      <string>10km/h</string>
+     </property>
+    </widget>
+    <widget class="QRadioButton" name="radioButton_15kmh">
+     <property name="geometry">
+      <rect>
+       <x>520</x>
+       <y>60</y>
+       <width>181</width>
+       <height>61</height>
+      </rect>
+     </property>
+     <property name="font">
+      <font>
+       <pointsize>30</pointsize>
+      </font>
+     </property>
+     <property name="text">
+      <string>15km/h</string>
+     </property>
+    </widget>
+    <widget class="QRadioButton" name="radioButton_20kmh">
+     <property name="geometry">
+      <rect>
+       <x>760</x>
+       <y>60</y>
+       <width>181</width>
+       <height>61</height>
+      </rect>
+     </property>
+     <property name="font">
+      <font>
+       <pointsize>30</pointsize>
+      </font>
+     </property>
+     <property name="text">
+      <string>20km/h</string>
+     </property>
+    </widget>
+    <widget class="QRadioButton" name="radioButton_30kmh">
+     <property name="geometry">
+      <rect>
+       <x>40</x>
+       <y>150</y>
+       <width>181</width>
+       <height>61</height>
+      </rect>
+     </property>
+     <property name="font">
+      <font>
+       <pointsize>30</pointsize>
+      </font>
+     </property>
+     <property name="text">
+      <string>30km/h</string>
+     </property>
+    </widget>
+    <widget class="QRadioButton" name="radioButton_40kmh">
+     <property name="geometry">
+      <rect>
+       <x>280</x>
+       <y>150</y>
+       <width>181</width>
+       <height>61</height>
+      </rect>
+     </property>
+     <property name="font">
+      <font>
+       <pointsize>30</pointsize>
+      </font>
+     </property>
+     <property name="text">
+      <string>40km/h</string>
+     </property>
+    </widget>
+    <widget class="QRadioButton" name="radioButton_60kmh">
+     <property name="geometry">
+      <rect>
+       <x>520</x>
+       <y>150</y>
+       <width>181</width>
+       <height>61</height>
+      </rect>
+     </property>
+     <property name="font">
+      <font>
+       <pointsize>30</pointsize>
+      </font>
+     </property>
+     <property name="text">
+      <string>60km/h</string>
+     </property>
+    </widget>
+    <widget class="QRadioButton" name="radioButton_80kmh">
+     <property name="geometry">
+      <rect>
+       <x>760</x>
+       <y>150</y>
+       <width>181</width>
+       <height>61</height>
+      </rect>
+     </property>
+     <property name="font">
+      <font>
+       <pointsize>30</pointsize>
+      </font>
+     </property>
+     <property name="text">
+      <string>80km/h</string>
+     </property>
+    </widget>
+   </widget>
+   <widget class="QGroupBox" name="groupBox_2">
+    <property name="geometry">
+     <rect>
+      <x>50</x>
+      <y>340</y>
+      <width>991</width>
+      <height>331</height>
+     </rect>
+    </property>
+    <property name="font">
+     <font>
+      <pointsize>30</pointsize>
+     </font>
+    </property>
+    <property name="title">
+     <string>队形控制</string>
+    </property>
+    <widget class="QRadioButton" name="radioButton_origin">
+     <property name="geometry">
+      <rect>
+       <x>50</x>
+       <y>70</y>
+       <width>261</width>
+       <height>111</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>原车道</string>
+     </property>
+    </widget>
+    <widget class="QRadioButton" name="radioButton_frontleft">
+     <property name="geometry">
+      <rect>
+       <x>380</x>
+       <y>70</y>
+       <width>261</width>
+       <height>111</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>前左</string>
+     </property>
+    </widget>
+    <widget class="QRadioButton" name="radioButton_rearleft">
+     <property name="geometry">
+      <rect>
+       <x>690</x>
+       <y>70</y>
+       <width>261</width>
+       <height>111</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>后左</string>
+     </property>
+    </widget>
+    <widget class="QRadioButton" name="radioButton_frontright">
+     <property name="geometry">
+      <rect>
+       <x>50</x>
+       <y>180</y>
+       <width>261</width>
+       <height>111</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>前右</string>
+     </property>
+    </widget>
+    <widget class="QRadioButton" name="radioButton_rearright">
+     <property name="geometry">
+      <rect>
+       <x>380</x>
+       <y>180</y>
+       <width>261</width>
+       <height>111</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>后右</string>
+     </property>
+    </widget>
+   </widget>
+  </widget>
+  <widget class="QMenuBar" name="menuBar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>1600</width>
+     <height>28</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QToolBar" name="mainToolBar">
+   <attribute name="toolBarArea">
+    <enum>TopToolBarArea</enum>
+   </attribute>
+   <attribute name="toolBarBreak">
+    <bool>false</bool>
+   </attribute>
+  </widget>
+  <widget class="QStatusBar" name="statusBar"/>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <resources/>
+ <connections/>
+</ui>