Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(step-generation): py commands for move_to well #17846

Merged
merged 4 commits into from
Mar 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion shared-data/command/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export * from './pipetting'
export * from './setup'
export * from './timing'
export * from './unsafe'

export * from './support'
// NOTE: these key/value pairs will only be present on commands at analysis/run time
// they pertain only to the actual execution status of a command on hardware, as opposed to
// the command's identity and parameters which can be known prior to runtime
Expand Down
14 changes: 14 additions & 0 deletions step-generation/src/__tests__/moveToWell.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
SOURCE_LABWARE,
} from '../fixtures'
import type { InvariantContext, RobotState } from '../types'
import type { WellOrigin } from '@opentrons/shared-data'

vi.mock('../utils/absorbanceReaderCollision')
vi.mock('../utils/thermocyclerPipetteCollision')
Expand All @@ -46,6 +47,10 @@ describe('moveToWell', () => {
pipetteId: DEFAULT_PIPETTE,
labwareId: SOURCE_LABWARE,
wellName: 'A1',
wellLocation: {
origin: 'bottom' as WellOrigin,
offset: { z: 1 },
},
}
const result = moveToWell(params, invariantContext, robotStateWithTip)
expect(getSuccessResult(result).commands).toEqual([
Expand All @@ -56,9 +61,18 @@ describe('moveToWell', () => {
pipetteId: DEFAULT_PIPETTE,
labwareId: SOURCE_LABWARE,
wellName: 'A1',
wellLocation: {
origin: 'bottom' as any,
offset: {
z: 1,
},
},
},
},
])
expect(getSuccessResult(result).python).toBe(
'mockPythonName.move_to(mockPythonName["A1"].bottom(z=1))'
)
})
it('should apply the optional params to the command', () => {
const params = {
Expand Down
16 changes: 12 additions & 4 deletions step-generation/src/commandCreators/atomic/moveToWell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import {
getIsHeaterShakerEastWestMultiChannelPipette,
getIsHeaterShakerNorthSouthOfNonTiprackWithMultiChannelPipette,
uuid,
formatPyStr,
formatPyWellLocation,
} from '../../utils'
import { COLUMN_4_SLOTS } from '../../constants'
import type { CreateCommand, MoveToWellParams } from '@opentrons/shared-data'
Expand All @@ -34,9 +36,8 @@ export const moveToWell: CommandCreator<MoveToWellParams> = (
const actionName = 'moveToWell'
const errors: CommandCreatorError[] = []
const labwareState = prevRobotState.labware
// TODO(2020-07-30, IL): the below is duplicated or at least similar
// across aspirate/dispense/blowout, we can probably DRY it up
const pipetteSpec = invariantContext.pipetteEntities[pipetteId]?.spec
const { pipetteEntities, labwareEntities } = invariantContext
const pipetteSpec = pipetteEntities[pipetteId]?.spec
const isFlexPipette =
(pipetteSpec?.displayCategory === 'FLEX' || pipetteSpec?.channels === 96) ??
false
Expand Down Expand Up @@ -160,7 +161,7 @@ export const moveToWell: CommandCreator<MoveToWellParams> = (
prevRobotState.modules,
slotName,
pipetteSpec,
invariantContext.labwareEntities[labwareId]
labwareEntities[labwareId]
)
) {
errors.push(
Expand All @@ -174,6 +175,9 @@ export const moveToWell: CommandCreator<MoveToWellParams> = (
}
}

const pipettePythonName = pipetteEntities[pipetteId].pythonName
const labwarePythonName = labwareEntities[labwareId].pythonName

const commands: CreateCommand[] = [
{
commandType: 'moveToWell',
Expand All @@ -188,7 +192,11 @@ export const moveToWell: CommandCreator<MoveToWellParams> = (
},
},
]
// NOTE: forceDirect and minimumZHeight were never wired up in the form or stepArgs
return {
commands,
python: `${pipettePythonName}.move_to(${labwarePythonName}[${formatPyStr(
wellName
)}]${formatPyWellLocation(wellLocation)})`,
}
}
Loading