calibration-cor-terms module
This module implements the correction-terms calibration process. The approach uses relative sensor values and therefore needs a neutral dataset.
It mainly considers a linear relationship between relative sensor-values and the corresponding angles.
Thus, a gain (g) is required for each sensor to fulfill the linear function theta = g * s
where theta is the angle and s is the relative sensor value. There is no offset because the measurement for 0°
always corresponds to a relative sensor value of 0.
Most gains are calculated by measuring two poses with predefined angles for each sensor.
Additionally, this calibration method adds correction-terms for the abduction of the digits and two correction terms for the thumb flexion and abduction.
Furthermore, this approach uses the flexion-hand-model, for which the thumb CMC joint has two degrees of freedom: flexion and abduction.
For more information about the approach, please refer to the Bachelor’s thesis by Johannes Michaelis.
Note
This calibration ignores the wrist abduction as it is broken on the CyberGlove III used at LTD.
- class cyberglove.calibration_cor_terms.CROSSCOUPLING(value)
Bases:
enum.EnumEnumeration holding information about the cross-coupling effects of the abduction sensors. The enum-objects hold the sensor-value of the corresponding neighboring MCP joint sensors.
- class cyberglove.calibration_cor_terms.CalibrationCorTerms(s_id='', use_latest_timestamp=False)
The class implementing the correction-terms calibration process.
- __init__(s_id='', use_latest_timestamp=False)
The
__init__()-method calls the parent-constructor (__init__()) which is taking care of asking for subject-information as well as creating and handling folder structure. It also creates a neutral_dataset, which is required to calculate relative sensor values. The__init__()-method() itself creates 22 gains and 5 correction-terms-constants for each sensor (although not every joint uses all 5 constants), it defines the visualization model to be of type flexion and sensor-names are set to the corresponding sensor-index number.- Parameters
s_id (string, optional) – subject ID if already known. if not specified, the parent-class will ask for it
use_latest_timestamp (bool, optional) – if set to True, the last timestamp-folder of the subject will be used
- calibrate(glove)
Runs the complete correction-terms calibration process. It calls the functions
measure()andpostprocess().- Parameters
glove (cyberglove.glove.Glove) – connected glove object
- Returns
None
- export_json()
Exports all gains and constants to the json-file
cor_terms.jsonin thefilepath-folder.- Returns
None
- Raises
FileNotFoundError – when file can’t be opened
- import_json()
Reads all gains and constants from the json-file
cor_terms.jsonin thefilepath-folder.- Returns
None
- Raises
FileNotFoundError – when file can’t be opened
- measure(glove)
Performs all measurements required for the correction-terms calibration process. It tests for existing files in the corresponding folder and calls the private functions
_measure_static_postures()and_measure_abduction_postures().- Parameters
glove (cyberglove.glove.Glove) – connected glove object
- Returns
the folderpath where the files with captured data are saved
- Return type
str
- postprocess(folderpath)
Post-processes the captured data to get a calibration. It calls the functions
_postprocess_linear(),_postprocess_abd_correction_terms()and_postprocess_thumb_correction_terms(). This post-processing method assumes that thestatic_postures.txt-file and thestatic_abduction_postures.txt-file are valid and hold all required information and it does not perform error checking/handling.- Parameters
folderpath (str) – folderpath of parent-directory of the
static_postures.txt-file and thestatic_abduction_postures.txt-file- Returns
None
- raw_to_angles(dataset)
Calculates angles from (absolute) raw sensor data with the gains, the correction-terms and the neutral dataset set as class-variables.
- Parameters
dataset (numpy.ndarray) – 1-dimensional array of 22 raw-values
- Returns
1-dimensional array of 22 corresponding angles
- Return type
numpy.ndarray