Skip to content

Commit

Permalink
fix(api): bump y max bounds to match robot geometry
Browse files Browse the repository at this point in the history
We now helpfully check that jogs don't overlap the maximum motion range
of each axis, at least in the positive direction, using the home
positions. This works pretty well for Z and X since it straightforwardly
prevents hard limit errors from unintentional endstop triggers, which
happen at the home position as one might expect.

Unfortunately, the robot geometry makes this approach completely invalid
for Y. When homing, the Y endstop (which is located on the back of the
head) actually interacts with a post projecting from the back of the
robot, which is located on the right side of the robot. This is the
reason we must always home X before homing Y: to make sure the head is
in the correct position for the Y endstop to interact with the post.

If the head is _not_ all the way to the right, it can actually go much
farther back - past the home location, past where the switch would
interact with the post. And the deck layout is designed to take
advantage of this; the position that A1 of most labware lives in is
farther back than the post, and thus customers would get spurious jog
failures when calibrating labwares in slots 10 and 11 using single
channel pipettes (because multi channels are wider in Y, the gantry
doesn't go far enough back to trigger the issue).

The fix is to create a different bound in the Y.

Closes #6886
  • Loading branch information
sfoster1 committed Jan 4, 2021
1 parent 61d9b4f commit ce1f360
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 13 deletions.
26 changes: 18 additions & 8 deletions api/src/opentrons/drivers/smoothie_drivers/driver_3_0.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
from time import sleep, time
from threading import Event, RLock
from typing import Any, Dict, Optional, Union, List, Tuple, cast
from typing import Any, Dict, Optional, Union, List, Tuple, cast
from typing_extensions import Final

from math import isclose
from serial.serialutil import SerialException # type: ignore

Expand Down Expand Up @@ -33,14 +36,15 @@


# TODO (artyom, ben 20171026): move to config
HOMED_POSITION: Dict[str, float] = {
'X': 418,
'Y': 353,
'Z': 218,
'A': 218,
'B': 19,
'C': 19
HOMED_POSITION: Final = {
'X': 418.0,
'Y': 353.0,
'Z': 218.0,
'A': 218.0,
'B': 19.0,
'C': 19.0
}
Y_BOUND_OVERRIDE: Final = 370


PLUNGER_BACKLASH_MM = 0.3
Expand Down Expand Up @@ -415,9 +419,15 @@ def gpio_chardev(self, gpio_chardev):
self._gpio_chardev = gpio_chardev

@property
def homed_position(self):
def homed_position(self) -> Dict[str, float]:
return self._homed_position.copy()

@property
def axis_bounds(self) -> Dict[str, float]:
bounds = {k: v for k, v in self._homed_position.items()}
bounds['Y'] = Y_BOUND_OVERRIDE
return bounds

def _update_position(self, target):
self._position.update({
axis: value
Expand Down
2 changes: 1 addition & 1 deletion api/src/opentrons/hardware_control/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ async def connect(self, port: str = None):
def axis_bounds(self) -> Dict[Axis, Tuple[float, float]]:
""" The (minimum, maximum) bounds for each axis. """
return {Axis[ax]: (0, pos) for ax, pos
in self._smoothie_driver.homed_position.items()
in self._smoothie_driver.axis_bounds.items()
if ax not in 'BC'}

@property
Expand Down
7 changes: 5 additions & 2 deletions api/src/opentrons/hardware_control/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@
MODULE_LOG = logging.getLogger(__name__)


_HOME_POSITION = {'X': 418.0, 'Y': 353.0, 'Z': 218.0,
_HOME_POSITION: Final = {'X': 418.0, 'Y': 353.0, 'Z': 218.0,
'A': 218.0, 'B': 19.0, 'C': 19.0}

_BOUNDS: Final = {'X': 418.0, 'Y': 370.0, 'Z': 218.0,
'A': 218.0, 'B': 19.0, 'C': 19.0}


Expand Down Expand Up @@ -288,7 +291,7 @@ async def build_module(
@property
def axis_bounds(self) -> Dict[Axis, Tuple[float, float]]:
""" The (minimum, maximum) bounds for each axis. """
return {Axis[ax]: (0, pos) for ax, pos in _HOME_POSITION.items()
return {Axis[ax]: (0, pos) for ax, pos in _BOUNDS.items()
if ax not in 'BC'}

@property
Expand Down
4 changes: 2 additions & 2 deletions api/src/opentrons/tools/overnight_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
attempts_to_home = 1
too_many_attempts_to_home = 3

XY_TOLERANCE = 30
ZA_TOLERANCE = 10
XY_TOLERANCE = 30.0
ZA_TOLERANCE = 10.0

AXIS_TEST_SKIPPING_TOLERANCE = 0.5

Expand Down

0 comments on commit ce1f360

Please sign in to comment.