Skip to content

Commit e5bfd63

Browse files
committed
add delayInwell
1 parent 71b9907 commit e5bfd63

File tree

3 files changed

+80
-0
lines changed

3 files changed

+80
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { curryCommandCreator, reduceCommandCreators } from '../../utils'
2+
import { delay, moveToWell } from '../atomic'
3+
import type { CommandCreator, CurriedCommandCreator } from '../../types'
4+
5+
interface DelayInWellArgs {
6+
pipetteId: string
7+
destinationId: string
8+
well: string
9+
zOffset: number
10+
seconds: number
11+
}
12+
13+
export const delayInWell: CommandCreator<DelayInWellArgs> = (
14+
args,
15+
invariantContext,
16+
prevRobotState
17+
) => {
18+
const { destinationId, well, zOffset, seconds, pipetteId } = args
19+
20+
const commandCreators: CurriedCommandCreator[] = [
21+
curryCommandCreator(moveToWell, {
22+
pipetteId: pipetteId,
23+
labwareId: destinationId,
24+
wellName: well,
25+
wellLocation: {
26+
origin: 'bottom',
27+
offset: { x: 0, y: 0, z: zOffset },
28+
},
29+
}),
30+
curryCommandCreator(delay, {
31+
seconds: seconds,
32+
}),
33+
]
34+
35+
return reduceCommandCreators(
36+
commandCreators,
37+
invariantContext,
38+
prevRobotState
39+
)
40+
}

step-generation/src/commandCreators/compound/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export { airGapInWell } from './airGapInWell'
66
export { blowOutInTrash } from './blowOutInTrash'
77
export { blowOutInWasteChute } from './blowOutInWasteChute'
88
export { consolidate } from './consolidate'
9+
export { delayInWell } from './delayInWell'
910
export { dispenseInTrash } from './dispenseInTrash'
1011
export { dispenseInWasteChute } from './dispenseInWasteChute'
1112
export { distribute } from './distribute'

step-generation/src/utils/misc.ts

+39
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ import type {
5555
RobotState,
5656
SourceAndDest,
5757
} from '../types'
58+
import { delayInWell } from '../commandCreators/compound/delayInWell'
5859
export const AIR: '__air__' = '__air__'
5960
export const SOURCE_WELL_BLOWOUT_DESTINATION: 'source_well' = 'source_well'
6061
export const DEST_WELL_BLOWOUT_DESTINATION: 'dest_well' = 'dest_well'
@@ -780,3 +781,41 @@ export const airGapLocationHelper: CommandCreator<AirGapLocationArgs> = (
780781

781782
return reduceCommandCreators(commands, invariantContext, prevRobotState)
782783
}
784+
785+
interface MoveAndDelayLocationHelperArgs {
786+
pipetteId: string
787+
destinationId: string
788+
well: string | null
789+
zOffset: number
790+
seconds: number
791+
}
792+
793+
export const moveAndDelayLocationHelper: CommandCreator<MoveAndDelayLocationHelperArgs> = (
794+
args,
795+
invariantContext,
796+
prevRobotState
797+
) => {
798+
const { pipetteId, destinationId, well, zOffset, seconds } = args
799+
const { labwareEntities, additionalEquipmentEntities } = invariantContext
800+
const trashOrLabware = getTrashOrLabware(
801+
labwareEntities,
802+
additionalEquipmentEntities,
803+
destinationId
804+
)
805+
806+
let commands: CurriedCommandCreator[] = []
807+
808+
if (well != null && trashOrLabware === 'labware') {
809+
commands = [
810+
curryCommandCreator(delayInWell, {
811+
destinationId,
812+
well,
813+
zOffset,
814+
seconds,
815+
pipetteId,
816+
}),
817+
]
818+
}
819+
820+
return reduceCommandCreators(commands, invariantContext, prevRobotState)
821+
}

0 commit comments

Comments
 (0)