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

feat(api): Support changing return tip height by tip size type #13157

Conversation

Laura-Danielle
Copy link
Contributor

@Laura-Danielle Laura-Danielle commented Jul 24, 2023

Overview

Closes RSS-275 although not specifically as the ticket requested. Please see the comment in the ticket for more details.

Test Plan

Using a P1000 pipette on the flex, pick up and return tip from the following tipracks:

  • 50ul
  • 200ul
  • 1000ul

(Tested by @SyntaxColoring)

And observe that the return tip heights do not cause any crashes into the tipracks.

Changelog

  • Grab a static lookup of all the available tip sizes and their default configurations
  • Utilize that to get the return tip height value
  • Update default flow rates whenever you pick up or drop a tip

Review requests

Check to see if anything seems weird or icky.

Risk assessment

  • Medium. Changing robot movement behavior.

@Laura-Danielle Laura-Danielle requested a review from a team as a code owner July 24, 2023 19:09
@codecov
Copy link

codecov bot commented Jul 24, 2023

Codecov Report

Merging #13157 (620e573) into internal-release_0.14.0 (6267e73) will decrease coverage by 0.05%.
Report is 17 commits behind head on internal-release_0.14.0.
The diff coverage is n/a.

Impacted file tree graph

@@                     Coverage Diff                     @@
##           internal-release_0.14.0   #13157      +/-   ##
===========================================================
- Coverage                    72.58%   72.54%   -0.05%     
===========================================================
  Files                         2372     2395      +23     
  Lines                        65437    66123     +686     
  Branches                      7202     7387     +185     
===========================================================
+ Hits                         47500    47967     +467     
- Misses                       16197    16404     +207     
- Partials                      1740     1752      +12     
Flag Coverage Δ
app 71.17% <ø> (-0.24%) ⬇️
g-code-testing 96.44% <ø> (ø)
notify-server 89.13% <ø> (ø)
protocol-designer 47.29% <ø> (ø)
shared-data 78.16% <ø> (-1.36%) ⬇️
step-generation 87.17% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
api/src/opentrons/hardware_control/dev_types.py 100.00% <ø> (ø)
...pi/src/opentrons/protocol_engine/state/pipettes.py 100.00% <ø> (ø)

... and 37 files with indirect coverage changes

@Laura-Danielle Laura-Danielle changed the base branch from edge to internal-release_0.14.0 July 25, 2023 14:41
@laviera laviera requested review from sanni-t and jbleon95 July 25, 2023 15:04
@SyntaxColoring SyntaxColoring self-requested a review July 25, 2023 16:18
Copy link
Contributor

@SyntaxColoring SyntaxColoring left a comment

Choose a reason for hiding this comment

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

When executing this on a Flex, I'm getting a KeyError at the load_pipette() step.

Jul 25 16:19:52.526304 737c08 opentrons-api[715]: Execution of ce6e8252-703a-4e36-89f2-27de164cc71b failed
                                                  Traceback (most recent call last):
                                                    File "/opt/opentrons-robot-server/opentrons/protocol_engine/execution/command_executor.py", line 108, in execute
                                                      result = await command_impl.execute(command.params)  # type: ignore[arg-type]
                                                    File "/opt/opentrons-robot-server/opentrons/protocol_engine/commands/load_pipette.py", line 58, in execute
                                                      loaded_pipette = await self._equipment.load_pipette(
                                                    File "/opt/opentrons-robot-server/opentrons/protocol_engine/execution/equipment.py", line 215, in load_pipette
                                                      static_pipette_config = pipette_data_provider.get_pipette_static_config(
                                                    File "/opt/opentrons-robot-server/opentrons/protocol_engine/resources/pipette_data_provider.py", line 84, in get_pipette_static_config
                                                      k.value: v for k, v in pipette_dict["supported_tips"].items()
                                                  KeyError: 'supported_tips'
Jul 25 16:19:52.541784 737c08 opentrons-api[715]: Exception raised by protocol
                                                  Traceback (most recent call last):
                                                    File "/opt/opentrons-robot-server/opentrons/protocol_runner/task_queue.py", line 72, in _run
                                                      await self._run_func()
                                                    File "/opt/opentrons-robot-server/opentrons/protocol_runner/legacy_wrappers.py", line 171, in execute
                                                      await to_thread.run_sync(run_protocol, protocol, context)
                                                    File "/opt/opentrons-robot-server/anyio/to_thread.py", line 28, in run_sync
                                                      return await get_asynclib().run_sync_in_worker_thread(func, *args, cancellable=cancellable,
                                                    File "/opt/opentrons-robot-server/anyio/_backends/_asyncio.py", line 802, in run_sync_in_worker_thread
                                                      return await future
                                                    File "/opt/opentrons-robot-server/anyio/_backends/_asyncio.py", line 740, in run
                                                      result = func(*args)
                                                    File "/opt/opentrons-robot-server/opentrons/protocols/execution/execute.py", line 27, in run_protocol
                                                      run_python(protocol, context)
                                                    File "/opt/opentrons-robot-server/opentrons/protocols/execution/execute_python.py", line 61, in run_python
                                                      exec("run(__context)", new_globs)
                                                    File "<string>", line 1, in <module>
                                                    File "laura_pick_up_return_test.py", line 8, in run
                                                    File "/opt/opentrons-robot-server/opentrons/protocols/api_support/util.py", line 383, in _check_version_wrapper
                                                      return decorated_obj(*args, **kwargs)
                                                    File "/opt/opentrons-robot-server/opentrons/protocol_api/protocol_context.py", line 782, in load_instrument
                                                      instrument_core = self._core.load_instrument(
                                                    File "/opt/opentrons-robot-server/opentrons/protocol_api/core/engine/protocol.py", line 414, in load_instrument
                                                      load_result = self._engine_client.load_pipette(instrument_name, engine_mount)
                                                    File "/opt/opentrons-robot-server/opentrons/protocol_engine/clients/sync_client.py", line 176, in load_pipette
                                                      result = self._transport.execute_command(request=request)
                                                    File "/opt/opentrons-robot-server/opentrons/protocol_engine/clients/transports.py", line 62, in execute_command
                                                      raise ProtocolCommandFailedError(
                                                  opentrons.protocol_engine.errors.error_occurrence.ProtocolCommandFailedError: Error 4000 GENERAL_ERROR (ProtocolCommandFailedError): PythonException: KeyError: 'supported_tips'

Here's my protocol:

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


def run(protocol):
    pipette = protocol.load_instrument("p1000_multi_flex", mount="right")
    tip_racks = [
        protocol.load_labware(n, s)
        for s, n in [
            ("C1", "opentrons_flex_96_tiprack_1000ul"),
            ("C2", "opentrons_flex_96_tiprack_200ul"),
            ("C3", "opentrons_flex_96_tiprack_50ul"),
        ]
    ]
    for t in tip_racks:
        pipette.pick_up_tip(t["A1"])
        pipette.drop_tip(t["A12"])

Comment on lines +179 to +181
tip_configuration = static_config.tip_configuration_lookup_table[
attached_tip.volume
]
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this need a fallback, e.g. for custom tip racks?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No not right now. See my long-ish comment in this ticket.

The liquid settings are mapped by pipette tip volume rather than tiprack URI.

Copy link
Contributor

@SyntaxColoring SyntaxColoring Jul 25, 2023

Choose a reason for hiding this comment

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

The liquid settings are mapped by pipette tip volume rather than tiprack URI.

Hmm, but even then, what guarantees that the tip volume will be one of the keys in this dict? Like, what if I have a weird tip rack with 140 µL tips? Or 300µL tips that actually only have a 270µL volume because they have a filter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Happy to fallback to a default value that is equivalent to the max volume of the pipette, however, we aren't supporting 3rd party tips at launch and this shouldn't be a concern imo.

Copy link
Contributor

Choose a reason for hiding this comment

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

Discussed on Slack: Although the Flex isn't supporting 3rd-party tips at launch, the OT-2 runs through this same codepath, so we'll add a fallback so the OT-2 keeps working.

Copy link
Contributor

@SyntaxColoring SyntaxColoring left a comment

Choose a reason for hiding this comment

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

Tested again on an OT-3 with the latest changes. Still works, yay!

Approving now so we can merge this to unblock ABR testing. Separately, I'll test on an OT-2 with custom tip racks and review the code more closely.

@Laura-Danielle Laura-Danielle merged commit b985fc1 into internal-release_0.14.0 Jul 26, 2023
@Laura-Danielle Laura-Danielle deleted the RSS-274-RSS-275-support-multiple-tip-heights-lengths branch July 26, 2023 16:25
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.

2 participants