Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(api): separate disengage and stop #13185

Merged

Conversation

ahiuchingau
Copy link
Contributor

@ahiuchingau ahiuchingau commented Jul 27, 2023

Overview

When we issue a StopRequest to the Flex axes, the following happens on the firmware side:

  1. the motor gets disengaged to stop any movement
  2. any queued up motor tasks are cleared

This has worked pretty well for immediately halting robot motion. But, this also means sometimes we're unexpectedly disengaging the motors when not necessary and leaving the axes in a non-movable state.

We can solve this by not disengaging the motors in the StopRequest task and let the DisableMotorRequest handles that. You'll need the changes in Opentrons/ot3-firmware#710 in order for this to work properly.

@ahiuchingau ahiuchingau requested a review from a team as a code owner July 27, 2023 21:01
@codecov
Copy link

codecov bot commented Jul 27, 2023

Codecov Report

Merging #13185 (b077d0c) into internal-release_0.14.0 (b0f5fa6) will decrease coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@                     Coverage Diff                     @@
##           internal-release_0.14.0   #13185      +/-   ##
===========================================================
- Coverage                    72.51%   72.51%   -0.01%     
===========================================================
  Files                         2394     2394              
  Lines                        66052    66051       -1     
  Branches                      7345     7345              
===========================================================
- Hits                         47897    47896       -1     
  Misses                       16407    16407              
  Partials                      1748     1748              
Flag Coverage Δ
g-code-testing 96.44% <ø> (ø)
notify-server 89.13% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
api/src/opentrons/hardware_control/ot3api.py 79.60% <ø> (-0.06%) ⬇️

Copy link
Contributor

@Laura-Danielle Laura-Danielle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving as a comment. Don't want my q's to be blocking.

await self._backend.halt()

def stop_modules(self) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this guy meant to do?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This clears any future module tasks scheduled by the protocol

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes I see it now. The diff on github was being weird for me and I thought it was a free floating func

await self.disengage_axes(
[ax for ax in Axis if self._backend.axis_is_present(ax)]
)
await self.stop_motors()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the order be

await self.stop_motors()
await self.disengage_axes()

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The disengage request is used to immediately stop the motor while it's still in motion. This allows the halt request to behave similarly to an estop.

Copy link
Contributor

@Laura-Danielle Laura-Danielle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ahiuchingau ahiuchingau merged commit 30c54da into internal-release_0.14.0 Aug 1, 2023
31 checks passed
@ahiuchingau ahiuchingau deleted the separate_halt-and-disengage-motors branch August 1, 2023 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants