cfclient 2017.4__py3-none-any.whl → 2025.12.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. cfclient/__init__.py +16 -11
  2. cfclient/configs/config.json +4 -3
  3. cfclient/configs/input/Generic_OS_X.json +1 -0
  4. cfclient/configs/input/Joystick.json +1 -0
  5. cfclient/configs/input/PS3_Mode_1.json +1 -0
  6. cfclient/configs/input/PS3_Mode_2.json +1 -0
  7. cfclient/configs/input/PS3_Mode_3.json +1 -0
  8. cfclient/configs/input/PS4_Mode_1.json +1 -0
  9. cfclient/configs/input/PS4_Mode_2.json +1 -0
  10. cfclient/configs/input/PS4_shoulder_btns_yaw.json +1 -0
  11. cfclient/configs/input/xbox360_mode1.json +1 -0
  12. cfclient/configs/log/PID_tuning/Attitude.json +46 -0
  13. cfclient/configs/log/PID_tuning/Attitude_rate.json +46 -0
  14. cfclient/configs/log/PID_tuning/Position.json +46 -0
  15. cfclient/configs/log/PID_tuning/Velocity.json +46 -0
  16. cfclient/configs/log/PID_tuning_components/Pitch.json +22 -0
  17. cfclient/configs/log/PID_tuning_components/Pitch_rate.json +22 -0
  18. cfclient/configs/log/PID_tuning_components/Position_x.json +22 -0
  19. cfclient/configs/log/PID_tuning_components/Position_y.json +22 -0
  20. cfclient/configs/log/PID_tuning_components/Position_z.json +22 -0
  21. cfclient/configs/log/PID_tuning_components/Roll.json +22 -0
  22. cfclient/configs/log/PID_tuning_components/Roll_rate.json +22 -0
  23. cfclient/configs/log/PID_tuning_components/Velocity_x.json +22 -0
  24. cfclient/configs/log/PID_tuning_components/Velocity_y.json +22 -0
  25. cfclient/configs/log/PID_tuning_components/Velocity_z.json +22 -0
  26. cfclient/configs/log/PID_tuning_components/Yaw.json +22 -0
  27. cfclient/configs/log/PID_tuning_components/Yaw_rate.json +22 -0
  28. cfclient/gui.py +44 -9
  29. cfclient/headless.py +3 -12
  30. cfclient/resources/log_param_doc.json +1 -0
  31. cfclient/ui/connectivity_manager.py +198 -0
  32. cfclient/ui/dialogs/about.py +53 -36
  33. cfclient/ui/dialogs/about.ui +23 -3
  34. cfclient/ui/dialogs/anchor_position_dialog.py +252 -0
  35. cfclient/ui/dialogs/anchor_position_dialog.ui +138 -0
  36. cfclient/ui/dialogs/basestation_mode_dialog.py +185 -0
  37. cfclient/ui/dialogs/basestation_mode_dialog.ui +186 -0
  38. cfclient/ui/dialogs/bootloader.py +448 -85
  39. cfclient/ui/dialogs/bootloader.ui +387 -134
  40. cfclient/ui/dialogs/cf2config.py +4 -4
  41. cfclient/ui/dialogs/cf2config.ui +3 -4
  42. cfclient/ui/dialogs/inputconfigdialogue.py +24 -19
  43. cfclient/ui/dialogs/inputconfigdialogue.ui +53 -30
  44. cfclient/ui/dialogs/lighthouse_bs_geometry_dialog.py +220 -0
  45. cfclient/ui/dialogs/lighthouse_bs_geometry_dialog.ui +110 -0
  46. cfclient/ui/dialogs/lighthouse_system_type_dialog.py +93 -0
  47. cfclient/ui/dialogs/lighthouse_system_type_dialog.ui +121 -0
  48. cfclient/ui/dialogs/logconfigdialogue.py +401 -101
  49. cfclient/ui/dialogs/logconfigdialogue.ui +117 -72
  50. cfclient/ui/icons/bl.webp +0 -0
  51. cfclient/ui/icons/bolt.webp +0 -0
  52. cfclient/ui/icons/cf21.webp +0 -0
  53. cfclient/ui/icons/checkmark_black.png +0 -0
  54. cfclient/ui/icons/checkmark_white.png +0 -0
  55. cfclient/ui/icons/create.png +0 -0
  56. cfclient/ui/icons/delete.png +0 -0
  57. cfclient/ui/icons/flapper.webp +0 -0
  58. cfclient/ui/icons/tag.webp +0 -0
  59. cfclient/ui/main.py +328 -258
  60. cfclient/ui/main.ui +184 -80
  61. cfclient/ui/pluginhelper.py +7 -1
  62. cfclient/ui/pose_logger.py +116 -0
  63. cfclient/ui/tab_toolbox.py +208 -0
  64. cfclient/ui/tabs/ColorLEDTab.py +752 -0
  65. cfclient/ui/tabs/ConsoleTab.py +48 -13
  66. cfclient/ui/{toolboxes → tabs}/CrtpSharkToolbox.py +19 -34
  67. cfclient/ui/tabs/ExampleTab.py +9 -16
  68. cfclient/ui/tabs/FlightTab.py +437 -325
  69. cfclient/ui/tabs/GpsTab.py +14 -20
  70. cfclient/ui/tabs/LEDRingTab.py +277 -0
  71. cfclient/ui/tabs/LogBlockDebugTab.py +20 -27
  72. cfclient/ui/tabs/LogBlockTab.py +35 -35
  73. cfclient/ui/tabs/LogClientTab.py +85 -0
  74. cfclient/ui/tabs/LogTab.py +50 -27
  75. cfclient/ui/tabs/ParamTab.py +443 -57
  76. cfclient/ui/tabs/PlotTab.py +23 -25
  77. cfclient/ui/tabs/TuningTab.py +292 -0
  78. cfclient/ui/tabs/__init__.py +12 -2
  79. cfclient/ui/tabs/colorLEDTab.ui +624 -0
  80. cfclient/ui/tabs/consoleTab.ui +46 -0
  81. cfclient/ui/tabs/flightActionContainer.ui +103 -0
  82. cfclient/ui/tabs/flightTab.ui +724 -237
  83. cfclient/ui/tabs/{ledTab.ui → ledRingTab.ui} +63 -46
  84. cfclient/ui/tabs/lighthouse_tab.py +714 -0
  85. cfclient/ui/tabs/lighthouse_tab.ui +430 -0
  86. cfclient/ui/tabs/locopositioning_tab.py +606 -389
  87. cfclient/ui/tabs/locopositioning_tab.ui +370 -253
  88. cfclient/ui/tabs/logClientTab.ui +52 -0
  89. cfclient/ui/tabs/logTab.ui +1 -1
  90. cfclient/ui/tabs/paramTab.ui +204 -3
  91. cfclient/ui/tabs/tuningTab.ui +773 -0
  92. cfclient/ui/widgets/ai.py +37 -39
  93. cfclient/ui/widgets/hexspinbox.py +16 -10
  94. cfclient/ui/widgets/plotter.ui +39 -47
  95. cfclient/ui/widgets/plotwidget.py +57 -22
  96. cfclient/ui/widgets/super_slider.py +112 -0
  97. cfclient/ui/wizards/__init__.py +0 -0
  98. cfclient/ui/wizards/bslh_1.png +0 -0
  99. cfclient/ui/wizards/bslh_2.png +0 -0
  100. cfclient/ui/wizards/bslh_3.png +0 -0
  101. cfclient/ui/wizards/bslh_4.png +0 -0
  102. cfclient/ui/wizards/bslh_5.png +0 -0
  103. cfclient/ui/wizards/lighthouse_geo_bs_estimation_wizard.py +465 -0
  104. cfclient/utils/config_manager.py +5 -4
  105. cfclient/utils/input/__init__.py +77 -19
  106. cfclient/utils/input/inputinterfaces/wiimote.py +2 -2
  107. cfclient/utils/input/inputreaderinterface.py +17 -7
  108. cfclient/utils/input/inputreaders/__init__.py +17 -0
  109. cfclient/utils/logconfigreader.py +245 -25
  110. cfclient/utils/logdatawriter.py +3 -1
  111. cfclient/utils/periodictimer.py +1 -1
  112. cfclient/utils/ui.py +336 -0
  113. cfclient/utils/zmq_led_driver.py +5 -0
  114. cfclient/utils/zmq_param.py +6 -0
  115. cfclient/version.py +34 -1
  116. cfclient-2025.12.1.dist-info/METADATA +70 -0
  117. cfclient-2025.12.1.dist-info/RECORD +152 -0
  118. {cfclient-2017.4.dist-info → cfclient-2025.12.1.dist-info}/WHEEL +1 -1
  119. {cfclient-2017.4.dist-info → cfclient-2025.12.1.dist-info}/entry_points.txt +0 -1
  120. cfclient-2025.12.1.dist-info/licenses/LICENSE.txt +350 -0
  121. {cfclient-2017.4.dist-info → cfclient-2025.12.1.dist-info}/top_level.txt +1 -0
  122. cfconfig/Makefile +51 -0
  123. cfconfig/configblock.py +111 -0
  124. cfloader/__init__.py +41 -55
  125. cfzmq/__init__.py +22 -14
  126. cfclient/ui/dialogs/cf1config.py +0 -265
  127. cfclient/ui/dialogs/cf1config.ui +0 -260
  128. cfclient/ui/tab.py +0 -96
  129. cfclient/ui/tabs/LEDTab.py +0 -169
  130. cfclient/ui/toolboxes/ConsoleToolbox.py +0 -69
  131. cfclient/ui/toolboxes/DebugDriverToolbox.py +0 -107
  132. cfclient/ui/toolboxes/__init__.py +0 -45
  133. cfclient/ui/toolboxes/consoleToolbox.ui +0 -62
  134. cfclient/ui/toolboxes/debugDriverToolbox.ui +0 -86
  135. cfclient-2017.4.dist-info/DESCRIPTION.rst +0 -3
  136. cfclient-2017.4.dist-info/METADATA +0 -22
  137. cfclient-2017.4.dist-info/RECORD +0 -104
  138. cfclient-2017.4.dist-info/metadata.json +0 -1
  139. /cfclient/{icon-256.png → ui/icons/icon-256.png} +0 -0
  140. /cfclient/ui/{toolboxes → tabs}/crtpSharkToolbox.ui +0 -0
