feat(robot-server): red light when estop is engaged #13173
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 thehardware
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
Review requests
As mentioned above, I couldn't put the Light Control Task initializer directly into
robot_server.hardware
because it needs to depend onrobot_server.runs.engine_store
androbot_server.runs
ends up depending onrobot_server.hardware
. Even if you pull the engine store out ofruns
, therobot_server.protocols
module ends up getting pulled in and it also depends onrobot_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.