Add OT-2 Calibration Data and Labware Offsets to PyLabRobot

I used the Opentrons app to calibrate my robot, but the calibration is off when I use PyLabRobot. Is there a way to add the calibration data to a protocol?

the calibration should actually be stored on the machine itself, and it should be used with ot as well as plr.

dumb question: do you use the correct resources in your deck setup?

you can apply offsets to individual commands like lh.aspirate with the offsets parameter.

with this, can you share how much the offset is approximately? a couple of weeks ago I fixed a bug in the resource loading on OT, but perhaps i made a mistake. fix OT resource loading and defining · PyLabRobot/pylabrobot@f19506d · GitHub

After playing around a little bit more, the issue seems to be strictly on the z axis, but it is inconsistent. The pipette does not lower enough (by about a centimeter) to successfully pick up a tip, but returning and discarding tips work fine. Aspirating and dispensing defaults to the top of the resource rather than 2 mm from the bottom. Trying to add offsets to an aspirate command gives me an error that “name Coordinate is not defined.”

await lh.aspirate(plate_1[“A1”], vols=[10], offsets=[Coordinate(0,0,10)])

Planning to take another look tomorrow morning with fresh eyes and find spots in my code where there may be errors. I’ll post another update tomorrow.

from pylabrobot.resources import Coordinate

1 Like

Update, here’s some code I used to test:

#Resources
tip_rack1 = opentrons_96_tiprack_20ul(name=‘tips_01’)
lh.deck.assign_child_at_slot(tip_rack1, slot=1)
plate_1 = corning_96_wellplate_360ul_flat(name=‘plate_01’)
lh.deck.assign_child_at_slot(plate_1, slot=4)
tube_rack1 = opentrons_15_tuberack_nest_15ml_conical(name=‘tubes_01’)
lh.deck.assign_child_at_slot(tube_rack1, slot=7)

#Tests
await lh.pick_up_tips(tip_rack1[“A1”], offsets=[Coordinate(-0.2,1.3,-12)])
await lh.aspirate(plate_1[“A1”], vols=[10.0], offsets=[Coordinate(0.3,0.8,-9)])
await lh.aspirate(tube_rack1[“A1”], vols=[10.0], offsets=[Coordinate(-2,1.5,-60)])
await lh.dispense(plate_1[“C1”], vols=[20.0], offsets=[Coordinate(0.3,0.8,0)])
await lh.return_tips(offsets=[Coordinate(-0.2,1.3,0)])

The x and y offsets are similar to what I needed to add in the Opentrons API, so no problems there. I added a -12 mm offset in order to pick up the tip, but the pipette would have hit the tip rack if I left the offset in to return the tip. Aspirating defaults to the top of the plate and tubes. My plate wells are 1 cm deep. -60 z offset goes about halfway down the tube.

Also worth noting, there is an issue with assigning liquids to the opentrons_10_tuberack_nest_4x50ml_6x15ml_conical resource. There are 10 slots, but assigning 10 liquids gives an error “Number of liquids (10) does not match number of tubes (12) in rack ‘tubes_1’.” However, assigning 12 liquids gives a list index out of range error.

One final question, is there a command to home the robot?

Thanks!

1 Like

so the issue is both when using PLR and when using the official software :sweat_smile:

lh.backend.home()

on it

the issue with assigning liquids is this resource has an imperfect grid:

"ordering": [
    ["A1", "B1", "C1"],
    ["A2", "B2", "C2"],
    ["A3", "B3"],
    ["A4", "B4"]
  ],

In PLR, I assumed in ItemizedResource that it would always be a full grid.

Working on a fix, which I’ll push later tonight.

In the meantime, please be aware that indexing tubes A4 and B4 will be wrong.

1 Like

so the issue is both when using PLR and when using the official software

x and y axis issues are in both, but z axis issues are only in PLR. My z offsets are all ~0 in the official software.

lh.backend.home()

Thanks!

https://github.com/PyLabRobot/pylabrobot/pull/201 should fix it

that’s not intended. which version of OT are you running?

This might be a different issue but I’ve reported a bug on github sometime ago where there was a difference in Z height when calling to aspirate, dispense, etc. It has supposedly been fixed with Opentrons App v7.2.0.

  • Opentrons App v7.2.0 - Bug Fixes: The OT-2 now consistently applies tip length calibration. There used to be a height discrepancy between Labware Position Check and protocol runs. If you previously compensated for the inconsistent pipette height with labware offsets, re-run Labware Position Check to avoid pipette crashes.
3 Likes

Running Opentrons App version 7.3.1, API version 2.13 or 2.14 usually. Again, I’m not having a problem with Opentrons.