-
Notifications
You must be signed in to change notification settings - Fork 1
/
mainwindow.h
89 lines (80 loc) · 1.98 KB
/
mainwindow.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include<opencv2/opencv.hpp>
#include<opencv/cv.h>
#include<stdio.h>
#include <iostream>
#include <sys/time.h>
#include <termios.h>
#include <unistd.h>
#include <fcntl.h>
#include <vector>
#include <opencv2/imgproc/imgproc.hpp>
//for stick socket
#include <QtNetwork>//use the socket
#include <QMessageBox>//for return mistake
//#include <math.h>
#include "dirent.h"
#include <sys/termios.h>
#include<string.h>
//#include <QTime>
#include "robot.h"
using namespace cv;
using namespace std;
//define struct for stick
struct Actual_JoyStick_CrlData//this data is used for controling
{
Actual_JoyStick_CrlData() {}
float Wheel;//wheel
int Acc;//acc
int brake;//brake
int clutch;//seperation and reunion
bool buttom_up;
bool buttom_down;
bool buttom_left;
bool buttom_right;
int shiftgears;//forward:1 Null: 0 backward:-1
};
//for distribute the frame
#define UDP_MAX_SIZE 1200
struct PackageHeader
{
//包头大小(sizeof(PackageHeader))
unsigned int uTransPackageHdrSize;
//当前包头的大小(sizeof(PackageHeader)+当前数据包长度)
unsigned int uTransPackageSize;
//数据的总大小
unsigned int uDataSize;
//数据被分成包的个数
unsigned int uDataPackageNum;
//数据包当前的帧号
unsigned int uDataPackageCurrIndex;
//数据包在整个数据中的偏移
unsigned int uDataPackageOffset;
};
//difine end
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
VideoCapture capture;
Actual_JoyStick_CrlData *CtlDara;
QTimer *timer;//the main function to send Image back to PC
QUdpSocket *ImgSender;
QUdpSocket *CtlRecever;
Mat frame;
ROBOT tiger;
private slots:
void on_Start_clicked(void);
void OntimeRun(void);
void CtlAction(void);
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H