7. API - G-Sensor
7.1. Regular Classes
The following classes are intended for general use with the devices they represent. All classes in this section are concrete (not abstract).
7.1.1. GSR
- class lannerpsp.GSR(check_platform: bool = False)[source]
G-Sensor.
- Parameters:
check_platform (bool) – Set to
True
to check if the platform supports this feature. Defaults toFalse
for better compatibility.- Raises:
PSPNotSupport – This function is not supported (when
check_platform
is set toTrue
).NotImplementedError – It has not been verified to run on this platform (when
check_platform
is set toTrue
).
- get_data() GSRDataModel [source]
Get the X-Axis, Y-Axis and Z-Axis data.
Example:
>>> gsr = GSR() >>> gsr_data = gsr.get_data() >>> gsr_data.g_range 2 >>> gsr_data.raw_x -4 >>> gsr_data.raw_y -9 >>> gsr_data.raw_z -214 >>> gsr_data.mg_x -0.03137254901960784 >>> gsr_data.mg_y -0.07058823529411765 >>> gsr_data.mg_z -1.6784313725490196 >>> gsr_data.to_dict() {'g_range': 2, 'raw_x': -3, 'raw_y': -9, 'raw_z': -218, 'mg_x': -0.023529411764705882, 'mg_y': -0.07058823529411765, 'mg_z': -1.7098039215686274}
- Returns:
X/Y/Z Axis data and range with ±g
- Return type:
- Raises:
PSPNotSupport – This platform does not support this function.
PSPError – General PSP functional error.
- get_offset() GSROffsetModel [source]
Get the X-Axis, Y-Axis and Z-Axis offset data.
Example:
>>> gsr = GSR() >>> gsr_offset = gsr.get_offset() >>> gsr_offset.raw_x 0 >>> gsr_offset.raw_y 0 >>> gsr_offset.raw_z 0 >>> gsr_offset.to_dict() {'raw_x': 0, 'raw_y': 0, 'raw_z': 0}
- Returns:
X/Y/Z Axis offset data
- Return type:
- Raises:
PSPNotSupport – This platform does not support this function.
PSPError – General PSP functional error.
7.2. Models
The following models are used to store data for data modeling.
7.2.1. GSRDataModel
7.2.2. GSROffsetModel
7.3. Supported Platforms
Note
GSR is commonly used on V-Series or R-Series platforms. See Vehicle/Rail Computer for more information.
The following platforms have been verified and confirmed to be supported: