-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcar.kv
280 lines (256 loc) · 6.16 KB
/
car.kv
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
#:kivy 1.0.9
#:import Vector kivy.vector.Vector
<MapDialog>:
filename_input: filename_input
cancel_btn: cancel_btn
save_btn: save_btn
orientation: 'vertical'
BoxLayout:
orientation: 'horizontal'
size_hint: (1, None)
height: 50
Label:
text: 'File name'
TextInput:
id: filename_input
BoxLayout:
orientation: 'horizontal'
size_hint: (1, None)
height: 50
Button:
id: cancel_btn
text: 'Cancel'
Button:
id: save_btn
text: 'Save'
<TopMenuWidget>:
pos_hint: {'top':1}
save_brain_button: save_brain_button
save_map_button: save_map_button
load_btn: load_button
clear_btn: clear_button
config_btn: config_button
pause_btn: pause_button
load_map_btn: load_map_btn
ActionView:
use_separator: True
ActionPrevious:
title: 'Self-Driving Car'
with_previous: False
ActionButton:
id: pause_button
text: 'Pause/Play'
ActionGroup:
text: 'Save'
mode: 'spinner'
ActionButton:
id: save_brain_button
text: 'Current Brain'
ActionButton:
id: save_map_button
text: 'Current Map'
ActionGroup:
text: 'Load'
mode: 'spinner'
ActionButton:
id: load_button
text: 'Last Brain'
ActionButton:
id: load_map_btn
text: 'Map...'
ActionButton:
id: clear_button
text: 'Clear'
ActionButton:
id: config_button
text: 'Configuration'
<Separator@Widget>:
canvas:
Color:
rgba: 1, 1, 1, 1
Rectangle:
pos: self.pos
size: self.size
<HSeparator@Separator>:
size_hint_y: None
height: dp(2)
<VSeparator@Separator>:
size_hint_x: None
width: dp(2)
<ConfigValueWidget>:
orientation: 'horizontal'
inner_label:config_label
inner_input:text_input
text:'set this'
value: '0'
size_hint: (1, None)
height: 50
pos_hint: {'top': 1}
Label:
id:config_label
text: self.parent.text
TextInput:
id:text_input
multiline: False
text: self.parent.value
<ConfigurationTitle@Label>:
pos_hint: {'left': 1}
size_hint: (1, None)
height: 50
<ConfigurationWidget>:
orientation: 'vertical'
save_btn: save_button
cancel_btn: cancel_button
dqn_gamma: gamma_rate
dqn_neurons: hidden_neurons
dqn_learning: learning_rate
dqn_temperature: temperature
dqn_sample: sample_size
reward_decay: decay_reward
reward_distance: distance_reward
pos_hint:{'top': 1}
ConfigurationTitle:
text: 'DQN Configuration'
HSeparator
BoxLayout:
orientation: 'vertical'
ConfigValueWidget:
id:gamma_rate
text: 'Gamma'
value: '0'
ConfigValueWidget:
id:hidden_neurons
text: 'NB Hidden Neurons'
value: '0'
ConfigValueWidget:
id:learning_rate
text: 'Learning Rate'
value: '0'
ConfigValueWidget:
id:temperature
text: 'Temperature'
value: '0'
ConfigValueWidget:
id:sample_size
text: 'Sample Size'
value: '0'
ConfigurationTitle:
text: 'Rewards Configuration'
HSeparator
BoxLayout:
orientation: 'vertical'
ConfigValueWidget:
id:decay_reward
text: 'Decay Reward'
value: '0'
ConfigValueWidget:
id:distance_reward
text: 'Distance Reward'
value: '0'
HSeparator
BoxLayout:
pos_hint: {'bottom': 1}
orientation: 'horizontal'
size_hint: (1, None)
height: 50
Button:
id: save_button
text: 'Save'
Button:
id: cancel_button
text: 'Cancel'
<RootWidget>:
orientation: 'vertical'
<Car>:
size_hint: (None, None)
width: 20
height: 10
canvas.before:
PushMatrix
Rotate:
angle: self.angle
origin: self.center
canvas:
Rectangle:
pos: self.pos
size: self.size
Color:
rgba: 1, 0, 0, 1
Rectangle:
pos: (self.pos[0] + self.width, self.center[1])
size: (2, 2)
Color:
rgba: 0, 1, 0, 1
Rectangle:
pos:self.pos
size: (2, 2)
canvas.after:
PopMatrix
Ball1:
center: Vector(25, 0) + self.parent.center
Ball2:
center: Vector(25,0).rotate(30) + self.parent.center
Ball3:
center: Vector(25,0).rotate(-30) + self.parent.center
<Ball1>:
size_hint: (None, None)
width: 10
height: 10
canvas:
Color:
rgba: 1,0,0,1
Rectangle:
pos: self.pos
size: self.size
<Ball2>:
size_hint: (None, None)
width: 10
height: 10
canvas:
Color:
rgba: 0,1,1,1
Rectangle:
pos: self.pos
size: self.size
<Ball3>:
size_hint: (None, None)
width: 10
height: 10
canvas:
Color:
rgba: 1,1,0,1
Rectangle:
pos: self.pos
size: self.size
<Game>:
car: game_car
top_image: top_goal
bottom_image: bottom_goal
Car:
id: game_car
center: self.parent.center
Image:
size_hint: (None, None)
width: 100
height: 100
id: top_goal
source: 'assets/top_goal.png'
Image:
size_hint: (None, None)
width: 100
height: 100
id: bottom_goal
source: 'assets/bottom_goal.png'
<TopPanel>
orientation: 'horizontal'
graph_widget: graph_widget
stats_widget: stats_widget
size_hint: (1, 0.3)
GraphWidget:
id: graph_widget
size_hint: (0.7, 1)
StatsWidget:
id: stats_widget
size_hint: (0.3, 1)
<StatsWidget>
cols:2