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.
Issue a command to calibrate them:
echo 1 > /sys/bus/iio/devices/iio:deviceX/calibrate
X being the ids of the accel and gyro.
Retrieve the calibration offsets
cat /sys/bus/iio/devices/iio:deviceX/in_(accel|anglvel)_(x|y|z)_calibbias
Save them in VPD.
Dependency¶
A spatial sensor whose driver implements perform_calib of accelgyro_drv in accelgyro.h.
Examples¶
To run this test, add this into test list:
{
"pytest_name": "spatial_sensor_calibration",
"label": "Gyroscope Calibration By EC",
"related_components": [
"test_tags.TestCategory.ACCELEROMETER",
"test_tags.TestCategory.VPD"
],
"args": {
"device_name": "cros-ec-gyro",
"device_location": "base",
"raw_entry_template": "in_anglvel_%s_raw",
"calibbias_entry_template": "in_anglvel_%s_calibbias",
"vpd_entry_template": "in_anglvel_%s_base_calibbias"
}
}
{
"pytest_name": "spatial_sensor_calibration",
"label": "Base Accelerometers Calibration By EC",
"related_components": [
"test_tags.TestCategory.ACCELEROMETER",
"test_tags.TestCategory.VPD"
],
"args": {
"device_name": "cros-ec-accel",
"device_location": "base",
"raw_entry_template": "in_accel_%s_raw",
"calibbias_entry_template": "in_accel_%s_calibbias",
"vpd_entry_template": "in_accel_%s_base_calibbias"
}
}
{
"pytest_name": "spatial_sensor_calibration",
"label": "Lid Accelerometers Calibration By EC",
"related_components": [
"test_tags.TestCategory.ACCELEROMETER",
"test_tags.TestCategory.VPD"
],
"args": {
"device_name": "cros-ec-accel",
"device_location": "lid",
"raw_entry_template": "in_accel_%s_raw",
"calibbias_entry_template": "in_accel_%s_calibbias",
"vpd_entry_template": "in_accel_%s_lid_calibbias"
}
}
Test Arguments¶
Name |
Type |
Description |
---|---|---|
timeout_secs |
int |
(optional; default: |
sensor_name |
str, dict |
(optional; default: |
device_name |
str |
The “name” atribute of the sensor |
device_location |
str |
The “location” atribute of the sensor |
raw_entry_template |
str |
(optional; default: |
calibbias_entry_template |
str |
(optional; default: |
vpd_entry_template |
str |
(optional; default: |
stabilize_time |
int |
(optional; default: |
prompt |
bool |
(optional; default: |
placement_range |
list |
(optional; default: |