moteus 0.3.73__py3-none-any.whl → 0.3.74__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.
- moteus/export.py +3 -1
- moteus/multiplex.py +68 -0
- moteus/version.py +1 -1
- {moteus-0.3.73.dist-info → moteus-0.3.74.dist-info}/METADATA +1 -1
- {moteus-0.3.73.dist-info → moteus-0.3.74.dist-info}/RECORD +8 -8
- {moteus-0.3.73.dist-info → moteus-0.3.74.dist-info}/WHEEL +0 -0
- {moteus-0.3.73.dist-info → moteus-0.3.74.dist-info}/entry_points.txt +0 -0
- {moteus-0.3.73.dist-info → moteus-0.3.74.dist-info}/top_level.txt +0 -0
moteus/export.py
CHANGED
@@ -25,6 +25,7 @@ ALL = [
|
|
25
25
|
'TRANSPORT_FACTORIES',
|
26
26
|
'INT8', 'INT16', 'INT32', 'F32', 'IGNORE',
|
27
27
|
'reader',
|
28
|
+
'RegisterParser', 'QueryParser',
|
28
29
|
]
|
29
30
|
from moteus.command import Command
|
30
31
|
from moteus.fdcanusb import Fdcanusb
|
@@ -36,7 +37,8 @@ from moteus.moteus import (
|
|
36
37
|
Controller, Register, Mode, QueryResolution, PositionResolution, Stream,
|
37
38
|
make_transport_args, get_singleton_transport,
|
38
39
|
TRANSPORT_FACTORIES)
|
39
|
-
from moteus.multiplex import (INT8, INT16, INT32, F32, IGNORE
|
40
|
+
from moteus.multiplex import (INT8, INT16, INT32, F32, IGNORE,
|
41
|
+
RegisterParser, QueryParser)
|
40
42
|
import moteus.reader as reader
|
41
43
|
import moteus.aiostream as aiostream
|
42
44
|
|
moteus/multiplex.py
CHANGED
@@ -238,6 +238,74 @@ class RegisterParser:
|
|
238
238
|
return int(self.read(resolution))
|
239
239
|
|
240
240
|
|
241
|
+
class QueryParser:
|
242
|
+
'''Parse a query to see what fields will be queried and at what
|
243
|
+
resolution.'''
|
244
|
+
|
245
|
+
def __init__(self, data):
|
246
|
+
self.data = data
|
247
|
+
self.size = len(data)
|
248
|
+
self._offset = 0
|
249
|
+
self._remaining = 0
|
250
|
+
self._current_register = 0
|
251
|
+
self._current_resolution = INT8
|
252
|
+
|
253
|
+
@staticmethod
|
254
|
+
def parse(data):
|
255
|
+
qp = QueryParser(data)
|
256
|
+
return [x for x in qp]
|
257
|
+
|
258
|
+
def __iter__(self):
|
259
|
+
return self
|
260
|
+
|
261
|
+
def __next__(self):
|
262
|
+
if self._remaining:
|
263
|
+
self._remaining -= 1
|
264
|
+
this_register = self._current_register
|
265
|
+
self._current_register += 1
|
266
|
+
|
267
|
+
return this_register, self._current_resolution
|
268
|
+
|
269
|
+
if self._offset >= self.size:
|
270
|
+
raise StopIteration()
|
271
|
+
|
272
|
+
while self._offset < self.size:
|
273
|
+
cmd = self.data[self._offset]
|
274
|
+
self._offset += 1
|
275
|
+
|
276
|
+
if cmd == NOP:
|
277
|
+
continue
|
278
|
+
|
279
|
+
if cmd >= 0x10 and cmd < 0x20:
|
280
|
+
resolution = (cmd >> 2) & 0x03
|
281
|
+
self._current_resolution = resolution
|
282
|
+
|
283
|
+
count = cmd & 0x03
|
284
|
+
|
285
|
+
if count == 0 and self._offset >= self.size:
|
286
|
+
# This is malformed.
|
287
|
+
raise RuntimeError("malformed query")
|
288
|
+
|
289
|
+
if count == 0:
|
290
|
+
count = self.data[self._offset]
|
291
|
+
self._offset += 1
|
292
|
+
|
293
|
+
if count == 0:
|
294
|
+
# Empty, guess we can ignore.
|
295
|
+
continue
|
296
|
+
|
297
|
+
maybe_current_register, self._offset = read_varuint(self._offset, self.data)
|
298
|
+
if maybe_current_register is None:
|
299
|
+
raise RuntimeError("malformed query")
|
300
|
+
|
301
|
+
self._current_register = maybe_current_register
|
302
|
+
self._remaining = count - 1
|
303
|
+
|
304
|
+
result_register = self._current_register
|
305
|
+
self._current_register += 1
|
306
|
+
return result_register, self._current_resolution
|
307
|
+
|
308
|
+
|
241
309
|
class WriteFrame:
|
242
310
|
"""Provides helper methods for writing structured data into a byte
|
243
311
|
buffer."""
|
moteus/version.py
CHANGED
@@ -3,21 +3,21 @@ moteus/aioserial.py,sha256=GeWuvsZKCRrfBN33JZFjtBXPr-0sKpQv9shRn2ulcDA,1079
|
|
3
3
|
moteus/aiostream.py,sha256=YAkVF6QWsA49vqO-GgXEohDghqm_-nnajJzhO_Q9qNQ,3696
|
4
4
|
moteus/calibrate_encoder.py,sha256=R3gWoKY-ikYlXViiCrhX_0BH7Ahx3T7zvDjX47go-Wc,15167
|
5
5
|
moteus/command.py,sha256=UkOsbtkso6Oyex8CfbpAKpBNriik519ymxL86EZGkRs,1169
|
6
|
-
moteus/export.py,sha256=
|
6
|
+
moteus/export.py,sha256=XitBUuf4MDRIneXQSUptizIhZi2BdHyFO2Vo_2d2CFI,1742
|
7
7
|
moteus/fdcanusb.py,sha256=7PrQiCTROY96gdT2zSZYU1bOCriw-I7H6NspaZpiEx4,7431
|
8
8
|
moteus/moteus.py,sha256=vImSRBn6VEmoijD6hvrSRVxuv1_xVaEJU3F_3Wi6GiE,52498
|
9
9
|
moteus/moteus_tool.py,sha256=ALwXiDWVwiAx9yJu0o-2eKd47wyKH5mRPq264mZrn5E,79662
|
10
|
-
moteus/multiplex.py,sha256=
|
10
|
+
moteus/multiplex.py,sha256=2tdNX5JSh21TOjN6N9LKribLQtVYyyYbXjzwXB64sfA,12119
|
11
11
|
moteus/posix_aioserial.py,sha256=2oDrw8TBEwuEQjY41g9rHeuFeffcPHqMwNS3nf5NVq8,3137
|
12
12
|
moteus/pythoncan.py,sha256=ofotOrDuaFhTLvaokaO3EJK6quVc75Bq-ue70lDMtXI,4071
|
13
13
|
moteus/reader.py,sha256=9i1-h4aGd4syfqtWJcpg70Bl-bmunkGU4FmXmOLyRt8,12121
|
14
14
|
moteus/regression.py,sha256=M5gjDBYJQ64iBXIrvBhMkD8TYhtlnQ85x8U4py0niGA,1196
|
15
15
|
moteus/router.py,sha256=501W5GZ12rFoc1lmcH3S7IYsoc-Q_-FJ4B3i37RzE3Q,2061
|
16
16
|
moteus/transport.py,sha256=WhkW2G9i25lkOlO55eI5_oXmU0PhDmxTeJ75Sg_7nTI,1021
|
17
|
-
moteus/version.py,sha256=
|
17
|
+
moteus/version.py,sha256=MMbaYQfVxvrukU0ch2BvAhEZVKvp8YZb3oeBDxmoSS4,627
|
18
18
|
moteus/win32_aioserial.py,sha256=culdl-vYxBKD5n2s5LkIMGyUaHyCcEc8BL5-DWEaxX8,2025
|
19
|
-
moteus-0.3.
|
20
|
-
moteus-0.3.
|
21
|
-
moteus-0.3.
|
22
|
-
moteus-0.3.
|
23
|
-
moteus-0.3.
|
19
|
+
moteus-0.3.74.dist-info/METADATA,sha256=bjSDdr78BY_7wBiA4jAX05LQD4J5OUITbbWkm-jL8YE,3490
|
20
|
+
moteus-0.3.74.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
|
21
|
+
moteus-0.3.74.dist-info/entry_points.txt,sha256=indCsEML1fmtWJU1WiV-d7UmmTaAMhyBLEc1iiKnexQ,57
|
22
|
+
moteus-0.3.74.dist-info/top_level.txt,sha256=aZzmI_yecTaDrdSp29pTJuowaSQ9dlIZheQpshGg4YQ,7
|
23
|
+
moteus-0.3.74.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|