-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.h
195 lines (170 loc) · 3.82 KB
/
config.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
/**
* @file config.h
* @brief C++ Interface: config
*
* @details Configuration module for Robot Vision System.
*
* Copyright: See COPYING file that comes with this distribution
*
* @author Valdur Kaldvee
* @author Margus Ernits
* @author Mauno Pihelgas
* @author Erik Kaju
*/
#ifndef CONFIG_H
#define CONFIG_H
#include <getopt.h> //longopts
#include "simpleini/SimpleIni.h"
#include "objecttype.h"
#include "blackoutconf.h"
#include <cv.h>
#include <highgui.h>
#include <QSettings>
#include <QDir>
#include <string>
#define RC_FIELD 0
#define RC_ROBOT 1
#define RC_ACTION 2
#define RC_SIG_A '1'
#define RC_SIG_B '2'
#define RC_SIG_ALL_ROBOTS '3'
#define RC_SIG_START '1'
#define RC_SIG_STOP '2'
#define RC_SIG_PING '3'
/**
* Configuration model for Robot Vision System
*
* @author Valdur Kaldvee
* @author Margus Ernits <[email protected]>
* @author Mauno Pihelgas <[email protected]>
*/
using namespace std;
class Config{
public:
//Config(int argn, char ** argv);
~Config();
private:
//TODO mis parameetreid võiks veel command linest ette anda? (Margus)
bool immediateStart;
int brightness;
int contrast;
char * bmp_filename;
const char * video_device;
const char * serial_device;
const char * robot_name;
const char * robot_params;
Config();
int readIni();
int showDebugInfo;
int sendCmdEnabled;
int blackPercent;
int colorPercent;
int topCut;
int sideCut;
int squareCut;
int img_width, img_height_front_cam, img_height_side_cam, img_offset_x, img_offset_y;
int img_flip;
int img_exposure;
int img_gain;
ObjectType blue, yellow, orange, black, green;
BlackoutConf blackout;
public:
QString colorConfFile;
int WB_kr,WB_kb,WB_kg;
const char * getmodemDevice();
const char * getRobotName();
const char * getRobotParams();
void setConfig(int argn, char ** argv);
static Config& getConfig();
void setSendCmdEnabled(int);
void setShowDebugInfo( int);
void usage(char**);
int getShowDebugInfo();
int getSendCmdEnabled();
int getTopCut();
void setTopCut(int);
int getSideCut();
void setSideCut(int);
void setImgWidth(int);
int getImgWidth();
void setImgHeightFrontCam(int);
int getImgHeightFrontCam();
void setImgHeightSideCam(int);
int getImgHeightSideCam();
void setImgOffsetX(int);
int getImgOffsetX();
void setImgOffsetY(int);
int getImgOffsetY();
bool getImmediateStart();
void setImgFlip(int);
int getImgFlip();
void setImgExposure(int);
int getImgExposure();
void setImgGain(int);
int getImgGain();
char keyS;
// 360 kaamera ainult
int getSquareCut();
void setSquareCut(int);
bool takeWB;
bool setSlider;
int *getWbKr();
int *getWbKb();
int *getWbKg();
ObjectType * getBlue()
{
return & blue;
}
ObjectType * getYellow()
{
return & yellow;
}
ObjectType * getOrange()
{
return & orange;
}
ObjectType * getBlack()
{
return & black;
}
ObjectType * getGreen()
{
return & green;
}
void setShowImage ( int theValue )
{
showImage = theValue;
}
int getShowImage() const
{
return showImage;
}
void setUseImageFile ( int theValue )
{
useImageFile = theValue;
}
int getUseImageFile() const
{
return useImageFile;
}
char * getImageFileName()
{
return bmp_filename;
}
void setSaveImage ( int theValue )
{
saveImage = theValue;
}
int getSaveImage() const
{
return saveImage;
}
BlackoutConf * getBlackout() {
return & blackout;
}
protected:
int showImage;
int useImageFile;
int saveImage;
};
#endif