Skip to content

DN simplify tecan coordinate system #581

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/pylabrobot.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 16 additions & 5 deletions pylabrobot/liquid_handling/backends/tecan/EVO_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
Union,
)

from pylabrobot.liquid_handling.utils import get_tight_single_resource_liquid_op_offsets
from pylabrobot.io.usb import USB
from pylabrobot.liquid_handling.backends.backend import (
LiquidHandlerBackend,
Expand Down Expand Up @@ -288,14 +289,20 @@ async def setup(self):

# Initialize plungers. Assumes wash station assigned at rail 1.
await self.liha.set_z_travel_height([self._z_range] * self.num_channels)
await self.liha.position_absolute_all_axis(45, 1031, 90, [1200] * self.num_channels)
wash = self.deck.get_resource("wash_waste")
wash_offsets = get_tight_single_resource_liquid_op_offsets(wash, self.num_channels)
location = wash.get_absolute_location() + wash.center() + wash_offsets[0]
location.x = int(location.x * 10)
location.y = int((352 - location.y) * 10)
location.z = int(wash.get_size_z() * 10)
await self.liha.position_absolute_all_axis(location.x, location.y,90, [location.z] * self.num_channels)
await self.liha.initialize_plunger(self._bin_use_channels(list(range(self.num_channels))))
await self.liha.position_valve_logical([1] * self.num_channels)
await self.liha.move_plunger_relative([100] * self.num_channels)
await self.liha.position_valve_logical([0] * self.num_channels)
await self.liha.set_end_speed_plunger([1800] * self.num_channels)
await self.liha.move_plunger_relative([-100] * self.num_channels)
await self.liha.position_absolute_all_axis(45, 1031, 90, [self._z_range] * self.num_channels)
await self.liha.position_absolute_all_axis(location.x, location.y, 90, [self._z_range] * self.num_channels)

async def setup_arm(self, module):
try:
Expand Down Expand Up @@ -459,7 +466,7 @@ async def dispense(self, ops: List[SingleChannelDispense], use_channels: List[in
x, _ = self._first_valid(x_positions)
y, yi = self._first_valid(y_positions)
assert x is not None and y is not None
await self.liha.set_z_travel_height(z if z else self._z_range for z in z_positions["travel"])
await self.liha.set_z_travel_height([z if z else self._z_range for z in z_positions["travel"]])
await self.liha.position_absolute_all_axis(
x,
y - yi * ys,
Expand Down Expand Up @@ -487,6 +494,7 @@ async def pick_up_tips(self, ops: List[Pickup], use_channels: List[int]):

# Get positions including offsets
x_positions, y_positions, z_positions = self._liha_positions(ops, use_channels)
z_positions["start"] = [int(op.resource.parent.z_start) for op in ops if op.resource.parent.z_start] # directly get z_position from z_start to avoid tip length issue?

# move channels
ys = int(ops[0].resource.get_absolute_size_y() * 10)
Expand Down Expand Up @@ -678,8 +686,8 @@ def get_z_position(z, z_off, tip_length):

for i, (op, channel) in enumerate(zip(ops, use_channels)):
location = ops[i].resource.get_absolute_location() + op.resource.center()
x_positions[channel] = int((location.x - 100 + op.offset.x) * 10)
y_positions[channel] = int((346.5 - location.y + op.offset.y) * 10) # TODO: verify
x_positions[channel] = int((location.x + op.offset.x) * 10)
y_positions[channel] = int((352 - (location.y + op.offset.y)) * 10) # TODO: verify

par = ops[i].resource.parent
if not isinstance(par, (TecanPlate, TecanTipRack)):
Expand All @@ -692,12 +700,15 @@ def get_z_position(z, z_off, tip_length):
z_positions["start"][channel] = get_z_position(
par.z_start, par.get_absolute_location().z + op.offset.z, tip_length
)
# container.get_absolute_position(z="cavity_bottom") + lld_search_height
z_positions["dispense"][channel] = get_z_position(
par.z_dispense, par.get_absolute_location().z + op.offset.z, tip_length
)
# container.get_absolute_position(z="cavity_bottom") + liquid_height
z_positions["max"][channel] = get_z_position(
par.z_max, par.get_absolute_location().z + op.offset.z, tip_length
)
# container.get_absolute_position(z="cavity_bottom")

return x_positions, y_positions, z_positions

Expand Down
2 changes: 1 addition & 1 deletion pylabrobot/resources/tecan/plate_carriers.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ def MP_4Pos_flat(name: str) -> TecanPlateCarrier:
size_y=380.0,
size_z=6.9,
off_x=11.0,
off_y=51.0,
off_y=23.0,
roma_x=1835,
roma_y=388,
roma_z_safe=946,
Expand Down
6 changes: 3 additions & 3 deletions pylabrobot/resources/tecan/tecan_decks.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,15 @@ def _coordinate_for_rails(self, rails: int, resource: Resource):
raise ValueError(f"Resource {resource} is not a Tecan resource.")

return Coordinate(
(rails - 1) * _RAILS_WIDTH - resource.off_x + 100,
resource.off_y + 345 - resource.get_absolute_size_y(),
130 + (rails - 1) * _RAILS_WIDTH - resource.off_x,
resource.off_y,
0,
) # TODO: verify

def _rails_for_x_coordinate(self, x: float):
"""Convert an x coordinate to a rail identifier."""

return round((x + _RAILS_WIDTH - 101) / _RAILS_WIDTH) + 1
return round((x + _RAILS_WIDTH - 130) / _RAILS_WIDTH) + 1

def summary(self) -> str:
"""Return a summary of the deck."""
Expand Down
12 changes: 6 additions & 6 deletions pylabrobot/resources/tecan/tip_carriers.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,15 @@ def DiTi_3Pos(name: str) -> TecanTipCarrier:
name=name,
size_x=149.0,
size_y=374.0,
size_z=4.5,
off_x=12.0,
off_y=24.7,
size_z=123.2,
off_x=12,
off_y=60,
sites=create_homogeneous_resources(
klass=ResourceHolder,
locations=[
Coordinate(13.3, 70.0, 4.5),
Coordinate(13.3, 170.0, 4.5),
Coordinate(13.3, 270.0, 4.5),
Coordinate(13.3, 13.4, 4.5),
Coordinate(13.3, 113.4, 4.5),
Coordinate(13.3, 213.4, 4.5),
],
Comment on lines -149 to 158
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you measure these? was it wrong before?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I measured these. The y coordinate changed because I am using off_y based on the front of the machine. and the z was not correct. These are hanging tips

resource_size_x=127.0,
resource_size_y=88.5,
Expand Down
2 changes: 1 addition & 1 deletion pylabrobot/resources/tecan/tip_racks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,7 @@ def DiTi_1000ul_LiHa(name: str) -> TecanTipRack:
num_items_x=12,
num_items_y=8,
dx=7.7,
dy=8.7,
dy=7.7,
dz=32.6,
item_dx=9.0,
item_dy=9.0,
Expand Down
8 changes: 4 additions & 4 deletions pylabrobot/resources/tecan/wash.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ def Wash_Station(name: str) -> TecanWashStation:
size_x=25.0,
size_y=390.0,
size_z=0.0,
off_y= -13,
off_x=12.5,
off_y=24.7,
sites=create_resources(
klass=ResourceHolder,
locations=[
Coordinate(12.2, 106.7, 0.0),
Coordinate(11.0, 180.7, 0.0),
Coordinate(12.2, 281.7, 0.0),
Coordinate(12.2, 107, 0.0),
Coordinate(11.0, 181, 0.0),
Coordinate(12.2, 282, 0.0),
],
resource_size_x=[
12.0,
Expand Down
Loading