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

feat(api): block robot movement when Estop is engaged or missing #13147

Conversation

fsinapi
Copy link
Contributor

@fsinapi fsinapi commented Jul 21, 2023

Overview

If the OT-3 Estop is engaged, or if there is no Estop plugged in, the robot should not be allowed to move. This includes the "logically engaged" state, where an Estop has been pressed but not acknowledged.

We block these movements with a simple function wrapper that checks the current estop status. If it is anything other than "disengaged," the OT3Controller will refuse to move and it will raise one of our nice exceptions about it.

Test Plan

On an OT-3, I tested moving the Estop state machine through all 4 of its states and sending a POST request to home the robot. In any state other than Disengaged, the robot responded with an error with the expected error message (with the correct error code!)

Changelog

  • Added a function wrapper around OT3Controller movement functions to block movement if the estop is enabled.
  • Added an option estopNotRequired that will allow the hardware controller to function with no estop connected.

Review requests

Do we need a way to disable this? I'm mostly thinking of any hardware-testing stuff that might not have an estop connected.

Risk assessment

If there are situations where we need to run OT3API functions without an Estop, this is pretty annoying.

Also, we should NOT merge this until the App supports acknowledging and clearing the Estop state. I will wait on @koji to decide when it is ready :)

@fsinapi fsinapi requested review from a team July 21, 2023 18:43
@fsinapi fsinapi self-assigned this Jul 21, 2023
@fsinapi fsinapi requested a review from a team as a code owner July 21, 2023 18:43
@codecov
Copy link

codecov bot commented Jul 21, 2023

Codecov Report

Merging #13147 (d6745b3) into edge (5f8e7f6) will decrease coverage by 0.51%.
Report is 6 commits behind head on edge.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             edge   #13147      +/-   ##
==========================================
- Coverage   72.25%   71.74%   -0.51%     
==========================================
  Files        2399     1578     -821     
  Lines       66420    52242   -14178     
  Branches     7385     3309    -4076     
==========================================
- Hits        47989    37482   -10507     
+ Misses      16661    14239    -2422     
+ Partials     1770      521    -1249     
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/config/advanced_settings.py 94.21% <ø> (ø)
api/src/opentrons/config/feature_flags.py 86.66% <ø> (ø)
...entrons/hardware_control/backends/ot3controller.py 68.57% <ø> (ø)
...er/robot_server/service/legacy/routers/settings.py 100.00% <ø> (ø)

... and 823 files with indirect coverage changes

@fsinapi fsinapi requested a review from koji July 21, 2023 18:53
Copy link
Member

@sfoster1 sfoster1 left a comment

Choose a reason for hiding this comment

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

Looks good but yes we should have a way to disable it. A feature flag that we do not expose via HTTP would work.

@fsinapi fsinapi requested a review from a team as a code owner July 24, 2023 14:38
…en, and set up Robot Server to actually hide settings that should be hidden
@fsinapi
Copy link
Contributor Author

fsinapi commented Jul 24, 2023

Looks good but yes we should have a way to disable it. A feature flag that we do not expose via HTTP would work.

Added the feature flag and tested that 1) it lets movements run without an estop, and 2) it does not show up on the HTTP endpoints

@fsinapi
Copy link
Contributor Author

fsinapi commented Aug 10, 2023

With latest commits, tested that the estopNotRequired option only shows up in HTTP after it's been set to True, and tested that if the option has been set then the Estop State endpoints never return the "not present" state

@shlokamin shlokamin merged commit ecd6453 into edge Aug 10, 2023
26 checks passed
@shlokamin shlokamin deleted the RCORE-809-Block-access-to-all-robot-movement-when-Estop-is-physically-or-logically-engaged branch August 10, 2023 21:08
TamarZanzouri pushed a commit that referenced this pull request Sep 13, 2023
)

* Raise exceptions if the estop is not in the DISENGAGED state during any movements

* Added nicer error messages

* Added feature flag to enable movement without an estop

* Fixed broken test

* un-expose the estop setting over HTTP

* Add the estopNotRequired setting back to definitions but make it hidden, and set up Robot Server to actually hide settings that should be hidden

* Fix settings migration tests

* If the estopNotRequired setting is enabled, always return that the estop is present
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.

3 participants