Skip to content
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

fix(api): Automatic tip tracking index out of range fix #15135

Merged

Conversation

CaseyBatten
Copy link
Contributor

@CaseyBatten CaseyBatten commented May 8, 2024

Overview

Addresses RQA-2700

Automatic tip tracking when iterating through multiple tip racks did not take into account progression range across those tipracks resulting in the potential for an index out of range error to manifest under certain conditions. These changes seek to fix that.

Test Plan

Ensure that API 2.18 protocols consume tipracks without encountering an index out of range error manifesting as an out of tips error when iterating through multiple tipracks using tip-cluster based automatic tip tracking. Protocols such as the one below should execute without issue.

from opentrons import protocol_api
from opentrons.protocol_api import COLUMN, ALL

requirements = {
    "robotType": "Flex",
    "apiLevel": "2.18",
}



def run(ctx: protocol_api.ProtocolContext):

    tiprack1000_1 = ctx.load_labware("opentrons_flex_96_tiprack_1000ul", "B2")
    tiprack1000_2 = ctx.load_labware("opentrons_flex_96_tiprack_1000ul", "C2")

    pipette = ctx.load_instrument(
        "flex_96channel_1000", mount="left", tip_racks=[tiprack1000_1, tiprack1000_2]
    )

    trashA3 = ctx.load_trash_bin("A3")

    pipette.configure_nozzle_layout(style=COLUMN, start="A12", tip_racks=[tiprack1000_1, tiprack1000_2])

    # pickup and drop all 12 columns of the first tiprack and the first column of the second tiprack using Column A12 of the pipette (Should progress across the tiprack left to right)
    for x in range(13):
        pipette.pick_up_tip()
        pipette.drop_tip()
    
    pipette.configure_nozzle_layout(style=COLUMN, start="A1", tip_racks=[tiprack1000_1, tiprack1000_2])
    # pickup and drop the remaining 11 columns of the second tiprack using column A1 of the pipette (should progress right to left)
    for x in range(11):
        pipette.pick_up_tip()
        pipette.drop_tip()

Changelog

  • Updated the tip cluster logic under tips.py to return None in situations where the iterator would extend beyond the bounds of a tiprack before the iteration logic has been able to evaluate the next upcoming step.

Review requests

Do these changes appear comprehensive enough given existing safegaurds within the tiprack iteration logic?

Risk assessment

Low, fixes oversight.

@CaseyBatten CaseyBatten changed the base branch from edge to chore_release-7.3.0 May 8, 2024 20:50
@CaseyBatten CaseyBatten requested review from jbleon95 and y3rsh May 8, 2024 21:54
@CaseyBatten CaseyBatten marked this pull request as ready for review May 8, 2024 21:54
@CaseyBatten CaseyBatten requested a review from a team as a code owner May 8, 2024 21:54
@CaseyBatten CaseyBatten requested a review from smb2268 May 8, 2024 21:59
Copy link
Contributor

@vegano1 vegano1 left a comment

Choose a reason for hiding this comment

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

Logically this makes sense.

Copy link
Contributor

@jbleon95 jbleon95 left a comment

Choose a reason for hiding this comment

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

These changes look like they'll solve the issue with tip tracking. Made a couple suggestions to potentially simplify these changes. If time allows I think a further refactor could simplify a lot of this logic, as well as going further since our whole tip tracking behavior is very spaghetti code to begin with.

@@ -312,7 +312,9 @@ def _cluster_search_A1(active_columns: int, active_rows: int) -> Optional[str]:
if critical_row + active_rows < len(columns[0]):
critical_row = critical_row + active_rows
else:
critical_column = critical_column + 1
critical_column += 1
if critical_column >= len(columns):
Copy link
Contributor

Choose a reason for hiding this comment

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

This if statement could probably be removed and the while check be changed to while critical_column < len(columns) if I understand this correctly, since we're not doing any indexing immediately after this.

@@ -336,7 +338,9 @@ def _cluster_search_A12(active_columns: int, active_rows: int) -> Optional[str]:
if critical_row + active_rows < len(columns[0]):
critical_row = critical_row + active_rows
else:
critical_column = critical_column - 1
critical_column -= 1
if critical_column < 0:
Copy link
Contributor

Choose a reason for hiding this comment

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

Same thing as above, except I don't think you'd need to change anything in the while conditional

…mption is occurring correctly in all directions
@CaseyBatten CaseyBatten merged commit 0c40f7d into chore_release-7.3.0 May 10, 2024
20 checks passed
@CaseyBatten CaseyBatten deleted the automatic_tip_tracking_index_range_fix branch May 10, 2024 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants