Skip to content

Commit

Permalink
fix bugs; add default-values param for touch-tip offset
Browse files Browse the repository at this point in the history
  • Loading branch information
IanLondon committed Oct 29, 2018
1 parent 5d06d57 commit dd0e537
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 7 deletions.
27 changes: 21 additions & 6 deletions api/src/opentrons/protocols/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@ def _get_location(loaded_labware, command_type, params, default_values):

if offset_from_bottom is None:
# not all commands use offsets

# touch-tip uses offset from top, not bottom, as default
# when offsetFromBottomMm command-specific value is unset
if command_type == 'touch-tip':
# TODO: Ian 2018-10-29 remove this `-1` when
# touch-tip-mm-from-top is a required field
return labware.wells(well).top(
z=default_values.get('touch-tip-mm-from-top', -1))

return labware.wells(well)

return labware.wells(well).bottom(offset_from_bottom)
Expand Down Expand Up @@ -178,12 +187,18 @@ def dispatch_commands(protocol_data, loaded_pipettes, loaded_labware): # noqa:
pipette.dispense(volume, location)

elif command_type == 'touch-tip':
offset_from_top = -1
if ('offsetFromBottomMm' in params):
offset_from_bottom = params['offsetFromBottomMm']
offset_from_top = (
location.properties['depth'] - offset_from_bottom)
pipette.touch_tip(location, v_offset=offset_from_top)
# NOTE: if touch_tip can take a location tuple,
# this can be much simpler
(wellObject, locTuple) = location

# Use the offset baked into the wellObject.
# Do not allow API to apply its v_offset kwarg default value,
# and do not apply the JSON protocol's default offset.
z_from_bottom = locTuple[2]
offset_from_top = (
wellObject.properties['depth'] - z_from_bottom) * -1

pipette.touch_tip(wellObject, v_offset=offset_from_top)


def execute_protocol(protocol):
Expand Down
4 changes: 4 additions & 0 deletions protocol-designer/src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ export const END_TERMINAL_TITLE = 'FINAL DECK STATE'
export const DEFAULT_CHANGE_TIP_OPTION: 'always' = 'always'
export const DEFAULT_MM_FROM_BOTTOM_ASPIRATE = 1
export const DEFAULT_MM_FROM_BOTTOM_DISPENSE = 0.5

// NOTE: in the negative Z direction, to go down from top
export const DEFAULT_MM_TOUCH_TIP_OFFSET_FROM_TOP = -1

export const DEFAULT_WELL_ORDER_FIRST_OPTION: 't2b' = 't2b'
export const DEFAULT_WELL_ORDER_SECOND_OPTION: 'l2r' = 'l2r'

Expand Down
2 changes: 2 additions & 0 deletions protocol-designer/src/file-data/selectors/fileCreator.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {selectors as steplistSelectors} from '../../steplist'
import {
DEFAULT_MM_FROM_BOTTOM_ASPIRATE,
DEFAULT_MM_FROM_BOTTOM_DISPENSE,
DEFAULT_MM_TOUCH_TIP_OFFSET_FROM_TOP,
} from '../../constants'
import type {BaseState} from '../../types'
import type {ProtocolFile, FilePipette, FileLabware} from '../../file-types'
Expand All @@ -29,6 +30,7 @@ const executionDefaults = {
'dispense-flow-rate': getPropertyAllPipettes('dispenseFlowRate'),
'aspirate-mm-from-bottom': DEFAULT_MM_FROM_BOTTOM_ASPIRATE,
'dispense-mm-from-bottom': DEFAULT_MM_FROM_BOTTOM_DISPENSE,
'touch-tip-mm-from-top': DEFAULT_MM_TOUCH_TIP_OFFSET_FROM_TOP,
}

export const createFile: BaseState => ProtocolFile = createSelector(
Expand Down
4 changes: 3 additions & 1 deletion shared-data/protocol-json-schema/protocol-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
"default-values": {
"description": "Default values required for protocol execution",
"type": "object",
"$note": "TODO: Ian 2018-10-29 make touch-tip-mm-from-top required (breaking change)",
"required": [
"aspirate-flow-rate",
"dispense-flow-rate",
Expand All @@ -153,7 +154,8 @@
"aspirate-flow-rate": {"$ref": "#/definitions/flow-rate-for-pipettes"},
"dispense-flow-rate": {"$ref": "#/definitions/flow-rate-for-pipettes"},
"aspirate-mm-from-bottom": {"$ref": "#/definitions/mm-offset"},
"dispense-mm-from-bottom": {"$ref": "#/definitions/mm-offset"}
"dispense-mm-from-bottom": {"$ref": "#/definitions/mm-offset"},
"touch-tip-mm-from-top": {"$ref": "#/definitions/mm-offset"}
}
},

Expand Down

0 comments on commit dd0e537

Please sign in to comment.