forked from RoboCup-SSL/grSim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configwidget.h
173 lines (151 loc) · 5 KB
/
configwidget.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
/*
grSim - RoboCup Small Size Soccer Robots Simulator
Copyright (C) 2011, Parsian Robotic Center (eew.aut.ac.ir/~parsian/grsim)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CONFIGWIDGET_H
#define CONFIGWIDGET_H
#include <QWidget>
#include <QDockWidget>
#include <QtGui>
#include <QSplitter>
#include <QStringList>
#include <QMainWindow>
#include <QSettings>
#include <stdint.h>
#include <stdio.h>
#include <vartypes/VarTreeModel.h>
#include <vartypes/VarItem.h>
#include <vartypes/VarTreeView.h>
#include <vartypes/VarXML.h>
#include <vartypes/VarList.h>
#include <vartypes/VarDouble.h>
#include <vartypes/VarBool.h>
#include <vartypes/VarInt.h>
#include <vartypes/VarTrigger.h>
#include <vartypes/VarXML.h>
#include <vartypes/VarTypes.h>
using namespace VarTypes;
#define DEF_VALUE(type,Type,name) \
shared_ptr<VarTypes::Var##Type> v_##name; \
inline type name() {return v_##name->get##Type();}
#define DEF_ENUM(type,name) \
shared_ptr<VarTypes::VarStringEnum> v_##name; \
type name() {if(v_##name!=NULL) return v_##name->getString();return * (new type);}
#define DEF_TREE(name) \
shared_ptr<VarTypes::VarList> name;
#define DEF_PTREE(parents, name) \
shared_ptr<VarTypes::VarList> parents##_##name;
class RobotSettings {
public:
//geometeric settings
double RobotCenterFromKicker;
double RobotRadius;
double RobotHeight;
double BottomHeight;
double KickerZ;
double KickerThickness;
double KickerWidth;
double KickerHeight;
double WheelRadius;
double WheelThickness;
double Wheel1Angle;
double Wheel2Angle;
double Wheel3Angle;
double Wheel4Angle;
//physical settings
double BodyMass;
double WheelMass;
double KickerMass;
double KickerDampFactor;
double RollerTorqueFactor;
double RollerPerpendicularTorqueFactor;
double Kicker_Friction;
double WheelTangentFriction;
double WheelPerpendicularFriction;
double Wheel_Motor_FMax;
};
class ConfigWidget : public VarTreeView
{
Q_OBJECT
protected:
vector<VarPtr> world;
VarTreeModel * tmodel;
public:
VarListPtr geo_vars;
ConfigWidget();
virtual ~ConfigWidget();
QSettings* robot_settings;
RobotSettings robotSettings;
RobotSettings blueSettings;
RobotSettings yellowSettings;
DEF_VALUE(double,Double,Field_Length)
DEF_VALUE(double,Double,Field_Width)
DEF_VALUE(double,Double,Field_Rad)
DEF_VALUE(double,Double,Field_Penalty_Rad)
DEF_VALUE(double,Double,Field_Penalty_Line)
DEF_VALUE(double,Double,Field_Penalty_Point)
DEF_VALUE(double,Double,Field_Margin)
DEF_VALUE(double,Double,Field_Referee_Margin)
DEF_VALUE(double,Double,Wall_Thickness)
DEF_VALUE(double,Double,Goal_Thickness)
DEF_VALUE(double,Double,Goal_Depth)
DEF_VALUE(double,Double,Goal_Width)
DEF_VALUE(double,Double,Goal_Height)
DEF_ENUM(std::string,YellowTeam)
DEF_ENUM(std::string,BlueTeam)
DEF_VALUE(double,Double,BallRadius)
DEF_VALUE(double,Double,BallMass)
DEF_VALUE(double,Double,BallFriction)
DEF_VALUE(double,Double,BallSlip)
DEF_VALUE(double,Double,BallBounce)
DEF_VALUE(double,Double,BallBounceVel)
DEF_VALUE(double,Double,BallLinearDamp)
DEF_VALUE(double,Double,BallAngularDamp)
DEF_VALUE(bool,Bool,SyncWithGL)
DEF_VALUE(double,Double,DesiredFPS)
DEF_VALUE(double,Double,DeltaTime)
DEF_VALUE(double,Double,Gravity)
DEF_VALUE(std::string,String,VisionMulticastAddr)
DEF_VALUE(int,Int,VisionMulticastPort)
DEF_VALUE(int,Int,CommandListenPort)
DEF_VALUE(int,Int,BlueStatusSendPort)
DEF_VALUE(int,Int,YellowStatusSendPort)
DEF_VALUE(int,Int,sendDelay)
DEF_VALUE(bool,Bool,noise)
DEF_VALUE(double,Double,noiseDeviation_x)
DEF_VALUE(double,Double,noiseDeviation_y)
DEF_VALUE(double,Double,noiseDeviation_angle)
DEF_VALUE(bool,Bool,vanishing)
DEF_VALUE(double,Double,ball_vanishing)
DEF_VALUE(double,Double,blue_team_vanishing)
DEF_VALUE(double,Double,yellow_team_vanishing)
DEF_VALUE(std::string, String, plotter_addr)
DEF_VALUE(int, Int, plotter_port)
DEF_VALUE(bool, Bool, plotter)
void loadRobotSettings(QString team);
public slots:
void loadRobotsSettings();
};
class ConfigDockWidget : public QDockWidget
{
Q_OBJECT
public:
QWidget* parent;
ConfigWidget* conf;
ConfigDockWidget(QWidget* _parent,ConfigWidget* _conf);
protected:
void closeEvent(QCloseEvent* event);
signals:
void closeSignal(bool);
};
#endif // CONFIGWIDGET_H