Skip to content

Commit 7748777

Browse files
committed
-
2 parents 9363640 + 94d1711 commit 7748777

20 files changed

+153
-137
lines changed

camera.py

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ def run(self):
6363
#print "run.1"
6464
self._image_lock.acquire()
6565
self._camera.grab_one()
66+
self._image_lock.release()
6667
#print "run.2: " + str(time.time()-ts)
6768
#self.save_image(image.Image(self._camera.get_image_bgr()).open().binarize().to_jpeg())
6869
self.save_image(self._camera.get_image_jpeg())
6970
#print "run.3: " + str(time.time()-ts)
70-
self._image_lock.release()
7171
else:
7272
time.sleep(CAMERA_REFRESH_INTERVAL - (time.time() - self._image_time))
7373

@@ -84,7 +84,7 @@ def save_image(self, image_jpeg):
8484
self._image_time=time.time()
8585

8686
def set_text(self, text):
87-
self._camera.set_overlay_text(text)
87+
self._camera.set_overlay_text(str(text))
8888

8989
def get_next_photo_index(self):
9090
last_photo_index = 0
@@ -169,17 +169,14 @@ def calibrate(self):
169169
def find_line(self):
170170
self._image_lock.acquire()
171171
img = self.get_image(0).binarize()
172-
#img.drawRectangle(0,200,640,40)
173-
#img.drawRectangle(240,200,160,40, color=(0,0,255))
174172
slices = [0,0,0]
175173
blobs = [0,0,0]
176174
slices[0] = img.crop(0, 100, 160, 120)
177175
slices[1] = img.crop(0, 80, 160, 100)
178176
slices[2] = img.crop(0, 60, 160, 80)
179-
coords = [50, 50, 50]
177+
coords = [-1, -1, -1]
180178
for idx, slice in enumerate(slices):
181-
blobs[idx] = slice.find_blobs(minsize=80, maxsize=1600)
182-
#print "blobs: " + str(blobs[idx])
179+
blobs[idx] = slice.find_blobs(minsize=30, maxsize=160)
183180
if len(blobs[idx]):
184181
coords[idx] = (blobs[idx][0].center[0] * 100) / 160
185182
print "line coord: " + str(idx) + " " + str(coords[idx])+ " area: " + str(blobs[idx][0].area())
@@ -204,23 +201,20 @@ def find_signal(self):
204201
return angle
205202

206203
def find_face(self):
207-
#print "face"
208204
faceX = None
209-
ts = time.time()
210205
self._image_lock.acquire()
211206
img = self.get_image(0)
212-
faces = img.find_faces()
207+
ts = time.time()
208+
faces = img.grayscale().find_faces()
209+
print "face.detect: " + str(time.time() - ts)
210+
self._image_lock.release()
213211
print faces
214212
if len(faces):
215-
# Get the largest face
213+
# Get the largest face, face is a rectangle
216214
bigFace = faces[0]
217-
# Draw a green box around the face
218-
#bigFace.draw()
219-
faceX = (bigFace.center[0] * 100) / 160
215+
center = bigFace[0]+(bigFace[2]/2)
216+
faceX = (center * 100) / 160
220217

221-
#self.save_image(img)
222-
self._image_lock.release()
223-
print "face: " + str(time.time() - ts)
224218
return faceX
225219

226220
def path_ahead(self):

coderbot.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"move_tr_speed": "75", "move_fw_elapse": "1.5", "show_page_program": "true", "load_at_start": "", "move_tr_elapse": "1", "sound_start": "$startup.mp3", "sound_stop": "$shutdown.mp3", "camera_exposure_mode": "auto", "prog_video_rec": "true", "show_control_move_commands": "true", "prog_level": "basic_move", "prog_scrollbars": "true", "ctrl_fw_speed": "100", "move_fw_speed": "100", "sound_shutter": "$shutter.mp3", "show_page_prefs": "true", "prog_maxblocks": "5", "ctrl_hud_image": "coderbot_hud_2.png", "move_motor_mode": "dc", "ctrl_fw_elapse": "-1", "ctrl_tr_elapse": "-1", "show_page_control": "true", "ctrl_tr_speed": "80"}
1+
{"move_tr_speed": "75", "move_fw_elapse": "1.5", "show_page_program": "true", "prog_saveonrun": "true", "load_at_start": "", "move_tr_elapse": "1", "sound_start": "$startup.mp3", "sound_stop": "$shutdown.mp3", "camera_exposure_mode": "auto", "prog_video_rec": "true", "prog_level": "basic_move", "prog_scrollbars": "true", "ctrl_fw_speed": "100", "move_fw_speed": "100", "sound_shutter": "$shutter.mp3", "show_page_prefs": "true", "prog_maxblocks": "5", "ctrl_hud_image": "", "button_func": "none", "move_motor_mode": "dc", "ctrl_fw_elapse": "-1", "ctrl_tr_elapse": "-1", "show_page_control": "true", "ctrl_tr_speed": "80"}

data/program_a b.data

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"dom_code": "<xml xmlns=\"http://www.w3.org/1999/xhtml\"><block type=\"coderbot_moveForward\" id=\"6\" x=\"347\" y=\"30\"><next><block type=\"coderbot_moveForward\" id=\"7\"></block></next></block></xml>", "code": "get_bot().forward(speed=100, elapse=1.5)\nget_bot().forward(speed=100, elapse=1.5)\n", "name": "a b"}

data/program_face.data

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"dom_code": "<xml xmlns=\"http://www.w3.org/1999/xhtml\"><block type=\"controls_whileUntil\" id=\"8\" inline=\"false\" x=\"43\" y=\"-64\"><field name=\"MODE\">WHILE</field><value name=\"BOOL\"><block type=\"logic_boolean\" id=\"9\"><field name=\"BOOL\">TRUE</field></block></value><statement name=\"DO\"><block type=\"variables_set\" id=\"10\" inline=\"true\"><field name=\"VAR\">faccia_x</field><value name=\"VALUE\"><block type=\"coderbot_adv_findFace\" id=\"11\"></block></value><next><block type=\"text_print\" id=\"12\" inline=\"false\"><value name=\"TEXT\"><block type=\"variables_get\" id=\"13\"><field name=\"VAR\">faccia_x</field></block></value><next><block type=\"controls_if\" id=\"14\" inline=\"false\"><value name=\"IF0\"><block type=\"logic_compare\" id=\"15\" inline=\"true\"><field name=\"OP\">GTE</field><value name=\"A\"><block type=\"variables_get\" id=\"16\"><field name=\"VAR\">faccia_x</field></block></value><value name=\"B\"><block type=\"math_number\" id=\"17\"><field name=\"NUM\">0</field></block></value></block></value><statement name=\"DO0\"><block type=\"controls_if\" id=\"18\" inline=\"false\"><mutation elseif=\"1\"></mutation><value name=\"IF0\"><block type=\"logic_compare\" id=\"19\" inline=\"true\"><field name=\"OP\">LT</field><value name=\"A\"><block type=\"variables_get\" id=\"20\"><field name=\"VAR\">faccia_x</field></block></value><value name=\"B\"><block type=\"math_number\" id=\"21\"><field name=\"NUM\">45</field></block></value></block></value><statement name=\"DO0\"><block type=\"coderbot_adv_move\" id=\"22\" inline=\"true\"><field name=\"ACTION\">LEFT</field><value name=\"SPEED\"><block type=\"math_number\" id=\"23\"><field name=\"NUM\">80</field></block></value><value name=\"ELAPSE\"><block type=\"math_arithmetic\" id=\"45\" inline=\"true\"><field name=\"OP\">DIVIDE</field><value name=\"A\"><block type=\"math_arithmetic\" id=\"46\" inline=\"true\"><field name=\"OP\">MINUS</field><value name=\"A\"><block type=\"math_number\" id=\"48\"><field name=\"NUM\">50</field></block></value><value name=\"B\"><block type=\"variables_get\" id=\"47\"><field name=\"VAR\">faccia_x</field></block></value></block></value><value name=\"B\"><block type=\"math_number\" id=\"49\"><field name=\"NUM\">100.1</field></block></value></block></value></block></statement><value name=\"IF1\"><block type=\"logic_compare\" id=\"25\" inline=\"true\"><field name=\"OP\">GT</field><value name=\"A\"><block type=\"variables_get\" id=\"26\"><field name=\"VAR\">faccia_x</field></block></value><value name=\"B\"><block type=\"math_number\" id=\"27\"><field name=\"NUM\">55</field></block></value></block></value><statement name=\"DO1\"><block type=\"coderbot_adv_move\" id=\"28\" inline=\"true\"><field name=\"ACTION\">RIGHT</field><value name=\"SPEED\"><block type=\"math_number\" id=\"29\"><field name=\"NUM\">80</field></block></value><value name=\"ELAPSE\"><block type=\"math_arithmetic\" id=\"43\" inline=\"true\"><field name=\"OP\">DIVIDE</field><value name=\"A\"><block type=\"math_arithmetic\" id=\"38\" inline=\"true\"><field name=\"OP\">MINUS</field><value name=\"A\"><block type=\"variables_get\" id=\"34\"><field name=\"VAR\">faccia_x</field></block></value><value name=\"B\"><block type=\"math_number\" id=\"39\"><field name=\"NUM\">50</field></block></value></block></value><value name=\"B\"><block type=\"math_number\" id=\"44\"><field name=\"NUM\">100.1</field></block></value></block></value></block></statement></block></statement></block></next></block></next></block></statement></block></xml>", "code": "faccia_x = None\n\n\nwhile True:\n get_prog_eng().check_end()\n faccia_x = get_cam().find_face()\n get_cam().set_text(faccia_x)\n if faccia_x >= 0:\n if faccia_x < 45:\n get_bot().left(speed=80, elapse=(50 - faccia_x) / 100.1)\n elif faccia_x > 55:\n get_bot().right(speed=80, elapse=(faccia_x - 50) / 100.1)\n", "name": "face"}

