sensors icon indicating copy to clipboard operation
sensors copied to clipboard

Interface for user-involving calibration?

Open martijnthe opened this issue 7 years ago • 3 comments

I'm wondering what your thoughts are w.r.t. sensors that require a calibration process involving the user (for example the well known "compass calibration dance").

Is the environment that hosts the Sensor interface supposed to take care of presenting a calibration UI as needed – for example, automatically presenting the calibration UI when an uncalibrated Sensor is start()ed? Is the idea that this is "transparent" to the consumer of the Sensor interface, i.e. defer the onactivate callback until the calibration process has successfully completed?

I wonder if it would make sense to offer a bit of control to the application that uses Sensor. I imagine it may lead to a better UX if the application can read the calibration status and trigger the process to calibrate it. This way the application can explain to the user it wants to access the Sensor and why, before triggering the calibration UI. Automatically triggering the calibration UI may be a bad UX...

Thoughts?

martijnthe avatar Oct 24 '17 10:10 martijnthe

@martijnthe dynamic calibration might be a nice feature, especially for magnetometer and fusion sensors that use it. However, if I remember correctly, none of the platform APIs provide such functionality, thus, it would be challenging to implement such feature in the browser.

On the lowest level, in addition to e.g., temperature or ALS window factory calibration, sensors may expose dynamic calibration routines, yet, these are rarely exposed to application / middleware layer.

Do you have any suggestions or ideas how this can be implemented across all platforms?

alexshalamov avatar Oct 30 '17 11:10 alexshalamov

@pozdnyakov We might use 'accuracy' as a hint for required calibration, wdyt? We already have an issue for that https://github.com/w3c/sensors/issues/154

Accuracy level is exposed on many platforms.

alexshalamov avatar Oct 30 '17 11:10 alexshalamov

@alexshalamov thanks for your comments.

Some ideas w.r.t. the API design, while keeping in mind:

  1. it may not make sense to calibrate a particular class of Sensor.
  2. it may not be possible to actual calibrate the sensor due to lack of platform support.
enum SensorCalibrationStatus {
  "unavailable",
  "uncalibrated",
  "calibrated",
}

interface Sensor :  EventTarget {
  readonly attribute SensorCalibrationStatus calibrationStatus;
  void calibrate();
  attribute EventHandler oncalibrationchange;
  ...
}

Re. 1 & 2: if a sensor doesn't need to be calibrated or cannot be calibrated for whatever reason, calibrationStatus would return "unavailable". calibrate() would be a no-op in that case and oncalibrationchange would never fire.

martijnthe avatar Oct 30 '17 13:10 martijnthe