Safety checking for suspect estimates and controller errors#191
Merged
Conversation
|
Doxygen warnings output: (if empty, there are no warnings). Please correct any warnings before merging. |
0b7b186 to
297a945
Compare
ae57ad6 to
59f30c4
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds shared safety validation for controller tracking errors and estimator outputs so the firmware can detect suspect state/control behavior and force the robot into safety mode sooner.
Changes:
- Added shared safety-mode state and threaded it through the main loop.
- Added controller-side validation hooks, per-state error monitors, and shared controller error escalation logic.
- Added estimator-side validation hooks, raw/unbounded state setters for estimates, and new state-config fields for error thresholds/timing.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/safety.hpp | Adds global safety-mode flag helpers used by validation code. |
| src/main.cpp | Publishes safety-mode state from the main control loop. |
| src/controls/state.hpp | Documents bounded vs raw setters and exposes no-bound setters publicly. |
| src/controls/estimator.hpp | Adds estimator validation hooks and per-state monitor members. |
| src/controls/estimator.cpp | Implements shared estimator limit checks and switches estimators to raw setters. |
| src/controls/estimator_manager.cpp | Runs estimator validation after each estimator step. |
| src/controls/controller.hpp | Adds controller validation hooks and per-state error monitoring utilities. |
| src/controls/controller.cpp | Implements shared controller error checks and per-controller validation. |
| src/controls/controller_manager.cpp | Runs controller validation before each controller step. |
| src/comms/config_data/state.hpp | Extends state config with controller-error threshold/timing fields. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Rishi-H
approved these changes
May 6, 2026
Contributor
Rishi-H
left a comment
There was a problem hiding this comment.
Tested on robot, code looks clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Code to attempt to detect and handle suspect controllers and estimators to reduce the duration and consequence of freakouts.