data/program_line_follower.data

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"dom_code": "<xml xmlns=\"http://www.w3.org/1999/xhtml\"><block type=\"controls_whileUntil\" id=\"70\" inline=\"false\" x=\"30\" y=\"4\"><field name=\"MODE\">WHILE</field><value name=\"BOOL\"><block type=\"logic_boolean\" id=\"71\"><field name=\"BOOL\">TRUE</field></block></value><statement name=\"DO\"><block type=\"variables_set\" id=\"72\" inline=\"true\"><field name=\"VAR\">line_position</field><value name=\"VALUE\"><block type=\"coderbot_adv_findLine\" id=\"73\"></block></value><next><block type=\"controls_if\" id=\"74\" inline=\"false\"><mutation elseif=\"1\" else=\"1\"></mutation><value name=\"IF0\"><block type=\"logic_compare\" id=\"75\" inline=\"true\"><field name=\"OP\">LT</field><value name=\"A\"><block type=\"variables_get\" id=\"76\"><field name=\"VAR\">line_position</field></block></value><value name=\"B\"><block type=\"math_number\" id=\"77\"><field name=\"NUM\">20</field></block></value></block></value><statement name=\"DO0\"><block type=\"coderbot_adv_move\" id=\"78\" inline=\"true\"><field name=\"ACTION\">LEFT</field><value name=\"SPEED\"><block type=\"math_number\" id=\"79\"><field name=\"NUM\">80</field></block></value><value name=\"ELAPSE\"><block type=\"math_number\" id=\"80\"><field name=\"NUM\">0.1</field></block></value></block></statement><value name=\"IF1\"><block type=\"logic_compare\" id=\"81\" inline=\"true\"><field name=\"OP\">GT</field><value name=\"A\"><block type=\"variables_get\" id=\"82\"><field name=\"VAR\">line_position</field></block></value><value name=\"B\"><block type=\"math_number\" id=\"83\"><field name=\"NUM\">80</field></block></value></block></value><statement name=\"DO1\"><block type=\"coderbot_adv_move\" id=\"84\" inline=\"true\"><field name=\"ACTION\">RIGHT</field><value name=\"SPEED\"><block type=\"math_number\" id=\"85\"><field name=\"NUM\">80</field></block></value><value name=\"ELAPSE\"><block type=\"math_number\" id=\"86\"><field name=\"NUM\">0.1</field></block></value></block></statement><statement name=\"ELSE\"><block type=\"coderbot_adv_move\" id=\"87\" inline=\"true\"><field name=\"ACTION\">FORWARD</field><value name=\"SPEED\"><block type=\"math_number\" id=\"88\"><field name=\"NUM\">100</field></block></value><value name=\"ELAPSE\"><block type=\"math_number\" id=\"89\"><field name=\"NUM\">0.2</field></block></value></block></statement></block></next></block></statement></block></xml>", "code": "line_position = None\n\n\nwhile True:\n get_prog_eng().check_end()\n line_position = get_cam().find_line()\n if line_position < 20:\n get_bot().left(speed=80, elapse=0.1)\n elif line_position > 80:\n get_bot().right(speed=80, elapse=0.1)\n else:\n get_bot().forward(speed=100, elapse=0.2)\n", "name": "line_follower"}
1+
{"dom_code": "<xml xmlns=\"http://www.w3.org/1999/xhtml\"><block type=\"controls_whileUntil\" id=\"1\" inline=\"false\" x=\"30\" y=\"4\"><field name=\"MODE\">WHILE</field><value name=\"BOOL\"><block type=\"logic_boolean\" id=\"2\"><field name=\"BOOL\">TRUE</field></block></value><statement name=\"DO\"><block type=\"variables_set\" id=\"3\" inline=\"true\"><field name=\"VAR\">line_position</field><value name=\"VALUE\"><block type=\"coderbot_adv_findLine\" id=\"4\"></block></value><next><block type=\"text_print\" id=\"5\" inline=\"false\"><value name=\"TEXT\"><block type=\"variables_get\" id=\"6\"><field name=\"VAR\">line_position</field></block></value><next><block type=\"controls_if\" id=\"7\" inline=\"false\"><mutation elseif=\"2\" else=\"1\"></mutation><value name=\"IF0\"><block type=\"logic_compare\" id=\"8\" inline=\"true\"><field name=\"OP\">LT</field><value name=\"A\"><block type=\"variables_get\" id=\"9\"><field name=\"VAR\">line_position</field></block></value><value name=\"B\"><block type=\"math_number\" id=\"10\"><field name=\"NUM\">0</field></block></value></block></value><statement name=\"DO0\"><block type=\"coderbot_adv_move\" id=\"11\" inline=\"true\"><field name=\"ACTION\">BACKWARD</field><value name=\"SPEED\"><block type=\"math_number\" id=\"12\"><field name=\"NUM\">50</field></block></value><value name=\"ELAPSE\"><block type=\"math_number\" id=\"13\"><field name=\"NUM\">0.1</field></block></value></block></statement><value name=\"IF1\"><block type=\"logic_compare\" id=\"14\" inline=\"true\"><field name=\"OP\">LT</field><value name=\"A\"><block type=\"variables_get\" id=\"15\"><field name=\"VAR\">line_position</field></block></value><value name=\"B\"><block type=\"math_number\" id=\"16\"><field name=\"NUM\">40</field></block></value></block></value><statement name=\"DO1\"><block type=\"coderbot_adv_move\" id=\"17\" inline=\"true\"><field name=\"ACTION\">LEFT</field><value name=\"SPEED\"><block type=\"math_number\" id=\"18\"><field name=\"NUM\">60</field></block></value><value name=\"ELAPSE\"><block type=\"math_number\" id=\"19\"><field name=\"NUM\">0.1</field></block></value></block></statement><value name=\"IF2\"><block type=\"logic_compare\" id=\"20\" inline=\"true\"><field name=\"OP\">GT</field><value name=\"A\"><block type=\"variables_get\" id=\"21\"><field name=\"VAR\">line_position</field></block></value><value name=\"B\"><block type=\"math_number\" id=\"22\"><field name=\"NUM\">60</field></block></value></block></value><statement name=\"DO2\"><block type=\"coderbot_adv_move\" id=\"23\" inline=\"true\"><field name=\"ACTION\">RIGHT</field><value name=\"SPEED\"><block type=\"math_number\" id=\"24\"><field name=\"NUM\">60</field></block></value><value name=\"ELAPSE\"><block type=\"math_number\" id=\"25\"><field name=\"NUM\">0.1</field></block></value></block></statement><statement name=\"ELSE\"><block type=\"coderbot_adv_move\" id=\"26\" inline=\"true\"><field name=\"ACTION\">FORWARD</field><value name=\"SPEED\"><block type=\"math_number\" id=\"27\"><field name=\"NUM\">70</field></block></value><value name=\"ELAPSE\"><block type=\"math_number\" id=\"28\"><field name=\"NUM\">0.2</field></block></value></block></statement></block></next></block></next></block></statement></block></xml>", "code": "line_position = None\n\n\nwhile True:\n get_prog_eng().check_end()\n line_position = get_cam().find_line()\n get_cam().set_text(line_position)\n if line_position < 0:\n get_bot().backward(speed=50, elapse=0.1)\n elif line_position < 40:\n get_bot().left(speed=60, elapse=0.1)\n elif line_position > 60:\n get_bot().right(speed=60, elapse=0.1)\n else:\n get_bot().forward(speed=70, elapse=0.2)\n", "name": "line_follower"}