@@ -1,260 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <ui version="4.0">
3
- <class>Form</class>
4
- <widget class="QWidget" name="Form">
5
- <property name="windowModality">
6
- <enum>Qt::ApplicationModal</enum>
7
- </property>
8
- <property name="enabled">
9
- <bool>true</bool>
10
- </property>
11
- <property name="geometry">
12
- <rect>
13
- <x>0</x>
14
- <y>0</y>
15
- <width>825</width>
16
- <height>395</height>
17
- </rect>
18
- </property>
19
- <property name="windowTitle">
20
- <string>Crazyflie 1.0 Config</string>
21
- </property>
22
- <layout class="QGridLayout" name="gridLayout_3">
23
- <item row="0" column="0">
24
- <layout class="QVBoxLayout" name="verticalLayout">
25
- <item>
26
- <widget class="QGroupBox" name="groupBox">
27
- <property name="title">
28
- <string>Crazyflie connection</string>
29
- </property>
30
- <layout class="QVBoxLayout" name="verticalLayout_2">
31
- <item>
32
- <layout class="QHBoxLayout" name="horizontalLayout_2">
33
- <item>
34
- <widget class="QPushButton" name="coldBootButton">
35
- <property name="text">
36
- <string>Initiate bootloader cold boot</string>
37
- </property>
38
- </widget>
39
- </item>
40
- <item>
41
- <widget class="QPushButton" name="pushButton_2">
42
- <property name="enabled">
43
- <bool>false</bool>
44
- </property>
45
- <property name="text">
46
- <string>Restart in bootloader mode</string>
47
- </property>
48
- </widget>
49
- </item>
50
- <item>
51
- <widget class="QPushButton" name="resetButton">
52
- <property name="enabled">
53
- <bool>false</bool>
54
- </property>
55
- <property name="text">
56
- <string>Restart in firmware mode</string>
57
- </property>
58
- </widget>
59
- </item>
60
- <item>
61
- <widget class="QPushButton" name="_cancel_bootloading">
62
- <property name="text">
63
- <string>Cancel bootloading</string>
64
- </property>
65
- </widget>
66
- </item>
67
- <item>
68
- <spacer name="horizontalSpacer">
69
- <property name="orientation">
70
- <enum>Qt::Horizontal</enum>
71
- </property>
72
- <property name="sizeHint" stdset="0">
73
- <size>
74
- <width>40</width>
75
- <height>20</height>
76
- </size>
77
- </property>
78
- </spacer>
79
- </item>
80
- </layout>
81
- </item>
82
- <item>
83
- <widget class="QLabel" name="connectionStatus">
84
- <property name="text">
85
- <string>Status: &lt;b&gt;Not connected&lt;/b&gt;</string>
86
- </property>
87
- </widget>
88
- </item>
89
- </layout>
90
- </widget>
91
- </item>
92
- <item>
93
- <layout class="QGridLayout" name="gridLayout">
94
- <property name="horizontalSpacing">
95
- <number>6</number>
96
- </property>
97
- <item row="0" column="0">
98
- <widget class="QGroupBox" name="configBlockGroup">
99
- <property name="enabled">
100
- <bool>true</bool>
101
- </property>
102
- <property name="title">
103
- <string>Configuration block</string>
104
- </property>
105
- <layout class="QGridLayout" name="gridLayout_2">
106
- <item row="6" column="0">
107
- <widget class="QLabel" name="label_9">
108
- <property name="text">
109
- <string>Radio bandwidth:</string>
110
- </property>
111
- </widget>
112
- </item>
113
- <item row="6" column="2">
114
- <widget class="QComboBox" name="radioSpeed">
115
- <property name="editable">
116
- <bool>false</bool>
117
- </property>
118
- <property name="currentIndex">
119
- <number>0</number>
120
- </property>
121
- <item>
122
- <property name="text">
123
- <string>250 Kbit/s</string>
124
- </property>
125
- </item>
126
- <item>
127
- <property name="text">
128
- <string>1 MBit/s</string>
129
- </property>
130
- </item>
131
- <item>
132
- <property name="text">
133
- <string> 2 MBit/s</string>
134
- </property>
135
- </item>
136
- </widget>
137
- </item>
138
- <item row="1" column="0">
139
- <widget class="QLabel" name="label_4">
140
- <property name="text">
141
- <string>Pitch trim:</string>
142
- </property>
143
- </widget>
144
- </item>
145
- <item row="2" column="0">
146
- <widget class="QLabel" name="label_6">
147
- <property name="text">
148
- <string>Roll trim:</string>
149
- </property>
150
- </widget>
151
- </item>
152
- <item row="8" column="2">
153
- <widget class="QPushButton" name="saveConfigblock">
154
- <property name="enabled">
155
- <bool>false</bool>
156
- </property>
157
- <property name="text">
158
- <string>Program</string>
159
- </property>
160
- </widget>
161
- </item>
162
- <item row="5" column="0">
163
- <widget class="QLabel" name="label_8">
164
- <property name="text">
165
- <string>Radio channel:</string>
166
- </property>
167
- </widget>
168
- </item>
169
- <item row="7" column="0">
170
- <spacer name="verticalSpacer_2">
171
- <property name="orientation">
172
- <enum>Qt::Vertical</enum>
173
- </property>
174
- <property name="sizeHint" stdset="0">
175
- <size>
176
- <width>0</width>
177
- <height>10</height>
178
- </size>
179
- </property>
180
- </spacer>
181
- </item>
182
- <item row="5" column="2">
183
- <widget class="QSpinBox" name="radioChannel">
184
- <property name="prefix">
185
- <string>Ch. </string>
186
- </property>
187
- <property name="maximum">
188
- <number>127</number>
189
- </property>
190
- </widget>
191
- </item>
192
- <item row="9" column="2">
193
- <spacer name="verticalSpacer">
194
- <property name="orientation">
195
- <enum>Qt::Vertical</enum>
196
- </property>
197
- <property name="sizeHint" stdset="0">
198
- <size>
199
- <width>20</width>
200
- <height>40</height>
201
- </size>
202
- </property>
203
- </spacer>
204
- </item>
205
- <item row="1" column="2">
206
- <widget class="QDoubleSpinBox" name="pitchTrim">
207
- <property name="decimals">
208
- <number>1</number>
209
- </property>
210
- <property name="minimum">
211
- <double>-10.000000000000000</double>
212
- </property>
213
- <property name="maximum">
214
- <double>10.000000000000000</double>
215
- </property>
216
- </widget>
217
- </item>
218
- <item row="2" column="2">
219
- <widget class="QDoubleSpinBox" name="rollTrim">
220
- <property name="decimals">
221
- <number>1</number>
222
- </property>
223
- <property name="minimum">
224
- <double>-10.000000000000000</double>
225
- </property>
226
- <property name="maximum">
227
- <double>10.000000000000000</double>
228
- </property>
229
- </widget>
230
- </item>
231
- </layout>
232
- </widget>
233
- </item>
234
- </layout>
235
- </item>
236
- <item>
237
- <layout class="QVBoxLayout" name="verticalLayout_6">
238
- <item>
239
- <widget class="QProgressBar" name="progressBar">
240
- <property name="value">
241
- <number>0</number>
242
- </property>
243
- </widget>
244
- </item>
245
- <item>
246
- <widget class="QLabel" name="statusLabel">
247
- <property name="text">
248
- <string>Status: &lt;b&gt;IDLE&lt;/b&gt;</string>
249
- </property>
250
- </widget>
251
- </item>
252
- </layout>
253
- </item>
254
- </layout>
255
- </item>
256
- </layout>
257
- </widget>
258
- <resources/>
259
- <connections/>
260
- </ui>
cfclient/ui/tab.py DELETED
@@ -1,96 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
- #
4
- # || ____ _ __
5
- # +------+ / __ )(_) /_______________ _____ ___
6
- # | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
7
- # +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
8
- # || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
9
- #
10
- # Copyright (C) 2011-2013 Bitcraze AB
11
- #
12
- # Crazyflie Nano Quadcopter Client
13
- #
14
- # This program is free software; you can redistribute it and/or
15
- # modify it under the terms of the GNU General Public License
16
- # as published by the Free Software Foundation; either version 2
17
- # of the License, or (at your option) any later version.
18
- #
19
- # This program is distributed in the hope that it will be useful,
20
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
21
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
- # GNU General Public License for more details.
23
-
24
- # You should have received a copy of the GNU General Public License along with
25
- # this program; if not, write to the Free Software Foundation, Inc.,
26
- # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27
-
28
- """
29
- Superclass for all tabs that implements common functions.
30
- """
31
-
32
- import logging
33
-
34
- from PyQt5 import QtWidgets
35
- from PyQt5.QtCore import pyqtSlot
36
-
37
- from cfclient.utils.config import Config
38
-
39
- __author__ = 'Bitcraze AB'
40
- __all__ = ['Tab']
41
-
42
- logger = logging.getLogger(__name__)
43
-
44
-
45
- class Tab(QtWidgets.QWidget):
46
- """Superclass for all tabs that implements common functions."""
47
-
48
- def __init__(self):
49
- super(Tab, self).__init__()
50
- self.tabName = "N/A"
51
- self.menuName = "N/A"
52
- self.enabled = True
53
-
54
- @pyqtSlot(bool)
55
- def toggleVisibility(self, checked):
56
- """Show or hide the tab."""
57
- if checked:
58
- self.tabWidget.addTab(self, self.getTabName())
59
- s = ""
60
- try:
61
- s = Config().get("open_tabs")
62
- if (len(s) > 0):
63
- s += ","
64
- except Exception:
65
- logger.warning("Exception while adding tab to config and "
66
- "reading tab config")
67
- # Check this since tabs in config are opened when app is started
68
- if (self.tabName not in s):
69
- s += "%s" % self.tabName
70
- Config().set("open_tabs", str(s))
71
-
72
- if not checked:
73
- self.tabWidget.removeTab(self.tabWidget.indexOf(self))
74
- try:
75
- parts = Config().get("open_tabs").split(",")
76
- except Exception:
77
- logger.warning("Exception while removing tab from config and "
78
- "reading tab config")
79
- parts = []
80
- s = ""
81
- for p in parts:
82
- if (self.tabName != p):
83
- s += "%s," % p
84
- s = s[0:len(s) - 1] # Remove last comma
85
- Config().set("open_tabs", str(s))
86
-
87
- def getMenuName(self):
88
- """Return the name of the tab that will be shown in the menu"""
89
- return self.menuName
90
-
91
- def getTabName(self):
92
- """Return the name of the tab that will be shown in the tab"""
93
- return self.tabName
94
-
95
- def is_visible(self):
96
- return self.tabWidget.currentWidget() == self
@@ -1,169 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
- #
4
- # || ____ _ __
5
- # +------+ / __ )(_) /_______________ _____ ___
6
- # | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
7
- # +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
8
- # || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
9
- #
10
- # Copyright (C) 2011-2013 Bitcraze AB
11
- #
12
- # Crazyflie Nano Quadcopter Client
13
- #
14
- # This program is free software; you can redistribute it and/or
15
- # modify it under the terms of the GNU General Public License
16
- # as published by the Free Software Foundation; either version 2
17
- # of the License, or (at your option) any later version.
18
- #
19
- # This program is distributed in the hope that it will be useful,
20
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
21
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
- # GNU General Public License for more details.
23
-
24
- # You should have received a copy of the GNU General Public License
25
- # along with this program; if not, write to the Free Software
26
- # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
27
- # 02110-1301, USA.
28
-
29
- """
30
- Basic tab to be able to set (and test) colors in the LED-ring.
31
- """
32
-
33
- import logging
34
-
35
- from PyQt5 import QtGui, uic
36
- from PyQt5.QtCore import pyqtSignal
37
-
38
- import cfclient
39
- from cfclient.ui.tab import Tab
40
-
41
- from cflib.crazyflie.mem import MemoryElement
42
-
43
- __author__ = 'Bitcraze AB'
44
- __all__ = ['LEDTab']
45
-
46
- logger = logging.getLogger(__name__)
47
-
48
- led_tab_class = uic.loadUiType(cfclient.module_path +
49
- "/ui/tabs/ledTab.ui")[0]
50
-
51
-
52
- class LEDTab(Tab, led_tab_class):
53
- """Tab for plotting logging data"""
54
-
55
- _connected_signal = pyqtSignal(str)
56
- _disconnected_signal = pyqtSignal(str)
57
-
58
- def __init__(self, tabWidget, helper, *args):
59
- super(LEDTab, self).__init__(*args)
60
- self.setupUi(self)
61
-
62
- self.tabName = "LED"
63
- self.menuName = "LED tab"
64
- self.tabWidget = tabWidget
65
-
66
- self._helper = helper
67
-
68
- # Always wrap callbacks from Crazyflie API though QT Signal/Slots
69
- # to avoid manipulating the UI when rendering it
70
- self._connected_signal.connect(self._connected)
71
- self._disconnected_signal.connect(self._disconnected)
72
-
73
- # Connect the Crazyflie API callbacks to the signals
74
- self._helper.cf.connected.add_callback(
75
- self._connected_signal.emit)
76
-
77
- self._helper.cf.disconnected.add_callback(
78
- self._disconnected_signal.emit)
79
-
80
- self._btns = [self._u1,
81
- self._u2,
82
- self._u3,
83
- self._u4,
84
- self._u5,
85
- self._u6,
86
- self._u7,
87
- self._u8,
88
- self._u9,
89
- self._u10,
90
- self._u11,
91
- self._u12]
92
-
93
- self._intensity = self._intensity_slider.value()
94
-
95
- self._u1.clicked.connect(lambda: self._select(0))
96
- self._u2.clicked.connect(lambda: self._select(1))
97
- self._u3.clicked.connect(lambda: self._select(2))
98
- self._u4.clicked.connect(lambda: self._select(3))
99
- self._u5.clicked.connect(lambda: self._select(4))
100
- self._u6.clicked.connect(lambda: self._select(5))
101
- self._u7.clicked.connect(lambda: self._select(6))
102
- self._u8.clicked.connect(lambda: self._select(7))
103
- self._u9.clicked.connect(lambda: self._select(8))
104
- self._u10.clicked.connect(lambda: self._select(9))
105
- self._u11.clicked.connect(lambda: self._select(10))
106
- self._u12.clicked.connect(lambda: self._select(11))
107
-
108
- self._mem = None
109
-
110
- self._intensity_slider.valueChanged.connect(self._intensity_change)
111
- self._intensity_slider.valueChanged.connect(
112
- self._intensity_spin.setValue)
113
- self._intensity_spin.valueChanged.connect(
114
- self._intensity_slider.setValue)
115
-
116
- def _select(self, nbr):
117
- col = QtGui.QColor() # default to invalid
118
-
119
- if self._mem:
120
- led = self._mem.leds[nbr]
121
- col = QtGui.QColor.fromRgb(led.r, led.g, led.b)
122
-
123
- col = QtGui.QColorDialog.getColor(col)
124
-
125
- if col.isValid() and self._mem:
126
- logger.info(col.red())
127
- self._mem.leds[nbr].set(r=col.red(), g=col.green(), b=col.blue())
128
- self.sender().setStyleSheet("background-color: rgb({},{},{})"
129
- .format(col.red(), col.green(),
130
- col.blue()))
131
- self._write_led_output()
132
-
133
- def _intensity_change(self, value):
134
- self._intensity = value
135
- self._write_led_output()
136
-
137
- def _write_led_output(self):
138
- if self._mem:
139
- for led in self._mem.leds:
140
- led.intensity = self._intensity
141
- self._mem.write_data(self._led_write_done)
142
- else:
143
- logger.info("No LED-ring memory found!")
144
-
145
- def _led_write_done(self, mem, addr):
146
- logger.info("LED write done callback")
147
-
148
- def _connected(self, link_uri):
149
- """Callback when the Crazyflie has been connected"""
150
- mems = self._helper.cf.mem.get_mems(MemoryElement.TYPE_DRIVER_LED)
151
- if len(mems) > 0:
152
- self._mem = mems[0]
153
- logger.info(self._mem)
154
-
155
- if self._mem:
156
- for btn in self._btns:
157
- btn.setEnabled(True)
158
- btn.setStyleSheet("background-color: black")
159
- self._intensity_slider.setEnabled(True)
160
- self._intensity_spin.setEnabled(True)
161
-
162
- def _disconnected(self, link_uri):
163
- """Callback for when the Crazyflie has been disconnected"""
164
- for btn in self._btns:
165
- btn.setEnabled(False)
166
- btn.setStyleSheet("background-color: none")
167
- self._intensity_slider.setEnabled(False)
168
- self._intensity_spin.setEnabled(False)
169
- self._intensity_slider.setValue(100)
@@ -1,69 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
- #
4
- # || ____ _ __
5
- # +------+ / __ )(_) /_______________ _____ ___
6
- # | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
7
- # +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
8
- # || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
9
- #
10
- # Copyright (C) 2011-2013 Bitcraze AB
11
- #
12
- # Crazyflie Nano Quadcopter Client
13
- #
14
- # This program is free software; you can redistribute it and/or
15
- # modify it under the terms of the GNU General Public License
16
- # as published by the Free Software Foundation; either version 2
17
- # of the License, or (at your option) any later version.
18
- #
19
- # This program is distributed in the hope that it will be useful,
20
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
21
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
- # GNU General Public License for more details.
23
- # You should have received a copy of the GNU General Public License along with
24
- # this program; if not, write to the Free Software Foundation, Inc.,
25
- # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26
- """
27
- A detachable toolbox for showing console printouts from the Crazyflie
28
- """
29
- from PyQt5 import QtWidgets
30
- from PyQt5 import uic
31
- from PyQt5.QtCore import pyqtSignal
32
- from PyQt5.QtCore import Qt
33
-
34
- import cfclient
35
-
36
- __author__ = 'Bitcraze AB'
37
- __all__ = ['ConsoleToolbox']
38
-
39
- console_class = uic.loadUiType(
40
- cfclient.module_path + "/ui/toolboxes/consoleToolbox.ui")[0]
41
-
42
-
43
- class ConsoleToolbox(QtWidgets.QWidget, console_class):
44
- """Console toolbox for showing printouts from the Crazyflie"""
45
- update = pyqtSignal(str)
46
-
47
- def __init__(self, helper, *args):
48
- super(ConsoleToolbox, self).__init__(*args)
49
- self.setupUi(self)
50
-
51
- self.update.connect(self.console.insertPlainText)
52
-
53
- self.helper = helper
54
-
55
- def getName(self):
56
- return 'Console'
57
-
58
- def _console_updated(self, data):
59
- self.update.emit(data)
60
-
61
- def enable(self):
62
- self.helper.cf.console.receivedChar.add_callback(self._console_updated)
63
-
64
- def disable(self):
65
- self.helper.cf.console.receivedChar.remove_callback(
66
- self._console_updated)
67
-
68
- def preferedDockArea(self):
69
- return Qt.BottomDockWidgetArea