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(robot-server): red light when estop is engaged #13173

Merged
merged 6 commits into from
Jul 27, 2023

Conversation

fsinapi
Copy link
Contributor

@fsinapi fsinapi commented Jul 26, 2023

Overview

When the estop is engaged, the status bar should turn red. This PR makes that happen.

Before this PR, the light control task was only started once the Engine Store was initialized (which could be for a number of endpoints). This poses an issue if the estop is pressed before any of those endpoints are called. As a part of this PR, we start the light control task as soon as the hardware is initialized, and supply the engine store later. There are some nasty circular dependencies if you try to include the runs module from the hardware module so we don't do that and instead register a callback for when the hardware is done initializing. I don't like this but I think we'll need a pretty big refactor to make it feasible.

Test Plan

On a Flex, tried pressing the estop and releasing it while the robot was sitting idle right after restarting the robot server. The light goes red & white.

During a run, if you press the Estop then the light turns solid red. Once you release the Estop it transitions into the hardware error mode (blinking red).

Changelog

  • Create light control task on startup
  • Light control task can be created without an EngineStore and have it supplied later
  • Light control task checks estop state
  • Hardware API provides an accessor for estop state

Review requests

As mentioned above, I couldn't put the Light Control Task initializer directly into robot_server.hardware because it needs to depend on robot_server.runs.engine_store and robot_server.runs ends up depending on robot_server.hardware. Even if you pull the engine store out of runs, the robot_server.protocols module ends up getting pulled in and it also depends on robot_server.hardware. If I'm missing an easy way to shoehorn this in without having a circular dependency then I'm all ears.

Risk assessment

Medium level that this could affect status bar workflows but that should be it, tested on a Flex that it works as expected in basic situations.

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

codecov bot commented Jul 26, 2023

Codecov Report

Merging #13173 (ff23472) into edge (6267e73) will decrease coverage by 0.01%.
Report is 26 commits behind head on edge.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             edge   #13173      +/-   ##
==========================================
- Coverage   72.58%   72.58%   -0.01%     
==========================================
  Files        2372     2372              
  Lines       65437    65434       -3     
  Branches     7202     7202              
==========================================
- Hits        47500    47497       -3     
  Misses      16197    16197              
  Partials     1740     1740              
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/api.py 82.51% <ø> (ø)
api/src/opentrons/hardware_control/ot3api.py 79.39% <ø> (ø)
...are_control/protocols/chassis_accessory_manager.py 66.66% <ø> (ø)
robot-server/robot_server/app_setup.py 95.65% <ø> (ø)
robot-server/robot_server/hardware.py 81.42% <ø> (-0.52%) ⬇️
robot-server/robot_server/runs/dependencies.py 100.00% <ø> (ø)

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.

Kinda gross but not sure what else to do really.

@fsinapi fsinapi merged commit 68a0546 into edge Jul 27, 2023
25 checks passed
@fsinapi fsinapi deleted the RCORE-810-Red-light-when-estop-is-engaged branch July 27, 2023 15:51
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