messages.pot

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: PROJECT VERSION\n"
1010
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
11-
"POT-Creation-Date: 2015-03-07 22:53+0000\n"
11+
"POT-Creation-Date: 2015-03-14 22:00+0000\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: LANGUAGE <[email protected]>\n"
@@ -69,7 +69,7 @@ msgid "Camera"
6969
msgstr ""
7070

7171
#: templates/blocks_adv.xml:234 templates/blocks_std.xml:69
72-
#: templates/config.html:14 templates/config.html:76
72+
#: templates/config.html:14
7373
msgid "Sensor"
7474
msgstr ""
7575

@@ -106,31 +106,31 @@ msgstr ""
106106
msgid "Button"
107107
msgstr ""
108108

109-
#: templates/config.html:18 templates/config.html:105
109+
#: templates/config.html:18 templates/config.html:118
110110
msgid "User Interface"
111111
msgstr ""
112112

113-
#: templates/config.html:23
113+
#: templates/config.html:23 templates/config.html:60
114114
msgid "Movement assisted by vision"
115115
msgstr ""
116116

117117
#: templates/config.html:26
118118
msgid "Step timing | distance / angle"
119119
msgstr ""
120120

121-
#: templates/config.html:27 templates/config.html:81
121+
#: templates/config.html:27 templates/config.html:63
122122
msgid "Forward speed"
123123
msgstr ""
124124

