-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api): Add critical point tracking to hardware control
The hardware control API now tracks whether a pipette has a tip or not and considers its "critical point", the point moved in a move command, to be either the end of the tip, the end of the nozzle, or the mount depending on the status of the pipette. Closes #2239
- Loading branch information
Showing
5 changed files
with
151 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import pytest | ||
from opentrons.types import Point | ||
from opentrons.hardware_control import pipette | ||
from opentrons.config import pipette_config | ||
|
||
|
||
def test_tip_tracking(): | ||
pip = pipette.Pipette('p10_single_v1') | ||
with pytest.raises(AssertionError): | ||
pip.remove_tip() | ||
assert not pip.has_tip | ||
pip.add_tip() | ||
assert pip.has_tip | ||
with pytest.raises(AssertionError): | ||
pip.add_tip() | ||
pip.remove_tip() | ||
assert not pip.has_tip | ||
with pytest.raises(AssertionError): | ||
pip.remove_tip() | ||
|
||
|
||
def test_critical_points(): | ||
for config in pipette_config.configs: | ||
loaded = pipette_config.load(config) | ||
pip = pipette.Pipette(config) | ||
mod_offset = Point(*loaded.model_offset) | ||
assert pip.critical_point == mod_offset | ||
pip.add_tip() | ||
new = mod_offset._replace(z=mod_offset.z - loaded.tip_length) | ||
assert pip.critical_point == new | ||
pip.remove_tip() | ||
assert pip.critical_point == mod_offset | ||
|
||
|
||
def test_volume_tracking(): | ||
for config in pipette_config.configs: | ||
loaded = pipette_config.load(config) | ||
pip = pipette.Pipette(config) | ||
assert pip.current_volume == 0.0 | ||
assert pip.available_volume == loaded.max_volume | ||
assert pip.ok_to_add_volume(loaded.max_volume - 0.1) | ||
pip.set_current_volume(0.1) | ||
with pytest.raises(AssertionError): | ||
pip.set_current_volume(loaded.max_volume + 0.1) | ||
with pytest.raises(AssertionError): | ||
pip.set_current_volume(-1) | ||
assert pip.current_volume == 0.1 | ||
pip.remove_current_volume(0.1) | ||
with pytest.raises(AssertionError): | ||
pip.remove_current_volume(0.1) | ||
assert pip.current_volume == 0.0 | ||
pip.set_current_volume(loaded.max_volume) | ||
assert not pip.ok_to_add_volume(0.1) | ||
with pytest.raises(AssertionError): | ||
pip.add_current_volume(0.1) | ||
assert pip.current_volume == loaded.max_volume |