Browse Source

DRG gongcheng tianjia shange xinzeng yige gongcheng tool_system_debug_command

Gogs 4 years ago
parent
commit
6f0edcbdfb

+ 21 - 4
src/fusion/fusion_DRG/mainwindow.cpp

@@ -9,6 +9,7 @@
 #include <algorithm>
 MainWindow * mw;
 
+#define APOLLO_FU   //宏开关,undef重新编译则恢复原来状态
 
 void ListenFusion(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
 {
@@ -54,7 +55,7 @@ MainWindow::MainWindow(QWidget *parent) :
 
     QTimer * timer = new QTimer(this);
     connect(timer,SIGNAL(timeout()),this,SLOT(onTimer()));
-    timer->start(1000);
+    timer->start(1000);  //1秒(1000毫秒)更新一次
 
     setWindowTitle("栅格图生成");
 
@@ -88,8 +89,8 @@ void MainWindow::generateDRG(iv::fusion::fusionobjectarray &arr){
     for(int i=0; i<arr.obj_size(); i++){
         //处理融合数据,分析每个障碍物特点
         iv::fusion::fusionobject obj = arr.obj(i);
-        iv::fusion::PointXYZ center = obj.centroid();
-        iv::fusion::Dimension space = obj.dimensions();
+        iv::fusion::PointXYZ center = obj.centroid();//中心点
+        iv::fusion::Dimension space = obj.dimensions();//尺寸
 
         //每个障碍物占据一片像素点
         //先确定左上角和右下角
@@ -176,7 +177,6 @@ void MainWindow::drawImage()
     brush.setStyle(Qt::SolidPattern);
     painter.setBrush(brush);
 
-
     int psize = drg.pixels_size();
     if(psize>1){
         for(int i=0; i<psize; i++){
@@ -196,6 +196,23 @@ void MainWindow::drawImage()
 void MainWindow::clearImage(){
     QImage image(QSize(200,800),QImage::Format_ARGB32);
     image.fill("gray");
+
+#ifdef APOLLO_FU
+    //image.fill("white");
+    QPainter painter(&image);
+    painter.setRenderHint(QPainter::Antialiasing);   //线条抗锯齿
+    painter.setRenderHint(QPainter::TextAntialiasing);
+
+    //painter.setPen(QColor(0, 160, 230));
+    painter.setPen(QColor(0, 250, 0));   //RGB配色表   http://www.wahart.com.hk/rgb.htm
+    for(int i=0;i<=80;i++){
+        painter.drawLine(0,i*10,200,i*10);
+    }
+    for(int i=0;i<=20;i++){
+        painter.drawLine(i*10,0,i*10,800);
+    }
+#endif
+
     ui->imageLabel->setPixmap(QPixmap::fromImage(image));
 }
 

+ 1 - 0
src/tool/tool_system_debug_command/tool_system_debug_command/README.md

@@ -0,0 +1 @@
+集成Ubuntu下的调试命令  图形化展示  半成品,来活了后面有时间再完善。

+ 11 - 0
src/tool/tool_system_debug_command/tool_system_debug_command/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();
+}

+ 91 - 0
src/tool/tool_system_debug_command/tool_system_debug_command/mainwindow.cpp

@@ -0,0 +1,91 @@
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+
+MainWindow::MainWindow(QWidget *parent) :
+    QMainWindow(parent),
+    ui(new Ui::MainWindow)
+{
+    ui->setupUi(this);
+    cmd = new QProcess(this);
+    connect(cmd , SIGNAL(readyReadStandardOutput()) , this , SLOT(on_readoutput()));
+    connect(cmd , SIGNAL(readyReadStandardError()) , this , SLOT(on_readerror()));
+
+}
+
+MainWindow::~MainWindow()
+{
+    delete ui;
+    if(cmd)
+    {
+        cmd->close();
+        cmd->waitForFinished();
+    }
+}
+
+void MainWindow::on_readoutput()
+{
+    ui->textBrowser_2->setText(cmd->readAllStandardOutput().data());   //将输出信息读取到编辑框
+}
+
+void MainWindow::on_readerror()
+{
+    QMessageBox::information(0, "标准错误输出", cmd->readAllStandardError().data());    //弹出信息框提示错误信息
+}
+
+void MainWindow::on_pushButton_clicked()
+{
+    ui->textBrowser->setText("打印本系统发行版的所有信息,比如发行版的ID,描述信息,具体版本,代号。\n");
+    cmd->start("bash");                           //启动终端(Windows下改为cmd)
+    cmd->waitForStarted();                        //等待启动完成
+    cmd->write("lsb_release -a\n");               //向终端写入“lsb_release -a”命令,注意尾部的“\n”不可省略
+}
+
+
+void MainWindow::on_pushButton_2_clicked()
+{
+    ui->textBrowser->setText("最后一行打印的是编译器版本号。\n");
+    cmd->start("bash");                   //启动终端(Windows下改为cmd)
+    cmd->waitForStarted();                //等待启动完成
+    cmd->write("g++ -v\n");               //向终端写入“g++ -v”命令,注意尾部的“\n”不可省略
+}
+
+void MainWindow::on_pushButton_3_clicked()
+{
+    ui->textBrowser->setText("返回公网出口IP和地区。\n");
+    cmd->start("bash");             //启动终端(Windows下改为cmd)
+    cmd->waitForStarted();          //等待启动完成
+    cmd->write("curl cip.cc\n");               //向终端写入“curl cip.cc”命令,注意尾部的“\n”不可省略
+}
+
+void MainWindow::on_pushButton_4_clicked()
+{
+    ui->textBrowser->setText("Destination 此列指示目标网络。\
+                             Gateway 此列指示网络的已定义网关。 如果在此列中看到*,则表示指定的网络不需要转发网关。\
+                             Genmask 此列指示网络的网络掩码。\
+                             Flags 此列中的U输出表示路线已启动。 G输出表示应该为此路由使用指定的网关。 D代表动态安装,M代表修改,R代表恢复。\
+                             MSS 此列指示此路由的TCP连接的默认最大段大小(MSS)。\
+                             Window 此列指示此路由上TCP连接的默认窗口大小。\
+                             Irtt 此列指示此路线的初始往返时间。\
+                             Iface Iface列显示网络接口。 如果您有多个接口,您会看到lo(用于环回),eth0(第一个以太网设备)和eth1(用于第二个以太网设备),依此类推您已安装的接口数量。\n");
+    cmd->start("bash");             //启动终端(Windows下改为cmd)
+    cmd->waitForStarted();          //等待启动完成
+    cmd->write("netstat -rn\n");               //向终端写入“netstat -rn”命令,注意尾部的“\n”不可省略
+}
+
+void MainWindow::on_pushButton_5_clicked()
+{
+    ui->textBrowser->setText("打印路由表信息。\n");
+    cmd->start("bash");             //启动终端(Windows下改为cmd)
+    cmd->waitForStarted();          //等待启动完成
+    cmd->write("ip route\n");               //向终端写入“ip route”命令,注意尾部的“\n”不可省略
+}
+
+void MainWindow::on_pushButton_6_clicked()
+{
+    //nc -l 1234
+}
+
+void MainWindow::on_pushButton_7_clicked()
+{
+    //nc -u -l 1234
+}

+ 42 - 0
src/tool/tool_system_debug_command/tool_system_debug_command/mainwindow.h

@@ -0,0 +1,42 @@
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QMainWindow>
+#include <QProcess>
+#include <QMessageBox>
+
+namespace Ui {
+class MainWindow;
+}
+
+class MainWindow : public QMainWindow
+{
+    Q_OBJECT
+
+public:
+    explicit MainWindow(QWidget *parent = 0);
+    ~MainWindow();
+    QProcess *cmd;
+
+private slots:
+    void on_pushButton_clicked();
+    void on_readoutput();
+    void on_readerror();
+
+    void on_pushButton_2_clicked();
+
+    void on_pushButton_3_clicked();
+
+    void on_pushButton_4_clicked();
+
+    void on_pushButton_5_clicked();
+
+    void on_pushButton_6_clicked();
+
+    void on_pushButton_7_clicked();
+
+private:
+    Ui::MainWindow *ui;
+};
+
+#endif // MAINWINDOW_H

+ 588 - 0
src/tool/tool_system_debug_command/tool_system_debug_command/mainwindow.ui

@@ -0,0 +1,588 @@
+<?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>1135</width>
+    <height>600</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>30</x>
+      <y>30</y>
+      <width>341</width>
+      <height>501</height>
+     </rect>
+    </property>
+    <property name="title">
+     <string>操作系统</string>
+    </property>
+    <widget class="QLabel" name="label">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>30</y>
+       <width>101</width>
+       <height>17</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>查看系统版本</string>
+     </property>
+    </widget>
+    <widget class="QPushButton" name="pushButton">
+     <property name="geometry">
+      <rect>
+       <x>160</x>
+       <y>30</y>
+       <width>111</width>
+       <height>25</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>lsb_release -a</string>
+     </property>
+    </widget>
+    <widget class="QPushButton" name="pushButton_2">
+     <property name="geometry">
+      <rect>
+       <x>160</x>
+       <y>60</y>
+       <width>89</width>
+       <height>25</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>g++ -v</string>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_3">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>60</y>
+       <width>91</width>
+       <height>17</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>查看编译器</string>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_12">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>90</y>
+       <width>91</width>
+       <height>17</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>查看pci设备</string>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_13">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>120</y>
+       <width>91</width>
+       <height>17</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>查看usb设备</string>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_14">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>150</y>
+       <width>101</width>
+       <height>17</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>查看CPU信息</string>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_15">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>180</y>
+       <width>101</width>
+       <height>17</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>查看环境变量</string>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_16">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>210</y>
+       <width>141</width>
+       <height>17</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>列出加载的内核模块</string>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_17">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>250</y>
+       <width>111</width>
+       <height>17</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>查看内核版本</string>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_18">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>280</y>
+       <width>67</width>
+       <height>17</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>TextLabel</string>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_19">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>310</y>
+       <width>67</width>
+       <height>17</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>TextLabel</string>
+     </property>
+    </widget>
+    <widget class="QPushButton" name="pushButton_10">
+     <property name="geometry">
+      <rect>
+       <x>160</x>
+       <y>90</y>
+       <width>89</width>
+       <height>25</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>lspci -tv</string>
+     </property>
+    </widget>
+    <widget class="QPushButton" name="pushButton_11">
+     <property name="geometry">
+      <rect>
+       <x>160</x>
+       <y>120</y>
+       <width>89</width>
+       <height>25</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>lsusb -tv</string>
+     </property>
+    </widget>
+    <widget class="QPushButton" name="pushButton_12">
+     <property name="geometry">
+      <rect>
+       <x>160</x>
+       <y>150</y>
+       <width>131</width>
+       <height>25</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>cat /proc/cpuinfo</string>
+     </property>
+    </widget>
+    <widget class="QPushButton" name="pushButton_13">
+     <property name="geometry">
+      <rect>
+       <x>160</x>
+       <y>180</y>
+       <width>89</width>
+       <height>25</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>env</string>
+     </property>
+    </widget>
+    <widget class="QPushButton" name="pushButton_14">
+     <property name="geometry">
+      <rect>
+       <x>160</x>
+       <y>210</y>
+       <width>89</width>
+       <height>25</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>lsmod</string>
+     </property>
+    </widget>
+    <widget class="QPushButton" name="pushButton_15">
+     <property name="geometry">
+      <rect>
+       <x>160</x>
+       <y>240</y>
+       <width>131</width>
+       <height>25</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>uname -r</string>
+     </property>
+    </widget>
+    <widget class="QPushButton" name="pushButton_16">
+     <property name="geometry">
+      <rect>
+       <x>160</x>
+       <y>270</y>
+       <width>89</width>
+       <height>25</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>PushButton</string>
+     </property>
+    </widget>
+    <widget class="QPushButton" name="pushButton_17">
+     <property name="geometry">
+      <rect>
+       <x>160</x>
+       <y>300</y>
+       <width>89</width>
+       <height>25</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>PushButton</string>
+     </property>
+    </widget>
+   </widget>
+   <widget class="QTextBrowser" name="textBrowser">
+    <property name="geometry">
+     <rect>
+      <x>810</x>
+      <y>50</y>
+      <width>311</width>
+      <height>91</height>
+     </rect>
+    </property>
+   </widget>
+   <widget class="QLabel" name="label_2">
+    <property name="geometry">
+     <rect>
+      <x>810</x>
+      <y>30</y>
+      <width>67</width>
+      <height>17</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>说明</string>
+    </property>
+   </widget>
+   <widget class="QGroupBox" name="groupBox_2">
+    <property name="geometry">
+     <rect>
+      <x>410</x>
+      <y>200</y>
+      <width>371</width>
+      <height>171</height>
+     </rect>
+    </property>
+    <property name="title">
+     <string>网络</string>
+    </property>
+    <widget class="QLabel" name="label_4">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>30</y>
+       <width>131</width>
+       <height>17</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>查看系统对外IP</string>
+     </property>
+    </widget>
+    <widget class="QPushButton" name="pushButton_3">
+     <property name="geometry">
+      <rect>
+       <x>130</x>
+       <y>30</y>
+       <width>111</width>
+       <height>25</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>curl cip.cc</string>
+     </property>
+    </widget>
+    <widget class="QPushButton" name="pushButton_4">
+     <property name="geometry">
+      <rect>
+       <x>130</x>
+       <y>60</y>
+       <width>89</width>
+       <height>25</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>netstat -rn</string>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_5">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>60</y>
+       <width>91</width>
+       <height>17</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>查看路由表</string>
+     </property>
+    </widget>
+    <widget class="QPushButton" name="pushButton_5">
+     <property name="geometry">
+      <rect>
+       <x>250</x>
+       <y>60</y>
+       <width>89</width>
+       <height>25</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>ip route</string>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_8">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>100</y>
+       <width>101</width>
+       <height>17</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>TCP监听端口</string>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_9">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>130</y>
+       <width>101</width>
+       <height>17</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>UDP监听端口</string>
+     </property>
+    </widget>
+    <widget class="QLineEdit" name="lineEdit">
+     <property name="geometry">
+      <rect>
+       <x>110</x>
+       <y>100</y>
+       <width>71</width>
+       <height>25</height>
+      </rect>
+     </property>
+    </widget>
+    <widget class="QLineEdit" name="lineEdit_2">
+     <property name="geometry">
+      <rect>
+       <x>110</x>
+       <y>130</y>
+       <width>71</width>
+       <height>25</height>
+      </rect>
+     </property>
+    </widget>
+    <widget class="QPushButton" name="pushButton_6">
+     <property name="geometry">
+      <rect>
+       <x>210</x>
+       <y>100</y>
+       <width>89</width>
+       <height>25</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>确定</string>
+     </property>
+    </widget>
+    <widget class="QPushButton" name="pushButton_7">
+     <property name="geometry">
+      <rect>
+       <x>210</x>
+       <y>130</y>
+       <width>89</width>
+       <height>25</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>确定</string>
+     </property>
+    </widget>
+   </widget>
+   <widget class="QLabel" name="label_6">
+    <property name="geometry">
+     <rect>
+      <x>30</x>
+      <y>0</y>
+      <width>541</width>
+      <height>17</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>所有命令的标准输出将从Text Brower显示,标准错误输出将从弹窗显示。</string>
+    </property>
+   </widget>
+   <widget class="QLabel" name="label_7">
+    <property name="geometry">
+     <rect>
+      <x>810</x>
+      <y>150</y>
+      <width>67</width>
+      <height>17</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>标准输出</string>
+    </property>
+   </widget>
+   <widget class="QTextBrowser" name="textBrowser_2">
+    <property name="geometry">
+     <rect>
+      <x>810</x>
+      <y>170</y>
+      <width>311</width>
+      <height>371</height>
+     </rect>
+    </property>
+   </widget>
+   <widget class="QGroupBox" name="groupBox_3">
+    <property name="geometry">
+     <rect>
+      <x>410</x>
+      <y>30</y>
+      <width>371</width>
+      <height>151</height>
+     </rect>
+    </property>
+    <property name="title">
+     <string>串口</string>
+    </property>
+    <widget class="QLabel" name="label_10">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>30</y>
+       <width>101</width>
+       <height>17</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>查看系统版本</string>
+     </property>
+    </widget>
+    <widget class="QPushButton" name="pushButton_8">
+     <property name="geometry">
+      <rect>
+       <x>110</x>
+       <y>30</y>
+       <width>111</width>
+       <height>25</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>lsb_release -a</string>
+     </property>
+    </widget>
+    <widget class="QPushButton" name="pushButton_9">
+     <property name="geometry">
+      <rect>
+       <x>110</x>
+       <y>60</y>
+       <width>89</width>
+       <height>25</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>g++ -v</string>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_11">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>60</y>
+       <width>91</width>
+       <height>17</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>1135</width>
+     <height>22</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>

+ 34 - 0
src/tool/tool_system_debug_command/tool_system_debug_command/tool_system_debug_command.pro

@@ -0,0 +1,34 @@
+#-------------------------------------------------
+#
+# Project created by QtCreator 2021-03-15T14:09:04
+#
+#-------------------------------------------------
+
+QT       += core gui
+
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+
+TARGET = tool_system_debug_command
+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 += \
+        main.cpp \
+        mainwindow.cpp
+
+HEADERS += \
+        mainwindow.h
+
+FORMS += \
+        mainwindow.ui