125-
#: templates/config.html:29
125+
#: templates/config.html:29 templates/config.html:65
126126
msgid "Forward elapse / distance"
127127
msgstr ""
128128

129-
#: templates/config.html:31 templates/config.html:85
129+
#: templates/config.html:31 templates/config.html:67
130130
msgid "Turn speed"
131131
msgstr ""
132132

133-
#: templates/config.html:33
133+
#: templates/config.html:33 templates/config.html:69
134134
msgid "Turn elapse / angle"
135135
msgstr ""
136136

@@ -170,125 +170,125 @@ msgstr ""
170170
msgid "Shows Editor scrollbars"
171171
msgstr ""
172172

173-
#: templates/config.html:60
173+
#: templates/config.html:72
174174
msgid "Other program parameters"
175175
msgstr ""
176176

177-
#: templates/config.html:61
177+
#: templates/config.html:73
178178
msgid "Auto record video on program run"
179179
msgstr ""
180180

181-
#: templates/config.html:64
181+
#: templates/config.html:76
182182
msgid "Max number of blocks allowed"
183183
msgstr ""
184184

185-
#: templates/config.html:68
185+
#: templates/config.html:80
186186
msgid "Start sound"
187187
msgstr ""
188188

189-
#: templates/config.html:70
189+
#: templates/config.html:82
190190
msgid "Stop sound"
191191
msgstr ""
192192

193-
#: templates/config.html:72
193+
#: templates/config.html:84
194194
msgid "Shutter sound"
195195
msgstr ""
196196

197-
#: templates/config.html:79
198-
msgid "Motor control mode"
197+
#: templates/config.html:88
198+
msgid "Camera parameters"
199199
msgstr ""
200200

201-
#: templates/config.html:83
202-
msgid "Forward elapse"
201+
#: templates/config.html:89
202+
msgid "Exposure mode"
203203
msgstr ""
204204

205-
#: templates/config.html:87
206-
msgid "Turn elapse"
205+
#: templates/config.html:100
206+
msgid "Motor control mode"
207207
msgstr ""
208208

209-
#: templates/config.html:91
209+
#: templates/config.html:104
210210
msgid "Load at start"
211211
msgstr ""
212212

