-
Notifications
You must be signed in to change notification settings - Fork 180
/
Copy pathblowOutInTrash.ts
48 lines (45 loc) · 1.47 KB
/
blowOutInTrash.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { reduceCommandCreators, curryWithoutPython } from '../../utils'
import { ZERO_OFFSET } from '../../constants'
import { blowOutInPlace, moveToAddressableArea } from '../atomic'
import type { CurriedCommandCreator, CommandCreator } from '../../types'
interface BlowOutInTrashParams {
pipetteId: string
flowRate: number
trashId: string
}
export const blowOutInTrash: CommandCreator<BlowOutInTrashParams> = (
args,
invariantContext,
prevRobotState
) => {
const { pipetteId, trashId, flowRate } = args
const { pipetteEntities, additionalEquipmentEntities } = invariantContext
const trashEntity = additionalEquipmentEntities[trashId]
const pipettePythonName = pipetteEntities[pipetteId].pythonName
const trashPythonName = trashEntity.pythonName
const pythonCommandCreator: CurriedCommandCreator = () => ({
commands: [],
python:
// The Python blow_out() does not take a flow rate argument, so we have to
// reconfigure the pipette's default blow out rate instead:
`${pipettePythonName}.flow_rate.blow_out = ${flowRate}\n` +
`${pipettePythonName}.blow_out(${trashPythonName})`,
})
const commandCreators = [
curryWithoutPython(moveToAddressableArea, {
pipetteId,
fixtureId: trashId,
offset: ZERO_OFFSET,
}),
curryWithoutPython(blowOutInPlace, {
pipetteId,
flowRate,
}),
pythonCommandCreator,
]
return reduceCommandCreators(
commandCreators,
invariantContext,
prevRobotState
)
}