puda-drivers 0.0.13__py3-none-any.whl → 0.0.15__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.
- puda_drivers/core/__init__.py +1 -2
- puda_drivers/machines/first.py +3 -3
- puda_drivers/move/gcode.py +12 -6
- puda_drivers/transfer/liquid/sartorius/rLine.py +8 -5
- {puda_drivers-0.0.13.dist-info → puda_drivers-0.0.15.dist-info}/METADATA +1 -1
- {puda_drivers-0.0.13.dist-info → puda_drivers-0.0.15.dist-info}/RECORD +8 -8
- {puda_drivers-0.0.13.dist-info → puda_drivers-0.0.15.dist-info}/WHEEL +0 -0
- {puda_drivers-0.0.13.dist-info → puda_drivers-0.0.15.dist-info}/licenses/LICENSE +0 -0
puda_drivers/core/__init__.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
from .serialcontroller import SerialController, list_serial_ports
|
|
2
2
|
from .logging import setup_logging
|
|
3
3
|
from .position import Position
|
|
4
|
-
from .nats_machine_client import NATSMachineClient, ExecutionState
|
|
5
4
|
|
|
6
|
-
__all__ = ["SerialController", "list_serial_ports", "setup_logging", "Position"
|
|
5
|
+
__all__ = ["SerialController", "list_serial_ports", "setup_logging", "Position"]
|
puda_drivers/machines/first.py
CHANGED
|
@@ -159,7 +159,7 @@ class First:
|
|
|
159
159
|
self.camera.disconnect()
|
|
160
160
|
self._logger.info("Machine shutdown complete")
|
|
161
161
|
|
|
162
|
-
def get_position(self) -> Dict[str, float]:
|
|
162
|
+
async def get_position(self) -> Dict[str, float]:
|
|
163
163
|
"""
|
|
164
164
|
Get the current position of the machine. Both QuBot and Sartorius are queried.
|
|
165
165
|
|
|
@@ -168,8 +168,8 @@ class First:
|
|
|
168
168
|
Returns:
|
|
169
169
|
Dictionary containing the current position of the machine and it's components.
|
|
170
170
|
"""
|
|
171
|
-
qubot_position = self.qubot.get_position()
|
|
172
|
-
sartorius_position = self.pipette.get_position()
|
|
171
|
+
qubot_position = await self.qubot.get_position()
|
|
172
|
+
sartorius_position = await self.pipette.get_position()
|
|
173
173
|
|
|
174
174
|
return {
|
|
175
175
|
"qubot": qubot_position.to_dict(),
|
puda_drivers/move/gcode.py
CHANGED
|
@@ -7,9 +7,9 @@ absolute coordinates, with relative moves converted to absolute internally.
|
|
|
7
7
|
Supports homing and position synchronization.
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
|
-
import time
|
|
11
10
|
import re
|
|
12
11
|
import logging
|
|
12
|
+
import asyncio
|
|
13
13
|
from dataclasses import dataclass
|
|
14
14
|
from typing import Optional, Dict, Tuple, Union
|
|
15
15
|
|
|
@@ -508,9 +508,12 @@ class GCodeController(SerialController):
|
|
|
508
508
|
|
|
509
509
|
return self._current_position
|
|
510
510
|
|
|
511
|
-
def get_position(self) -> Position:
|
|
511
|
+
async def get_position(self) -> Position:
|
|
512
512
|
"""
|
|
513
|
-
Get the current machine position (M114 command).
|
|
513
|
+
Get the current machine position (M114 command) asynchronously.
|
|
514
|
+
|
|
515
|
+
This method can be called even when the machine is moving from other commands,
|
|
516
|
+
as it runs the blocking serial communication in a separate thread.
|
|
514
517
|
|
|
515
518
|
Returns:
|
|
516
519
|
Position containing X, Y, Z, and A positions
|
|
@@ -519,7 +522,8 @@ class GCodeController(SerialController):
|
|
|
519
522
|
Returns an empty Position if the query fails or no positions are found.
|
|
520
523
|
"""
|
|
521
524
|
self._logger.info("Querying current machine position (M114).")
|
|
522
|
-
|
|
525
|
+
# Run the blocking execute call in a thread pool to allow concurrent operations
|
|
526
|
+
res: str = await asyncio.to_thread(self.execute, "M114")
|
|
523
527
|
|
|
524
528
|
# Extract position values using regex
|
|
525
529
|
pattern = re.compile(r"([XYZA]):(-?\d+\.\d+)")
|
|
@@ -556,11 +560,13 @@ class GCodeController(SerialController):
|
|
|
556
560
|
|
|
557
561
|
Note:
|
|
558
562
|
This method may recursively call itself if a correction move is made.
|
|
563
|
+
Since this method calls move_absolute (which is blocking), it remains
|
|
564
|
+
synchronous. The async get_position() is called using asyncio.run().
|
|
559
565
|
"""
|
|
560
566
|
self._logger.info("Starting position synchronization check (M114).")
|
|
561
567
|
|
|
562
|
-
# Query the actual machine position
|
|
563
|
-
queried_position = self.get_position()
|
|
568
|
+
# Query the actual machine position (async method called from sync context)
|
|
569
|
+
queried_position = asyncio.run(self.get_position())
|
|
564
570
|
|
|
565
571
|
if not queried_position.get_axes():
|
|
566
572
|
self._logger.error("Query position failed. Cannot synchronize.")
|
|
@@ -9,14 +9,13 @@ Reference: https://api.sartorius.com/document-hub/dam/download/34901/Sartorius-r
|
|
|
9
9
|
|
|
10
10
|
import json
|
|
11
11
|
import logging
|
|
12
|
+
import asyncio
|
|
12
13
|
from typing import Optional
|
|
13
14
|
from puda_drivers.core.serialcontroller import SerialController
|
|
14
15
|
from .constants import STATUS_CODES
|
|
15
16
|
|
|
16
17
|
class SartoriusDeviceError(Exception):
|
|
17
18
|
"""Custom exception raised when the Sartorius device reports an error."""
|
|
18
|
-
|
|
19
|
-
pass
|
|
20
19
|
|
|
21
20
|
class SartoriusController(SerialController):
|
|
22
21
|
"""
|
|
@@ -372,15 +371,19 @@ class SartoriusController(SerialController):
|
|
|
372
371
|
|
|
373
372
|
return json.dumps(status_data)
|
|
374
373
|
|
|
375
|
-
def get_position(self) -> int:
|
|
374
|
+
async def get_position(self) -> int:
|
|
376
375
|
"""
|
|
377
|
-
Query the current position of the pipette (DP command).
|
|
376
|
+
Query the current position of the pipette (DP command) asynchronously.
|
|
377
|
+
|
|
378
|
+
This method can be called even when the pipette is performing other operations,
|
|
379
|
+
as it runs the blocking serial communication in a separate thread.
|
|
378
380
|
|
|
379
381
|
Returns:
|
|
380
382
|
Current position in steps
|
|
381
383
|
"""
|
|
382
384
|
self._logger.info("** Querying Position (DP) **")
|
|
383
|
-
|
|
385
|
+
# Run the blocking execute call in a thread pool to allow concurrent operations
|
|
386
|
+
response = await asyncio.to_thread(self.execute, command="DP")
|
|
384
387
|
self._logger.info("** Position: %s steps **\n", response)
|
|
385
388
|
return response
|
|
386
389
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: puda-drivers
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.15
|
|
4
4
|
Summary: Hardware drivers for the PUDA platform.
|
|
5
5
|
Project-URL: Homepage, https://github.com/zhao-bears/puda-drivers
|
|
6
6
|
Project-URL: Issues, https://github.com/zhao-bears/puda-drivers/issues
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
puda_drivers/__init__.py,sha256=rcF5xCkMgyLlJLN3gWwJnUoW0ShPyISeyENvaqwg4Ik,503
|
|
2
2
|
puda_drivers/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
puda_drivers/core/__init__.py,sha256=
|
|
3
|
+
puda_drivers/core/__init__.py,sha256=XbCdXsU6NMDsmEAtavAGiSZZPla5d7zc2L7Qx9qKHdY,214
|
|
4
4
|
puda_drivers/core/logging.py,sha256=prOeJ3CGEbm37TtMRyAOTQQiMU5_ImZTRXmcUJxkenc,2892
|
|
5
5
|
puda_drivers/core/position.py,sha256=f4efmDSrKKCtqrR-GUJxVitPG20MiuGSDOWt-9TVISk,12628
|
|
6
6
|
puda_drivers/core/serialcontroller.py,sha256=38mKas1iJaOkAE0_V4tmqgZz7RxMMEWfGqA0Ma_Dt2A,8604
|
|
@@ -12,18 +12,18 @@ puda_drivers/labware/opentrons_96_tiprack_300ul.json,sha256=jmNaworu688GEgFdxMxN
|
|
|
12
12
|
puda_drivers/labware/polyelectric_8_wellplate_30000ul.json,sha256=esu2tej0ORs7Pfd4HwoQVUpU5mPvp2AYzE3zsCC2FDk,3104
|
|
13
13
|
puda_drivers/labware/trash_bin.json,sha256=Hk4MXO48P28jG7F87DUd9Ja4c_P7kAy3karPQ965i9Y,580
|
|
14
14
|
puda_drivers/machines/__init__.py,sha256=zmIk_r2T8nbPA68h3Cko8N6oL7ncoBpmvhNcAqzHmc4,45
|
|
15
|
-
puda_drivers/machines/first.py,sha256=
|
|
15
|
+
puda_drivers/machines/first.py,sha256=cqK8Gwk89nTweVTImhHU1RimtvDn4En36qV_ZanMGIU,19701
|
|
16
16
|
puda_drivers/move/__init__.py,sha256=NKIKckcqgyviPM0EGFcmIoaqkJM4qekR4babfdddRzM,96
|
|
17
17
|
puda_drivers/move/deck.py,sha256=yq2B4WMqj0hQvHt8HoJskP10u1DUyKwUnjP2c9gJ174,1397
|
|
18
|
-
puda_drivers/move/gcode.py,sha256=
|
|
18
|
+
puda_drivers/move/gcode.py,sha256=GNbFkGgXcr0vBXXWbM96aRkkdQsTiqLCA56V-z3ebYs,23102
|
|
19
19
|
puda_drivers/move/grbl/__init__.py,sha256=vBeeti8DVN2dACi1rLmHN_UGIOdo0s-HZX6mIepLV5I,98
|
|
20
20
|
puda_drivers/move/grbl/api.py,sha256=loj8_Vap7S9qaD0ReHhgxr9Vkl6Wp7DGzyLkZyZ6v_k,16995
|
|
21
21
|
puda_drivers/move/grbl/constants.py,sha256=4736CRDzLGWVqGscLajMlrIQMyubsHfthXi4RF1CHNg,9585
|
|
22
22
|
puda_drivers/transfer/liquid/sartorius/__init__.py,sha256=7fljIbu0KkumsI3NI3O64dl6JkMAQDG5-uGqPefDI7M,97
|
|
23
23
|
puda_drivers/transfer/liquid/sartorius/api.py,sha256=jxwIJmY2k1K2ts6NC2ZgFTe4MOiH8TGnJeqYOqNa3rE,28250
|
|
24
24
|
puda_drivers/transfer/liquid/sartorius/constants.py,sha256=mcsjLrVBH-RSodH-pszstwcEL9wwbV0vOgHbGNxZz9w,2770
|
|
25
|
-
puda_drivers/transfer/liquid/sartorius/rLine.py,sha256=
|
|
26
|
-
puda_drivers-0.0.
|
|
27
|
-
puda_drivers-0.0.
|
|
28
|
-
puda_drivers-0.0.
|
|
29
|
-
puda_drivers-0.0.
|
|
25
|
+
puda_drivers/transfer/liquid/sartorius/rLine.py,sha256=FWEFO9tZN3cbneiozXRs77O-47Jg_8vYzWJvUrWpYxA,14531
|
|
26
|
+
puda_drivers-0.0.15.dist-info/METADATA,sha256=CBB25oLMTKaHkRqnPsrr80dDLenQxKa_OQoZo0GTSno,7102
|
|
27
|
+
puda_drivers-0.0.15.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
28
|
+
puda_drivers-0.0.15.dist-info/licenses/LICENSE,sha256=7EI8xVBu6h_7_JlVw-yPhhOZlpY9hP8wal7kHtqKT_E,1074
|
|
29
|
+
puda_drivers-0.0.15.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|