Skip to content

Commit 899eaa4

Browse files
authored
slow iswap context manager (#397)
1 parent 59e760a commit 899eaa4

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

docs/user_guide/hamilton-star/iswap-module.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@
22

33
The `R0` module allows fine grained control of the iSWAP gripper.
44

5+
## Common tasks
6+
7+
- Parking
8+
9+
You can park the iSWAP using {meth}`~pylabrobot.liquid_handling.backends.hamilton.STAR.STAR.park_iswap`.
10+
11+
```python
12+
await lh.backend.park_iswap()
13+
```
14+
15+
- Opening gripper:
16+
17+
You can open the iSWAP gripper using {meth}`~pylabrobot.liquid_handling.backends.hamilton.STAR.STAR.iswap_open_gripper`. Warning: this will release any object that is gripped. Used for error recovery.
18+
19+
```python
20+
await lh.backend.iswap_open_gripper()
21+
```
22+
523
## Rotations
624

725
You can rotate the iSWAP to 12 predifined positions using {meth}`~pylabrobot.liquid_handling.backends.hamilton.STAR.STAR.iswap_rotate`.
@@ -20,3 +38,12 @@ wrist_drive = random.choice([STAR.WristOrientation.LEFT, STAR.WristOrientation.R
2038
await lh.backend.rotate_iswap_rotation_drive(rotation_drive)
2139
await lh.backend.rotate_iswap_wrist(wrist_drive)
2240
```
41+
42+
## Slow movement
43+
44+
You can make the iswap move more slowly during sensitive operations using {meth}`~pylabrobot.liquid_handling.backends.hamilton.STAR.STAR.slow_iswap`. This is useful when you want to avoid splashing or other disturbances.
45+
46+
```python
47+
async with lh.backend.slow_iswap():
48+
await lh.move_plate(plate, plt_car[1])
49+
```

pylabrobot/liquid_handling/backends/hamilton/STAR.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import logging
55
import re
66
from abc import ABCMeta
7+
from contextlib import asynccontextmanager
78
from typing import (
89
Callable,
910
Dict,
@@ -7811,6 +7812,23 @@ async def request_volume_in_tip(self, channel: int) -> float:
78117812
_, current_volume = resp["qc"] # first is max volume
78127813
return float(current_volume) / 10
78137814

7815+
@asynccontextmanager
7816+
async def slow_iswap(self, wrist_velocity: int = 20_000, gripper_velocity: int = 20_000):
7817+
"""A context manager that sets the iSWAP to slow speed during the context"""
7818+
assert 20 <= gripper_velocity <= 75_000
7819+
assert 20 <= wrist_velocity <= 65_000
7820+
7821+
original_wv = (await self.send_command("R0", "RA", ra="wv", fmt="wv#####"))["wv"]
7822+
original_tv = (await self.send_command("R0", "RA", ra="tv", fmt="tv#####"))["tv"]
7823+
7824+
await self.send_command("R0", "AA", wv=gripper_velocity) # wrist velocity
7825+
await self.send_command("R0", "AA", tv=wrist_velocity) # gripper velocity
7826+
try:
7827+
yield
7828+
finally:
7829+
await self.send_command("R0", "AA", wv=original_wv)
7830+
await self.send_command("R0", "AA", tv=original_tv)
7831+
78147832

78157833
class UnSafe:
78167834
"""

0 commit comments

Comments
 (0)