213-
#: templates/config.html:96
213+
#: templates/config.html:109
214214
msgid "Button function"
215215
msgstr ""
216216

217-
#: templates/config.html:97
217+
#: templates/config.html:110
218218
msgid "None"
219219
msgstr ""
220220

221-
#: templates/config.html:99
221+
#: templates/config.html:112
222222
msgid "Start/Stop current program"
223223
msgstr ""
224224

225-
#: templates/config.html:106
225+
#: templates/config.html:119
226226
msgid "Show Control page"
227227
msgstr ""
228228

229-
#: templates/config.html:108
229+
#: templates/config.html:121
230230
msgid "Show Control movement commands"
231231
msgstr ""
232232

233-
#: templates/config.html:110
233+
#: templates/config.html:123
234234
msgid "Show Program page"
235235
msgstr ""
236236

237-
#: templates/config.html:112
237+
#: templates/config.html:125
238238
msgid "Show Preferences button"
239239
msgstr ""
240240

241-
#: templates/config.html:117
241+
#: templates/config.html:130
242242
msgid "Cancel"
243243
msgstr ""
244244

245-
#: templates/config.html:118 templates/program.html:18
245+
#: templates/config.html:131 templates/program.html:18
246246
#: templates/program.html:26
247247
msgid "Save"
248248
msgstr ""
249249

250-
#: templates/config_params.html:18
250+
#: templates/config_params.html:19
251251
msgid "Say what:"
252252
msgstr ""
253253

254-
#: templates/config_params.html:19
254+
#: templates/config_params.html:20
255255
msgid "Saved"
256256
msgstr ""
257257

258-
#: templates/config_params.html:20
258+
#: templates/config_params.html:21
259259
msgid "Program saved"
260260
msgstr ""
261261

262-
#: templates/config_params.html:21
262+
#: templates/config_params.html:22
263263
msgid "Program name already in use, overwrite?"
264264
msgstr ""
265265

266-
#: templates/config_params.html:22
266+
#: templates/config_params.html:23
267267
msgid "Delete"
268268
msgstr ""
269269

270-
#: templates/config_params.html:23
270+
#: templates/config_params.html:24
271271
msgid "Delete photo"
272272
msgstr ""
273273

274-
#: templates/config_params.html:24
274+
#: templates/config_params.html:25
275275
msgid "Reset move counter?"
276276
msgstr ""
277277

278-
#: templates/config_params.html:25 templates/program.html:40
278+
#: templates/config_params.html:26 templates/program.html:40
279279
msgid "is running"
280280
msgstr ""
281281

282-
#: templates/config_params.html:26
282+
#: templates/config_params.html:27
283283
msgid "stopped"
284284
msgstr ""
285285

286-
#: templates/config_params.html:27 templates/control.html:51
286+
#: templates/config_params.html:28 templates/control.html:51
287287
#: templates/program.html:32
288288
msgid "Stop"
289289
msgstr ""
290290

291-
#: templates/config_params.html:28
291+
#: templates/config_params.html:29
292292
msgid "Close"
293293
msgstr ""
294294

program.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,12 @@ def run(self):
126126
get_cam().video_rec(program.name)
127127
print "starting video"
128128
exec(self._code)
129-
get_cam().video_stop() #if video is running, stop it
130129
#print "run.2"
131130
except RuntimeError as re:
132131
print "quit: " + str(re)
133-
self._running = False
132+
finally:
133+
get_cam().video_stop() #if video is running, stop it
134+
self._running = False
134135

135136
def as_json(self):
136137
return {'name': self.name,
1.84 KB
Loading

static/images/icons/favicon.ico

32.2 KB
Binary file not shown.

static/js/control.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,13 @@ Mousetrap.bind(['command+alt+s', 'ctrl+alt+k'], function(e) {
154154
$.mobile.pageContainer.pagecontainer('change', '#page-preferences');
155155
return false;
156156
});
157-
157+
158+
Mousetrap.bind(['command+alt+h', 'ctrl+alt+h'], function(e) {
159+
if(confirm("Shutdown CoderBot?")){
160+
bot.halt();
161+
}
162+
});
163+
158164
botStatus();
159165

160166
function botStatus() {

0 commit comments

Comments
 (0)