Advertisement
Guest User

cam5

a guest
Oct 8th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 71.22 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2.  
  3. # Form implementation generated from reading ui file 'C:\G5_Tool\G5_Stream_Tool\G5_Stream_Tool.ui'
  4. #
  5. # Created by: PyQt5 UI code generator 5.11.2
  6. #
  7. # WARNING! All changes made in this file will be lost!
  8.  
  9. from PyQt5 import QtCore, QtGui, QtWidgets
  10. from PyQt5.QtCore import *
  11. from PyQt5.QtGui import QPixmap, QImage
  12.  
  13. import paramiko
  14. import cv2
  15. import socket
  16. import numpy as np
  17. import sys
  18. import time
  19. import os
  20.  
  21. from threading import Thread, Event, ThreadError
  22. from urllib.request import urlopen
  23.  
  24. #Colors
  25. red = "background-color : rgb(170, 0, 0) ; color : rgb(255, 255, 255)"
  26. green = "background-color : rgb(0, 170, 0) ; color : rgb(255, 255, 255)"
  27. blue = "background-color : rgb(0, 85, 127) ; color : rgb(255, 255, 255)"
  28.  
  29.  
  30. class Ui_Form(object):
  31. def setupUi(self, Form):
  32. Form.setObjectName("Form")
  33. Form.resize(1827, 1022)
  34. icon = QtGui.QIcon()
  35. icon.addPixmap(QtGui.QPixmap("../macq.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
  36. Form.setWindowIcon(icon)
  37. self.groupBox_cam_mono = QtWidgets.QGroupBox(Form)
  38. self.groupBox_cam_mono.setGeometry(QtCore.QRect(1020, 450, 791, 541))
  39. font = QtGui.QFont()
  40. font.setFamily("Yu Gothic UI")
  41. font.setPointSize(11)
  42. font.setBold(True)
  43. font.setItalic(False)
  44. font.setWeight(75)
  45. self.groupBox_cam_mono.setFont(font)
  46. self.groupBox_cam_mono.setStyleSheet("color: rgb(0, 85, 127);")
  47. self.groupBox_cam_mono.setObjectName("groupBox_cam_mono")
  48. self.label_cam_stream = QtWidgets.QLabel(self.groupBox_cam_mono)
  49. self.label_cam_stream.setGeometry(QtCore.QRect(10, 30, 771, 501))
  50. self.label_cam_stream.setText("")
  51. self.label_cam_stream.setObjectName("label_cam_stream")
  52. self.groupBox_cam_mono_2 = QtWidgets.QGroupBox(Form)
  53. self.groupBox_cam_mono_2.setGeometry(QtCore.QRect(20, 450, 811, 541))
  54. font = QtGui.QFont()
  55. font.setFamily("Yu Gothic UI")
  56. font.setPointSize(11)
  57. font.setBold(True)
  58. font.setItalic(False)
  59. font.setWeight(75)
  60. self.groupBox_cam_mono_2.setFont(font)
  61. self.groupBox_cam_mono_2.setStyleSheet("color: rgb(0, 85, 127);")
  62. self.groupBox_cam_mono_2.setObjectName("groupBox_cam_mono_2")
  63. self.label_cam_capture = QtWidgets.QLabel(self.groupBox_cam_mono_2)
  64. self.label_cam_capture.setGeometry(QtCore.QRect(10, 30, 791, 501))
  65. self.label_cam_capture.setText("")
  66. self.label_cam_capture.setObjectName("label_cam_capture")
  67. self.groupBox_cam_mono_6 = QtWidgets.QGroupBox(Form)
  68. self.groupBox_cam_mono_6.setGeometry(QtCore.QRect(20, 10, 211, 431))
  69. font = QtGui.QFont()
  70. font.setFamily("Yu Gothic UI")
  71. font.setPointSize(11)
  72. font.setBold(True)
  73. font.setItalic(False)
  74. font.setWeight(75)
  75. self.groupBox_cam_mono_6.setFont(font)
  76. self.groupBox_cam_mono_6.setStyleSheet("color: rgb(0, 85, 127);")
  77. self.groupBox_cam_mono_6.setObjectName("groupBox_cam_mono_6")
  78. self.label_13 = QtWidgets.QLabel(self.groupBox_cam_mono_6)
  79. self.label_13.setGeometry(QtCore.QRect(300, 950, 311, 31))
  80. self.label_13.setStyleSheet("background-color: rgb(0, 255, 0);")
  81. self.label_13.setAlignment(QtCore.Qt.AlignCenter)
  82. self.label_13.setObjectName("label_13")
  83. self.button_capture = QtWidgets.QPushButton(self.groupBox_cam_mono_6)
  84. self.button_capture.setGeometry(QtCore.QRect(30, 350, 151, 41))
  85. font = QtGui.QFont()
  86. font.setFamily("Yu Gothic UI")
  87. font.setPointSize(10)
  88. self.button_capture.setFont(font)
  89. self.button_capture.setStyleSheet("color: rgb(0, 0, 0);\n"
  90. "")
  91. self.button_capture.setObjectName("button_capture")
  92. self.button_videostream = QtWidgets.QPushButton(self.groupBox_cam_mono_6)
  93. self.button_videostream.setGeometry(QtCore.QRect(30, 290, 151, 41))
  94. font = QtGui.QFont()
  95. font.setFamily("Yu Gothic UI")
  96. font.setPointSize(10)
  97. self.button_videostream.setFont(font)
  98. self.button_videostream.setStyleSheet("color: rgb(0, 0, 0);\n"
  99. "")
  100. self.button_videostream.setObjectName("button_videostream")
  101. self.label_ROI_3 = QtWidgets.QLabel(self.groupBox_cam_mono_6)
  102. self.label_ROI_3.setGeometry(QtCore.QRect(30, 30, 171, 31))
  103. font = QtGui.QFont()
  104. font.setFamily("Yu Gothic UI")
  105. font.setPointSize(10)
  106. self.label_ROI_3.setFont(font)
  107. self.label_ROI_3.setStyleSheet("color: rgb(0, 0, 0);")
  108. self.label_ROI_3.setObjectName("label_ROI_3")
  109. self.txt_hostname = QtWidgets.QTextEdit(self.groupBox_cam_mono_6)
  110. self.txt_hostname.setEnabled(True)
  111. self.txt_hostname.setGeometry(QtCore.QRect(30, 60, 151, 31))
  112. font = QtGui.QFont()
  113. font.setFamily("Yu Gothic UI")
  114. font.setPointSize(10)
  115. self.txt_hostname.setFont(font)
  116. self.txt_hostname.setStyleSheet("")
  117. self.txt_hostname.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
  118. self.txt_hostname.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
  119. self.txt_hostname.setObjectName("txt_hostname")
  120. self.button_connect = QtWidgets.QPushButton(self.groupBox_cam_mono_6)
  121. self.button_connect.setGeometry(QtCore.QRect(30, 110, 151, 41))
  122. font = QtGui.QFont()
  123. font.setFamily("Yu Gothic UI")
  124. font.setPointSize(10)
  125. self.button_connect.setFont(font)
  126. self.button_connect.setStyleSheet("color: rgb(0, 0, 0);\n"
  127. "")
  128. self.button_connect.setObjectName("button_connect")
  129. self.label_ROI_11 = QtWidgets.QLabel(self.groupBox_cam_mono_6)
  130. self.label_ROI_11.setGeometry(QtCore.QRect(30, 200, 161, 31))
  131. font = QtGui.QFont()
  132. font.setFamily("Yu Gothic UI")
  133. font.setPointSize(10)
  134. self.label_ROI_11.setFont(font)
  135. self.label_ROI_11.setStyleSheet("color: rgb(0, 0, 0);")
  136. self.label_ROI_11.setObjectName("label_ROI_11")
  137. self.radioButton_color = QtWidgets.QRadioButton(self.groupBox_cam_mono_6)
  138. self.radioButton_color.setGeometry(QtCore.QRect(30, 230, 151, 20))
  139. font = QtGui.QFont()
  140. font.setFamily("Yu Gothic UI")
  141. font.setPointSize(10)
  142. self.radioButton_color.setFont(font)
  143. self.radioButton_color.setStyleSheet("color:rgb(0, 0, 0)")
  144. self.radioButton_color.setObjectName("radioButton_color")
  145. self.radioButton_bw = QtWidgets.QRadioButton(self.groupBox_cam_mono_6)
  146. self.radioButton_bw.setGeometry(QtCore.QRect(30, 250, 161, 20))
  147. font = QtGui.QFont()
  148. font.setFamily("Yu Gothic UI")
  149. font.setPointSize(10)
  150. font.setBold(False)
  151. font.setItalic(False)
  152. font.setWeight(50)
  153. font.setStrikeOut(False)
  154. font.setKerning(False)
  155. self.radioButton_bw.setFont(font)
  156. self.radioButton_bw.setStyleSheet("color: rgb(0, 0, 0);")
  157. self.radioButton_bw.setObjectName("radioButton_bw")
  158. self.groupBox_cam_mono_7 = QtWidgets.QGroupBox(Form)
  159. self.groupBox_cam_mono_7.setGeometry(QtCore.QRect(950, 10, 431, 431))
  160. font = QtGui.QFont()
  161. font.setFamily("Yu Gothic UI")
  162. font.setPointSize(11)
  163. font.setBold(True)
  164. font.setItalic(False)
  165. font.setWeight(75)
  166. self.groupBox_cam_mono_7.setFont(font)
  167. self.groupBox_cam_mono_7.setStyleSheet("color: rgb(0, 85, 127);")
  168. self.groupBox_cam_mono_7.setObjectName("groupBox_cam_mono_7")
  169. self.label_14 = QtWidgets.QLabel(self.groupBox_cam_mono_7)
  170. self.label_14.setGeometry(QtCore.QRect(300, 950, 311, 31))
  171. self.label_14.setStyleSheet("background-color: rgb(0, 255, 0);")
  172. self.label_14.setAlignment(QtCore.Qt.AlignCenter)
  173. self.label_14.setObjectName("label_14")
  174. self.label_ROI = QtWidgets.QLabel(self.groupBox_cam_mono_7)
  175. self.label_ROI.setGeometry(QtCore.QRect(30, 130, 211, 41))
  176. font = QtGui.QFont()
  177. font.setFamily("Yu Gothic UI")
  178. font.setPointSize(10)
  179. self.label_ROI.setFont(font)
  180. self.label_ROI.setStyleSheet("color: rgb(0, 0, 0);")
  181. self.label_ROI.setObjectName("label_ROI")
  182. self.label_ROI_2 = QtWidgets.QLabel(self.groupBox_cam_mono_7)
  183. self.label_ROI_2.setGeometry(QtCore.QRect(30, 90, 141, 31))
  184. font = QtGui.QFont()
  185. font.setFamily("Yu Gothic UI")
  186. font.setPointSize(10)
  187. self.label_ROI_2.setFont(font)
  188. self.label_ROI_2.setStyleSheet("color: rgb(0, 0, 0);")
  189. self.label_ROI_2.setObjectName("label_ROI_2")
  190. self.button_flash_on = QtWidgets.QPushButton(self.groupBox_cam_mono_7)
  191. self.button_flash_on.setGeometry(QtCore.QRect(240, 90, 41, 31))
  192. font = QtGui.QFont()
  193. font.setFamily("Yu Gothic UI")
  194. font.setPointSize(9)
  195. self.button_flash_on.setFont(font)
  196. self.button_flash_on.setStyleSheet("color: rgb(0, 0, 0);\n"
  197. "")
  198. self.button_flash_on.setObjectName("button_flash_on")
  199. self.button_flash_off = QtWidgets.QPushButton(self.groupBox_cam_mono_7)
  200. self.button_flash_off.setGeometry(QtCore.QRect(290, 90, 41, 31))
  201. font = QtGui.QFont()
  202. font.setFamily("Yu Gothic UI")
  203. font.setPointSize(9)
  204. self.button_flash_off.setFont(font)
  205. self.button_flash_off.setStyleSheet("color: rgb(0, 0, 0);\n"
  206. "")
  207. self.button_flash_off.setObjectName("button_flash_off")
  208. self.label_ROI_4 = QtWidgets.QLabel(self.groupBox_cam_mono_7)
  209. self.label_ROI_4.setGeometry(QtCore.QRect(30, 240, 161, 21))
  210. font = QtGui.QFont()
  211. font.setFamily("Yu Gothic UI")
  212. font.setPointSize(10)
  213. self.label_ROI_4.setFont(font)
  214. self.label_ROI_4.setStyleSheet("color: rgb(0, 0, 0);")
  215. self.label_ROI_4.setObjectName("label_ROI_4")
  216. self.label_ROI_5 = QtWidgets.QLabel(self.groupBox_cam_mono_7)
  217. self.label_ROI_5.setGeometry(QtCore.QRect(30, 270, 171, 21))
  218. font = QtGui.QFont()
  219. font.setFamily("Yu Gothic UI")
  220. font.setPointSize(10)
  221. self.label_ROI_5.setFont(font)
  222. self.label_ROI_5.setStyleSheet("color: rgb(0, 0, 0);")
  223. self.label_ROI_5.setObjectName("label_ROI_5")
  224. self.label_ROI_7 = QtWidgets.QLabel(self.groupBox_cam_mono_7)
  225. self.label_ROI_7.setGeometry(QtCore.QRect(330, 240, 21, 21))
  226. font = QtGui.QFont()
  227. font.setFamily("Yu Gothic UI")
  228. font.setPointSize(10)
  229. self.label_ROI_7.setFont(font)
  230. self.label_ROI_7.setStyleSheet("color: rgb(0, 0, 0);")
  231. self.label_ROI_7.setObjectName("label_ROI_7")
  232. self.label_ROI_8 = QtWidgets.QLabel(self.groupBox_cam_mono_7)
  233. self.label_ROI_8.setGeometry(QtCore.QRect(330, 270, 21, 21))
  234. font = QtGui.QFont()
  235. font.setFamily("Yu Gothic UI")
  236. font.setPointSize(10)
  237. self.label_ROI_8.setFont(font)
  238. self.label_ROI_8.setStyleSheet("color: rgb(0, 0, 0);")
  239. self.label_ROI_8.setObjectName("label_ROI_8")
  240. self.label_ir_voltage = QtWidgets.QLabel(self.groupBox_cam_mono_7)
  241. self.label_ir_voltage.setGeometry(QtCore.QRect(230, 270, 81, 21))
  242. font = QtGui.QFont()
  243. font.setFamily("Yu Gothic UI")
  244. font.setPointSize(10)
  245. self.label_ir_voltage.setFont(font)
  246. self.label_ir_voltage.setStyleSheet("color:rgb(113, 56, 170)")
  247. self.label_ir_voltage.setText("")
  248. self.label_ir_voltage.setObjectName("label_ir_voltage")
  249. self.label_ir_current = QtWidgets.QLabel(self.groupBox_cam_mono_7)
  250. self.label_ir_current.setGeometry(QtCore.QRect(230, 240, 81, 21))
  251. font = QtGui.QFont()
  252. font.setFamily("Yu Gothic UI")
  253. font.setPointSize(10)
  254. self.label_ir_current.setFont(font)
  255. self.label_ir_current.setStyleSheet("color:rgb(113, 56, 170)")
  256. self.label_ir_current.setText("")
  257. self.label_ir_current.setObjectName("label_ir_current")
  258. self.label_ROI_10 = QtWidgets.QLabel(self.groupBox_cam_mono_7)
  259. self.label_ROI_10.setGeometry(QtCore.QRect(30, 180, 211, 41))
  260. font = QtGui.QFont()
  261. font.setFamily("Yu Gothic UI")
  262. font.setPointSize(10)
  263. self.label_ROI_10.setFont(font)
  264. self.label_ROI_10.setStyleSheet("color: rgb(0, 0, 0);")
  265. self.label_ROI_10.setObjectName("label_ROI_10")
  266. self.button_led_red_off = QtWidgets.QPushButton(self.groupBox_cam_mono_7)
  267. self.button_led_red_off.setGeometry(QtCore.QRect(290, 40, 41, 31))
  268. font = QtGui.QFont()
  269. font.setFamily("Yu Gothic UI")
  270. font.setPointSize(9)
  271. self.button_led_red_off.setFont(font)
  272. self.button_led_red_off.setStyleSheet("color: rgb(0, 0, 0);\n"
  273. "")
  274. self.button_led_red_off.setObjectName("button_led_red_off")
  275. self.label_ROI_39 = QtWidgets.QLabel(self.groupBox_cam_mono_7)
  276. self.label_ROI_39.setGeometry(QtCore.QRect(30, 40, 71, 31))
  277. font = QtGui.QFont()
  278. font.setFamily("Yu Gothic UI")
  279. font.setPointSize(10)
  280. self.label_ROI_39.setFont(font)
  281. self.label_ROI_39.setStyleSheet("color: rgb(0, 0, 0);")
  282. self.label_ROI_39.setObjectName("label_ROI_39")
  283. self.button_led_red_on = QtWidgets.QPushButton(self.groupBox_cam_mono_7)
  284. self.button_led_red_on.setGeometry(QtCore.QRect(240, 40, 41, 31))
  285. font = QtGui.QFont()
  286. font.setFamily("Yu Gothic UI")
  287. font.setPointSize(9)
  288. self.button_led_red_on.setFont(font)
  289. self.button_led_red_on.setStyleSheet("color: rgb(0, 0, 0);\n"
  290. "")
  291. self.button_led_red_on.setObjectName("button_led_red_on")
  292. self.label_ROI_6 = QtWidgets.QLabel(self.groupBox_cam_mono_7)
  293. self.label_ROI_6.setGeometry(QtCore.QRect(30, 300, 181, 21))
  294. font = QtGui.QFont()
  295. font.setFamily("Yu Gothic UI")
  296. font.setPointSize(10)
  297. self.label_ROI_6.setFont(font)
  298. self.label_ROI_6.setStyleSheet("color: rgb(0, 0, 0);")
  299. self.label_ROI_6.setObjectName("label_ROI_6")
  300. self.label_photodiode_voltage = QtWidgets.QLabel(self.groupBox_cam_mono_7)
  301. self.label_photodiode_voltage.setGeometry(QtCore.QRect(230, 300, 81, 21))
  302. font = QtGui.QFont()
  303. font.setFamily("Yu Gothic UI")
  304. font.setPointSize(10)
  305. self.label_photodiode_voltage.setFont(font)
  306. self.label_photodiode_voltage.setStyleSheet("color:rgb(113, 56, 170)")
  307. self.label_photodiode_voltage.setText("")
  308. self.label_photodiode_voltage.setObjectName("label_photodiode_voltage")
  309. self.label_ROI_9 = QtWidgets.QLabel(self.groupBox_cam_mono_7)
  310. self.label_ROI_9.setGeometry(QtCore.QRect(330, 300, 21, 21))
  311. font = QtGui.QFont()
  312. font.setFamily("Yu Gothic UI")
  313. font.setPointSize(10)
  314. self.label_ROI_9.setFont(font)
  315. self.label_ROI_9.setStyleSheet("color: rgb(0, 0, 0);")
  316. self.label_ROI_9.setObjectName("label_ROI_9")
  317. self.label_ROI_12 = QtWidgets.QLabel(self.groupBox_cam_mono_7)
  318. self.label_ROI_12.setGeometry(QtCore.QRect(30, 330, 181, 21))
  319. font = QtGui.QFont()
  320. font.setFamily("Yu Gothic UI")
  321. font.setPointSize(10)
  322. font.setBold(True)
  323. font.setWeight(75)
  324. self.label_ROI_12.setFont(font)
  325. self.label_ROI_12.setStyleSheet("color: rgb(0, 0, 0);")
  326. self.label_ROI_12.setObjectName("label_ROI_12")
  327. self.label_ROI_13 = QtWidgets.QLabel(self.groupBox_cam_mono_7)
  328. self.label_ROI_13.setGeometry(QtCore.QRect(30, 360, 171, 21))
  329. font = QtGui.QFont()
  330. font.setFamily("Yu Gothic UI")
  331. font.setPointSize(10)
  332. font.setBold(True)
  333. font.setWeight(75)
  334. self.label_ROI_13.setFont(font)
  335. self.label_ROI_13.setStyleSheet("color: rgb(0, 0, 0);")
  336. self.label_ROI_13.setObjectName("label_ROI_13")
  337. self.label_ROI_14 = QtWidgets.QLabel(self.groupBox_cam_mono_7)
  338. self.label_ROI_14.setGeometry(QtCore.QRect(30, 390, 161, 21))
  339. font = QtGui.QFont()
  340. font.setFamily("Yu Gothic UI")
  341. font.setPointSize(10)
  342. font.setBold(True)
  343. font.setWeight(75)
  344. self.label_ROI_14.setFont(font)
  345. self.label_ROI_14.setStyleSheet("color: rgb(0, 0, 0);")
  346. self.label_ROI_14.setObjectName("label_ROI_14")
  347. self.label_vin_vsense = QtWidgets.QLabel(self.groupBox_cam_mono_7)
  348. self.label_vin_vsense.setGeometry(QtCore.QRect(230, 330, 81, 21))
  349. font = QtGui.QFont()
  350. font.setFamily("Yu Gothic UI")
  351. font.setPointSize(10)
  352. self.label_vin_vsense.setFont(font)
  353. self.label_vin_vsense.setStyleSheet("color:rgb(113, 56, 170)")
  354. self.label_vin_vsense.setText("")
  355. self.label_vin_vsense.setObjectName("label_vin_vsense")
  356. self.label_boost_vsense = QtWidgets.QLabel(self.groupBox_cam_mono_7)
  357. self.label_boost_vsense.setGeometry(QtCore.QRect(230, 360, 81, 21))
  358. font = QtGui.QFont()
  359. font.setFamily("Yu Gothic UI")
  360. font.setPointSize(10)
  361. self.label_boost_vsense.setFont(font)
  362. self.label_boost_vsense.setStyleSheet("color:rgb(113, 56, 170)")
  363. self.label_boost_vsense.setText("")
  364. self.label_boost_vsense.setObjectName("label_boost_vsense")
  365. self.label_cap_vsense = QtWidgets.QLabel(self.groupBox_cam_mono_7)
  366. self.label_cap_vsense.setGeometry(QtCore.QRect(230, 390, 81, 21))
  367. font = QtGui.QFont()
  368. font.setFamily("Yu Gothic UI")
  369. font.setPointSize(10)
  370. self.label_cap_vsense.setFont(font)
  371. self.label_cap_vsense.setStyleSheet("color:rgb(113, 56, 170)")
  372. self.label_cap_vsense.setText("")
  373. self.label_cap_vsense.setObjectName("label_cap_vsense")
  374. self.label_ROI_15 = QtWidgets.QLabel(self.groupBox_cam_mono_7)
  375. self.label_ROI_15.setGeometry(QtCore.QRect(330, 330, 21, 21))
  376. font = QtGui.QFont()
  377. font.setFamily("Yu Gothic UI")
  378. font.setPointSize(10)
  379. self.label_ROI_15.setFont(font)
  380. self.label_ROI_15.setStyleSheet("color: rgb(0, 0, 0);")
  381. self.label_ROI_15.setObjectName("label_ROI_15")
  382. self.label_ROI_16 = QtWidgets.QLabel(self.groupBox_cam_mono_7)
  383. self.label_ROI_16.setGeometry(QtCore.QRect(330, 360, 21, 21))
  384. font = QtGui.QFont()
  385. font.setFamily("Yu Gothic UI")
  386. font.setPointSize(10)
  387. self.label_ROI_16.setFont(font)
  388. self.label_ROI_16.setStyleSheet("color: rgb(0, 0, 0);")
  389. self.label_ROI_16.setObjectName("label_ROI_16")
  390. self.label_ROI_17 = QtWidgets.QLabel(self.groupBox_cam_mono_7)
  391. self.label_ROI_17.setGeometry(QtCore.QRect(330, 390, 21, 21))
  392. font = QtGui.QFont()
  393. font.setFamily("Yu Gothic UI")
  394. font.setPointSize(10)
  395. self.label_ROI_17.setFont(font)
  396. self.label_ROI_17.setStyleSheet("color: rgb(0, 0, 0);")
  397. self.label_ROI_17.setObjectName("label_ROI_17")
  398. self.flash_slider = QtWidgets.QSlider(self.groupBox_cam_mono_7)
  399. self.flash_slider.setGeometry(QtCore.QRect(240, 140, 91, 22))
  400. self.flash_slider.setOrientation(QtCore.Qt.Horizontal)
  401. self.flash_slider.setObjectName("flash_slider")
  402. self.label_intensity = QtWidgets.QLabel(self.groupBox_cam_mono_7)
  403. self.label_intensity.setGeometry(QtCore.QRect(350, 140, 71, 21))
  404. font = QtGui.QFont()
  405. font.setFamily("Yu Gothic UI")
  406. font.setPointSize(10)
  407. self.label_intensity.setFont(font)
  408. self.label_intensity.setStyleSheet("color:rgb(113, 56, 170)")
  409. self.label_intensity.setObjectName("label_intensity")
  410. self.label_threshold = QtWidgets.QLabel(self.groupBox_cam_mono_7)
  411. self.label_threshold.setGeometry(QtCore.QRect(350, 190, 71, 21))
  412. font = QtGui.QFont()
  413. font.setFamily("Yu Gothic UI")
  414. font.setPointSize(10)
  415. self.label_threshold.setFont(font)
  416. self.label_threshold.setStyleSheet("color:rgb(113, 56, 170)")
  417. self.label_threshold.setObjectName("label_threshold")
  418. self.photodiode_slider = QtWidgets.QSlider(self.groupBox_cam_mono_7)
  419. self.photodiode_slider.setGeometry(QtCore.QRect(240, 190, 91, 22))
  420. self.photodiode_slider.setOrientation(QtCore.Qt.Horizontal)
  421. self.photodiode_slider.setObjectName("photodiode_slider")
  422. self.groupBox_cam_mono_8 = QtWidgets.QGroupBox(Form)
  423. self.groupBox_cam_mono_8.setGeometry(QtCore.QRect(1400, 10, 411, 301))
  424. font = QtGui.QFont()
  425. font.setFamily("Yu Gothic UI")
  426. font.setPointSize(11)
  427. font.setBold(True)
  428. font.setItalic(False)
  429. font.setWeight(75)
  430. self.groupBox_cam_mono_8.setFont(font)
  431. self.groupBox_cam_mono_8.setStyleSheet("color: rgb(0, 85, 127);")
  432. self.groupBox_cam_mono_8.setObjectName("groupBox_cam_mono_8")
  433. self.label_15 = QtWidgets.QLabel(self.groupBox_cam_mono_8)
  434. self.label_15.setGeometry(QtCore.QRect(300, 950, 311, 31))
  435. self.label_15.setStyleSheet("background-color: rgb(0, 255, 0);")
  436. self.label_15.setAlignment(QtCore.Qt.AlignCenter)
  437. self.label_15.setObjectName("label_15")
  438. self.label_ROI_23 = QtWidgets.QLabel(self.groupBox_cam_mono_8)
  439. self.label_ROI_23.setGeometry(QtCore.QRect(20, 130, 91, 21))
  440. font = QtGui.QFont()
  441. font.setFamily("Yu Gothic UI")
  442. font.setPointSize(10)
  443. self.label_ROI_23.setFont(font)
  444. self.label_ROI_23.setStyleSheet("color: rgb(0, 0, 0);")
  445. self.label_ROI_23.setObjectName("label_ROI_23")
  446. self.label_ROI_24 = QtWidgets.QLabel(self.groupBox_cam_mono_8)
  447. self.label_ROI_24.setGeometry(QtCore.QRect(20, 160, 91, 21))
  448. font = QtGui.QFont()
  449. font.setFamily("Yu Gothic UI")
  450. font.setPointSize(10)
  451. self.label_ROI_24.setFont(font)
  452. self.label_ROI_24.setStyleSheet("color: rgb(0, 0, 0);")
  453. self.label_ROI_24.setObjectName("label_ROI_24")
  454. self.label_hour = QtWidgets.QLabel(self.groupBox_cam_mono_8)
  455. self.label_hour.setGeometry(QtCore.QRect(200, 130, 171, 21))
  456. font = QtGui.QFont()
  457. font.setFamily("Yu Gothic UI")
  458. font.setPointSize(10)
  459. self.label_hour.setFont(font)
  460. self.label_hour.setStyleSheet("color:rgb(113, 56, 170)")
  461. self.label_hour.setObjectName("label_hour")
  462. self.label_date = QtWidgets.QLabel(self.groupBox_cam_mono_8)
  463. self.label_date.setGeometry(QtCore.QRect(200, 160, 171, 21))
  464. font = QtGui.QFont()
  465. font.setFamily("Yu Gothic UI")
  466. font.setPointSize(10)
  467. self.label_date.setFont(font)
  468. self.label_date.setStyleSheet("color:rgb(113, 56, 170)")
  469. self.label_date.setObjectName("label_date")
  470. self.label_ROI_25 = QtWidgets.QLabel(self.groupBox_cam_mono_8)
  471. self.label_ROI_25.setGeometry(QtCore.QRect(20, 200, 91, 31))
  472. font = QtGui.QFont()
  473. font.setFamily("Yu Gothic UI")
  474. font.setPointSize(10)
  475. self.label_ROI_25.setFont(font)
  476. self.label_ROI_25.setStyleSheet("color: rgb(0, 0, 0);")
  477. self.label_ROI_25.setObjectName("label_ROI_25")
  478. self.label_ROI_26 = QtWidgets.QLabel(self.groupBox_cam_mono_8)
  479. self.label_ROI_26.setGeometry(QtCore.QRect(20, 229, 91, 31))
  480. font = QtGui.QFont()
  481. font.setFamily("Yu Gothic UI")
  482. font.setPointSize(10)
  483. self.label_ROI_26.setFont(font)
  484. self.label_ROI_26.setStyleSheet("color: rgb(0, 0, 0);")
  485. self.label_ROI_26.setObjectName("label_ROI_26")
  486. self.label_latitude = QtWidgets.QLabel(self.groupBox_cam_mono_8)
  487. self.label_latitude.setGeometry(QtCore.QRect(200, 200, 171, 31))
  488. font = QtGui.QFont()
  489. font.setFamily("Yu Gothic UI")
  490. font.setPointSize(10)
  491. self.label_latitude.setFont(font)
  492. self.label_latitude.setStyleSheet("color:rgb(113, 56, 170)")
  493. self.label_latitude.setObjectName("label_latitude")
  494. self.label_ROI_29 = QtWidgets.QLabel(self.groupBox_cam_mono_8)
  495. self.label_ROI_29.setGeometry(QtCore.QRect(20, 40, 141, 21))
  496. font = QtGui.QFont()
  497. font.setFamily("Yu Gothic UI")
  498. font.setPointSize(10)
  499. self.label_ROI_29.setFont(font)
  500. self.label_ROI_29.setStyleSheet("color: rgb(0, 0, 0);")
  501. self.label_ROI_29.setObjectName("label_ROI_29")
  502. self.label_ROI_30 = QtWidgets.QLabel(self.groupBox_cam_mono_8)
  503. self.label_ROI_30.setGeometry(QtCore.QRect(20, 70, 141, 21))
  504. font = QtGui.QFont()
  505. font.setFamily("Yu Gothic UI")
  506. font.setPointSize(10)
  507. self.label_ROI_30.setFont(font)
  508. self.label_ROI_30.setStyleSheet("color: rgb(0, 0, 0);")
  509. self.label_ROI_30.setObjectName("label_ROI_30")
  510. self.label_gga_fix = QtWidgets.QLabel(self.groupBox_cam_mono_8)
  511. self.label_gga_fix.setGeometry(QtCore.QRect(200, 40, 81, 21))
  512. font = QtGui.QFont()
  513. font.setFamily("Yu Gothic UI")
  514. font.setPointSize(10)
  515. self.label_gga_fix.setFont(font)
  516. self.label_gga_fix.setStyleSheet("color:rgb(113, 56, 170)")
  517. self.label_gga_fix.setObjectName("label_gga_fix")
  518. self.label_rmc_state = QtWidgets.QLabel(self.groupBox_cam_mono_8)
  519. self.label_rmc_state.setGeometry(QtCore.QRect(200, 70, 81, 21))
  520. font = QtGui.QFont()
  521. font.setFamily("Yu Gothic UI")
  522. font.setPointSize(10)
  523. self.label_rmc_state.setFont(font)
  524. self.label_rmc_state.setStyleSheet("color:rgb(113, 56, 170)")
  525. self.label_rmc_state.setObjectName("label_rmc_state")
  526. self.label_longitude = QtWidgets.QLabel(self.groupBox_cam_mono_8)
  527. self.label_longitude.setGeometry(QtCore.QRect(200, 230, 171, 41))
  528. font = QtGui.QFont()
  529. font.setFamily("Yu Gothic UI")
  530. font.setPointSize(10)
  531. self.label_longitude.setFont(font)
  532. self.label_longitude.setStyleSheet("color:rgb(113, 56, 170)")
  533. self.label_longitude.setObjectName("label_longitude")
  534. self.groupBox_cam_mono_11 = QtWidgets.QGroupBox(Form)
  535. self.groupBox_cam_mono_11.setGeometry(QtCore.QRect(250, 10, 681, 431))
  536. font = QtGui.QFont()
  537. font.setFamily("Yu Gothic UI")
  538. font.setPointSize(11)
  539. font.setBold(True)
  540. font.setItalic(False)
  541. font.setWeight(75)
  542. self.groupBox_cam_mono_11.setFont(font)
  543. self.groupBox_cam_mono_11.setStyleSheet("color: rgb(0, 85, 127);")
  544. self.groupBox_cam_mono_11.setObjectName("groupBox_cam_mono_11")
  545. self.label_19 = QtWidgets.QLabel(self.groupBox_cam_mono_11)
  546. self.label_19.setGeometry(QtCore.QRect(300, 950, 311, 31))
  547. self.label_19.setStyleSheet("background-color: rgb(0, 255, 0);")
  548. self.label_19.setAlignment(QtCore.Qt.AlignCenter)
  549. self.label_19.setObjectName("label_19")
  550. self.button_flash_prog = QtWidgets.QPushButton(self.groupBox_cam_mono_11)
  551. self.button_flash_prog.setGeometry(QtCore.QRect(510, 100, 151, 41))
  552. font = QtGui.QFont()
  553. font.setFamily("Yu Gothic UI")
  554. font.setPointSize(10)
  555. self.button_flash_prog.setFont(font)
  556. self.button_flash_prog.setStyleSheet("color: rgb(0, 0, 0);\n"
  557. "")
  558. self.button_flash_prog.setObjectName("button_flash_prog")
  559. self.scrollArea_shell = QtWidgets.QScrollArea(self.groupBox_cam_mono_11)
  560. self.scrollArea_shell.setGeometry(QtCore.QRect(30, 40, 461, 321))
  561. font = QtGui.QFont()
  562. font.setPointSize(8)
  563. self.scrollArea_shell.setFont(font)
  564. self.scrollArea_shell.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
  565. self.scrollArea_shell.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
  566. self.scrollArea_shell.setWidgetResizable(True)
  567. self.scrollArea_shell.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft)
  568. self.scrollArea_shell.setObjectName("scrollArea_shell")
  569. self.scrollAreaWidgetContents = QtWidgets.QWidget()
  570. self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 438, 319))
  571. self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
  572. self.gridLayout = QtWidgets.QGridLayout(self.scrollAreaWidgetContents)
  573. self.gridLayout.setObjectName("gridLayout")
  574. self.label_shell = QtWidgets.QLabel(self.scrollAreaWidgetContents)
  575. font = QtGui.QFont()
  576. font.setFamily("Courier New")
  577. font.setPointSize(9)
  578. self.label_shell.setFont(font)
  579. self.label_shell.setStyleSheet("color: rgb(255, 255, 255);\n"
  580. "background-color: rgb(0, 0, 0);")
  581. self.label_shell.setText("")
  582. self.label_shell.setObjectName("label_shell")
  583. self.gridLayout.addWidget(self.label_shell, 0, 0, 1, 1)
  584. self.scrollArea_shell.setWidget(self.scrollAreaWidgetContents)
  585. self.progress_bar = QtWidgets.QProgressBar(self.groupBox_cam_mono_11)
  586. self.progress_bar.setGeometry(QtCore.QRect(30, 380, 461, 31))
  587. font = QtGui.QFont()
  588. font.setFamily("Yu Gothic UI")
  589. font.setPointSize(10)
  590. self.progress_bar.setFont(font)
  591. self.progress_bar.setStyleSheet("color: rgb(0, 0, 0);")
  592. self.progress_bar.setProperty("value", 24)
  593. self.progress_bar.setObjectName("progress_bar")
  594. self.button_configurate = QtWidgets.QPushButton(self.groupBox_cam_mono_11)
  595. self.button_configurate.setGeometry(QtCore.QRect(510, 40, 151, 41))
  596. font = QtGui.QFont()
  597. font.setFamily("Yu Gothic UI")
  598. font.setPointSize(10)
  599. self.button_configurate.setFont(font)
  600. self.button_configurate.setStyleSheet("color: rgb(0, 0, 0);\n"
  601. "")
  602. self.button_configurate.setObjectName("button_configurate")
  603. self.button_reset = QtWidgets.QPushButton(self.groupBox_cam_mono_11)
  604. self.button_reset.setGeometry(QtCore.QRect(510, 160, 151, 41))
  605. font = QtGui.QFont()
  606. font.setFamily("Yu Gothic UI")
  607. font.setPointSize(10)
  608. self.button_reset.setFont(font)
  609. self.button_reset.setStyleSheet("color: rgb(0, 0, 0);\n"
  610. "")
  611. self.button_reset.setObjectName("button_reset")
  612. self.label_19.raise_()
  613. self.button_flash_prog.raise_()
  614. self.scrollArea_shell.raise_()
  615. self.progress_bar.raise_()
  616. self.label_shell.raise_()
  617. self.progress_bar.raise_()
  618. self.label_shell.raise_()
  619. self.scrollArea_shell.raise_()
  620. self.progress_bar.raise_()
  621. self.button_configurate.raise_()
  622. self.button_reset.raise_()
  623. self.groupBox_cam_mono_9 = QtWidgets.QGroupBox(Form)
  624. self.groupBox_cam_mono_9.setGeometry(QtCore.QRect(1400, 320, 411, 121))
  625. font = QtGui.QFont()
  626. font.setFamily("Yu Gothic UI")
  627. font.setPointSize(11)
  628. font.setBold(True)
  629. font.setItalic(False)
  630. font.setWeight(75)
  631. self.groupBox_cam_mono_9.setFont(font)
  632. self.groupBox_cam_mono_9.setStyleSheet("color: rgb(0, 85, 127);")
  633. self.groupBox_cam_mono_9.setObjectName("groupBox_cam_mono_9")
  634. self.label_17 = QtWidgets.QLabel(self.groupBox_cam_mono_9)
  635. self.label_17.setGeometry(QtCore.QRect(300, 950, 311, 31))
  636. self.label_17.setStyleSheet("background-color: rgb(0, 255, 0);")
  637. self.label_17.setAlignment(QtCore.Qt.AlignCenter)
  638. self.label_17.setObjectName("label_17")
  639. self.txt_gain = QtWidgets.QTextEdit(self.groupBox_cam_mono_9)
  640. self.txt_gain.setEnabled(True)
  641. self.txt_gain.setGeometry(QtCore.QRect(240, 30, 61, 31))
  642. font = QtGui.QFont()
  643. font.setFamily("Yu Gothic UI")
  644. font.setPointSize(10)
  645. self.txt_gain.setFont(font)
  646. self.txt_gain.setStyleSheet("")
  647. self.txt_gain.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
  648. self.txt_gain.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
  649. self.txt_gain.setObjectName("txt_gain")
  650. self.label_ROI_18 = QtWidgets.QLabel(self.groupBox_cam_mono_9)
  651. self.label_ROI_18.setGeometry(QtCore.QRect(20, 70, 211, 31))
  652. font = QtGui.QFont()
  653. font.setFamily("Yu Gothic UI")
  654. font.setPointSize(10)
  655. font.setBold(True)
  656. font.setWeight(75)
  657. self.label_ROI_18.setFont(font)
  658. self.label_ROI_18.setStyleSheet("color: rgb(0, 0, 0);")
  659. self.label_ROI_18.setObjectName("label_ROI_18")
  660. self.button_set_exposure = QtWidgets.QPushButton(self.groupBox_cam_mono_9)
  661. self.button_set_exposure.setGeometry(QtCore.QRect(320, 70, 51, 31))
  662. font = QtGui.QFont()
  663. font.setFamily("Yu Gothic UI")
  664. font.setPointSize(10)
  665. self.button_set_exposure.setFont(font)
  666. self.button_set_exposure.setStyleSheet("color: rgb(0, 0, 0);\n"
  667. "")
  668. self.button_set_exposure.setObjectName("button_set_exposure")
  669. self.button_set_gain = QtWidgets.QPushButton(self.groupBox_cam_mono_9)
  670. self.button_set_gain.setGeometry(QtCore.QRect(320, 30, 51, 31))
  671. font = QtGui.QFont()
  672. font.setFamily("Yu Gothic UI")
  673. font.setPointSize(10)
  674. self.button_set_gain.setFont(font)
  675. self.button_set_gain.setStyleSheet("color: rgb(0, 0, 0);\n"
  676. "")
  677. self.button_set_gain.setObjectName("button_set_gain")
  678. self.txt_exposure = QtWidgets.QTextEdit(self.groupBox_cam_mono_9)
  679. self.txt_exposure.setEnabled(True)
  680. self.txt_exposure.setGeometry(QtCore.QRect(240, 70, 61, 31))
  681. font = QtGui.QFont()
  682. font.setFamily("Yu Gothic UI")
  683. font.setPointSize(10)
  684. self.txt_exposure.setFont(font)
  685. self.txt_exposure.setStyleSheet("")
  686. self.txt_exposure.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
  687. self.txt_exposure.setObjectName("txt_exposure")
  688. self.label_ROI_19 = QtWidgets.QLabel(self.groupBox_cam_mono_9)
  689. self.label_ROI_19.setGeometry(QtCore.QRect(20, 40, 211, 21))
  690. font = QtGui.QFont()
  691. font.setFamily("Yu Gothic UI")
  692. font.setPointSize(10)
  693. font.setBold(True)
  694. font.setWeight(75)
  695. self.label_ROI_19.setFont(font)
  696. self.label_ROI_19.setStyleSheet("color: rgb(0, 0, 0);")
  697. self.label_ROI_19.setObjectName("label_ROI_19")
  698. self.button_motor_stop = QtWidgets.QPushButton(Form)
  699. self.button_motor_stop.setGeometry(QtCore.QRect(900, 690, 51, 51))
  700. font = QtGui.QFont()
  701. font.setFamily("Yu Gothic UI")
  702. font.setPointSize(10)
  703. font.setBold(True)
  704. font.setWeight(75)
  705. self.button_motor_stop.setFont(font)
  706. self.button_motor_stop.setStyleSheet("color: rgb(0, 0, 0);\n"
  707. "")
  708. self.button_motor_stop.setObjectName("button_motor_stop")
  709. self.button_motor_right = QtWidgets.QPushButton(Form)
  710. self.button_motor_right.setGeometry(QtCore.QRect(960, 690, 51, 51))
  711. font = QtGui.QFont()
  712. font.setFamily("Yu Gothic UI")
  713. font.setPointSize(10)
  714. font.setBold(True)
  715. font.setWeight(75)
  716. self.button_motor_right.setFont(font)
  717. self.button_motor_right.setStyleSheet("color: rgb(0, 0, 0);\n"
  718. "")
  719. self.button_motor_right.setObjectName("button_motor_right")
  720. self.button_motor_left = QtWidgets.QPushButton(Form)
  721. self.button_motor_left.setGeometry(QtCore.QRect(840, 690, 51, 51))
  722. font = QtGui.QFont()
  723. font.setFamily("Yu Gothic UI")
  724. font.setPointSize(10)
  725. font.setBold(True)
  726. font.setWeight(75)
  727. self.button_motor_left.setFont(font)
  728. self.button_motor_left.setStyleSheet("color: rgb(0, 0, 0);\n"
  729. "")
  730. self.button_motor_left.setObjectName("button_motor_left")
  731. self.button_motor_up = QtWidgets.QPushButton(Form)
  732. self.button_motor_up.setGeometry(QtCore.QRect(900, 630, 51, 51))
  733. font = QtGui.QFont()
  734. font.setFamily("Yu Gothic UI")
  735. font.setPointSize(10)
  736. font.setBold(True)
  737. font.setWeight(75)
  738. self.button_motor_up.setFont(font)
  739. self.button_motor_up.setStyleSheet("color: rgb(0, 0, 0);\n"
  740. "")
  741. self.button_motor_up.setObjectName("button_motor_up")
  742. self.button_motor_down = QtWidgets.QPushButton(Form)
  743. self.button_motor_down.setGeometry(QtCore.QRect(900, 750, 51, 51))
  744. font = QtGui.QFont()
  745. font.setFamily("Yu Gothic UI")
  746. font.setPointSize(10)
  747. font.setBold(False)
  748. font.setWeight(50)
  749. self.button_motor_down.setFont(font)
  750. self.button_motor_down.setStyleSheet("color: rgb(0, 0, 0);\n"
  751. "")
  752. self.button_motor_down.setObjectName("button_motor_down")
  753.  
  754. self.retranslateUi(Form)
  755. QtCore.QMetaObject.connectSlotsByName(Form)
  756.  
  757. def retranslateUi(self, Form):
  758. _translate = QtCore.QCoreApplication.translate
  759. Form.setWindowTitle(_translate("Form", "CAM G5 Testbench Tool"))
  760. self.groupBox_cam_mono.setTitle(_translate("Form", "Camera Color videostream"))
  761. self.groupBox_cam_mono_2.setTitle(_translate("Form", "Camera Image Capture"))
  762. self.groupBox_cam_mono_6.setTitle(_translate("Form", "Main Tool"))
  763. self.label_13.setText(_translate("Form", "<html><head/><body><p><span style=\" font-size:10pt; font-weight:600; color:#ffffff;\">SHARPNESS IS OK</span></p></body></html>"))
  764. self.button_capture.setText(_translate("Form", "Capture "))
  765. self.button_videostream.setText(_translate("Form", "Videostream"))
  766. self.label_ROI_3.setText(_translate("Form", "<html><head/><body><p><span style=\" font-weight:600;\">Hostname Camera :</span></p></body></html>"))
  767. self.txt_hostname.setHtml(_translate("Form", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
  768. "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
  769. "p, li { white-space: pre-wrap; }\n"
  770. "</style></head><body style=\" font-family:\'Yu Gothic UI\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
  771. "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p></body></html>"))
  772. self.button_connect.setText(_translate("Form", "Connect"))
  773. self.label_ROI_11.setText(_translate("Form", "<html><head/><body><p><span style=\" font-weight:600;\">Sensor selection :</span></p></body></html>"))
  774. self.radioButton_color.setText(_translate("Form", "Color"))
  775. self.radioButton_bw.setText(_translate("Form", "Black and White"))
  776. self.groupBox_cam_mono_7.setTitle(_translate("Form", "Flash Board Control"))
  777. self.label_14.setText(_translate("Form", "<html><head/><body><p><span style=\" font-size:10pt; font-weight:600; color:#ffffff;\">SHARPNESS IS OK</span></p></body></html>"))
  778. self.label_ROI.setText(_translate("Form", "<html><head/><body><p><span style=\" font-weight:600;\">Flash Intensity :</span></p></body></html>"))
  779. self.label_ROI_2.setText(_translate("Form", "<html><head/><body><p><span style=\" font-weight:600;\">Flash Control :</span></p></body></html>"))
  780. self.button_flash_on.setText(_translate("Form", "On"))
  781. self.button_flash_off.setText(_translate("Form", "Off"))
  782. self.label_ROI_4.setText(_translate("Form", "<html><head/><body><p><span style=\" font-weight:600;\">IR LED Current :</span></p></body></html>"))
  783. self.label_ROI_5.setText(_translate("Form", "<html><head/><body><p><span style=\" font-weight:600;\">IR LED Voltage :</span></p></body></html>"))
  784. self.label_ROI_7.setText(_translate("Form", "<html><head/><body><p>[A]</p></body></html>"))
  785. self.label_ROI_8.setText(_translate("Form", "<html><head/><body><p>[V]</p></body></html>"))
  786. self.label_ROI_10.setText(_translate("Form", "<html><head/><body><p><span style=\" font-weight:600;\">Photodiode threshold :</span></p></body></html>"))
  787. self.button_led_red_off.setText(_translate("Form", "Off"))
  788. self.label_ROI_39.setText(_translate("Form", "<html><head/><body><p><span style=\" font-weight:600;\">LED Red :</span></p></body></html>"))
  789. self.button_led_red_on.setText(_translate("Form", "On"))
  790. self.label_ROI_6.setText(_translate("Form", "<html><head/><body><p><span style=\" font-weight:600;\">Photodiode Voltage :</span></p></body></html>"))
  791. self.label_ROI_9.setText(_translate("Form", "<html><head/><body><p>[V]</p></body></html>"))
  792. self.label_ROI_12.setText(_translate("Form", "Vin Vsense :"))
  793. self.label_ROI_13.setText(_translate("Form", "Boost Vsense :"))
  794. self.label_ROI_14.setText(_translate("Form", "Cap Vsense :"))
  795. self.label_ROI_15.setText(_translate("Form", "<html><head/><body><p>[V]</p></body></html>"))
  796. self.label_ROI_16.setText(_translate("Form", "<html><head/><body><p>[V]</p></body></html>"))
  797. self.label_ROI_17.setText(_translate("Form", "<html><head/><body><p>[V]</p></body></html>"))
  798. self.label_intensity.setText(_translate("Form", "11"))
  799. self.label_threshold.setText(_translate("Form", "11"))
  800. self.groupBox_cam_mono_8.setTitle(_translate("Form", "GPS Management"))
  801. self.label_15.setText(_translate("Form", "<html><head/><body><p><span style=\" font-size:10pt; font-weight:600; color:#ffffff;\">SHARPNESS IS OK</span></p></body></html>"))
  802. self.label_ROI_23.setText(_translate("Form", "<html><head/><body><p><span style=\" font-weight:600;\">UTC Time :</span></p></body></html>"))
  803. self.label_ROI_24.setText(_translate("Form", "<html><head/><body><p><span style=\" font-weight:600;\">Date Time :</span></p></body></html>"))
  804. self.label_hour.setText(_translate("Form", "11"))
  805. self.label_date.setText(_translate("Form", "11"))
  806. self.label_ROI_25.setText(_translate("Form", "<html><head/><body><p><span style=\" font-weight:600;\">Latitude :</span></p></body></html>"))
  807. self.label_ROI_26.setText(_translate("Form", "<html><head/><body><p><span style=\" font-weight:600;\">Longitude :</span></p></body></html>"))
  808. self.label_latitude.setText(_translate("Form", "11.1111111"))
  809. self.label_ROI_29.setText(_translate("Form", "<html><head/><body><p><span style=\" font-weight:600;\">GPS GGA Fix :</span></p></body></html>"))
  810. self.label_ROI_30.setText(_translate("Form", "<html><head/><body><p><span style=\" font-weight:600;\">GPS RMC State :</span></p></body></html>"))
  811. self.label_gga_fix.setText(_translate("Form", "Invalid"))
  812. self.label_rmc_state.setText(_translate("Form", "Invalid"))
  813. self.label_longitude.setText(_translate("Form", "11.1111111"))
  814. self.groupBox_cam_mono_11.setTitle(_translate("Form", "STM32 Reset / Flash"))
  815. self.label_19.setText(_translate("Form", "<html><head/><body><p><span style=\" font-size:10pt; font-weight:600; color:#ffffff;\">SHARPNESS IS OK</span></p></body></html>"))
  816. self.button_flash_prog.setText(_translate("Form", "Flash ยตC"))
  817. self.button_configurate.setText(_translate("Form", "GPIO Config"))
  818. self.button_reset.setText(_translate("Form", "Reset ยตC"))
  819. self.groupBox_cam_mono_9.setTitle(_translate("Form", "Sensor Parameters"))
  820. self.label_17.setText(_translate("Form", "<html><head/><body><p><span style=\" font-size:10pt; font-weight:600; color:#ffffff;\">SHARPNESS IS OK</span></p></body></html>"))
  821. self.txt_gain.setHtml(_translate("Form", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
  822. "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
  823. "p, li { white-space: pre-wrap; }\n"
  824. "</style></head><body style=\" font-family:\'Yu Gothic UI\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
  825. "<p align=\"center\" style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p></body></html>"))
  826. self.label_ROI_18.setText(_translate("Form", "Time Exposure :"))
  827. self.button_set_exposure.setText(_translate("Form", "Set"))
  828. self.button_set_gain.setText(_translate("Form", "Set"))
  829. self.txt_exposure.setHtml(_translate("Form", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
  830. "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
  831. "p, li { white-space: pre-wrap; }\n"
  832. "</style></head><body style=\" font-family:\'Yu Gothic UI\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
  833. "<p align=\"center\" style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p></body></html>"))
  834. self.label_ROI_19.setText(_translate("Form", "Gain :"))
  835. self.button_motor_stop.setText(_translate("Form", "S"))
  836. self.button_motor_right.setText(_translate("Form", ">"))
  837. self.button_motor_left.setText(_translate("Form", "<"))
  838. self.button_motor_up.setText(_translate("Form", "^"))
  839. self.button_motor_down.setText(_translate("Form", "v"))
  840.  
  841.  
  842. # Complement init
  843. self.label_latitude.clear()
  844. self.label_longitude.clear()
  845. self.label_hour.clear()
  846. self.label_gga_fix.clear()
  847. self.label_rmc_state.clear()
  848. self.label_date.clear()
  849. self.label_ir_current.clear()
  850. self.label_ir_voltage.clear()
  851. self.label_photodiode_voltage.clear()
  852.  
  853. #Buttons
  854. self.button_led_red_on.clicked.connect(self.led_red_on)
  855. self.button_led_red_off.clicked.connect(self.led_red_off)
  856. self.button_flash_on.clicked.connect(self.flash_on)
  857. self.button_flash_off.clicked.connect(self.flash_off)
  858. self.button_flash_prog.clicked.connect(self.flash_prog)
  859. self.button_reset.clicked.connect(self.reset_stm32)
  860. self.button_connect.clicked.connect(self.connect_camera)
  861. self.button_configurate.clicked.connect(self.config_gpio)
  862. self.button_capture.clicked.connect(self.cam_capture)
  863. self.button_videostream.clicked.connect(self.videostream)
  864.  
  865. self.button_motor_down.clicked.connect(self.motor_move_down)
  866. self.button_motor_up.clicked.connect(self.motor_move_up)
  867. self.button_motor_left.clicked.connect(self.motor_move_left)
  868. self.button_motor_right.clicked.connect(self.motor_move_right)
  869. self.button_motor_stop.clicked.connect(self.motor_move_stop)
  870.  
  871. self.flash_slider.valueChanged.connect(self.set_flash_intensity)
  872. self.photodiode_slider.valueChanged.connect(self.set_photodiode_threshold)
  873.  
  874. self.flash_intensity = 0
  875. self.threshold = 0
  876. self.server_ok = 0
  877. self.camera_capture = 0
  878. self.ser_flash = ''
  879. self.ser_gps = ''
  880. self.label_intensity.setText("0 %")
  881. self.label_threshold.setText("0 V")
  882.  
  883. self.txt_hostname.setAlignment(QtCore.Qt.AlignCenter)
  884. self.progress_bar.setValue(0)
  885.  
  886. #
  887. # Flash Intensity Setting
  888. #
  889. def set_photodiode_threshold(self):
  890. try :
  891. self.threshold = round(((self.photodiode_slider.value() / 100)*3.3) , 2)
  892. self.label_threshold.setText(str(self.threshold) + " V")
  893. command = "python G5_TestBench/send_serial_flash.py 60 "+str(self.photodiode_slider.value())
  894. self.ssh.exec_command(command)
  895. except :
  896. print("Error Setting Photodiode Threshold !")
  897. pass
  898.  
  899. #
  900. # Flash Intensity Setting
  901. #
  902. def set_flash_intensity(self):
  903. try:
  904. self.flash_intensity = int(self.flash_slider.value())
  905. self.label_intensity.setText(str(self.flash_intensity)+ " %")
  906. command = "python G5_TestBench/send_serial_flash.py 50 "+str(self.flash_intensity)
  907. self.ssh.exec_command(command)
  908. except :
  909. print("Error Setting Flash Intensity !")
  910. pass
  911.  
  912. #
  913. # MOTOR MOVE UP
  914. #
  915. def motor_move_up(self):
  916. try :
  917. self.button_motor_down.setStyleSheet("color: rgb(0, 0, 0);")
  918. self.button_motor_up.setStyleSheet(blue)
  919. self.button_motor_left.setStyleSheet("color: rgb(0, 0, 0);")
  920. self.button_motor_right.setStyleSheet("color: rgb(0, 0, 0);")
  921. self.button_motor_stop.setStyleSheet("color: rgb(0, 0, 0);")
  922.  
  923. self.txt_shell_con = ""
  924. command = "sudo -S -p '' bash G5_TestBench/MOVE_MOTOR_UP"
  925. stdin, stdout, stderr = self.ssh.exec_command(command)
  926. stdin.write('nvidia' + "\n")
  927. stdin.flush()
  928. stdin.close()
  929. out_updt = list()
  930. cnt = 0
  931. for line in iter(lambda: stdout.readline(2048), ""):
  932. cnt = cnt + 1
  933. print(line, end="")
  934. out_updt.append(self.txt_shell_con + " > " + line)
  935. self.progress_bar.setValue(cnt)
  936. self.label_shell.setText("".join(out_updt))
  937. self.label_shell.adjustSize()
  938. self.scrollArea_shell.verticalScrollBar().setValue(
  939. self.scrollArea_shell.verticalScrollBar().maximum())
  940. QtGui.QGuiApplication.processEvents()
  941. if cnt == 100:
  942. cnt = 0
  943. self.progress_bar.setValue(100)
  944. except :
  945. pass
  946.  
  947. #
  948. # MOTOR MOVE DOWN
  949. #
  950. def motor_move_down(self):
  951. try :
  952. self.button_motor_down.setStyleSheet(blue)
  953. self.button_motor_up.setStyleSheet("color: rgb(0, 0, 0);")
  954. self.button_motor_left.setStyleSheet("color: rgb(0, 0, 0);")
  955. self.button_motor_right.setStyleSheet("color: rgb(0, 0, 0);")
  956. self.button_motor_stop.setStyleSheet("color: rgb(0, 0, 0);")
  957.  
  958. self.txt_shell_con = ""
  959. command = "sudo -S -p '' bash G5_TestBench/MOVE_MOTOR_DOWN"
  960. stdin, stdout, stderr = self.ssh.exec_command(command)
  961. stdin.write('nvidia' + "\n")
  962. stdin.flush()
  963. stdin.close()
  964. out_updt = list()
  965. cnt = 0
  966. for line in iter(lambda: stdout.readline(2048), ""):
  967. cnt = cnt + 1
  968. print(line, end="")
  969. out_updt.append(self.txt_shell_con + " > " + line)
  970. self.progress_bar.setValue(cnt)
  971. self.label_shell.setText("".join(out_updt))
  972. self.label_shell.adjustSize()
  973. self.scrollArea_shell.verticalScrollBar().setValue(
  974. self.scrollArea_shell.verticalScrollBar().maximum())
  975. QtGui.QGuiApplication.processEvents()
  976. if cnt == 100:
  977. cnt = 0
  978. self.progress_bar.setValue(100)
  979. except :
  980. pass
  981.  
  982. #
  983. # MOTOR MOVE RIGHT
  984. #
  985. def motor_move_left(self):
  986. try :
  987. self.button_motor_down.setStyleSheet("color: rgb(0, 0, 0);")
  988. self.button_motor_up.setStyleSheet("color: rgb(0, 0, 0);")
  989. self.button_motor_left.setStyleSheet(blue)
  990. self.button_motor_right.setStyleSheet("color: rgb(0, 0, 0);")
  991. self.button_motor_stop.setStyleSheet("color: rgb(0, 0, 0);")
  992.  
  993. self.txt_shell_con = ""
  994. command = "sudo -S -p '' bash G5_TestBench/MOVE_MOTOR_LEFT"
  995. stdin, stdout, stderr = self.ssh.exec_command(command)
  996. stdin.write('nvidia' + "\n")
  997. stdin.flush()
  998. stdin.close()
  999. out_updt = list()
  1000. cnt = 0
  1001. for line in iter(lambda: stdout.readline(2048), ""):
  1002. cnt = cnt + 1
  1003. print(line, end="")
  1004. out_updt.append(self.txt_shell_con + " > " + line)
  1005. self.progress_bar.setValue(cnt)
  1006. self.label_shell.setText("".join(out_updt))
  1007. self.label_shell.adjustSize()
  1008. self.scrollArea_shell.verticalScrollBar().setValue(
  1009. self.scrollArea_shell.verticalScrollBar().maximum())
  1010. QtGui.QGuiApplication.processEvents()
  1011. if cnt == 100:
  1012. cnt = 0
  1013. self.progress_bar.setValue(100)
  1014. except :
  1015. pass
  1016.  
  1017. #
  1018. # MOTOR MOVE RIGHT
  1019. #
  1020. def motor_move_right(self):
  1021. try :
  1022. self.button_motor_down.setStyleSheet("color: rgb(0, 0, 0);")
  1023. self.button_motor_up.setStyleSheet("color: rgb(0, 0, 0);")
  1024. self.button_motor_left.setStyleSheet("color: rgb(0, 0, 0);")
  1025. self.button_motor_right.setStyleSheet(blue)
  1026. self.button_motor_stop.setStyleSheet("color: rgb(0, 0, 0);")
  1027.  
  1028. self.txt_shell_con = ""
  1029. command = "sudo -S -p '' bash G5_TestBench/MOVE_MOTOR_RIGHT"
  1030. stdin, stdout, stderr = self.ssh.exec_command(command)
  1031. stdin.write('nvidia' + "\n")
  1032. stdin.flush()
  1033. stdin.close()
  1034. out_updt = list()
  1035. cnt = 0
  1036. for line in iter(lambda: stdout.readline(2048), ""):
  1037. cnt = cnt + 1
  1038. print(line, end="")
  1039. out_updt.append(self.txt_shell_con + " > " + line)
  1040. self.progress_bar.setValue(cnt)
  1041. self.label_shell.setText("".join(out_updt))
  1042. self.label_shell.adjustSize()
  1043. self.scrollArea_shell.verticalScrollBar().setValue(
  1044. self.scrollArea_shell.verticalScrollBar().maximum())
  1045. QtGui.QGuiApplication.processEvents()
  1046. if cnt == 100:
  1047. cnt = 0
  1048. self.progress_bar.setValue(100)
  1049. except :
  1050. pass
  1051.  
  1052. #
  1053. # MOTOR STOP
  1054. #
  1055. def motor_move_stop(self):
  1056. try :
  1057. self.button_motor_down.setStyleSheet("color: rgb(0, 0, 0);")
  1058. self.button_motor_up.setStyleSheet("color: rgb(0, 0, 0);")
  1059. self.button_motor_left.setStyleSheet("color: rgb(0, 0, 0);")
  1060. self.button_motor_right.setStyleSheet("color: rgb(0, 0, 0);")
  1061. self.button_motor_stop.setStyleSheet(blue)
  1062.  
  1063. self.txt_shell_con = ""
  1064. command = "sudo -S -p '' bash G5_TestBench/STOP_MOTORS"
  1065. stdin, stdout, stderr = self.ssh.exec_command(command)
  1066. stdin.write('nvidia' + "\n")
  1067. stdin.flush()
  1068. stdin.close()
  1069. out_updt = list()
  1070. cnt = 0
  1071. for line in iter(lambda: stdout.readline(2048), ""):
  1072. cnt = cnt + 1
  1073. print(line, end="")
  1074. out_updt.append(self.txt_shell_con + " > " + line)
  1075. self.progress_bar.setValue(cnt)
  1076. self.label_shell.setText("".join(out_updt))
  1077. self.label_shell.adjustSize()
  1078. self.scrollArea_shell.verticalScrollBar().setValue(
  1079. self.scrollArea_shell.verticalScrollBar().maximum())
  1080. QtGui.QGuiApplication.processEvents()
  1081. if cnt == 100:
  1082. cnt = 0
  1083. self.progress_bar.setValue(100)
  1084. except :
  1085. pass
  1086.  
  1087.  
  1088.  
  1089. #
  1090. # LED RED ON
  1091. #
  1092. def led_red_on(self):
  1093. self.button_led_red_on.setStyleSheet(blue)
  1094. self.button_led_red_off.setStyleSheet("color: rgb(0, 0, 0);")
  1095.  
  1096. try :
  1097. self.txt_shell_con = ""
  1098. command = "sudo -S -p '' bash G5_TestBench/LED_RED_ON"
  1099. stdin, stdout, stderr = self.ssh.exec_command(command)
  1100. stdin.write('nvidia' + "\n")
  1101. stdin.flush()
  1102. stdin.close()
  1103. out_updt = list()
  1104. cnt = 0
  1105. for line in iter(lambda: stdout.readline(2048), ""):
  1106. cnt = cnt + 1
  1107. print(line, end="")
  1108. out_updt.append(self.txt_shell_con + " > " + line)
  1109. self.progress_bar.setValue(cnt)
  1110. self.label_shell.setText("".join(out_updt))
  1111. self.label_shell.adjustSize()
  1112. self.scrollArea_shell.verticalScrollBar().setValue(self.scrollArea_shell.verticalScrollBar().maximum())
  1113. QtGui.QGuiApplication.processEvents()
  1114. if cnt == 100:
  1115. cnt = 0
  1116. self.progress_bar.setValue(100)
  1117. except :
  1118. pass
  1119.  
  1120. #
  1121. # LED RED OFF
  1122. #
  1123. def led_red_off(self):
  1124. self.button_led_red_off.setStyleSheet(blue)
  1125. self.button_led_red_on.setStyleSheet("color: rgb(0, 0, 0);")
  1126.  
  1127. try :
  1128. self.txt_shell_con = ""
  1129. command = "sudo -S -p '' bash G5_TestBench/LED_RED_OFF"
  1130. stdin, stdout, stderr = self.ssh.exec_command(command)
  1131. stdin.write('nvidia' + "\n")
  1132. stdin.flush()
  1133. stdin.close()
  1134. out_updt = list()
  1135. cnt = 0
  1136. for line in iter(lambda: stdout.readline(2048), ""):
  1137. cnt = cnt + 1
  1138. print(line, end="")
  1139. out_updt.append(self.txt_shell_con + " > " + line)
  1140. self.progress_bar.setValue(cnt)
  1141. self.label_shell.setText("".join(out_updt))
  1142. self.label_shell.adjustSize()
  1143. self.scrollArea_shell.verticalScrollBar().setValue(self.scrollArea_shell.verticalScrollBar().maximum())
  1144. QtGui.QGuiApplication.processEvents()
  1145. if cnt == 100:
  1146. cnt = 0
  1147. self.progress_bar.setValue(100)
  1148. except :
  1149. pass
  1150.  
  1151. #
  1152. # FLASH ON
  1153. #
  1154. def flash_on(self):
  1155. self.button_flash_on.setStyleSheet(blue)
  1156. self.button_flash_off.setStyleSheet("color: rgb(0, 0, 0);")
  1157. try :
  1158. command = "python G5_TestBench/send_serial_flash.py 30"
  1159. self.ssh.exec_command(command)
  1160. except :
  1161. print("Error Sending Flash ON !")
  1162. pass
  1163.  
  1164. #
  1165. # FLASH OFF
  1166. #
  1167. def flash_off(self):
  1168. self.button_flash_off.setStyleSheet(blue)
  1169. self.button_flash_on.setStyleSheet("color: rgb(0, 0, 0);")
  1170. try :
  1171. command = "python G5_TestBench/send_serial_flash.py 40"
  1172. self.ssh.exec_command(command)
  1173. except :
  1174. print("Error Sending Flash OFF !")
  1175. pass
  1176.  
  1177. #
  1178. # TEST MODE ENABLE
  1179. #
  1180. def test_mode_enable(self):
  1181. try :
  1182. self.txt_shell_con = ""
  1183. except :
  1184. pass
  1185.  
  1186. #
  1187. # TEST MODE DISABLE
  1188. #
  1189. def test_mode_disable(self):
  1190. try :
  1191. self.txt_shell_con = ""
  1192. except :
  1193. pass
  1194.  
  1195. #
  1196. # CAMERA IMAGE CAPTURE
  1197. #
  1198. def cam_capture(self):
  1199. try :
  1200. self.label_cam_capture.show()
  1201. self.camera_capture = 1
  1202. except :
  1203. pass
  1204.  
  1205. #
  1206. # STM32 FLASH PROGRAMMATION
  1207. #
  1208. def flash_prog(self):
  1209. try :
  1210. # GPIO Configuration TX1
  1211. self.txt_shell_con = ""
  1212. command = "sudo -S -p '' bash G5_TestBench/STM32_FLASH"
  1213. stdin, stdout, stderr = self.ssh.exec_command(command)
  1214. stdin.write('nvidia' + "\n")
  1215. stdin.flush()
  1216. stdin.close()
  1217. out_updt = list()
  1218. cnt = 0
  1219. for line in iter(lambda: stdout.readline(2048), ""):
  1220. cnt = cnt + 1
  1221. print(line, end="")
  1222. out_updt.append(self.txt_shell_con + " > " + line)
  1223. self.progress_bar.setValue(cnt)
  1224. self.label_shell.setText("".join(out_updt))
  1225. self.label_shell.adjustSize()
  1226. self.scrollArea_shell.verticalScrollBar().setValue(self.scrollArea_shell.verticalScrollBar().maximum())
  1227. QtGui.QGuiApplication.processEvents()
  1228. if cnt == 100:
  1229. cnt = 0
  1230. self.progress_bar.setValue(100)
  1231. except :
  1232. pass
  1233.  
  1234. #
  1235. # RESET ยตC STM32
  1236. #
  1237. def reset_stm32(self):
  1238. try :
  1239. # Reset STM32
  1240. self.txt_shell_con = ""
  1241. command = "sudo -S -p '' bash G5_TestBench/RESET_STM32"
  1242. stdin, stdout, stderr = self.ssh.exec_command(command)
  1243. stdin.write('nvidia' + "\n")
  1244. stdin.flush()
  1245. out_updt = list()
  1246. cnt = 0
  1247. for line in iter(lambda: stdout.readline(2048), ""):
  1248. cnt = cnt + 1
  1249. print(line, end="")
  1250. out_updt.append(self.txt_shell_con + " > " + line)
  1251.  
  1252. self.progress_bar.setValue(cnt)
  1253. self.label_shell.setText("".join(out_updt))
  1254. self.label_shell.adjustSize()
  1255. self.scrollArea_shell.verticalScrollBar().setValue(self.scrollArea_shell.verticalScrollBar().maximum())
  1256. QtGui.QGuiApplication.processEvents()
  1257. if cnt == 100:
  1258. cnt = 0
  1259. self.progress_bar.setValue(100)
  1260. except :
  1261. pass
  1262.  
  1263. #
  1264. # CAMERA CONNECTION with hostname
  1265. #
  1266. def connect_camera(self):
  1267. try :
  1268. self.ssh = paramiko.SSHClient()
  1269. self.ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  1270. self.hostname = self.txt_hostname.toPlainText()
  1271. self.ipadress = socket.gethostbyname(self.hostname)
  1272. self.ssh.connect(self.ipadress, username='nvidia', password='nvidia', timeout=3)
  1273. self.txt_hostname.setStyleSheet(green)
  1274.  
  1275. print("******************************************************")
  1276. print(" Camera "+self.hostname+" connected ! ")
  1277. print("******************************************************")
  1278. print("")
  1279.  
  1280. self.test_mode_enable()
  1281.  
  1282. # Threading for Serial receive
  1283. self.thread_3_cancelled = False
  1284. self.thread_3 = Thread(target=self.tx1_read_serial)
  1285. self.thread_3.start()
  1286.  
  1287. print("Camera initialised")
  1288. print("")
  1289. except :
  1290. self.txt_hostname.setStyleSheet(red)
  1291. print("******************************************************")
  1292. print(" Camera " + self.hostname + " connection failed ! ")
  1293. print("******************************************************")
  1294. print("")
  1295.  
  1296. #
  1297. # Videostream Threading
  1298. #
  1299. def videostream(self):
  1300. try :
  1301. #self.launch_mjpeg_demo()
  1302. # Threading for streaming
  1303. self.thread_1_cancelled = False
  1304. self.thread_1 = Thread(target=self.start_stream_camera)
  1305. self.thread_1.start()
  1306. except :
  1307. pass
  1308.  
  1309. #
  1310. # Gpio Configuration for Jetson TX1
  1311. #
  1312. def config_gpio(self):
  1313. try :
  1314. # GPIO Configuration TX1
  1315. self.txt_shell_con = ""
  1316. command = "sudo -S -p '' bash G5_TestBench/TX1_GPIO_EXPORT"
  1317. stdin, stdout, stderr = self.ssh.exec_command(command)
  1318. stdin.write('nvidia' + "\n")
  1319. stdin.flush()
  1320. stdin.close()
  1321. out_updt = list()
  1322. cnt = 0
  1323. for line in iter(lambda: stdout.readline(2048), ""):
  1324. cnt = cnt + 1
  1325. print(line, end="")
  1326. out_updt.append(self.txt_shell_con+" > "+line)
  1327.  
  1328. self.progress_bar.setValue(cnt)
  1329. self.label_shell.setText("".join(out_updt))
  1330. self.label_shell.adjustSize()
  1331. self.scrollArea_shell.verticalScrollBar().setValue(self.scrollArea_shell.verticalScrollBar().maximum())
  1332. QtGui.QGuiApplication.processEvents()
  1333. if cnt == 100:
  1334. cnt = 0
  1335. self.progress_bar.setValue(100)
  1336. #self.test_mode_enable()
  1337. except :
  1338. pass
  1339.  
  1340. #
  1341. # Videostream Threading
  1342. #
  1343. def start_stream_camera(self):
  1344. # Check if color or bw sensor is selectionned
  1345. if self.radioButton_color.isChecked():
  1346. print('http://' + self.hostname + ':1340/?action=stream')
  1347. self.stream = urlopen('http://' + self.hostname + ':1340/?action=stream')
  1348. if self.radioButton_bw.isChecked():
  1349. print('http://' + self.hostname + ':1339/?action=stream')
  1350. self.stream = urlopen('http://' + self.hostname + ':1339/?action=stream')
  1351. bytes = b''
  1352. while not self.thread_1_cancelled:
  1353. try:
  1354. bytes += self.stream.read(1024)
  1355. a = bytes.find(b'\xff\xd8')
  1356. b = bytes.find(b'\xff\xd9')
  1357. if a != -1 and b != -1:
  1358. jpg = bytes[a:b + 2]
  1359. bytes = bytes[b + 2:]
  1360. self.img = cv2.imdecode(np.fromstring(jpg, dtype=np.uint8), cv2.IMREAD_COLOR)
  1361. self.displayImage_Stream(self.img , self.label_cam_stream)
  1362. if(self.camera_capture == 1):
  1363. self.displayImage_Stream(self.img, self.label_cam_capture)
  1364. #cv2.imwrite("C:\G5_Tool\G5_Stream_Tool\captures\Capture_Flash"+self.flash_intensity+".jpg", self.img)
  1365. self.camera_capture = 0
  1366. print("Image captured from the camera !")
  1367. self.server_ok = 1
  1368. except:
  1369. print("Thread 1 Crash !")
  1370. self.server_ok = 0
  1371. self.thread_1_cancelled = True
  1372. pass
  1373.  
  1374. #
  1375. # Display Images from Mjpeg streamer
  1376. #
  1377. def displayImage_Stream(self, img, label):
  1378. # COLOR Camera treatment
  1379. qformat = QImage.Format_RGB888
  1380.  
  1381. # Display video streaming
  1382. label.show()
  1383. out_cam_color = QImage(img, img.shape[1], img.shape[0], img.strides[0], qformat)
  1384. out_cam_color = out_cam_color.rgbSwapped()
  1385. label.setPixmap(QPixmap.fromImage(out_cam_color))
  1386. label.setScaledContents(True)
  1387.  
  1388. #
  1389. # Thread 3
  1390. # Serial Reading from TX1 ttyTHS1
  1391. #
  1392. def tx1_read_serial(self):
  1393. print('GPS Management start !')
  1394. print('ADC Management start !')
  1395. self.label_ir_current.show()
  1396. self.label_boost_vsense.show()
  1397. self.label_cap_vsense.show()
  1398. self.label_photodiode_voltage.show()
  1399. self.label_vin_vsense.show()
  1400. self.label_ir_voltage.show()
  1401.  
  1402. while not self.thread_3_cancelled:
  1403. try:
  1404. command = "python G5_TestBench/tx1_read_file.py G5_TestBench/gps_state.txt"
  1405. stdin, stdout, stderr = self.ssh.exec_command(command)
  1406. stdin.close()
  1407. for line in iter(lambda: stdout.readline(2048), ""):
  1408. #print(line, end="")
  1409. self.gps_infos_read(line)
  1410. except ThreadError:
  1411. print("Thread 3 Crash !")
  1412. self.thread_3_cancelled = True
  1413. try:
  1414. command = "python G5_TestBench/tx1_read_file.py G5_TestBench/adc_state.txt"
  1415. stdin, stdout, stderr = self.ssh.exec_command(command)
  1416. stdin.close()
  1417. for line in iter(lambda: stdout.readline(2048), ""):
  1418. #print(line, end="")
  1419. self.adc_infos_read(line)
  1420. except ThreadError:
  1421. print("Thread 3 Crash !")
  1422. self.thread_3_cancelled = True
  1423.  
  1424. #
  1425. # Read and display gps infos
  1426. #
  1427. def gps_infos_read(self, str):
  1428. try :
  1429. gps_info = str.split(';')
  1430. # Protocol [GGA_Fix;RMC_State;Hour;Minute;Seconde;Day;Month;Year;Latitude;Latitude_NS;Longitude;Longitude_EW]
  1431. gps_fix = gps_info[0]
  1432. gps_state = gps_info[1]
  1433. gps_hour = gps_info[2]
  1434. gps_minute = gps_info[3]
  1435. gps_seconde = gps_info[4]
  1436. gps_day = gps_info[5]
  1437. gps_month = gps_info[6]
  1438. gps_year = "20"+gps_info[7]
  1439. gps_latitude = gps_info[8]
  1440. gps_longitude = gps_info[9]
  1441.  
  1442. if (len(gps_hour) == 1):
  1443. gps_hour = "0"+gps_hour
  1444. if (len(gps_minute) == 1):
  1445. gps_minute = "0"+gps_minute
  1446. if (len(gps_seconde) == 1):
  1447. gps_seconde = "0"+gps_seconde
  1448. if (len(gps_day) == 1):
  1449. gps_day = "0"+gps_day
  1450. if (len(gps_year) == 1):
  1451. gps_year = "0"+gps_year
  1452.  
  1453. self.label_gga_fix.setText(gps_fix)
  1454. self.label_rmc_state.setText(gps_state)
  1455.  
  1456. if gps_state == "GPS Active":
  1457. #Month
  1458. gps_month_str = ""
  1459. if (gps_month == "9"): gps_month_str = "September"
  1460. if (gps_month == "10"): gps_month_str = "October"
  1461. if (gps_month == "11"): gps_month_str = "November"
  1462. if (gps_month == "12"): gps_month_str = "December"
  1463. if (gps_month == "1"): gps_month_str = "January"
  1464. if (gps_month == "2"): gps_month_str = "February"
  1465. if (gps_month == "3"): gps_month_str = "March"
  1466. if (gps_month == "4"): gps_month_str = "April"
  1467. if (gps_month == "5"): gps_month_str = "May"
  1468. if (gps_month == "6"): gps_month_str = "June"
  1469. if (gps_month == "7"): gps_month_str = "July"
  1470. if (gps_month == "8"): gps_month_str = "August"
  1471. #Edit Labels on Window Tool
  1472. self.label_hour.setText(gps_hour+" : "+gps_minute+" : "+gps_seconde)
  1473. self.label_date.setText(gps_day+" "+gps_month_str+" "+gps_year)
  1474. self.label_latitude.setText(gps_latitude)
  1475. self.label_longitude.setText(gps_longitude)
  1476. except :
  1477. pass
  1478.  
  1479. #
  1480. # Read and display adc infos
  1481. #
  1482. def adc_infos_read(self, str):
  1483. try :
  1484. adc_info = str.split(';')
  1485. # Protocole [Vin_Vsense ; Boost_Vsense ; Cap_Vsense ; Switch_Imon ; Light_Vsense ; Led_Vsense ; Led_Isense ; Pot_Flash_Duty]
  1486. vin_vsense = adc_info[0]
  1487. boost_vsense = adc_info[1]
  1488. cap_vsense = adc_info[2]
  1489. switch_imon = adc_info[3]
  1490. light_vsense = adc_info[4]
  1491. led_vsense = adc_info[5]
  1492. led_isense = adc_info[6]
  1493. pot_flash_duty = adc_info[7]
  1494.  
  1495. self.label_ir_current.setText(led_isense)
  1496. self.label_boost_vsense.setText(boost_vsense)
  1497. self.label_cap_vsense.setText(cap_vsense)
  1498. self.label_photodiode_voltage.setText(light_vsense)
  1499. self.label_vin_vsense.setText(vin_vsense)
  1500. self.label_ir_voltage.setText(led_vsense)
  1501. except :
  1502. pass
  1503.  
  1504. #
  1505. # close window
  1506. #
  1507. def close_window(self):
  1508. app = QtWidgets.QApplication(sys.argv)
  1509. app.exec_()
  1510. print("")
  1511. print("******************************************")
  1512. print("* *")
  1513. print("* G5_Stream_Tool Closed ! *")
  1514. print("* *")
  1515. print("******************************************")
  1516. print("")
  1517.  
  1518. self.thread_1_cancelled = true
  1519.  
  1520. self.test_mode_disable()
  1521. self.ssh.close()
  1522.  
  1523. #
  1524. # Main prog
  1525. #
  1526. if __name__ == "__main__":
  1527. import sys
  1528. app = QtWidgets.QApplication(sys.argv)
  1529. Form = QtWidgets.QWidget()
  1530. ui = Ui_Form()
  1531. ui.setupUi(Form)
  1532. Form.showMaximized()
  1533. sys.exit(ui.close_window())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement