forked from twiniars/RESpecTa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
globals.h
323 lines (300 loc) · 9.22 KB
/
globals.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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
#ifndef GLOBALS_H
#define GLOBALS_H
#include <QStringList>
#include <iostream>
enum SceneMode { InsertItem, InsertLine, MoveItem };
//*************** STATE TYPES ***************//
/**
* Enum Type representing StateTypes.
*/
enum StateType {SYSTEM_INITIALIZATION, RUN_GENERATOR, EMPTY_GEN_FOR_SET, EMPTY_GEN, WAIT, STOP_GEN,
INITIATE_SENSOR_READING, GET_SENSOR_READING,
//CUBE_STATE_INIT, CUBE_STATE_WRITING, CUBE_STATE_CHANGE, COMMUNICATE_WITH_SOLVER, MANIPULATION_SEQ_TRANSLATION,
STATE_TYPES_NUMBER };
//IMPORTANT: SYSTEM INITIALIZATION needs to be first on the list
/**
* Table containing all strings representing StateTypes.
*/
static std::string STATE_TYPE_TABLE[STATE_TYPES_NUMBER+1] =
{"systemInitialization","set_next_ecp_state","wait_for_task_termination","emptyGen","wait_ms","send_end_motion_to_ecps",
"initiateSensorReading","getSensorReading",""};
/**
* Function returning list of StateTypes.
* @returns List containing names of all StateTypes.
*/
static QStringList getStateTypeTable()
{
QStringList items;
for (int i=0;i<STATE_TYPES_NUMBER;i++)
{
items<<QString().fromStdString(STATE_TYPE_TABLE[i]);
}
return items;
}
/**
* Function checking if given StateType is a proper value of StateTypes.
* @param value StateType to check if proper.
* @returns True if the value is proper.
*/
static bool isProper(StateType value)
{
return (value>=0 && value<STATE_TYPES_NUMBER);
}
//*************** GENERATOR TYPES ***************//
/**
* Enum Type representing GeneratorTypes.
*/
enum GeneratorType {ECP_GEN_TEACH_IN, ECP_GEN_NEWSMOOTH, ECP_GEN_WEIGHT_MEASURE, ECP_GEN_TRANSPARENT, ECP_GEN_TFF_NOSE_RUN,
ECP_ST_BIAS_EDP_FORCE, ECP_GEN_TFF_RUBIK_GRAB, ECP_GEN_TFF_RUBIK_FACE_ROTATE, ECP_ST_GRIPPER_OPENING,
ECP_GEN_TFF_GRIPPER_APPROACH,
GENERATORS_NUMBER};
/**
* Table containing all strings representing GeneratorTypes(not for initialization).
*/
static std::string GENERATOR_TYPE_TABLE[GENERATORS_NUMBER+1] =
{"ECP_GEN_TEACH_IN","ECP_GEN_NEWSMOOTH","ECP_GEN_WEIGHT_MEASURE","ECP_GEN_TRANSPARENT","ECP_GEN_TFF_NOSE_RUN",
"ECP_ST_BIAS_EDP_FORCE","ECP_GEN_TFF_RUBIK_GRAB","ECP_GEN_TFF_RUBIK_FACE_ROTATE","ECP_ST_GRIPPER_OPENING",
"ECP_GEN_TFF_GRIPPER_APPROACH",""};
/**
* Table containing all strings representing GeneratorTypes(for initialization).
*/
static std::string GENERATOR_TYPE_TABLE2[GENERATORS_NUMBER+1] =
{"ecp_teach_in_gen","ecp_smooth_gen","weight_measure_gen","ecp_gen_t","ecp_tff_nose_run_gen",
"bias_edp_force_st","ecp_tff_rubik_grab_gen","ecp_tff_rubik_face_rotate_gen","gripper_opening",
"ecp_tff_gripper_approach_gen",""};
/**
* Function returning list of GeneratorTypes(not for initialization).
* @returns List containing names of all GeneratorTypes(not for initialization).
*/
static QStringList getGeneratorTypeTable()
{
QStringList items;
for (int i=0;i<GENERATORS_NUMBER;i++)
{
items<<QString().fromStdString(GENERATOR_TYPE_TABLE[i]);
}
return items;
}
/**
* Function returning list of GeneratorTypes(for initialization).
* @returns List containing names of all GeneratorTypes(for initialization).
*/
static QStringList getGeneratorTypeTable2()
{
QStringList items;
for (int i=0;i<GENERATORS_NUMBER;i++)
{
items<<QString().fromStdString(GENERATOR_TYPE_TABLE2[i]);
}
return items;
}
/**
* Function checking if given GeneratorType is a proper value of GeneratorTypes.
* @param value GeneratorType to check if proper.
* @returns True if the value is proper.
*/
static bool isProper(GeneratorType value)
{
return (value>=0 && value<GENERATORS_NUMBER);
}
//*************** ROBOTS ***************//
/**
* Enum Type representing Robots.
*/
enum Robot {ROBOT_UNDEFINED, irp6ot_m, irp6p_m, festival, conveyor,
ROBOT_ELECTRON, bird_hand, ROBOT_SPEECHRECOGNITION,
ROBOTS_NUMBER};
/**
* Table containing all strings representing Robots.
*/
static std::string ROBOT_TABLE[ROBOTS_NUMBER+1] =
{"ROBOT_UNDEFINED","irp6ot_m","irp6p_m","festival","conveyor",
"ROBOT_ELECTRON","bird_hand","ROBOT_SPEECHRECOGNITION",""};
/**
* Function returning list of StateTypes.
* @returns List containing names of all Robots.
*/
static QStringList getRobotTable()
{
QStringList items;
for (int i=0;i<ROBOTS_NUMBER;i++)
{
items<<QString().fromStdString(ROBOT_TABLE[i]);
}
return items;
}
/**
* Function checking if given Robot is a proper value of Robots.
* @param value Robot to check if proper.
* @returns True if the value is proper.
*/
static bool isProper(Robot value)
{
return (value>=0 && value<ROBOTS_NUMBER);
}
//*************** SENSORS ***************//
/**
* Enum Type representing Sensors.
*/
enum Sensor {SENSOR_CAMERA_ON_TRACK, SENSOR_CAMERA_SA,
SENSORS_NUMBER};
/**
* Table containing all strings representing Sensors.
*/
static std::string SENSOR_TABLE[SENSORS_NUMBER+1] =
{"SENSOR_CAMERA_ON_TRACK","SENSOR_CAMERA_SA",""};
/**
* Function returning list of StateTypes.
* @returns List containing names of all Sensors.
*/
static QStringList getSensorTable()
{
QStringList items;
for (int i=0;i<SENSORS_NUMBER;i++)
{
items<<QString().fromStdString(SENSOR_TABLE[i]);
}
return items;
}
/**
* Function checking if given Sensor is a proper value of Sensors.
* @param value Sensor to check if proper.
* @returns True if the value is proper.
*/
static bool isProper(Sensor value)
{
return (value>=0 && value<SENSORS_NUMBER);
}
//*************** COORD TYPES ***************//
/**
* Enum Type representing CoordTypes.
*/
enum CoordType {ecp_XYZ_ANGLE_AXIS, ecp_XYZ_EULER_ZYZ, JOINT, MOTOR, ECP_PF_VELOCITY,
COORDTYPES_NUMBER};
/**
* Table containing all strings representing CoordTypes.
*/
static std::string COORD_TYPE_TABLE[COORDTYPES_NUMBER+1] =
{"ecp_XYZ_ANGLE_AXIS","ecp_XYZ_EULER_ZYZ","JOINT","MOTOR","ECP_PF_VELOCITY",""};
/**
* Function returning list of StateTypes.
* @returns List containing names of all CoordTypes.
*/
static QStringList getCoordTypeTable()
{
QStringList items;
for (int i=0;i<COORDTYPES_NUMBER;i++)
{
items<<QString().fromStdString(COORD_TYPE_TABLE[i]);
}
return items;
}
/**
* Function checking if given CoordType is a proper value of CoordTypes.
* @param value CoordType to check if proper.
* @returns True if the value is proper.
*/
static bool isProper(CoordType value)
{
return (value>=0 && value<COORDTYPES_NUMBER);
}
//*************** MOTION TYPES ***************//
/**
* Enum Type representing MotionTypes.
*/
enum MotionType {ABSOLUTE, RELATIVE,
MOTIONTYPES_NUMBER};
/**
* Table containing all strings representing MotionTypes.
*/
static std::string MOTION_TYPE_TABLE[MOTIONTYPES_NUMBER+1] =
{"Absolute","Relative",""};
/**
* Function returning list of StateTypes.
* @returns List containing names of all MotionTypes.
*/
static QStringList getMotionTypeTable()
{
QStringList items;
for (int i=0;i<MOTIONTYPES_NUMBER;i++)
{
items<<QString().fromStdString(MOTION_TYPE_TABLE[i]);
}
return items;
}
/**
* Function checking if given MotionType is a proper value of MotionTypes.
* @param value MotionType to check if proper.
* @returns True if the value is proper.
*/
static bool isProper(MotionType value)
{
return (value>=0 && value<MOTIONTYPES_NUMBER);
}
//*************** TRANSMITTERS ***************//
/**
* Enum Type representing Transmitters.
*/
enum Transmitter {TRANSMITTER_RC_WINDOWS,
TRANSMITTERS_NUMBER};
/**
* Table containing all strings representing Transmitters.
*/
static std::string TRANSMITTER_TABLE[TRANSMITTERS_NUMBER+1] =
{"TRANSMITTER_RC_WINDOWS",""};
/**
* Function returning list of Transmitters.
* @returns List containing names of all Transmitters.
*/
static QStringList getTransmitterTable()
{
QStringList items;
for (int i=0;i<TRANSMITTERS_NUMBER;i++)
{
items<<QString().fromStdString(TRANSMITTER_TABLE[i]);
}
return items;
}
/**
* Function checking if given Transmitter is a proper value of Transmitters.
* @param value Transmitter to check if proper.
* @returns True if the value is proper.
*/
static bool isProper(Transmitter value)
{
return (value>=0 && value<TRANSMITTERS_NUMBER);
}
//*************** CONDITIONS ***************//
/**
* Enum Type representing Conditions.
*/
enum ConditionType {TRU, STATEOPERATIONRESULT, INIFILE,
COND_NUMBER};
/**
* Table containing all strings representing Conditions.
*/
static std::string CONDITION_TABLE[COND_NUMBER+1] =
{"true", "stateOperationResult", "iniFile.",""};
/**
* Function returning list of StateTypes.
* @returns List containing names of all Conditions.
*/
static QStringList getCondTypeTable()
{
QStringList items;
for (int i=0;i<COND_NUMBER;i++)
{
items<<QString().fromStdString(CONDITION_TABLE[i]);
}
return items;
}
/**
* Function checking if given Condition is a proper value of Conditions.
* @param value Condition to check if proper.
* @returns True if the value is proper.
*/
static bool isProper(ConditionType value)
{
return (value>=0 && value<COND_NUMBER);
}
#endif // GLOBALS_H