Skip to content

Safety checking for suspect estimates and controller errors#191

Merged
Rishi-H merged 17 commits into
mainfrom
improved-safety-checks
May 6, 2026
Merged

Safety checking for suspect estimates and controller errors#191
Rishi-H merged 17 commits into
mainfrom
improved-safety-checks

Conversation

@BananaBuff
Copy link
Copy Markdown
Contributor

@BananaBuff BananaBuff commented May 4, 2026

Code to attempt to detect and handle suspect controllers and estimators to reduce the duration and consequence of freakouts.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

Doxygen warnings output: (if empty, there are no warnings). Please correct any warnings before merging.

  

@BananaBuff BananaBuff force-pushed the improved-safety-checks branch 2 times, most recently from 0b7b186 to 297a945 Compare May 4, 2026 16:39
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment thread src/main.cpp
Comment thread src/controls/controller.cpp
Comment thread src/controls/estimator.cpp Outdated
Comment thread src/controls/controller.hpp
Comment thread src/controls/controller.cpp
Comment thread src/controls/estimator.cpp Outdated
Comment thread src/comms/config_data/state.hpp
Comment thread src/controls/state.hpp
Comment thread src/comms/config_data/state.hpp
Comment thread src/controls/estimator.cpp Outdated
BananaBuff and others added 7 commits May 4, 2026 13:01
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>
@BananaBuff BananaBuff marked this pull request as ready for review May 4, 2026 20:40
@BananaBuff BananaBuff requested a review from Rishi-H May 4, 2026 20:40
Copy link
Copy Markdown
Contributor

@Rishi-H Rishi-H left a comment

Choose a reason for hiding this comment

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

Tested on robot, code looks clean.

@Rishi-H Rishi-H merged commit 1b15e5a into main May 6, 2026
2 checks passed
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.

4 participants