Skip to content

Commit

Permalink
feat(shared-data, app): separate definition for 96-channel tip rack a…
Browse files Browse the repository at this point in the history
…dapter (#13379)

split definition for 96 channel tip rack adapter and logic to support that for LPC

---------

Co-authored-by: Jethary <[email protected]>
Co-authored-by: Brian Cooper <[email protected]>
  • Loading branch information
3 people authored Aug 25, 2023
1 parent 80ad147 commit f1f6c29
Show file tree
Hide file tree
Showing 14 changed files with 266 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,17 +146,17 @@ export const LabwarePositionCheckComponent = (
const [currentStepIndex, setCurrentStepIndex] = React.useState<number>(0)
const handleCleanUpAndClose = (): void => {
setIsExiting(true)
const dropTipToBeSafeCommands: DropTipCreateCommand[] = (
protocolData?.pipettes ?? []
).map(pip => ({
commandType: 'dropTip' as const,
params: {
pipetteId: pip.id,
labwareId: FIXED_TRASH_ID,
wellName: 'A1',
wellLocation: { origin: 'default' as const },
},
}))
const dropTipToBeSafeCommands: DropTipCreateCommand[] = goldenLPC
? []
: (protocolData?.pipettes ?? []).map(pip => ({
commandType: 'dropTip' as const,
params: {
pipetteId: pip.id,
labwareId: FIXED_TRASH_ID,
wellName: 'A1',
wellLocation: { origin: 'default' as const },
},
}))
chainRunCommands(
maintenanceRunId,
[
Expand Down
88 changes: 71 additions & 17 deletions app/src/organisms/LabwarePositionCheck/PickUpTip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
getVectorDifference,
HEATERSHAKER_MODULE_TYPE,
IDENTITY_VECTOR,
MoveLabwareCreateCommand,
} from '@opentrons/shared-data'
import { useChainRunCommands } from '../../resources/runs/hooks'
import { UnorderedList } from '../../molecules/UnorderedList'
Expand Down Expand Up @@ -60,6 +61,7 @@ export const PickUpTip = (props: PickUpTipProps): JSX.Element | null => {
existingOffsets,
workingOffsets,
setFatalError,
adapterId,
} = props
const [showTipConfirmation, setShowTipConfirmation] = React.useState(false)

Expand All @@ -69,7 +71,6 @@ export const PickUpTip = (props: PickUpTipProps): JSX.Element | null => {
const pipetteMount = pipette?.mount
if (pipetteName == null || labwareDef == null || pipetteMount == null)
return null

const pipetteZMotorAxis: 'leftZ' | 'rightZ' =
pipetteMount === 'left' ? 'leftZ' : 'rightZ'

Expand Down Expand Up @@ -102,6 +103,42 @@ export const PickUpTip = (props: PickUpTipProps): JSX.Element | null => {
o.initialPosition != null
)?.initialPosition

let moveLabware: MoveLabwareCreateCommand[]
if (adapterId != null) {
moveLabware = [
{
commandType: 'moveLabware' as const,
params: {
labwareId: adapterId,
newLocation: { slotName: location.slotName },
strategy: 'manualMoveWithoutPause',
},
},
{
commandType: 'moveLabware' as const,
params: {
labwareId,
newLocation:
adapterId != null
? { labwareId: adapterId }
: { slotName: location.slotName },
strategy: 'manualMoveWithoutPause',
},
},
]
} else {
moveLabware = [
{
commandType: 'moveLabware' as const,
params: {
labwareId,
newLocation: location,
strategy: 'manualMoveWithoutPause',
},
},
]
}

const handleConfirmPlacement = (): void => {
const modulePrepCommands = protocolData.modules.reduce<CreateCommand[]>(
(acc, module) => {
Expand All @@ -121,14 +158,7 @@ export const PickUpTip = (props: PickUpTipProps): JSX.Element | null => {
chainRunCommands(
[
...modulePrepCommands,
{
commandType: 'moveLabware' as const,
params: {
labwareId: labwareId,
newLocation: location,
strategy: 'manualMoveWithoutPause',
},
},
...moveLabware,
{
commandType: 'moveToWell' as const,
params: {
Expand Down Expand Up @@ -212,6 +242,37 @@ export const PickUpTip = (props: PickUpTipProps): JSX.Element | null => {
})
}

const moveLabwareOffDeck: MoveLabwareCreateCommand[] =
adapterId != null
? [
{
commandType: 'moveLabware' as const,
params: {
labwareId: labwareId,
newLocation: 'offDeck',
strategy: 'manualMoveWithoutPause',
},
},
{
commandType: 'moveLabware' as const,
params: {
labwareId: adapterId,
newLocation: 'offDeck',
strategy: 'manualMoveWithoutPause',
},
},
]
: [
{
commandType: 'moveLabware' as const,
params: {
labwareId: labwareId,
newLocation: 'offDeck',
strategy: 'manualMoveWithoutPause',
},
},
]

const handleConfirmTipAttached = (): void => {
chainRunCommands(
[
Expand All @@ -229,14 +290,7 @@ export const PickUpTip = (props: PickUpTipProps): JSX.Element | null => {
commandType: 'retractAxis' as const,
params: { axis: 'y' },
},
{
commandType: 'moveLabware' as const,
params: {
labwareId: labwareId,
newLocation: 'offDeck',
strategy: 'manualMoveWithoutPause',
},
},
...moveLabwareOffDeck,
],
false
)
Expand Down
87 changes: 71 additions & 16 deletions app/src/organisms/LabwarePositionCheck/ReturnTip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
getLabwareDisplayName,
getModuleType,
HEATERSHAKER_MODULE_TYPE,
MoveLabwareCreateCommand,
} from '@opentrons/shared-data'
import { StyledText } from '../../atoms/text'
import { UnorderedList } from '../../molecules/UnorderedList'
Expand Down Expand Up @@ -42,6 +43,7 @@ export const ReturnTip = (props: ReturnTipProps): JSX.Element | null => {
isRobotMoving,
chainRunCommands,
setFatalError,
adapterId,
} = props

const labwareDef = getLabwareDef(labwareId, protocolData)
Expand Down Expand Up @@ -70,6 +72,73 @@ export const ReturnTip = (props: ReturnTipProps): JSX.Element | null => {
/>,
]

let moveLabware: MoveLabwareCreateCommand[]
if (adapterId != null) {
moveLabware = [
{
commandType: 'moveLabware' as const,
params: {
labwareId: adapterId,
newLocation: { slotName: location.slotName },
strategy: 'manualMoveWithoutPause',
},
},
{
commandType: 'moveLabware' as const,
params: {
labwareId,
newLocation:
adapterId != null
? { labwareId: adapterId }
: { slotName: location.slotName },
strategy: 'manualMoveWithoutPause',
},
},
]
} else {
moveLabware = [
{
commandType: 'moveLabware' as const,
params: {
labwareId,
newLocation: location,
strategy: 'manualMoveWithoutPause',
},
},
]
}

const moveLabwareOffDeck: MoveLabwareCreateCommand[] =
adapterId != null
? [
{
commandType: 'moveLabware' as const,
params: {
labwareId: labwareId,
newLocation: 'offDeck',
strategy: 'manualMoveWithoutPause',
},
},
{
commandType: 'moveLabware' as const,
params: {
labwareId: adapterId,
newLocation: 'offDeck',
strategy: 'manualMoveWithoutPause',
},
},
]
: [
{
commandType: 'moveLabware' as const,
params: {
labwareId: labwareId,
newLocation: 'offDeck',
strategy: 'manualMoveWithoutPause',
},
},
]

const handleConfirmPlacement = (): void => {
const modulePrepCommands = protocolData.modules.reduce<CreateCommand[]>(
(acc, module) => {
Expand All @@ -89,14 +158,7 @@ export const ReturnTip = (props: ReturnTipProps): JSX.Element | null => {
chainRunCommands(
[
...modulePrepCommands,
{
commandType: 'moveLabware' as const,
params: {
labwareId: labwareId,
newLocation: location,
strategy: 'manualMoveWithoutPause',
},
},
...moveLabware,
{
commandType: 'moveToWell' as const,
params: {
Expand All @@ -121,14 +183,7 @@ export const ReturnTip = (props: ReturnTipProps): JSX.Element | null => {
},
},
},
{
commandType: 'moveLabware' as const,
params: {
labwareId: labwareId,
newLocation: 'offDeck',
strategy: 'manualMoveWithoutPause',
},
},
...moveLabwareOffDeck,
{ commandType: 'home' as const, params: {} },
],
false
Expand Down
3 changes: 3 additions & 0 deletions app/src/organisms/LabwarePositionCheck/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface CheckTipRacksStep {
pipetteId: string
labwareId: string
location: LabwareOffsetLocation
adapterId?: string
}
export interface AttachProbeStep {
section: typeof SECTIONS.ATTACH_PROBE
Expand All @@ -31,6 +32,7 @@ export interface PickUpTipStep {
pipetteId: string
labwareId: string
location: LabwareOffsetLocation
adapterId?: string
}
export interface CheckPositionsStep {
section: typeof SECTIONS.CHECK_POSITIONS
Expand All @@ -52,6 +54,7 @@ export interface ReturnTipStep {
pipetteId: string
labwareId: string
location: LabwareOffsetLocation
adapterId?: string
}
export interface DetachProbeStep {
section: typeof SECTIONS.DETACH_PROBE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const getCheckSteps = (args: LPCArgs): LabwarePositionCheckStep[] => {
labwareId: lastTiprackCheckStep.labwareId,
pipetteId: lastTiprackCheckStep.pipetteId,
location: lastTiprackCheckStep.location,
adapterId: lastTiprackCheckStep.adapterId,
}
const checkLabwareSectionSteps = getCheckLabwareSectionSteps(args)

Expand All @@ -53,6 +54,7 @@ export const getCheckSteps = (args: LPCArgs): LabwarePositionCheckStep[] => {
labwareId: lastTiprackCheckStep.labwareId,
pipetteId: lastTiprackCheckStep.pipetteId,
location: lastTiprackCheckStep.location,
adapterId: lastTiprackCheckStep.adapterId,
}

return [
Expand Down Expand Up @@ -130,11 +132,12 @@ function getCheckTipRackSectionSteps(args: LPCArgs): CheckTipRacksStep[] {

return [
...acc,
...labwareLocations.map(({ location }) => ({
...labwareLocations.map(({ location, adapterId }) => ({
section: SECTIONS.CHECK_TIP_RACKS,
labwareId: params.labwareId,
pipetteId: params.pipetteId,
location,
adapterId,
})),
]
}, [])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import { SECTIONS } from '../constants'
import {
CompletedProtocolAnalysis,
LoadedPipette,
getLabwareDefURI,
getPipetteNameSpecs,
} from '@opentrons/shared-data'
import { getLabwareLocationCombos } from '../../ApplyHistoricOffsets/hooks/getLabwareLocationCombos'

import type { LabwarePositionCheckStep, CheckPositionsStep } from '../types'
import type { LabwareLocationCombo } from '../../ApplyHistoricOffsets/hooks/getLabwareLocationCombos'
import { getLabwareDefinitionsFromCommands } from './labware'

function getPrimaryPipetteId(pipettes: LoadedPipette[]): string {
if (pipettes.length < 1) {
Expand Down Expand Up @@ -51,8 +53,15 @@ function getAllCheckSectionSteps(
labware,
modules
)
const labwareDefinitions = getLabwareDefinitionsFromCommands(commands)
const labwareLocations = labwareLocationCombos.reduce<LabwareLocationCombo[]>(
(acc, labwareLocationCombo) => {
const labwareDef = labwareDefinitions.find(
def => getLabwareDefURI(def) === labwareLocationCombo.definitionUri
)
if ((labwareDef?.allowedRoles ?? []).includes('adapter')) {
return acc
}
// remove duplicate definitionUri in same location
const comboAlreadyExists = acc.some(
accLocationCombo =>
Expand All @@ -65,11 +74,14 @@ function getAllCheckSectionSteps(
[]
)

return labwareLocations.map(({ location, labwareId, moduleId }) => ({
section: SECTIONS.CHECK_POSITIONS,
labwareId: labwareId,
pipetteId: getPrimaryPipetteId(pipettes),
location,
moduleId,
}))
return labwareLocations.map(
({ location, labwareId, moduleId, adapterId }) => ({
section: SECTIONS.CHECK_POSITIONS,
labwareId: labwareId,
pipetteId: getPrimaryPipetteId(pipettes),
location,
moduleId,
adapterId,
})
)
}
Loading

0 comments on commit f1f6c29

Please sign in to comment.