calibration-ibanez module

This module implements the calibration process by Gracia-Ibanez et al. 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. Instead of only taking a little amount of datasets into account to calculate the correction-terms, motion is performed and captured and a minimization postprocess is executed to get best results.

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 and the wrist roll as they are not considered in the publication of Gracia-Ibanez et al.

Furthermore, DIPs are not calibrated by using predefined angles. For the minimization-post-processing of the thumb’s joints, DIP2 is estimated by a function depending on the PIP2 sensor output (Gracia-Ibanez et al. used a 18-sensor-glove).

class cyberglove.calibration_ibanez.CROSSCOUPLING(value)

Bases: enum.Enum

Class holding information about cross-coupling (influencing sensor indices) and about instructions how to perform motion measurements. Cross-coupling only applies to abduction and thumb joints.

class cyberglove.calibration_ibanez.CalibrationIbanez(s_id='', use_latest_timestamp=False)

The class implementing the calibration process by Gracia-Ibanez.

__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 calibration process by Gracia-Ibanez et al. It calls the functions measure() and postprocess().

Parameters

glove (cyberglove.glove.Glove) – connected glove object

Returns

None

export_json()

Exports all gains and constants to the json-file ibanez.json in the filepath-folder.

Returns

None

Raises

FileNotFoundError – when file can’t be opened

import_json()

Reads all gains and constants from the json-file ibanez.json in the filepath-folder.

Returns

None

Raises

FileNotFoundError – when file can’t be opened

measure(glove)

Performs all measurements required for the calibration process by Gracia-Ibanez et al. It tests for existing files in the corresponding folder and calls the private functions _measure_static_postures() and _measure_motion().

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(), _postprocess_thumb_adj_f() and _postprocess_thumb_closed_loop(). This post-processing method assumes that the static_postures.txt-file and the motion_<description>.txt-files are valid, hold all required information and it does not perform error checking/handling.

Parameters

folderpath (str) – path to folder containing the files static_postures.txt and ``motion_<description>.txt’ (multiple files)

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