Skip to content

core: frontend: add notification for uncalibrated sensors #3443

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

Conversation

nicoschmdt
Copy link
Contributor

@nicoschmdt nicoschmdt commented Jul 29, 2025

fix: #3292

Calibrated:
image

Uncalibrated:
image

Docker image for testing: nicoschmdt/blueos-core/notification-for-uncalibrated-sensors

Summary by Sourcery

Add a dashboard notification for uncalibrated sensors and propagate calibration status through the store

New Features:

  • Track uncalibrated sensor status in the Vuex store
  • Watch IMU and compass calibration flags to update uncalibrated state automatically
  • Display a warning card with tooltip on the main UI when any sensor is uncalibrated

Copy link

sourcery-ai bot commented Jul 29, 2025

Reviewer's Guide

This PR introduces a real-time notification in the main App when any IMU or compass sensors remain uncalibrated by tracking their status via Vue watchers and storing the flag in the Vuex autopilot module.

Sequence diagram for real-time uncalibrated sensor notification update

sequenceDiagram
    participant OnboardSensorsVue
    participant AutopilotStore
    participant AppVue
    OnboardSensorsVue->>OnboardSensorsVue: Watch imu_is_calibrated/compass_is_calibrated
    OnboardSensorsVue->>AutopilotStore: setUncalibratedSensors(flag)
    AppVue->>AutopilotStore: Read uncalibrated_sensors
    AppVue-->>User: Show/hide uncalibrated sensors notification
Loading

Class diagram for updated AutopilotStore and App.vue

classDiagram
    class AutopilotStore {
      +bool uncalibrated_sensors
      +setUncalibratedSensors(bool uncalibrated)
    }
    class App {
      +bool uncalibrated_sensors()
    }
    App --> AutopilotStore : uses uncalibrated_sensors
Loading

File-Level Changes

Change Details Files
Added notification card for uncalibrated sensors in the main App component
  • Inserted a v-card with v-if and v-tooltip to display the warning
  • Included mdi-alert-outline icon and “Uncalibrated sensors” title
  • Exposed new computed property uncalibrated_sensors to read from store
core/frontend/src/App.vue
Implemented status tracking for sensor calibration in the OnboardSensors component
  • Added deep, immediate watchers on imu_is_calibrated and compass_is_calibrated
  • Created updateUncalibratedSensorsStatus method to set store flag
  • Invoked status update on component mount
core/frontend/src/components/vehiclesetup/overview/OnboardSensors.vue
Extended the autopilot Vuex store to hold uncalibrated sensor flag
  • Declared uncalibrated_sensors state property
  • Added setUncalibratedSensors mutation to update the flag
core/frontend/src/store/autopilot.ts

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @nicoschmdt - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments

### Comment 1
<location> `core/frontend/src/components/vehiclesetup/overview/OnboardSensors.vue:321` </location>
<code_context>
+    this.updateUncalibratedSensorsStatus()
   },
   methods: {
+    updateUncalibratedSensorsStatus() {
+      autopilot_data.setUncalibratedSensors(
+        Object.values(this.imu_is_calibrated).some((calibrated) => !calibrated)
+        || Object.values(this.compass_is_calibrated).some((calibrated) => !calibrated),
+      )
+    },
     print_bus(bus: BUS_TYPE): string {
</code_context>

<issue_to_address>
Potential issue if imu_is_calibrated or compass_is_calibrated are not objects.

If imu_is_calibrated or compass_is_calibrated can be null or undefined, Object.values will throw. Add a guard or default to an empty object to avoid runtime errors.
</issue_to_address>

### Comment 2
<location> `core/frontend/src/store/autopilot.ts:41` </location>
<code_context>

   verhicle_armed = false

+  uncalibrated_sensors = false
+
   get parameter() {
</code_context>

<issue_to_address>
Typo in property name 'verhicle_armed' remains unaddressed.

Please update the property name to 'vehicle_armed' for consistency and maintainability.

Suggested implementation:

```typescript
  vehicle_armed = false


```

```typescript
  setVehicleArmed(armed: boolean): void {
    this.vehicle_armed = armed
  }

```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@nicoschmdt nicoschmdt force-pushed the notification-for-uncalibrated-sensors branch 2 times, most recently from c9e5ee4 to 06de407 Compare July 29, 2025 17:18
@joaoantoniocardoso
Copy link
Member

hmm... I'm not sure whether we want to put the notification in the widgets area, as the other notifications-like things are happening on the opposite side of the top bar.

@nicoschmdt
Copy link
Contributor Author

I placed it in the widgets area because the armed notification appears in that same position. But if the uncalibrated sensors notification doesn't need to be as explicit as the armed one, maybe we could just use the notification system instead?

@joaoantoniocardoso
Copy link
Member

Hmm, right, although they all share semantics, as you noted, they may differ in priority. The notification system is a good idea too (and perhaps we should do both). I'll let other people input on this.

Since this is UX, I hope @ES-Alexander can give his view on it?

@ES-Alexander
Copy link
Collaborator

ES-Alexander commented Jul 30, 2025

As I understand it:

  • The "Armed" indicator widget is to indicate when the interface is in "safe" mode, which requires additional confirmation before certain actions can occur (to prevent unsafe behaviour)
    • The calibration state does not have such an interface mode, and while action is required it does not meaningfully influence the use of BlueOS (just of the autopilot / vehicle control)
  • The notifications list from the bell icon at the far right of the header bar is for events
    • The calibration state is reported regularly, but is not an event so much as a continuous state, so it does not belong in the list (to avoid being continual spam, or getting lost in subsequent notifications)
  • The other icons at the right are for a mix of functionalities and state indicators
    • This seems like the best fit for the calibration details

I can think of a couple of potential interface options:

  1. Augment the heartbeat indicator
    • Make it orange when uncalibrated
    • Include calibration details in the clicked expansion (at least showing which sensors are uncalibrated, but ideally also including calibration health/quality so it's useful even when calibrated, although this could be raised as an Issue and completed as a future improvement)
    • Add links when uncalibrated to jump to the relevant calibration page in BlueOS
  2. Add one or more temporary indicators
    • This would be more like the storage full warning, which only shows up when the problem is happening
    • There could be a single indicator with a tooltip that "one or more sensors are uncalibrated", which clicking on could take to the vehicle setup overview page, OR
    • There could be separate indicators per sensor type, so when several sensors are uncalibrated there are multiple indicators, with click-through links going to the relevant calibration page (in the vehicle setup section)

I personally prefer the heartbeat augmentation approach, because calibration seems like part of the autopilot health, and I'm reluctant to have an ever-growing list of icons people need to know about and be able to interpret. That said, the temporary indicators approach still seems viable, and would at least be better than the current lack of indication. I'm unsure which would be easier to implement - they seem pretty similar in complexity 🤷‍♂️

@nicoschmdt nicoschmdt force-pushed the notification-for-uncalibrated-sensors branch 5 times, most recently from 5b0b82c to 71dbd61 Compare August 5, 2025 19:38
@nicoschmdt nicoschmdt force-pushed the notification-for-uncalibrated-sensors branch from 71dbd61 to 9de8bf1 Compare August 5, 2025 21:15
@joaoantoniocardoso joaoantoniocardoso merged commit f5ae809 into bluerobotics:master Aug 6, 2025
6 checks passed
@ES-Alexander ES-Alexander added the docs-needed Change needs to be documented label Aug 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-needed Change needs to be documented
Projects
None yet
Development

Successfully merging this pull request may close these issues.

core: frontend: Notification for uncalibrated sensors
5 participants