Skip to content
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

Implement offset and gain stick Calibration #441

Merged
merged 7 commits into from
May 5, 2022

Conversation

mmmaisel
Copy link
Contributor

@mmmaisel mmmaisel commented May 3, 2022

The existing axis calibration just clipped the allowed axis values to a
given maximum. Replace this with linear offset and gain calibration.
Calibration is applied when queueing pending events so that all
following calculations receive corrected values.
Replace the existing "clipping" steps with the previously uncalibrated
case - clipping to the global minimum/maximum value.

Implement an interactive calibration workflow which
automatically detects when enough data was collected by evaluation
statistic properties. The current estimated calibration values are shown
live in red and turn black if the relative error is below 1%.
If not enough values are collected after 30 seconds, time out and
continue with the available data. This avoids long calibration times
that may lead to bug reports because users think it hangs in case of
noisy devices. Determine the final calibration values with a linear regression.

Rework the calibration dialog, e.g remove redundant ProgressBars and
reduce empty space. The new dialog is also ready to be extended for
sensor calibration.

Should also help with #407.

@mmmaisel mmmaisel changed the title Calibration Implement offset and gain stick Calibration May 3, 2022
src/gui/calibration.cpp Outdated Show resolved Hide resolved
src/gui/calibration.cpp Outdated Show resolved Hide resolved
src/axisvaluebox.cpp Outdated Show resolved Hide resolved
src/gui/calibration.cpp Outdated Show resolved Hide resolved
src/estimator.h Outdated Show resolved Hide resolved
src/pt1.h Outdated Show resolved Hide resolved
src/joycontrolstick.h Outdated Show resolved Hide resolved
src/pt1.h Outdated Show resolved Hide resolved
The layout of the JoySensorEditDialog jumps around when the number of
decimals in the bearing and safezone labels change.

Fix it by putting all stick labels and values from the left column in a
QGridLayout and set the length of the first value to the length of a
dummy string with nine decimals.
If a nullptr is passed as stick to the status box, it crashes.
This will be a problem in the new combined sensor/stick calibration dialog.
The existing axis calibration just clipped the allowed axis values to a
given maximum. Replace this with linear offset and gain calibration.
Calibration is applied when queueing pending events so that all
following calculations receive corrected values.

Replace the existing "clipping" steps with the previously uncalibrated
case - clipping to the global minimum/maximum value.

Temporarily remove load/store to XML and disable the existing calibration
dialog. They will be implemented again in the following commits.
It was removed in the previous commit.
Implement calibration storage on the InputDevice so that calibration is
applied to all sets of the current device. Add XML load/store again.
This helper class will be used during calibration in the following
commits to estimate offset and gain values and theier accuracy.
The PT1 class implements a first order lag filter (or PT1).
This filter willl be used to denoise the calibration values
and later for sensor data processing.
Implement an interactive calibration workflow which
automatically detects when enough data was collected by evaluation
statistic properties. The current estimated calibration values are shown
live in red and turn black if the relative error is below 1%.
If not enough values are collected after 30 seconds, time out and
continue with the available data. This avoids long calibration times
that may lead to bug reports because users think it hangs in case of
noisy devices. Determine the final calibration values with a linear regression.

Rework the calibration dialog, e.g remove redundant ProgressBars and
reduce empty space. The new dialog is also ready to be extended for
sensor calibration.

Encode the device index with a bitmask into the type int since this
allows using the QVariant::int user data in the combo box directly.
Copy link
Member

@pktiuk pktiuk left a comment

Choose a reason for hiding this comment

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

LGTM

@pktiuk pktiuk merged commit aa8960e into AntiMicroX:master May 5, 2022
@pktiuk pktiuk mentioned this pull request May 5, 2022
1 task
@mmmaisel mmmaisel deleted the calibration branch May 27, 2022 15:36
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.

None yet

2 participants