Skip to content

Commit

Permalink
fix(api): enagage axis before attempting to move
Browse files Browse the repository at this point in the history
There seems to be some issue on the firmware where the motor is enabled but does not seem to actually get enabled, causing the axis we are attempting to move to error with finished movement with condition not met. The firmware should be enabling the motor and if we query the motor enable status with get_status_request = 0x01 we get the correct response where the motor is enabled. For whatever reason sending an explicit enable_motor_request = 0x06 before moving the axis fixes the problem.
  • Loading branch information
vegano1 committed Apr 19, 2024
1 parent 5e6b38e commit cbb69cd
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions api/src/opentrons/hardware_control/ot3api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1539,6 +1539,12 @@ async def _home_axis(self, axis: Axis) -> None:
await self._set_plunger_current_and_home(axis, motor_ok, encoder_ok)
return

# TODO: (ba, 2024-04-19): We need to explictly engage the axis and enable
# the motor when we are attempting to move. This should be already
# happening but something on the firmware is either not enabling the motor or
# disabling the motor.
await self.engage_axes([axis])

# we can move to safe home distance!
if encoder_ok and motor_ok:
origin, target_pos = await self._retrieve_home_position(axis)
Expand Down Expand Up @@ -1655,14 +1661,22 @@ async def retract_axis(self, axis: Axis) -> None:
motor_ok = self._backend.check_motor_status([axis])
encoder_ok = self._backend.check_encoder_status([axis])

if motor_ok and encoder_ok:
# we can move to the home position without checking the limit switch
origin = await self._backend.update_position()
target_pos = {axis: self._backend.home_position()[axis]}
await self._backend.move(origin, target_pos, 400, HWStopCondition.none)
else:
# home the axis
await self._home_axis(axis)
async with self._motion_lock:
if motor_ok and encoder_ok:
# TODO: (ba, 2024-04-19): We need to explictly engage the axis and enable
# the motor when we are attempting to move. This should be already
# happening but something on the firmware is either not enabling the motor or
# disabling the motor.
await self.engage_axes([axis])

# we can move to the home position without checking the limit switch
origin = await self._backend.update_position()
target_pos = {axis: self._backend.home_position()[axis]}
await self._backend.move(origin, target_pos, 400, HWStopCondition.none)
else:
# home the axis
await self._home_axis(axis)

await self._cache_current_position()
await self._cache_encoder_position()

Expand Down

0 comments on commit cbb69cd

Please sign in to comment.