From 48e1976d47ad7e53ed1b200ebf3e7835d11a6ef7 Mon Sep 17 00:00:00 2001 From: Jethary Date: Fri, 29 Mar 2024 15:53:12 -0400 Subject: [PATCH] feat(protocol-designer, step-generation): x/Y tip positioning for asp, disp, mix closes AUTH-5 --- components/src/forms/InputField.tsx | 2 +- .../components/BatchEditForm/BatchEditMix.tsx | 8 +- .../BatchEditForm/BatchEditMoveLiquid.tsx | 8 +- .../StepEditForm/fields/DelayFields.tsx | 3 +- .../TipPositionField/TipPositionAllViz.tsx | 54 +++ .../TipPositionInput.module.css | 2 +- .../TipPositionField/TipPositionModal.tsx | 459 ++++++++++-------- .../TipPositionField/ZTipPositionModal.tsx | 248 ++++++++++ .../fields/TipPositionField/constants.ts | 4 + .../fields/TipPositionField/index.tsx | 108 ++++- .../fields/TipPositionField/utils.ts | 73 ++- .../src/load-file/migration/8_1_0.ts | 16 +- .../src/localization/en/modal.json | 7 +- .../src/localization/en/tooltip.json | 8 +- .../test/createPresavedStepForm.test.ts | 6 + .../src/steplist/fieldLevel/index.ts | 18 - .../formLevel/stepFormToArgs/mixFormToArgs.ts | 13 +- .../stepFormToArgs/moveLiquidFormToArgs.ts | 8 + .../test/getDefaultsForStepType.test.ts | 7 +- .../src/ui/steps/test/selectors.test.ts | 37 ++ shared-data/js/helpers/index.ts | 32 ++ .../src/__tests__/aspirate.test.ts | 34 ++ .../src/__tests__/consolidate.test.ts | 158 ++++++ .../src/__tests__/dispense.test.ts | 22 +- .../src/__tests__/distribute.test.ts | 28 ++ step-generation/src/__tests__/mix.test.ts | 4 + .../src/__tests__/transfer.test.ts | 187 +++++++ .../src/commandCreators/atomic/aspirate.ts | 6 + .../src/commandCreators/atomic/dispense.ts | 10 +- .../commandCreators/compound/consolidate.ts | 22 + .../commandCreators/compound/distribute.ts | 18 + .../src/commandCreators/compound/mix.ts | 20 + .../src/commandCreators/compound/transfer.ts | 24 + .../src/fixtures/commandFixtures.ts | 4 + step-generation/src/types.ts | 14 + step-generation/src/utils/misc.ts | 11 + 36 files changed, 1405 insertions(+), 278 deletions(-) create mode 100644 protocol-designer/src/components/StepEditForm/fields/TipPositionField/TipPositionAllViz.tsx create mode 100644 protocol-designer/src/components/StepEditForm/fields/TipPositionField/ZTipPositionModal.tsx create mode 100644 protocol-designer/src/components/StepEditForm/fields/TipPositionField/constants.ts diff --git a/components/src/forms/InputField.tsx b/components/src/forms/InputField.tsx index 899594bc1872..1244905ce275 100644 --- a/components/src/forms/InputField.tsx +++ b/components/src/forms/InputField.tsx @@ -36,7 +36,7 @@ export interface InputFieldProps { /** appears to the right of the caption. Used for character limits, eg '0/45' */ secondaryCaption?: string | null | undefined /** optional input type (default "text") */ - type?: typeof INPUT_TYPE_TEXT | typeof INPUT_TYPE_PASSWORD + type?: typeof INPUT_TYPE_TEXT | typeof INPUT_TYPE_PASSWORD | 'number' /** mouse click handler */ onClick?: (event: React.MouseEvent) => unknown /** focus handler */ diff --git a/protocol-designer/src/components/BatchEditForm/BatchEditMix.tsx b/protocol-designer/src/components/BatchEditForm/BatchEditMix.tsx index 062052ea9d67..76074bc8e3bb 100644 --- a/protocol-designer/src/components/BatchEditForm/BatchEditMix.tsx +++ b/protocol-designer/src/components/BatchEditForm/BatchEditMix.tsx @@ -88,7 +88,10 @@ export const BatchEditMix = (props: BatchEditMixProps): JSX.Element => { tiprack={propsForFields.tipRack.value} /> { className={styles.small_field} > { /> {tipPositionFieldName && ( )} diff --git a/protocol-designer/src/components/StepEditForm/fields/TipPositionField/TipPositionAllViz.tsx b/protocol-designer/src/components/StepEditForm/fields/TipPositionField/TipPositionAllViz.tsx new file mode 100644 index 000000000000..fe18c6957de7 --- /dev/null +++ b/protocol-designer/src/components/StepEditForm/fields/TipPositionField/TipPositionAllViz.tsx @@ -0,0 +1,54 @@ +import * as React from 'react' +import round from 'lodash/round' + +import PIPETTE_TIP_IMAGE from '../../../../images/pipette_tip.svg' +import WELL_CROSS_SECTION_IMAGE from '../../../../images/well_cross_section.svg' + +import styles from './TipPositionInput.module.css' + +const WELL_HEIGHT_PIXELS = 145 +const WELL_WIDTH_PIXELS = 100 +const PIXEL_DECIMALS = 2 + +interface TipPositionAllVizProps { + mmFromBottom: number + xPosition: number + wellDepthMm: number + xWidthMm: number +} + +export const TipPositionAllViz = ( + props: TipPositionAllVizProps +): JSX.Element => { + const { mmFromBottom, xPosition, wellDepthMm, xWidthMm } = props + const fractionOfWellHeight = mmFromBottom / wellDepthMm + const pixelsFromBottom = + Number(fractionOfWellHeight) * WELL_HEIGHT_PIXELS - WELL_HEIGHT_PIXELS + const roundedPixelsFromBottom = round(pixelsFromBottom, PIXEL_DECIMALS) + const bottomPx = wellDepthMm + ? roundedPixelsFromBottom + : mmFromBottom - WELL_HEIGHT_PIXELS + + const xPx = (WELL_WIDTH_PIXELS / xWidthMm) * xPosition + const roundedXPx = round(xPx, PIXEL_DECIMALS) + return ( +
+ + + {props.wellDepthMm !== null && ( + {props.wellDepthMm}mm + )} + +
+ ) +} diff --git a/protocol-designer/src/components/StepEditForm/fields/TipPositionField/TipPositionInput.module.css b/protocol-designer/src/components/StepEditForm/fields/TipPositionField/TipPositionInput.module.css index 772292881c10..6cd3edf2a6b4 100644 --- a/protocol-designer/src/components/StepEditForm/fields/TipPositionField/TipPositionInput.module.css +++ b/protocol-designer/src/components/StepEditForm/fields/TipPositionField/TipPositionInput.module.css @@ -11,7 +11,7 @@ display: flex; flex-direction: row; justify-content: space-between; - margin: 3rem 0 2rem; + margin: 1rem 0 2rem; } .position_from_bottom_input { diff --git a/protocol-designer/src/components/StepEditForm/fields/TipPositionField/TipPositionModal.tsx b/protocol-designer/src/components/StepEditForm/fields/TipPositionField/TipPositionModal.tsx index f940ff14815d..c0aeda31d731 100644 --- a/protocol-designer/src/components/StepEditForm/fields/TipPositionField/TipPositionModal.tsx +++ b/protocol-designer/src/components/StepEditForm/fields/TipPositionField/TipPositionModal.tsx @@ -2,107 +2,85 @@ import * as React from 'react' import { createPortal } from 'react-dom' import cx from 'classnames' import { useTranslation } from 'react-i18next' -import round from 'lodash/round' import { AlertModal, + DIRECTION_COLUMN, Flex, - HandleKeypress, - Icon, InputField, - OutlineButton, RadioGroup, + SPACING, + StyledText, } from '@opentrons/components' import { getMainPagePortalEl } from '../../../portals/MainPageModalPortal' import modalStyles from '../../../modals/modal.module.css' import { getIsTouchTipField } from '../../../../form-types' -import { TipPositionZAxisViz } from './TipPositionZAxisViz' +import { TOO_MANY_DECIMALS } from './constants' +import { TipPositionAllViz } from './TipPositionAllViz' import styles from './TipPositionInput.module.css' import * as utils from './utils' -import type { StepFieldName } from '../../../../form-types' -const SMALL_STEP_MM = 1 -const LARGE_STEP_MM = 10 -const DECIMALS_ALLOWED = 1 +import type { StepFieldName } from '../../../../form-types' -interface Props { - closeModal: () => unknown - isIndeterminate?: boolean - mmFromBottom: number | null +type Offset = 'x' | 'y' | 'z' +interface PositionSpec { name: StepFieldName - updateValue: (val: number | null | undefined) => unknown - wellDepthMm: number + value: number | null + updateValue: (val: number | null | undefined) => void } +export type PositionSpecs = Record -const roundValue = (value: number | string | null): number => { - return round(Number(value), DECIMALS_ALLOWED) +interface TipPositionModalProps { + closeModal: () => void + specs: PositionSpecs + wellDepthMm: number + wellXWidthMm: number + wellYWidthMm: number + isIndeterminate?: boolean } -const TOO_MANY_DECIMALS: 'TOO_MANY_DECIMALS' = 'TOO_MANY_DECIMALS' -const OUT_OF_BOUNDS: 'OUT_OF_BOUNDS' = 'OUT_OF_BOUNDS' -type Error = typeof TOO_MANY_DECIMALS | typeof OUT_OF_BOUNDS - -const getErrorText = (args: { - errors: Error[] - maxMmFromBottom: number - minMmFromBottom: number - isPristine: boolean - t: any -}): string | null => { - const { errors, minMmFromBottom, maxMmFromBottom, isPristine, t } = args - - if (errors.includes(TOO_MANY_DECIMALS)) { - return t('tip_position.errors.TOO_MANY_DECIMALS') - } else if (!isPristine && errors.includes(OUT_OF_BOUNDS)) { - return t('tip_position.errors.OUT_OF_BOUNDS', { - minMmFromBottom, - maxMmFromBottom, - }) - } else { - return null - } -} +export const TipPositionModal = ( + props: TipPositionModalProps +): JSX.Element | null => { + const { + isIndeterminate, + specs, + wellDepthMm, + wellXWidthMm, + wellYWidthMm, + closeModal, + } = props + const zSpec = specs.z + const ySpec = specs.y + const xSpec = specs.x -const getErrors = (args: { - isDefault: boolean - value: string | null - maxMmFromBottom: number - minMmFromBottom: number -}): Error[] => { - const { isDefault, value, maxMmFromBottom, minMmFromBottom } = args - const errors: Error[] = [] - if (isDefault) return errors - - const v = Number(value) - if (value === null || Number.isNaN(v)) { - // blank or otherwise invalid should show this error as a fallback - return [OUT_OF_BOUNDS] - } - const correctDecimals = round(v, DECIMALS_ALLOWED) === v - const outOfBounds = v > maxMmFromBottom || v < minMmFromBottom + const { t } = useTranslation(['modal', 'button']) - if (!correctDecimals) { - errors.push(TOO_MANY_DECIMALS) - } - if (outOfBounds) { - errors.push(OUT_OF_BOUNDS) + if (zSpec == null || xSpec == null || ySpec == null) { + console.error('expected to find specs for the zPosition but could not') + return null } - return errors -} -export const TipPositionModal = (props: Props): JSX.Element => { - const { isIndeterminate, name, wellDepthMm } = props - const { t } = useTranslation(['modal', 'button']) const defaultMmFromBottom = utils.getDefaultMmFromBottom({ - name, + name: zSpec.name, wellDepthMm, }) - const [value, setValue] = React.useState( - props.mmFromBottom === null ? null : String(props.mmFromBottom) + const [zValue, setZValue] = React.useState( + zSpec.value === null ? null : String(zSpec?.value) + ) + const [yValue, setYValue] = React.useState( + ySpec.value === null ? null : String(ySpec?.value) ) + const [xValue, setXValue] = React.useState( + xSpec.value === null ? null : String(xSpec?.value) + ) + const [isDefault, setIsDefault] = React.useState( - !isIndeterminate && props.mmFromBottom === null + !isIndeterminate && + zSpec.value === null && + ySpec.value === 0 && + xSpec.value === 0 ) // in this modal, pristinity hides the OUT_OF_BOUNDS error only. const [isPristine, setPristine] = React.useState(true) @@ -111,32 +89,72 @@ export const TipPositionModal = (props: Props): JSX.Element => { maxMmFromBottom: number minMmFromBottom: number } => { - if (getIsTouchTipField(name)) { + if (getIsTouchTipField(zSpec?.name ?? '')) { return { - maxMmFromBottom: roundValue(wellDepthMm), - minMmFromBottom: roundValue(wellDepthMm / 2), + maxMmFromBottom: utils.roundValue(wellDepthMm), + minMmFromBottom: utils.roundValue(wellDepthMm / 2), } } return { - maxMmFromBottom: roundValue(wellDepthMm * 2), + maxMmFromBottom: utils.roundValue(wellDepthMm * 2), minMmFromBottom: 0, } } + const { maxMmFromBottom, minMmFromBottom } = getMinMaxMmFromBottom() - const errors = getErrors({ + const { minValue: yMinWidth, maxValue: yMaxWidth } = utils.getMinMaxWidth( + wellYWidthMm + ) + const { minValue: xMinWidth, maxValue: xMaxWidth } = utils.getMinMaxWidth( + wellXWidthMm + ) + + const zErrors = utils.getErrors({ + isDefault, + minMm: minMmFromBottom, + maxMm: maxMmFromBottom, + value: zValue, + }) + const xErrors = utils.getErrors({ isDefault, - minMmFromBottom, - maxMmFromBottom, - value, + minMm: xMinWidth, + maxMm: xMaxWidth, + value: xValue, }) - const hasErrors = errors.length > 0 + const yErrors = utils.getErrors({ + isDefault, + minMm: yMinWidth, + maxMm: yMaxWidth, + value: yValue, + }) + const hasErrors = + zErrors.length > 0 || xErrors.length > 0 || yErrors.length > 0 const hasVisibleErrors = isPristine - ? errors.includes(TOO_MANY_DECIMALS) + ? zErrors.includes(TOO_MANY_DECIMALS) || + xErrors.includes(TOO_MANY_DECIMALS) || + yErrors.includes(TOO_MANY_DECIMALS) : hasErrors - const errorText = getErrorText({ - errors, - maxMmFromBottom, - minMmFromBottom, + + const zErrorText = utils.getErrorText({ + errors: zErrors, + maxMm: maxMmFromBottom, + minMm: minMmFromBottom, + isPristine, + t, + }) + + const xErrorText = utils.getErrorText({ + errors: xErrors, + minMm: xMinWidth, + maxMm: xMaxWidth, + isPristine, + t, + }) + + const yErrorText = utils.getErrorText({ + errors: yErrors, + minMm: yMinWidth, + maxMm: yMaxWidth, isPristine, t, }) @@ -146,19 +164,23 @@ export const TipPositionModal = (props: Props): JSX.Element => { if (!hasErrors) { if (isDefault) { - props.updateValue(null) + zSpec.updateValue(null) + xSpec.updateValue(0) + ySpec.updateValue(0) } else { - props.updateValue(value === null ? null : Number(value)) + zSpec.updateValue(zValue === null ? null : Number(zValue)) + xSpec.updateValue(xValue === null ? null : Number(xValue)) + ySpec.updateValue(yValue === null ? null : Number(yValue)) } - props.closeModal() + closeModal() } } const handleCancel = (): void => { - props.closeModal() + closeModal() } - const handleChange = (newValueRaw: string | number): void => { + const handleZChange = (newValueRaw: string | number): void => { // if string, strip non-number characters from string and cast to number const newValue = typeof newValueRaw === 'string' @@ -166,147 +188,166 @@ export const TipPositionModal = (props: Props): JSX.Element => { : String(newValueRaw) if (newValue === '.') { - setValue('0.') + setZValue('0.') } else { - setValue(Number(newValue) >= 0 ? newValue : '0') + setZValue(Number(newValue) >= 0 ? newValue : '0') } } - const handleInputFieldChange = ( + const handleZInputFieldChange = ( e: React.ChangeEvent ): void => { - handleChange(e.currentTarget.value) + handleZChange(e.currentTarget.value) } - const handleIncrementDecrement = (delta: number): void => { - const prevValue = value === null ? defaultMmFromBottom : Number(value) - setIsDefault(false) - handleChange(roundValue(prevValue + delta)) + const handleXChange = (newValueRaw: string | number): void => { + // if string, strip non-number characters from string and cast to number + const newValue = + typeof newValueRaw === 'string' + ? newValueRaw.replace(/[^-.0-9]/g, '') + : String(newValueRaw) + + if (newValue === '.') { + setXValue('0.') + } else { + setXValue(newValue) + } } - const makeHandleIncrement = (step: number): (() => void) => () => { - handleIncrementDecrement(step) + const handleXInputFieldChange = ( + e: React.ChangeEvent + ): void => { + handleXChange(e.currentTarget.value) } - const makeHandleDecrement = (step: number): (() => void) => () => { - handleIncrementDecrement(step * -1) + const handleYChange = (newValueRaw: string | number): void => { + // if string, strip non-number characters from string and cast to number + const newValue = + typeof newValueRaw === 'string' + ? newValueRaw.replace(/[^-.0-9]/g, '') + : String(newValueRaw) + + if (newValue === '.') { + setYValue('0.') + } else { + setYValue(newValue) + } } - const TipPositionInputField = !isDefault && ( - - ) + const handleYInputFieldChange = ( + e: React.ChangeEvent + ): void => { + handleYChange(e.currentTarget.value) + } + + const TipPositionInputField = !isDefault ? ( + + + + {t('tip_position.field_titles.x_position')} + + + + + + {t('tip_position.field_titles.y_position')} + + + + + + {t('tip_position.field_titles.z_position')} + + + + + ) : null // Mix Form's asp/disp tip position field has different default value text - const isMixAspDispField = name === 'mix_mmFromBottom' + const isMixAspDispField = zSpec.name === 'mix_mmFromBottom' return createPortal( - - -
-

{t('tip_position.title')}

-

{t(`tip_position.body.${name}`)}

-
-
- -
- ) => { - setIsDefault(e.currentTarget.value === 'default') - }} - options={[ - { - name: isMixAspDispField - ? `Aspirate 1mm, Dispense 0.5mm from the bottom (default)` - : `${defaultMmFromBottom} mm from the bottom (default)`, - value: 'default', - }, - { - name: 'Custom', - value: 'custom', - }, - ]} - name="TipPositionOptions" - /> - {TipPositionInputField} -
- -
- {!isDefault && ( -
- - Up - - - Down - -
- )} - -
+
+

{t('tip_position.title')}

+

{t(`tip_position.body.${zSpec.name}`)}

+
+
+ + + ) => { + setIsDefault(e.currentTarget.value === 'default') + }} + options={[ + { + name: isMixAspDispField + ? `Aspirate 1mm, Dispense 0.5mm from the bottom center (default)` + : `${defaultMmFromBottom} mm from the bottom center (default)`, + value: 'default', + }, + { + name: 'Custom', + value: 'custom', + }, + ]} + name="TipPositionOptions" + /> + {TipPositionInputField} -
- - , + +
+ +
+
+
+
, getMainPagePortalEl() ) } diff --git a/protocol-designer/src/components/StepEditForm/fields/TipPositionField/ZTipPositionModal.tsx b/protocol-designer/src/components/StepEditForm/fields/TipPositionField/ZTipPositionModal.tsx new file mode 100644 index 000000000000..c7e801ba00f7 --- /dev/null +++ b/protocol-designer/src/components/StepEditForm/fields/TipPositionField/ZTipPositionModal.tsx @@ -0,0 +1,248 @@ +import * as React from 'react' +import { createPortal } from 'react-dom' +import cx from 'classnames' +import { useTranslation } from 'react-i18next' +import { + AlertModal, + Flex, + HandleKeypress, + Icon, + InputField, + OutlineButton, + RadioGroup, +} from '@opentrons/components' +import { getMainPagePortalEl } from '../../../portals/MainPageModalPortal' +import { getIsTouchTipField } from '../../../../form-types' +import { TipPositionZAxisViz } from './TipPositionZAxisViz' +import * as utils from './utils' +import { LARGE_STEP_MM, SMALL_STEP_MM, TOO_MANY_DECIMALS } from './constants' + +import type { StepFieldName } from '../../../../form-types' + +import modalStyles from '../../../modals/modal.module.css' +import styles from './TipPositionInput.module.css' + +interface Props { + closeModal: () => void + isIndeterminate?: boolean + mmFromBottom: number | null + name: StepFieldName + updateValue: (val: number | null | undefined) => unknown + wellDepthMm: number +} + +export const ZTipPositionModal = (props: Props): JSX.Element => { + const { isIndeterminate, name, wellDepthMm } = props + const { t } = useTranslation(['modal', 'button']) + const defaultMmFromBottom = utils.getDefaultMmFromBottom({ + name, + wellDepthMm, + }) + + const [value, setValue] = React.useState( + props.mmFromBottom === null ? null : String(props.mmFromBottom) + ) + const [isDefault, setIsDefault] = React.useState( + !isIndeterminate && props.mmFromBottom === null + ) + // in this modal, pristinity hides the OUT_OF_BOUNDS error only. + const [isPristine, setPristine] = React.useState(true) + + const getMinMaxMmFromBottom = (): { + maxMmFromBottom: number + minMmFromBottom: number + } => { + if (getIsTouchTipField(name)) { + return { + maxMmFromBottom: utils.roundValue(wellDepthMm), + minMmFromBottom: utils.roundValue(wellDepthMm / 2), + } + } + return { + maxMmFromBottom: utils.roundValue(wellDepthMm * 2), + minMmFromBottom: 0, + } + } + const { maxMmFromBottom, minMmFromBottom } = getMinMaxMmFromBottom() + const errors = utils.getErrors({ + isDefault, + minMm: minMmFromBottom, + maxMm: maxMmFromBottom, + value, + }) + const hasErrors = errors.length > 0 + const hasVisibleErrors = isPristine + ? errors.includes(TOO_MANY_DECIMALS) + : hasErrors + const errorText = utils.getErrorText({ + errors, + minMm: maxMmFromBottom, + maxMm: minMmFromBottom, + isPristine, + t, + }) + + const handleDone = (): void => { + setPristine(false) + + if (!hasErrors) { + if (isDefault) { + props.updateValue(null) + } else { + props.updateValue(value === null ? null : Number(value)) + } + props.closeModal() + } + } + + const handleCancel = (): void => { + props.closeModal() + } + + const handleChange = (newValueRaw: string | number): void => { + // if string, strip non-number characters from string and cast to number + const newValue = + typeof newValueRaw === 'string' + ? newValueRaw.replace(/[^.0-9]/, '') + : String(newValueRaw) + + if (newValue === '.') { + setValue('0.') + } else { + setValue(Number(newValue) >= 0 ? newValue : '0') + } + } + + const handleInputFieldChange = ( + e: React.ChangeEvent + ): void => { + handleChange(e.currentTarget.value) + } + + const handleIncrementDecrement = (delta: number): void => { + const prevValue = value === null ? defaultMmFromBottom : Number(value) + setIsDefault(false) + handleChange(utils.roundValue(prevValue + delta)) + } + + const makeHandleIncrement = (step: number): (() => void) => () => { + handleIncrementDecrement(step) + } + + const makeHandleDecrement = (step: number): (() => void) => () => { + handleIncrementDecrement(step * -1) + } + + const TipPositionInputField = !isDefault && ( + + ) + + return createPortal( + + +
+

{t('tip_position.title')}

+

{t(`tip_position.body.${name}`)}

+
+
+ +
+ ) => { + setIsDefault(e.currentTarget.value === 'default') + }} + options={[ + { + name: `${defaultMmFromBottom} mm from the bottom (default)`, + value: 'default', + }, + { + name: 'Custom', + value: 'custom', + }, + ]} + name="TipPositionOptions" + /> + {TipPositionInputField} +
+ +
+ {!isDefault && ( +
+ + + + + + +
+ )} + +
+
+
+
+
, + getMainPagePortalEl() + ) +} diff --git a/protocol-designer/src/components/StepEditForm/fields/TipPositionField/constants.ts b/protocol-designer/src/components/StepEditForm/fields/TipPositionField/constants.ts new file mode 100644 index 000000000000..c790cb449ccf --- /dev/null +++ b/protocol-designer/src/components/StepEditForm/fields/TipPositionField/constants.ts @@ -0,0 +1,4 @@ +export const DECIMALS_ALLOWED = 1 +export const SMALL_STEP_MM = 1 +export const LARGE_STEP_MM = 10 +export const TOO_MANY_DECIMALS: 'TOO_MANY_DECIMALS' = 'TOO_MANY_DECIMALS' diff --git a/protocol-designer/src/components/StepEditForm/fields/TipPositionField/index.tsx b/protocol-designer/src/components/StepEditForm/fields/TipPositionField/index.tsx index 5c97ead2a9e7..5a780ba25e43 100644 --- a/protocol-designer/src/components/StepEditForm/fields/TipPositionField/index.tsx +++ b/protocol-designer/src/components/StepEditForm/fields/TipPositionField/index.tsx @@ -11,20 +11,28 @@ import { useHoverTooltip, UseHoverTooltipTargetProps, } from '@opentrons/components' -import { getWellsDepth } from '@opentrons/shared-data' +import { + getWellsDepth, + getWellXDimension, + getWellYDimension, +} from '@opentrons/shared-data' import { getIsTouchTipField, getIsDelayPositionField, +} from '../../../../form-types' +import { selectors as stepFormSelectors } from '../../../../step-forms' +import { PositionSpecs, TipPositionModal } from './TipPositionModal' +import { getDefaultMmFromBottom } from './utils' +import { ZTipPositionModal } from './ZTipPositionModal' +import type { TipXOffsetFields, TipYOffsetFields, TipZOffsetFields, } from '../../../../form-types' -import { selectors as stepFormSelectors } from '../../../../step-forms' -import { TipPositionModal } from './TipPositionModal' -import { getDefaultMmFromBottom } from './utils' +import type { FieldPropsByName } from '../../types' + import stepFormStyles from '../../StepEditForm.module.css' import styles from './TipPositionInput.module.css' -import type { FieldPropsByName } from '../../types' interface TipPositionFieldProps { propsForFields: FieldPropsByName @@ -38,7 +46,7 @@ export function TipPositionField(props: TipPositionFieldProps): JSX.Element { const { labwareId, propsForFields, zField, xField, yField } = props const { name: zName, - value: zValue, + value: rawZValue, updateValue: zUpdateValue, tooltipContent, isIndeterminate, @@ -55,22 +63,30 @@ export function TipPositionField(props: TipPositionFieldProps): JSX.Element { : null let wellDepthMm = 0 + let wellXWidthMm = 0 + let wellYWidthMm = 0 if (labwareDef != null) { - // NOTE: only taking depth of first well in labware def, UI not currently equipped for multiple depths + // NOTE: only taking depth of first well in labware def, UI not currently equipped for multiple depths/widths const firstWell = labwareDef.wells.A1 if (firstWell) { wellDepthMm = getWellsDepth(labwareDef, ['A1']) + wellXWidthMm = getWellXDimension(labwareDef, ['A1']) + wellYWidthMm = getWellYDimension(labwareDef, ['A1']) } } - if (wellDepthMm === 0 && labwareId != null && labwareDef != null) { + if ( + (wellDepthMm === 0 || wellXWidthMm === 0 || wellYWidthMm === 0) && + labwareId != null && + labwareDef != null + ) { console.error( - `expected to find the well depth mm with labwareId ${labwareId} but could not` + `expected to find all well dimensions mm with labwareId ${labwareId} but could not` ) } const handleOpen = (): void => { - if (wellDepthMm) { + if (wellDepthMm && wellXWidthMm && wellYWidthMm) { setModalOpen(true) } } @@ -79,28 +95,72 @@ export function TipPositionField(props: TipPositionFieldProps): JSX.Element { } const isTouchTipField = getIsTouchTipField(zName) const isDelayPositionField = getIsDelayPositionField(zName) - let value: string | number = '0' - const mmFromBottom = typeof zValue === 'number' ? zValue : null + let zValue: string | number = '0' + const mmFromBottom = typeof rawZValue === 'number' ? rawZValue : null if (wellDepthMm !== null) { // show default value for field in parens if no mmFromBottom value is selected - value = + zValue = mmFromBottom !== null ? mmFromBottom : getDefaultMmFromBottom({ name: zName, wellDepthMm }) } + + let modal = ( + + ) + if (yField != null && xField != null) { + const { + name: xName, + value: rawXValue, + updateValue: xUpdateValue, + } = propsForFields[xField] + const { + name: yName, + value: rawYValue, + updateValue: yUpdateValue, + } = propsForFields[yField] + + const specs: PositionSpecs = { + z: { + name: zName, + value: mmFromBottom, + updateValue: zUpdateValue, + }, + x: { + name: xName, + value: rawXValue != null ? Number(rawXValue) : null, + updateValue: xUpdateValue, + }, + y: { + name: yName, + value: rawYValue != null ? Number(rawYValue) : null, + updateValue: yUpdateValue, + }, + } + + modal = ( + + ) + } + return ( <> {tooltipContent} - {isModalOpen && ( - - )} + {isModalOpen ? modal : null} { + return round(Number(value), DECIMALS_ALLOWED) +} + +const OUT_OF_BOUNDS: 'OUT_OF_BOUNDS' = 'OUT_OF_BOUNDS' +type Error = typeof TOO_MANY_DECIMALS | typeof OUT_OF_BOUNDS + +export const getErrorText = (args: { + errors: Error[] + maxMm: number + minMm: number + isPristine: boolean + t: any +}): string | null => { + const { errors, minMm, maxMm, isPristine, t } = args + + if (errors.includes(TOO_MANY_DECIMALS)) { + return t('tip_position.errors.TOO_MANY_DECIMALS') + } else if (!isPristine && errors.includes(OUT_OF_BOUNDS)) { + return t('tip_position.errors.OUT_OF_BOUNDS', { + minMm, + maxMm, + }) + } else { + return null + } +} + +export const getErrors = (args: { + isDefault: boolean + value: string | null + maxMm: number + minMm: number +}): Error[] => { + const { isDefault, value, maxMm, minMm } = args + const errors: Error[] = [] + if (isDefault) return errors + + const v = Number(value) + if (value === null || Number.isNaN(v)) { + // blank or otherwise invalid should show this error as a fallback + return [OUT_OF_BOUNDS] + } + const correctDecimals = round(v, DECIMALS_ALLOWED) === v + const outOfBounds = v > maxMm || v < minMm + + if (!correctDecimals) { + errors.push(TOO_MANY_DECIMALS) + } + if (outOfBounds) { + errors.push(OUT_OF_BOUNDS) + } + return errors +} + +interface MinMaxValues { + minValue: number + maxValue: number +} + +export const getMinMaxWidth = (width: number): MinMaxValues => { + return { + minValue: -width / 2, + maxValue: width / 2, + } +} diff --git a/protocol-designer/src/load-file/migration/8_1_0.ts b/protocol-designer/src/load-file/migration/8_1_0.ts index c60ffb211832..9fc8f7fb123e 100644 --- a/protocol-designer/src/load-file/migration/8_1_0.ts +++ b/protocol-designer/src/load-file/migration/8_1_0.ts @@ -54,7 +54,7 @@ export const migrateFile = ( form => form.stepType === 'moveLiquid' || form.stepType === 'mix' ) - const pipettingSavedStepsWithTipRack = pipettingSavedSteps.reduce( + const pipettingSavedStepsWithAdditionalFields = pipettingSavedSteps.reduce( (acc, item) => { const tipRackUri = tiprackAssignments[item.pipette] const tiprackLoadName = @@ -67,8 +67,16 @@ export const migrateFile = ( const tiprackIds = loadLabwareCommands .filter(command => command.params.loadName === tiprackLoadName) .map(command => command.params.labwareId) - - acc[item.id] = { ...item, tipRack: tiprackIds[0] } + const xyKeys = + item.stepType === 'mix' + ? { mix_x_position: 0, mix_y_position: 0 } + : { + aspirate_x_position: 0, + aspirate_y_position: 0, + dispense_x_position: 0, + dispense_y_position: 0, + } + acc[item.id] = { ...item, tipRack: tiprackIds[0], ...xyKeys } return acc }, {} @@ -82,7 +90,7 @@ export const migrateFile = ( ...designerApplication.data, savedStepForms: { ...designerApplication.data.savedStepForms, - ...pipettingSavedStepsWithTipRack, + ...pipettingSavedStepsWithAdditionalFields, }, pipetteTiprackAssignments: newTiprackAssignments, }, diff --git a/protocol-designer/src/localization/en/modal.json b/protocol-designer/src/localization/en/modal.json index edceb80718f6..c6372cba279c 100644 --- a/protocol-designer/src/localization/en/modal.json +++ b/protocol-designer/src/localization/en/modal.json @@ -71,9 +71,14 @@ "aspirate_delay_mmFromBottom": "Change from where in the well the robot delays after aspirating", "dispense_delay_mmFromBottom": "Change from where in the well the robot delays after dispensing" }, + "field_titles": { + "z_position": "Z position", + "x_position": "X position", + "y_position": "Y position" + }, "errors": { "TOO_MANY_DECIMALS": "a max of 1 decimal place is allowed", - "OUT_OF_BOUNDS": "accepted range is {{minMmFromBottom}} to {{maxMmFromBottom}}" + "OUT_OF_BOUNDS": "accepted range is {{minMm}} to {{maxMm}}" }, "field_label": "Distance from bottom of well" }, diff --git a/protocol-designer/src/localization/en/tooltip.json b/protocol-designer/src/localization/en/tooltip.json index 9e1fbb908c08..6d3756b39caf 100644 --- a/protocol-designer/src/localization/en/tooltip.json +++ b/protocol-designer/src/localization/en/tooltip.json @@ -25,7 +25,7 @@ "aspirate_delay_mmFromBottom": "Distance from the bottom of the well", "aspirate_flowRate": "The speed at which the pipette aspirates", "aspirate_mix_checkbox": "Pipette up and down before aspirating", - "aspirate_mmFromBottom": "Distance from the bottom of the well", + "aspirate_mmFromBottom": "Adjust tip position", "aspirate_touchTip_checkbox": "Touch tip to each side of well after aspirating", "aspirate_touchTip_mmFromBottom": "Distance from the bottom of the well", "blowout_checkbox": "Where to dispose of remaining volume in tip", @@ -36,12 +36,12 @@ "dispense_delay_mmFromBottom": "Distance from the bottom of the well", "dispense_flowRate": "The speed at which the pipette dispenses", "dispense_mix_checkbox": "Pipette up and down after dispensing", - "dispense_mmFromBottom": "Distance from the bottom of the well", + "dispense_mmFromBottom": "Adjust tip position", "dispense_touchTip_checkbox": "Touch tip to each side of well after dispensing", "dispense_touchTip_mmFromBottom": "Distance from the bottom of the well", "disposalVolume_checkbox": "Aspirate extra volume that is disposed of after a multi-dispense is complete. We recommend a disposal volume of at least the pipette's minimum.", "heaterShakerSetTimer": "Once this counter has elapsed, the module will deactivate the heater and shaker", - "mix_mmFromBottom": "Distance from the bottom of the well", + "mix_mmFromBottom": "Adjust tip position", "mix_touchTip_checkbox": "Touch tip to each side of the well after mixing", "mix_touchTip_mmFromBottom": "Distance from the bottom of the well", "preWetTip": "Pre-wet pipette tip by aspirating and dispensing 2/3 of the tip's max volume", @@ -66,7 +66,9 @@ "aspirate_touchTip_checkbox": "Touch tip is not supported", "blowout_checkbox": "Redundant with disposal volume", "dispense_mix_checkbox": "Unable to mix in a waste chute or trash bin", + "aspirate_mmFromBottom": "Tip position adjustment is not supported", "dispense_mmFromBottom": "Tip position adjustment is not supported", + "mix_mmFromBottom": "Tip position adjustment is not supported", "dispense_touchTip_checkbox": "Touch tip is not supported" } }, diff --git a/protocol-designer/src/step-forms/test/createPresavedStepForm.test.ts b/protocol-designer/src/step-forms/test/createPresavedStepForm.test.ts index 526c4c784b1e..c440c25a0e58 100644 --- a/protocol-designer/src/step-forms/test/createPresavedStepForm.test.ts +++ b/protocol-designer/src/step-forms/test/createPresavedStepForm.test.ts @@ -187,6 +187,10 @@ describe('createPresavedStepForm', () => { stepDetails: '', stepName: 'transfer', volume: null, + aspirate_x_position: 0, + aspirate_y_position: 0, + dispense_x_position: 0, + dispense_y_position: 0, }) }) describe('mix step', () => { @@ -210,6 +214,8 @@ describe('createPresavedStepForm', () => { mix_wellOrder_first: 't2b', mix_wellOrder_second: 'l2r', blowout_checkbox: false, + mix_x_position: 0, + mix_y_position: 0, blowout_location: null, changeTip: 'always', stepDetails: '', diff --git a/protocol-designer/src/steplist/fieldLevel/index.ts b/protocol-designer/src/steplist/fieldLevel/index.ts index 0bff33b4fe70..15dd06279cf5 100644 --- a/protocol-designer/src/steplist/fieldLevel/index.ts +++ b/protocol-designer/src/steplist/fieldLevel/index.ts @@ -401,24 +401,6 @@ const stepFieldHelperMap: Record = { tipRack: { getErrors: composeErrors(requiredField), }, - mix_x_position: { - getErrors: composeErrors(requiredField), - }, - mix_y_position: { - getErrors: composeErrors(requiredField), - }, - aspirate_x_position: { - getErrors: composeErrors(requiredField), - }, - aspirate_y_position: { - getErrors: composeErrors(requiredField), - }, - dispense_x_position: { - getErrors: composeErrors(requiredField), - }, - dispense_y_position: { - getErrors: composeErrors(requiredField), - }, } const profileFieldHelperMap: Record = { // profile step fields diff --git a/protocol-designer/src/steplist/formLevel/stepFormToArgs/mixFormToArgs.ts b/protocol-designer/src/steplist/formLevel/stepFormToArgs/mixFormToArgs.ts index 741355f95a01..d9d4936b71e4 100644 --- a/protocol-designer/src/steplist/formLevel/stepFormToArgs/mixFormToArgs.ts +++ b/protocol-designer/src/steplist/formLevel/stepFormToArgs/mixFormToArgs.ts @@ -15,7 +15,14 @@ type MixStepArgs = MixArgs export const mixFormToArgs = ( hydratedFormData: HydratedMixFormDataLegacy ): MixStepArgs => { - const { labware, pipette, dropTip_location, nozzles } = hydratedFormData + const { + labware, + pipette, + dropTip_location, + nozzles, + mix_x_position, + mix_y_position, + } = hydratedFormData const matchingTipLiquidSpecs = getMatchingTipLiquidSpecs( pipette, hydratedFormData.volume, @@ -105,5 +112,9 @@ export const mixFormToArgs = ( dispenseDelaySeconds, dropTipLocation: dropTip_location, nozzles, + aspirateXOffset: mix_x_position ?? 0, + dispenseXOffset: mix_x_position ?? 0, + aspirateYOffset: mix_y_position ?? 0, + dispenseYOffset: mix_y_position ?? 0, } } diff --git a/protocol-designer/src/steplist/formLevel/stepFormToArgs/moveLiquidFormToArgs.ts b/protocol-designer/src/steplist/formLevel/stepFormToArgs/moveLiquidFormToArgs.ts index 7d330f54dbfd..4b3023fdad3a 100644 --- a/protocol-designer/src/steplist/formLevel/stepFormToArgs/moveLiquidFormToArgs.ts +++ b/protocol-designer/src/steplist/formLevel/stepFormToArgs/moveLiquidFormToArgs.ts @@ -78,6 +78,10 @@ export const moveLiquidFormToArgs = ( path, tipRack, nozzles, + aspirate_x_position, + dispense_x_position, + aspirate_y_position, + dispense_y_position, } = fields let sourceWells = getOrderedWells( fields.aspirate_wells, @@ -211,6 +215,10 @@ export const moveLiquidFormToArgs = ( name: hydratedFormData.stepName, dropTipLocation, nozzles, + aspirateXOffset: aspirate_x_position ?? 0, + aspirateYOffset: aspirate_y_position ?? 0, + dispenseXOffset: dispense_x_position ?? 0, + dispenseYOffset: dispense_y_position ?? 0, } console.assert( sourceWellsUnordered.length > 0, diff --git a/protocol-designer/src/steplist/formLevel/test/getDefaultsForStepType.test.ts b/protocol-designer/src/steplist/formLevel/test/getDefaultsForStepType.test.ts index 84803e31a745..cf0b72b84b08 100644 --- a/protocol-designer/src/steplist/formLevel/test/getDefaultsForStepType.test.ts +++ b/protocol-designer/src/steplist/formLevel/test/getDefaultsForStepType.test.ts @@ -59,13 +59,16 @@ describe('getDefaultsForStepType', () => { aspirate_delay_checkbox: false, aspirate_delay_mmFromBottom: null, aspirate_delay_seconds: `${DEFAULT_DELAY_SECONDS}`, - + aspirate_x_position: 0, + aspirate_y_position: 0, dispense_airGap_checkbox: false, dispense_airGap_volume: null, dispense_delay_checkbox: false, dispense_delay_seconds: `${DEFAULT_DELAY_SECONDS}`, dispense_delay_mmFromBottom: null, tipRack: null, + dispense_x_position: 0, + dispense_y_position: 0, }) }) }) @@ -94,6 +97,8 @@ describe('getDefaultsForStepType', () => { aspirate_flowRate: null, dispense_flowRate: null, tipRack: null, + mix_x_position: 0, + mix_y_position: 0, }) }) }) diff --git a/protocol-designer/src/ui/steps/test/selectors.test.ts b/protocol-designer/src/ui/steps/test/selectors.test.ts index 5cf64a591604..7cfa25c5e225 100644 --- a/protocol-designer/src/ui/steps/test/selectors.test.ts +++ b/protocol-designer/src/ui/steps/test/selectors.test.ts @@ -418,10 +418,23 @@ describe('_getSavedMultiSelectFieldValues', () => { isIndeterminate: false, value: undefined, }, + aspirate_labware: { value: 'aspirate_labware_id', isIndeterminate: false, }, + aspirate_x_position: { + isIndeterminate: false, + }, + aspirate_y_position: { + isIndeterminate: false, + }, + dispense_x_position: { + isIndeterminate: false, + }, + dispense_y_position: { + isIndeterminate: false, + }, aspirate_wells: { isIndeterminate: true, }, @@ -669,6 +682,18 @@ describe('_getSavedMultiSelectFieldValues', () => { path: { isIndeterminate: true, }, + aspirate_x_position: { + isIndeterminate: false, + }, + aspirate_y_position: { + isIndeterminate: false, + }, + dispense_x_position: { + isIndeterminate: false, + }, + dispense_y_position: { + isIndeterminate: false, + }, preWetTip: { isIndeterminate: true, }, @@ -850,6 +875,12 @@ describe('_getSavedMultiSelectFieldValues', () => { mix_touchTip_checkbox: { value: false, isIndeterminate: false }, mix_touchTip_mmFromBottom: { value: null, isIndeterminate: false }, nozzles: { value: undefined, isIndeterminate: false }, + mix_x_position: { + isIndeterminate: false, + }, + mix_y_position: { + isIndeterminate: false, + }, dropTip_location: { value: 'fixedTrash', isIndeterminate: false, @@ -920,6 +951,12 @@ describe('_getSavedMultiSelectFieldValues', () => { mix_touchTip_checkbox: { isIndeterminate: true }, mix_touchTip_mmFromBottom: { isIndeterminate: true }, nozzles: { isIndeterminate: true }, + mix_x_position: { + isIndeterminate: false, + }, + mix_y_position: { + isIndeterminate: false, + }, dropTip_location: { value: 'fixedTrash', isIndeterminate: false, diff --git a/shared-data/js/helpers/index.ts b/shared-data/js/helpers/index.ts index 2d78f16ca1f0..c10fd818c478 100644 --- a/shared-data/js/helpers/index.ts +++ b/shared-data/js/helpers/index.ts @@ -201,6 +201,38 @@ export const getWellsDepth = ( return offsets[0] } +export const getWellXDimension = ( + labwareDef: LabwareDefinition2, + wells: string[] +): number => { + const offsets = wells.map(well => { + const labwareWell = labwareDef.wells[well] + const shape = labwareWell.shape + if (shape === 'circular') { + return labwareWell.diameter + } else { + return labwareWell.xDimension + } + }) + return offsets[0] +} + +export const getWellYDimension = ( + labwareDef: LabwareDefinition2, + wells: string[] +): number => { + const offsets = wells.map(well => { + const labwareWell = labwareDef.wells[well] + const shape = labwareWell.shape + if (shape === 'circular') { + return labwareWell.diameter + } else { + return labwareWell.yDimension + } + }) + return offsets[0] +} + export const getSlotHasMatingSurfaceUnitVector = ( deckDef: DeckDefinition, addressableAreaName: string diff --git a/step-generation/src/__tests__/aspirate.test.ts b/step-generation/src/__tests__/aspirate.test.ts index 7731f5e389e2..d937fcda7a47 100644 --- a/step-generation/src/__tests__/aspirate.test.ts +++ b/step-generation/src/__tests__/aspirate.test.ts @@ -67,6 +67,8 @@ describe('aspirate', () => { well: 'A1', } as AspDispAirgapParams), tipRack: 'tiprack1Id', + xOffset: 0, + yOffset: 0, } const result = aspirate(params, invariantContext, robotStateWithTip) expect(getSuccessResult(result).commands).toEqual([ @@ -82,6 +84,8 @@ describe('aspirate', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 5, }, }, @@ -106,6 +110,8 @@ describe('aspirate', () => { well: 'A1', } as AspDispAirgapParams), tipRack: 'tiprack1Id', + xOffset: 0, + yOffset: 0, }, invariantContext, robotStateWithTip @@ -133,6 +139,8 @@ describe('aspirate', () => { well: 'A1', } as AspDispAirgapParams), tipRack: 'tipRack', + xOffset: 0, + yOffset: 0, }, invariantContext, robotStateWithTip @@ -153,6 +161,8 @@ describe('aspirate', () => { well: 'A1', } as AspDispAirgapParams), tipRack: 'tipRack', + xOffset: 0, + yOffset: 0, }, invariantContext, robotStateWithTip @@ -170,6 +180,8 @@ describe('aspirate', () => { well: 'A1', } as AspDispAirgapParams), tipRack: 'tipRack', + xOffset: 0, + yOffset: 0, }, invariantContext, initialRobotState @@ -190,6 +202,8 @@ describe('aspirate', () => { well: 'A1', } as AspDispAirgapParams), tipRack: 'tipRack', + xOffset: 0, + yOffset: 0, }, invariantContext, robotStateWithTip @@ -214,6 +228,8 @@ describe('aspirate', () => { well: 'A1', } as AspDispAirgapParams), tipRack: 'tipRack', + xOffset: 0, + yOffset: 0, }, invariantContext, initialRobotState @@ -246,6 +262,8 @@ describe('aspirate', () => { well: 'A1', } as AspDispAirgapParams), tipRack: 'tipRack', + xOffset: 0, + yOffset: 0, }, invariantContext, robotStateWithTip @@ -278,6 +296,8 @@ describe('aspirate', () => { well: 'A1', } as AspDispAirgapParams), tipRack: 'tipRack', + xOffset: 0, + yOffset: 0, }, invariantContext, robotStateWithTip @@ -316,6 +336,8 @@ describe('aspirate', () => { well: 'A1', } as AspDispAirgapParams), tipRack: 'tipRack', + xOffset: 0, + yOffset: 0, }, invariantContext, robotStateWithTip @@ -348,6 +370,8 @@ describe('aspirate', () => { well: 'A1', } as AspDispAirgapParams), tipRack: 'tipRack', + xOffset: 0, + yOffset: 0, }, invariantContext, robotStateWithTip @@ -386,6 +410,8 @@ describe('aspirate', () => { well: 'A1', } as AspDispAirgapParams), tipRack: 'tipRack', + xOffset: 0, + yOffset: 0, }, invariantContext, robotStateWithTip @@ -414,6 +440,8 @@ describe('aspirate', () => { well: 'A1', } as AspDispAirgapParams), tipRack: 'tipRack', + xOffset: 0, + yOffset: 0, }, invariantContext, robotStateWithTip @@ -441,6 +469,8 @@ describe('aspirate', () => { well: 'A1', } as AspDispAirgapParams), tipRack: 'tipRack', + xOffset: 0, + yOffset: 0, }, invariantContext, robotStateWithTip @@ -468,6 +498,8 @@ describe('aspirate', () => { well: 'A1', } as AspDispAirgapParams), tipRack: 'tipRack', + xOffset: 0, + yOffset: 0, }, invariantContext, robotStateWithTip @@ -497,6 +529,8 @@ describe('aspirate', () => { well: 'A1', } as AspDispAirgapParams), tipRack: 'tipRack', + xOffset: 0, + yOffset: 0, }, invariantContext, robotStateWithTip diff --git a/step-generation/src/__tests__/consolidate.test.ts b/step-generation/src/__tests__/consolidate.test.ts index 219c7b51c544..26a56b0caf5a 100644 --- a/step-generation/src/__tests__/consolidate.test.ts +++ b/step-generation/src/__tests__/consolidate.test.ts @@ -33,6 +33,8 @@ const airGapHelper = makeAirGapHelper({ origin: 'bottom', offset: { z: 11.54, + x: 0, + y: 0, }, }, }) @@ -98,6 +100,10 @@ beforeEach(() => { blowoutLocation: null, dropTipLocation: FIXED_TRASH_ID, tipRack: 'tiprack1Id', + aspirateXOffset: 0, + dispenseXOffset: 0, + aspirateYOffset: 0, + dispenseYOffset: 0, } }) @@ -259,6 +265,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: ASPIRATE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -274,6 +282,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: ASPIRATE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -307,6 +317,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: ASPIRATE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -330,6 +342,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: ASPIRATE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -363,6 +377,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: ASPIRATE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -373,6 +389,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: ASPIRATE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -383,6 +401,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: ASPIRATE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -399,6 +419,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: ASPIRATE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -409,6 +431,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: ASPIRATE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -419,6 +443,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: ASPIRATE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -454,6 +480,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: DISPENSE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -467,6 +495,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: DISPENSE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -501,6 +531,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: DISPENSE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -520,6 +552,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: DISPENSE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -553,6 +587,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: DISPENSE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -566,6 +602,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: DISPENSE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -599,6 +637,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: ASPIRATE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -616,6 +656,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: ASPIRATE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -655,6 +697,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: ASPIRATE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -675,6 +719,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: ASPIRATE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -715,6 +761,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: ASPIRATE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -734,6 +782,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: ASPIRATE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -1056,6 +1106,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.1, }, }, @@ -1080,6 +1132,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.1, }, }, @@ -1105,6 +1159,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.1, }, }, @@ -1163,6 +1219,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 11.54, }, }, @@ -1188,6 +1246,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.1, }, }, @@ -1246,6 +1306,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 11.54, }, }, @@ -1271,6 +1333,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.2, }, }, @@ -1313,6 +1377,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.2, }, }, @@ -1337,6 +1403,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.2, }, }, @@ -1385,6 +1453,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.1, }, }, @@ -1409,6 +1479,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.1, }, }, @@ -1434,6 +1506,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.1, }, }, @@ -1492,6 +1566,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 11.54, }, }, @@ -1517,6 +1593,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.2, }, }, @@ -1559,6 +1637,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.2, }, }, @@ -1583,6 +1663,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.2, }, }, @@ -1628,6 +1710,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 11.54, }, }, @@ -1698,6 +1782,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.1, }, }, @@ -1722,6 +1808,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.1, }, }, @@ -1747,6 +1835,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.1, }, }, @@ -1805,6 +1895,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 11.54, }, }, @@ -1831,6 +1923,8 @@ describe('consolidate single-channel', () => { origin: 'bottom', offset: { z: 3.1, + x: 0, + y: 0, }, }, flowRate: 2.1, @@ -1888,6 +1982,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 11.54, }, }, @@ -1913,6 +2009,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.2, }, }, @@ -1955,6 +2053,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.2, }, }, @@ -1979,6 +2079,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.2, }, }, @@ -2043,6 +2145,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.1, }, }, @@ -2067,6 +2171,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.1, }, }, @@ -2092,6 +2198,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.1, }, }, @@ -2150,6 +2258,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 11.54, }, }, @@ -2175,6 +2285,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.2, }, }, @@ -2217,6 +2329,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.2, }, }, @@ -2241,6 +2355,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.2, }, }, @@ -2300,6 +2416,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 11.54, }, }, @@ -2367,6 +2485,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.1, }, }, @@ -2391,6 +2511,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.1, }, }, @@ -2416,6 +2538,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.1, }, }, @@ -2474,6 +2598,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 11.54, }, }, @@ -2499,6 +2625,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.1, }, }, @@ -2557,6 +2685,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 11.54, }, }, @@ -2582,6 +2712,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.2, }, }, @@ -2624,6 +2756,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.2, }, }, @@ -2648,6 +2782,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.2, }, }, @@ -2708,6 +2844,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 11.54, }, }, @@ -2747,6 +2885,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.1, }, }, @@ -2772,6 +2912,8 @@ describe('consolidate single-channel', () => { origin: 'bottom', offset: { z: 3.1, + x: 0, + y: 0, }, }, flowRate: 2.2, @@ -2796,6 +2938,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.1, }, }, @@ -2854,6 +2998,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 11.54, }, }, @@ -2879,6 +3025,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.2, }, }, @@ -2921,6 +3069,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.2, }, }, @@ -2945,6 +3095,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.2, }, }, @@ -3003,6 +3155,8 @@ describe('consolidate single-channel', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 11.54, }, }, @@ -3061,6 +3215,10 @@ describe('consolidate multi-channel', () => { volume: 140, tipRack: 'tiprack1Id', changeTip: 'once', + aspirateXOffset: 0, + dispenseXOffset: 0, + aspirateYOffset: 0, + dispenseYOffset: 0, } as ConsolidateArgs const result = consolidate(data, invariantContext, initialRobotState) const res = getSuccessResult(result) diff --git a/step-generation/src/__tests__/dispense.test.ts b/step-generation/src/__tests__/dispense.test.ts index 18e51c9b7a79..37d8965b526d 100644 --- a/step-generation/src/__tests__/dispense.test.ts +++ b/step-generation/src/__tests__/dispense.test.ts @@ -20,12 +20,12 @@ import { DEFAULT_PIPETTE, SOURCE_LABWARE, } from '../fixtures' -import { dispense } from '../commandCreators/atomic/dispense' -import { InvariantContext, RobotState } from '../types' -import type { - AspDispAirgapParams as V3AspDispAirgapParams, - DispenseParams, -} from '@opentrons/shared-data/protocol/types/schemaV3' +import { + ExtendedDispenseParams, + dispense, +} from '../commandCreators/atomic/dispense' +import type { InvariantContext, RobotState } from '../types' +import type { DispenseParams } from '@opentrons/shared-data/protocol/types/schemaV3' vi.mock('../utils/thermocyclerPipetteCollision') vi.mock('../utils/heaterShakerCollision') @@ -46,7 +46,7 @@ describe('dispense', () => { vi.resetAllMocks() }) describe('tip tracking & commands:', () => { - let params: V3AspDispAirgapParams + let params: ExtendedDispenseParams beforeEach(() => { params = { pipette: DEFAULT_PIPETTE, @@ -55,6 +55,8 @@ describe('dispense', () => { well: 'A1', offsetFromBottomMm: 5, flowRate: 6, + xOffset: 0, + yOffset: 0, } }) it('dispense normally (with tip)', () => { @@ -71,6 +73,8 @@ describe('dispense', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 5, }, }, @@ -99,7 +103,9 @@ describe('dispense', () => { volume: 50, labware: SOURCE_LABWARE, well: 'A1', - } as DispenseParams, + xOffset: 0, + yOffset: 0, + }, invariantContext, initialRobotState ) diff --git a/step-generation/src/__tests__/distribute.test.ts b/step-generation/src/__tests__/distribute.test.ts index 2db91df01d28..3e8fa31f749b 100644 --- a/step-generation/src/__tests__/distribute.test.ts +++ b/step-generation/src/__tests__/distribute.test.ts @@ -36,6 +36,8 @@ const airGapHelper = makeAirGapHelper({ wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 11.54, }, }, @@ -44,6 +46,8 @@ const dispenseAirGapHelper = makeDispenseAirGapHelper({ wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 11.54, }, }, @@ -84,6 +88,10 @@ beforeEach(() => { aspirateAirGapVolume: null, touchTipAfterDispense: false, dropTipLocation: FIXED_TRASH_ID, + aspirateXOffset: 0, + dispenseXOffset: 0, + aspirateYOffset: 0, + dispenseYOffset: 0, } blowoutSingleToTrash = blowoutInPlaceHelper() blowoutSingleToSourceA1 = blowoutHelper(SOURCE_LABWARE, { @@ -274,6 +282,8 @@ describe('advanced settings: volume, mix, pre-wet tip, tip touch, tip position', wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: ASPIRATE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -309,6 +319,8 @@ describe('advanced settings: volume, mix, pre-wet tip, tip touch, tip position', wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: ASPIRATE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -320,6 +332,8 @@ describe('advanced settings: volume, mix, pre-wet tip, tip touch, tip position', wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: ASPIRATE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -553,6 +567,8 @@ describe('advanced settings: volume, mix, pre-wet tip, tip touch, tip position', wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: ASPIRATE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -565,6 +581,8 @@ describe('advanced settings: volume, mix, pre-wet tip, tip touch, tip position', wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: ASPIRATE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -690,6 +708,8 @@ describe('advanced settings: volume, mix, pre-wet tip, tip touch, tip position', wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: ASPIRATE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -701,6 +721,8 @@ describe('advanced settings: volume, mix, pre-wet tip, tip touch, tip position', wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: ASPIRATE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -781,6 +803,8 @@ describe('advanced settings: volume, mix, pre-wet tip, tip touch, tip position', wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: ASPIRATE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -793,6 +817,8 @@ describe('advanced settings: volume, mix, pre-wet tip, tip touch, tip position', wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: ASPIRATE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -879,6 +905,8 @@ describe('advanced settings: volume, mix, pre-wet tip, tip touch, tip position', wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: ASPIRATE_OFFSET_FROM_BOTTOM_MM, }, }, diff --git a/step-generation/src/__tests__/mix.test.ts b/step-generation/src/__tests__/mix.test.ts index c2392a94c98a..cc2115c42dac 100644 --- a/step-generation/src/__tests__/mix.test.ts +++ b/step-generation/src/__tests__/mix.test.ts @@ -51,6 +51,10 @@ beforeEach(() => { aspirateDelaySeconds: null, dispenseDelaySeconds: null, dropTipLocation: FIXED_TRASH_ID, + aspirateXOffset: 0, + dispenseXOffset: 0, + aspirateYOffset: 0, + dispenseYOffset: 0, } invariantContext = makeContext() diff --git a/step-generation/src/__tests__/transfer.test.ts b/step-generation/src/__tests__/transfer.test.ts index 43b33ce0ca3f..16900858cb0a 100644 --- a/step-generation/src/__tests__/transfer.test.ts +++ b/step-generation/src/__tests__/transfer.test.ts @@ -37,6 +37,8 @@ const airGapHelper = makeAirGapHelper({ wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 11.54, }, }, @@ -45,6 +47,8 @@ const dispenseAirGapHelper = makeDispenseAirGapHelper({ wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 11.54, }, }, @@ -78,6 +82,10 @@ beforeEach(() => { mixInDestination: null, blowoutLocation: null, dropTipLocation: FIXED_TRASH_ID, + aspirateXOffset: 0, + dispenseXOffset: 0, + aspirateYOffset: 0, + dispenseYOffset: 0, } invariantContext = makeContext() @@ -561,6 +569,8 @@ describe('advanced options', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: ASPIRATE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -594,6 +604,8 @@ describe('advanced options', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: ASPIRATE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -628,6 +640,8 @@ describe('advanced options', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: ASPIRATE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -704,6 +718,8 @@ describe('advanced options', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: ASPIRATE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -715,6 +731,8 @@ describe('advanced options', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: ASPIRATE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -754,6 +772,8 @@ describe('advanced options', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: ASPIRATE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -766,6 +786,8 @@ describe('advanced options', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: ASPIRATE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -928,6 +950,8 @@ describe('advanced options', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: DISPENSE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -939,6 +963,8 @@ describe('advanced options', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: DISPENSE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -977,6 +1003,8 @@ describe('advanced options', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: DISPENSE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -986,6 +1014,8 @@ describe('advanced options', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: DISPENSE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -997,6 +1027,8 @@ describe('advanced options', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: DISPENSE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -1097,6 +1129,8 @@ describe('advanced options', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.1, }, }, @@ -1122,6 +1156,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 3.1, + y: 0, + x: 0, }, }, flowRate: 2.2, @@ -1146,6 +1182,8 @@ describe('advanced options', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.1, }, }, @@ -1171,6 +1209,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 3.1, + y: 0, + x: 0, }, }, flowRate: 2.2, @@ -1195,6 +1235,8 @@ describe('advanced options', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.1, }, }, @@ -1254,6 +1296,8 @@ describe('advanced options', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 11.54, }, }, @@ -1281,6 +1325,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 11.54, + y: 0, + x: 0, }, }, flowRate: 2.2, @@ -1303,8 +1349,11 @@ describe('advanced options', () => { wellName: 'B1', wellLocation: { origin: 'bottom', + offset: { z: DISPENSE_OFFSET_FROM_BOTTOM_MM, + y: 0, + x: 0, }, }, flowRate: 2.2, @@ -1346,6 +1395,8 @@ describe('advanced options', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.2, }, }, @@ -1371,6 +1422,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: DISPENSE_OFFSET_FROM_BOTTOM_MM, + y: 0, + x: 0, }, }, flowRate: 2.2, @@ -1432,6 +1485,8 @@ describe('advanced options', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.1, }, }, @@ -1457,6 +1512,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 3.1, + y: 0, + x: 0, }, }, flowRate: 2.2, @@ -1481,6 +1538,8 @@ describe('advanced options', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 3.1, }, }, @@ -1540,6 +1599,8 @@ describe('advanced options', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 11.54, }, }, @@ -1567,6 +1628,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 11.54, + y: 0, + x: 0, }, }, flowRate: 2.2, @@ -1591,6 +1654,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 3.2, + y: 0, + x: 0, }, }, flowRate: 2.2, @@ -1632,6 +1697,8 @@ describe('advanced options', () => { wellLocation: { origin: 'bottom', offset: { + y: 0, + x: 0, z: 3.2, }, }, @@ -1657,6 +1724,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 3.2, + y: 0, + x: 0, }, }, flowRate: 2.2, @@ -1716,6 +1785,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 11.54, + y: 0, + x: 0, }, }, flowRate: 2.1, @@ -1756,6 +1827,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 3.1, + y: 0, + x: 0, }, }, flowRate: 2.1, @@ -1780,6 +1853,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 3.1, + y: 0, + x: 0, }, }, flowRate: 2.2, @@ -1805,6 +1880,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 3.1, + y: 0, + x: 0, }, }, flowRate: 2.1, @@ -1829,6 +1906,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 3.1, + y: 0, + x: 0, }, }, flowRate: 2.2, @@ -1854,6 +1933,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 3.1, + y: 0, + x: 0, }, }, flowRate: 2.1, @@ -1913,6 +1994,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 11.54, + y: 0, + x: 0, }, }, flowRate: 2.1, @@ -1939,6 +2022,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 11.54, + y: 0, + x: 0, }, }, flowRate: 2.2, @@ -1963,6 +2048,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: DISPENSE_OFFSET_FROM_BOTTOM_MM, + y: 0, + x: 0, }, }, flowRate: 2.2, @@ -2005,6 +2092,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: DISPENSE_OFFSET_FROM_BOTTOM_MM, + y: 0, + x: 0, }, }, flowRate: 2.1, @@ -2029,6 +2118,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: DISPENSE_OFFSET_FROM_BOTTOM_MM, + y: 0, + x: 0, }, }, flowRate: 2.2, @@ -2091,6 +2182,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 3.1, + y: 0, + x: 0, }, }, flowRate: 2.1, @@ -2115,6 +2208,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 3.1, + y: 0, + x: 0, }, }, flowRate: 2.2, @@ -2140,6 +2235,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 3.1, + y: 0, + x: 0, }, }, flowRate: 2.1, @@ -2197,6 +2294,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 11.54, + y: 0, + x: 0, }, }, pipetteId: 'p300SingleId', @@ -2222,6 +2321,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 11.54, + y: 0, + x: 0, }, }, pipetteId: 'p300SingleId', @@ -2248,6 +2349,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: DISPENSE_OFFSET_FROM_BOTTOM_MM, + y: 0, + x: 0, }, }, flowRate: 2.2, @@ -2290,6 +2393,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: DISPENSE_OFFSET_FROM_BOTTOM_MM, + y: 0, + x: 0, }, }, flowRate: 2.1, @@ -2314,6 +2419,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: DISPENSE_OFFSET_FROM_BOTTOM_MM, + y: 0, + x: 0, }, }, flowRate: 2.2, @@ -2374,6 +2481,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 11.54, + y: 0, + x: 0, }, }, }, @@ -2442,6 +2551,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 3.1, + y: 0, + x: 0, }, }, flowRate: 2.1, @@ -2466,6 +2577,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 3.1, + y: 0, + x: 0, }, }, flowRate: 2.2, @@ -2491,6 +2604,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 3.1, + y: 0, + x: 0, }, }, flowRate: 2.1, @@ -2515,6 +2630,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 3.1, + y: 0, + x: 0, }, }, flowRate: 2.2, @@ -2540,6 +2657,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 3.1, + y: 0, + x: 0, }, }, flowRate: 2.1, @@ -2599,6 +2718,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 11.54, + y: 0, + x: 0, }, }, flowRate: 2.1, @@ -2625,6 +2746,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 11.54, + y: 0, + x: 0, }, }, flowRate: 2.2, @@ -2649,6 +2772,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: DISPENSE_OFFSET_FROM_BOTTOM_MM, + y: 0, + x: 0, }, }, flowRate: 2.2, @@ -2691,6 +2816,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: DISPENSE_OFFSET_FROM_BOTTOM_MM, + y: 0, + x: 0, }, }, flowRate: 2.1, @@ -2715,6 +2842,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: DISPENSE_OFFSET_FROM_BOTTOM_MM, + y: 0, + x: 0, }, }, flowRate: 2.2, @@ -2777,6 +2906,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 3.1, + y: 0, + x: 0, }, }, flowRate: 2.1, @@ -2801,6 +2932,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 3.1, + y: 0, + x: 0, }, }, flowRate: 2.2, @@ -2826,6 +2959,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 3.1, + y: 0, + x: 0, }, }, flowRate: 2.1, @@ -2885,6 +3020,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 11.54, + y: 0, + x: 0, }, }, flowRate: 2.1, @@ -2911,6 +3048,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 11.54, + y: 0, + x: 0, }, }, flowRate: 2.2, @@ -2935,6 +3074,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: DISPENSE_OFFSET_FROM_BOTTOM_MM, + y: 0, + x: 0, }, }, flowRate: 2.2, @@ -2977,6 +3118,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: DISPENSE_OFFSET_FROM_BOTTOM_MM, + y: 0, + x: 0, }, }, flowRate: 2.1, @@ -3001,6 +3144,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: DISPENSE_OFFSET_FROM_BOTTOM_MM, + y: 0, + x: 0, }, }, flowRate: 2.2, @@ -3061,6 +3206,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 11.54, + y: 0, + x: 0, }, }, }, @@ -3127,6 +3274,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 3.1, + y: 0, + x: 0, }, }, flowRate: 2.1, @@ -3151,6 +3300,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 3.1, + y: 0, + x: 0, }, }, flowRate: 2.2, @@ -3176,6 +3327,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 3.1, + y: 0, + x: 0, }, }, flowRate: 2.1, @@ -3200,6 +3353,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 3.1, + y: 0, + x: 0, }, }, flowRate: 2.2, @@ -3225,6 +3380,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 3.1, + y: 0, + x: 0, }, }, flowRate: 2.1, @@ -3284,6 +3441,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 11.54, + y: 0, + x: 0, }, }, flowRate: 2.1, @@ -3310,6 +3469,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 11.54, + y: 0, + x: 0, }, }, flowRate: 2.2, @@ -3334,6 +3495,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: DISPENSE_OFFSET_FROM_BOTTOM_MM, + y: 0, + x: 0, }, }, flowRate: 2.2, @@ -3376,6 +3539,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: DISPENSE_OFFSET_FROM_BOTTOM_MM, + y: 0, + x: 0, }, }, flowRate: 2.1, @@ -3399,6 +3564,8 @@ describe('advanced options', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: DISPENSE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -3459,6 +3626,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 11.54, + y: 0, + x: 0, }, }, volume: 3, @@ -3511,6 +3680,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 3.1, + y: 0, + x: 0, }, }, flowRate: 2.1, @@ -3535,6 +3706,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 3.1, + y: 0, + x: 0, }, }, flowRate: 2.2, @@ -3560,6 +3733,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 3.1, + y: 0, + x: 0, }, }, flowRate: 2.1, @@ -3619,6 +3794,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 11.54, + y: 0, + x: 0, }, }, flowRate: 2.1, @@ -3644,6 +3821,8 @@ describe('advanced options', () => { wellLocation: { origin: 'bottom', offset: { + x: 0, + y: 0, z: 11.54, }, }, @@ -3669,6 +3848,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: DISPENSE_OFFSET_FROM_BOTTOM_MM, + y: 0, + x: 0, }, }, flowRate: 2.2, @@ -3711,6 +3892,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: DISPENSE_OFFSET_FROM_BOTTOM_MM, + y: 0, + x: 0, }, }, flowRate: 2.1, @@ -3735,6 +3918,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: DISPENSE_OFFSET_FROM_BOTTOM_MM, + y: 0, + x: 0, }, }, flowRate: 2.2, @@ -3795,6 +3980,8 @@ describe('advanced options', () => { origin: 'bottom', offset: { z: 11.54, + y: 0, + x: 0, }, }, }, diff --git a/step-generation/src/commandCreators/atomic/aspirate.ts b/step-generation/src/commandCreators/atomic/aspirate.ts index fb360c4cebf5..d7226da3387a 100644 --- a/step-generation/src/commandCreators/atomic/aspirate.ts +++ b/step-generation/src/commandCreators/atomic/aspirate.ts @@ -18,6 +18,8 @@ import type { AspirateParams } from '@opentrons/shared-data/protocol/types/schem import type { CommandCreator, CommandCreatorError } from '../../types' export interface ExtendedAspirateParams extends AspirateParams { + xOffset: number + yOffset: number tipRack: string } /** Aspirate with given args. Requires tip. */ @@ -35,6 +37,8 @@ export const aspirate: CommandCreator = ( flowRate, isAirGap, tipRack, + xOffset, + yOffset, } = args const actionName = 'aspirate' const errors: CommandCreatorError[] = [] @@ -208,6 +212,8 @@ export const aspirate: CommandCreator = ( origin: 'bottom', offset: { z: offsetFromBottomMm, + x: xOffset, + y: yOffset, }, }, flowRate, diff --git a/step-generation/src/commandCreators/atomic/dispense.ts b/step-generation/src/commandCreators/atomic/dispense.ts index 58c7019fe757..2bec571bd6e6 100644 --- a/step-generation/src/commandCreators/atomic/dispense.ts +++ b/step-generation/src/commandCreators/atomic/dispense.ts @@ -16,8 +16,12 @@ import type { CreateCommand } from '@opentrons/shared-data' import type { DispenseParams } from '@opentrons/shared-data/protocol/types/schemaV3' import type { CommandCreator, CommandCreatorError } from '../../types' +export interface ExtendedDispenseParams extends DispenseParams { + xOffset: number + yOffset: number +} /** Dispense with given args. Requires tip. */ -export const dispense: CommandCreator = ( +export const dispense: CommandCreator = ( args, invariantContext, prevRobotState @@ -30,6 +34,8 @@ export const dispense: CommandCreator = ( offsetFromBottomMm, flowRate, isAirGap, + xOffset, + yOffset, } = args const actionName = 'dispense' const errors: CommandCreatorError[] = [] @@ -172,6 +178,8 @@ export const dispense: CommandCreator = ( origin: 'bottom', offset: { z: offsetFromBottomMm, + x: xOffset, + y: yOffset, }, }, flowRate, diff --git a/step-generation/src/commandCreators/compound/consolidate.ts b/step-generation/src/commandCreators/compound/consolidate.ts index 09c1b02a9aee..4bfc89db7846 100644 --- a/step-generation/src/commandCreators/compound/consolidate.ts +++ b/step-generation/src/commandCreators/compound/consolidate.ts @@ -152,6 +152,10 @@ export const consolidate: CommandCreator = ( mixFirstAspirate, mixInDestination, dropTipLocation, + aspirateXOffset, + aspirateYOffset, + dispenseXOffset, + dispenseYOffset, } = args const aspirateAirGapVolume = args.aspirateAirGapVolume || 0 const maxWellsPerChunk = Math.floor( @@ -220,6 +224,8 @@ export const consolidate: CommandCreator = ( offsetFromBottomMm: airGapOffsetSourceWell, isAirGap: true, tipRack: args.tipRack, + xOffset: 0, + yOffset: 0, }), ...(aspirateDelay != null ? [ @@ -277,6 +283,8 @@ export const consolidate: CommandCreator = ( flowRate: aspirateFlowRateUlSec, offsetFromBottomMm: aspirateOffsetFromBottomMm, tipRack: args.tipRack, + xOffset: aspirateXOffset, + yOffset: aspirateYOffset, }), ...delayAfterAspirateCommands, ...touchTipAfterAspirateCommand, @@ -326,6 +334,10 @@ export const consolidate: CommandCreator = ( aspirateDelaySeconds: aspirateDelay?.seconds, dispenseDelaySeconds: dispenseDelay?.seconds, tipRack: args.tipRack, + aspirateXOffset, + aspirateYOffset, + dispenseXOffset, + dispenseYOffset, }) : [] const preWetTipCommands = args.preWetTip // Pre-wet tip is equivalent to a single mix, with volume equal to the consolidate volume. @@ -342,6 +354,10 @@ export const consolidate: CommandCreator = ( aspirateDelaySeconds: aspirateDelay?.seconds, dispenseDelaySeconds: dispenseDelay?.seconds, tipRack: args.tipRack, + aspirateXOffset, + aspirateYOffset, + dispenseXOffset, + dispenseYOffset, }) : [] // can not mix in a waste chute @@ -360,6 +376,10 @@ export const consolidate: CommandCreator = ( aspirateDelaySeconds: aspirateDelay?.seconds, dispenseDelaySeconds: dispenseDelay?.seconds, tipRack: args.tipRack, + aspirateXOffset, + aspirateYOffset, + dispenseXOffset, + dispenseYOffset, }) : [] @@ -385,6 +405,8 @@ export const consolidate: CommandCreator = ( well: destinationWell ?? undefined, flowRate: dispenseFlowRateUlSec, offsetFromBottomMm: dispenseOffsetFromBottomMm, + xOffset: dispenseXOffset, + yOffset: dispenseYOffset, }), ] diff --git a/step-generation/src/commandCreators/compound/distribute.ts b/step-generation/src/commandCreators/compound/distribute.ts index 9662a07d959c..520ce06aeb46 100644 --- a/step-generation/src/commandCreators/compound/distribute.ts +++ b/step-generation/src/commandCreators/compound/distribute.ts @@ -147,6 +147,10 @@ export const distribute: CommandCreator = ( dispenseFlowRateUlSec, dispenseOffsetFromBottomMm, blowoutLocation, + aspirateXOffset, + aspirateYOffset, + dispenseXOffset, + dispenseYOffset, } = args const aspirateAirGapVolume = args.aspirateAirGapVolume || 0 const dispenseAirGapVolume = args.dispenseAirGapVolume || 0 @@ -211,6 +215,8 @@ export const distribute: CommandCreator = ( flowRate: aspirateFlowRateUlSec, offsetFromBottomMm: airGapOffsetSourceWell, isAirGap: true, + xOffset: 0, + yOffset: 0, tipRack: args.tipRack, }), ...(aspirateDelay != null @@ -232,6 +238,8 @@ export const distribute: CommandCreator = ( flowRate: dispenseFlowRateUlSec, offsetFromBottomMm: airGapOffsetDestWell, isAirGap: true, + xOffset: 0, + yOffset: 0, }), ...(dispenseDelay != null ? [ @@ -290,6 +298,8 @@ export const distribute: CommandCreator = ( well: destWell, flowRate: dispenseFlowRateUlSec, offsetFromBottomMm: dispenseOffsetFromBottomMm, + xOffset: dispenseXOffset, + yOffset: dispenseYOffset, }), ...delayAfterDispenseCommands, ...touchTipAfterDispenseCommand, @@ -337,6 +347,8 @@ export const distribute: CommandCreator = ( offsetFromBottomMm: airGapOffsetDestWell, isAirGap: true, tipRack: args.tipRack, + xOffset: 0, + yOffset: 0, }), ...(aspirateDelay != null ? [ @@ -439,6 +451,10 @@ export const distribute: CommandCreator = ( aspirateDelaySeconds: aspirateDelay?.seconds, dispenseDelaySeconds: dispenseDelay?.seconds, tipRack: args.tipRack, + aspirateXOffset, + aspirateYOffset, + dispenseXOffset, + dispenseYOffset, }) : [] @@ -478,6 +494,8 @@ export const distribute: CommandCreator = ( flowRate: aspirateFlowRateUlSec, offsetFromBottomMm: aspirateOffsetFromBottomMm, tipRack: args.tipRack, + xOffset: aspirateXOffset, + yOffset: aspirateYOffset, }), ...delayAfterAspirateCommands, ...touchTipAfterAspirateCommand, diff --git a/step-generation/src/commandCreators/compound/mix.ts b/step-generation/src/commandCreators/compound/mix.ts index 4a918da5a0df..284529c7c1f2 100644 --- a/step-generation/src/commandCreators/compound/mix.ts +++ b/step-generation/src/commandCreators/compound/mix.ts @@ -35,6 +35,10 @@ export function mixUtil(args: { aspirateFlowRateUlSec: number dispenseFlowRateUlSec: number tipRack: string + aspirateXOffset: number + dispenseXOffset: number + aspirateYOffset: number + dispenseYOffset: number aspirateDelaySeconds?: number | null | undefined dispenseDelaySeconds?: number | null | undefined }): CurriedCommandCreator[] { @@ -51,6 +55,10 @@ export function mixUtil(args: { aspirateDelaySeconds, dispenseDelaySeconds, tipRack, + aspirateXOffset, + aspirateYOffset, + dispenseXOffset, + dispenseYOffset, } = args const getDelayCommand = (seconds?: number | null): CurriedCommandCreator[] => @@ -76,6 +84,8 @@ export function mixUtil(args: { offsetFromBottomMm: aspirateOffsetFromBottomMm, flowRate: aspirateFlowRateUlSec, tipRack, + xOffset: aspirateXOffset, + yOffset: aspirateYOffset, }), ...getDelayCommand(aspirateDelaySeconds), curryCommandCreator(dispense, { @@ -85,6 +95,8 @@ export function mixUtil(args: { well, offsetFromBottomMm: dispenseOffsetFromBottomMm, flowRate: dispenseFlowRateUlSec, + xOffset: dispenseXOffset, + yOffset: dispenseYOffset, }), ...getDelayCommand(dispenseDelaySeconds), ], @@ -123,6 +135,10 @@ export const mix: CommandCreator = ( blowoutOffsetFromTopMm, dropTipLocation, tipRack, + aspirateXOffset, + aspirateYOffset, + dispenseXOffset, + dispenseYOffset, } = data const is96Channel = @@ -257,6 +273,10 @@ export const mix: CommandCreator = ( aspirateDelaySeconds, dispenseDelaySeconds, tipRack, + aspirateXOffset, + aspirateYOffset, + dispenseXOffset, + dispenseYOffset, }) return [ ...configureNozzleLayoutCommand, diff --git a/step-generation/src/commandCreators/compound/transfer.ts b/step-generation/src/commandCreators/compound/transfer.ts index 6d57f7ee4575..f22638f6b482 100644 --- a/step-generation/src/commandCreators/compound/transfer.ts +++ b/step-generation/src/commandCreators/compound/transfer.ts @@ -205,6 +205,10 @@ export const transfer: CommandCreator = ( dispenseFlowRateUlSec, dispenseOffsetFromBottomMm, tipRack, + aspirateXOffset, + aspirateYOffset, + dispenseXOffset, + dispenseYOffset, } = args const aspirateAirGapVolume = args.aspirateAirGapVolume || 0 const dispenseAirGapVolume = args.dispenseAirGapVolume || 0 @@ -329,6 +333,10 @@ export const transfer: CommandCreator = ( aspirateDelaySeconds: aspirateDelay?.seconds, dispenseDelaySeconds: dispenseDelay?.seconds, tipRack, + aspirateXOffset, + aspirateYOffset, + dispenseXOffset, + dispenseYOffset, }) : [] const mixBeforeAspirateCommands = @@ -346,6 +354,10 @@ export const transfer: CommandCreator = ( aspirateDelaySeconds: aspirateDelay?.seconds, dispenseDelaySeconds: dispenseDelay?.seconds, tipRack, + aspirateXOffset, + aspirateYOffset, + dispenseXOffset, + dispenseYOffset, }) : [] const delayAfterAspirateCommands = @@ -410,6 +422,10 @@ export const transfer: CommandCreator = ( aspirateDelaySeconds: aspirateDelay?.seconds, dispenseDelaySeconds: dispenseDelay?.seconds, tipRack, + aspirateXOffset, + aspirateYOffset, + dispenseXOffset, + dispenseYOffset, }) : [] @@ -425,6 +441,8 @@ export const transfer: CommandCreator = ( offsetFromBottomMm: airGapOffsetSourceWell, isAirGap: true, tipRack, + xOffset: 0, + yOffset: 0, }), ...(aspirateDelay != null ? [ @@ -445,6 +463,8 @@ export const transfer: CommandCreator = ( flowRate: dispenseFlowRateUlSec, offsetFromBottomMm: airGapOffsetDestWell, isAirGap: true, + xOffset: 0, + yOffset: 0, }), ...(dispenseDelay != null ? [ @@ -486,6 +506,8 @@ export const transfer: CommandCreator = ( flowRate: aspirateFlowRateUlSec, offsetFromBottomMm: aspirateOffsetFromBottomMm, tipRack, + xOffset: aspirateXOffset, + yOffset: aspirateYOffset, }), ] const dispenseCommand = [ @@ -496,6 +518,8 @@ export const transfer: CommandCreator = ( well: destinationWell ?? undefined, flowRate: dispenseFlowRateUlSec, offsetFromBottomMm: dispenseOffsetFromBottomMm, + xOffset: dispenseXOffset, + yOffset: dispenseYOffset, }), ] diff --git a/step-generation/src/fixtures/commandFixtures.ts b/step-generation/src/fixtures/commandFixtures.ts index 2c38a361ee7a..3d1ee3945745 100644 --- a/step-generation/src/fixtures/commandFixtures.ts +++ b/step-generation/src/fixtures/commandFixtures.ts @@ -129,6 +129,8 @@ export const makeAspirateHelper: MakeAspDispHelper = bakedP wellLocation: { origin: 'bottom', offset: { + y: 0, + x: 0, z: ASPIRATE_OFFSET_FROM_BOTTOM_MM, }, }, @@ -199,6 +201,8 @@ const _defaultDispenseParams = { wellLocation: { origin: 'bottom' as const, offset: { + y: 0, + x: 0, z: DISPENSE_OFFSET_FROM_BOTTOM_MM, }, }, diff --git a/step-generation/src/types.ts b/step-generation/src/types.ts index 98e1e8ec90c8..6cef80c43ed1 100644 --- a/step-generation/src/types.ts +++ b/step-generation/src/types.ts @@ -192,6 +192,10 @@ export type SharedTransferLikeArgs = CommonArgs & { aspirateFlowRateUlSec: number /** offset from bottom of well in mm */ aspirateOffsetFromBottomMm: number + /** x offset mm */ + aspirateXOffset: number + /** y offset mm */ + aspirateYOffset: number // ===== DISPENSE SETTINGS ===== /** Air gap after dispense */ @@ -206,6 +210,10 @@ export type SharedTransferLikeArgs = CommonArgs & { dispenseFlowRateUlSec: number /** offset from bottom of well in mm */ dispenseOffsetFromBottomMm: number + /** x offset mm */ + dispenseXOffset: number + /** y offset mm */ + dispenseYOffset: number } export type ConsolidateArgs = SharedTransferLikeArgs & { @@ -286,6 +294,12 @@ export type MixArgs = CommonArgs & { /** offset from bottom of well in mm */ aspirateOffsetFromBottomMm: number dispenseOffsetFromBottomMm: number + /** x offset */ + aspirateXOffset: number + dispenseXOffset: number + /** y offset */ + aspirateYOffset: number + dispenseYOffset: number /** flow rates in uL/sec */ aspirateFlowRateUlSec: number dispenseFlowRateUlSec: number diff --git a/step-generation/src/utils/misc.ts b/step-generation/src/utils/misc.ts index c9f36587213c..58bf2e9f782b 100644 --- a/step-generation/src/utils/misc.ts +++ b/step-generation/src/utils/misc.ts @@ -479,6 +479,8 @@ interface DispenseLocationHelperArgs { pipetteId: string volume: number flowRate: number + xOffset: number + yOffset: number offsetFromBottomMm?: number well?: string } @@ -494,6 +496,8 @@ export const dispenseLocationHelper: CommandCreator flowRate, offsetFromBottomMm, well, + xOffset, + yOffset, } = args const trashOrLabware = getTrashOrLabware( @@ -516,6 +520,8 @@ export const dispenseLocationHelper: CommandCreator well, flowRate, offsetFromBottomMm, + xOffset, + yOffset, }), ] } else if (trashOrLabware === 'wasteChute') { @@ -660,6 +666,8 @@ export const airGapHelper: CommandCreator = ( offsetFromBottomMm, isAirGap: true, tipRack, + xOffset: 0, + yOffset: 0, }), ] // when aspirating out of multi wells for consolidate @@ -674,6 +682,9 @@ export const airGapHelper: CommandCreator = ( offsetFromBottomMm, isAirGap: true, tipRack, + // NOTE: airgap aspirates happen at default x/y offset + xOffset: 0, + yOffset: 0, }), ] }