spatial_sensor_calibration ========================== **Source code:** `spatial_sensor_calibration.py `_ Perform calibration on spatial sensors Description ----------- Spatial sensors are sensors with X, Y, Z values such as accelerometer or gyroscope. Test Procedure -------------- The step for calibration is as follows: 1) Put the device on a flat table, facing up. 2) Issue a command to calibrate them: - echo 1 > /sys/bus/iio/devices/iio:deviceX/calibrate - X being the ids of the accel and gyro. 3) Retrieve the calibration offsets - cat /sys/bus/iio/devices/iio:deviceX/in_(accel|anglvel)_(x|y|z)_calibbias 4) Save them in VPD. Dependency ---------- - A spatial sensor whose driver implements `perform_calib`_ of accelgyro_drv in `accelgyro.h `_. .. _perform_calib: https://source.chromium.org/search?q=perform_calib%20f:platform%2Fec%2Fdriver Examples -------- To run this test, add this into test list: .. test_list:: generic_ec_component_accel_examples:AccelerometerIMUTests. GyroscopeCalibrationByEC .. test_list:: generic_ec_component_accel_examples:AccelerometerIMUTests. BaseAccelerometersCalibrationByEC .. test_list:: generic_ec_component_accel_examples:AccelerometerIMUTests. LidAccelerometersCalibrationByEC Test Arguments -------------- .. list-table:: :widths: 20 10 60 :header-rows: 1 :align: left * - Name - Type - Description * - timeout_secs - int - (optional; default: ``60``) Timeout in seconds when waiting for device. * - sensor_name - str, dict - (optional; default: ``{'en-US': 'Accelerometer'}``) name of the sensor to calibrate. * - device_name - str - The "name" atribute of the sensor * - device_location - str - The "location" atribute of the sensor * - raw_entry_template - str - (optional; default: ``'in_accel_%s_raw'``) Template for the sysfs raw value entry. * - calibbias_entry_template - str - (optional; default: ``'in_accel_%s_calibbias'``) Template for the sysfs calibbias value entry. * - vpd_entry_template - str - (optional; default: ``'in_accel_%s_base_calibbias'``) Template for the sysfs calibbias value entry. * - stabilize_time - int - (optional; default: ``1``) Time to wait until calibbias stabilize. * - prompt - bool - (optional; default: ``True``) Prompt user to put the device in correct facing * - placement_range - list - (optional; default: ``[None, None, None]``) A list of sequences asserting the range of X, Y, Z. Each element is [min, max] or None if it's a don't care.