Inertial Class#
- class rocketpy.sensors.InertialSensor[source]#
Model of an inertial sensor (accelerometer, gyroscope, magnetometer). Inertial sensors measurements are handled as vectors. The measurements are affected by the sensor’s orientation in the rocket.
- Variables:
sampling_rate (
float
) – Sample rate of the sensor in Hz.orientation (
tuple
,list
) – Orientation of the sensor in the rocket.measurement_range (
float
,tuple
) – The measurement range of the sensor in the sensor units.resolution (
float
) – The resolution of the sensor in sensor units/LSB.noise_density (
float
,list
) – The noise density of the sensor in sensor units/√Hz.noise_variance (
float
,list
) – The variance of the noise of the sensor in sensor units^2.random_walk_density (
float
,list
) – The random walk density of the sensor in sensor units/√Hz.random_walk_variance (
float
,list
) – The variance of the random walk of the sensor in sensor units^2.constant_bias (
float
,list
) – The constant bias of the sensor in sensor units.operating_temperature (
float
) – The operating temperature of the sensor in Kelvin.temperature_bias (
float
,list
) – The temperature bias of the sensor in sensor units/K.temperature_scale_factor (
float
,list
) – The temperature scale factor of the sensor in %/K.cross_axis_sensitivity (
float
) – The cross axis sensitivity of the sensor in percentage.name (
str
) – The name of the sensor.rotation_matrix (
Matrix
) – The rotation matrix of the sensor from the rocket frame to the sensor frame of reference.normal_vector (
Vector
) – The normal vector of the sensor in the rocket frame of reference.measurement (
float
) – The measurement of the sensor after quantization, noise and temperature drift.measured_data (
list
) – The stored measured data of the sensor after quantization, noise and temperature drift.
- __init__(sampling_rate, orientation=(0, 0, 0), measurement_range=inf, resolution=0, noise_density=0, noise_variance=1, random_walk_density=0, random_walk_variance=1, constant_bias=0, operating_temperature=298.15, temperature_bias=0, temperature_scale_factor=0, cross_axis_sensitivity=0, name='Sensor')[source]#
Initialize the accelerometer sensor
- Parameters:
sampling_rate (
float
) – Sample rate of the sensororientation (
tuple
,list
, optional) –Orientation of the sensor in relation to the rocket frame of reference (Body Axes Coordinate System). See Rocket Class Axes Definitions for more information. If orientation is not given, the sensor axes will be aligned with the rocket axis. The orientation can be given as either:
A list or tuple of length 3, where the elements are the intrinsic rotation angles in radians. The rotation sequence z-x-z (3-1-3) is used, meaning the sensor is first around the z axis (roll), then around the new x axis (pitch) and finally around the new z axis (roll).
A list of lists (matrix) of shape 3x3, representing the rotation matrix from the sensor frame to the rocket frame. The sensor frame of reference is defined as being initially aligned with the rocket frame of reference.
measurement_range (
float
,tuple
, optional) – The measurement range of the sensor in the sensor units. If a float, the same range is applied both for positive and negative values. If a tuple, the first value is the positive range and the second value is the negative range. Default is np.inf.resolution (
float
, optional) – The resolution of the sensor in sensor units/LSB. Default is 0, meaning no quantization is applied.noise_density (
float
,list
, optional) – The noise density of the sensor for a Gaussian white noise in sensor units/√Hz. Sometimes called “white noise drift”, “angular random walk” for gyroscopes, “velocity random walk” for accelerometers or “(rate) noise density”. Default is 0, meaning no noise is applied. If a float or int is given, the same noise density is applied to all axes. The values of each axis can be set individually by passing a list of length 3.noise_variance (
float
,list
, optional) – The noise variance of the sensor for a Gaussian white noise in sensor units^2. Default is 1, meaning the noise is normally distributed with a standard deviation of 1 unit. If a float or int is given, the same noise variance is applied to all axes. The values of each axis can be set individually by passing a list of length 3.random_walk_density (
float
,list
, optional) – The random walk density of the sensor for a Gaussian random walk in sensor units/√Hz. Sometimes called “bias (in)stability” or “bias drift”. Default is 0, meaning no random walk is applied. If a float or int is given, the same random walk is applied to all axes. The values of each axis can be set individually by passing a list of length 3.random_walk_variance (
float
,list
, optional) – The random walk variance of the sensor for a Gaussian random walk in sensor units^2. Default is 1, meaning the noise is normally distributed with a standard deviation of 1 unit. If a float or int is given, the same random walk variance is applied to all axes. The values of each axis can be set individually by passing a list of length 3.constant_bias (
float
,list
, optional) – The constant bias of the sensor in sensor units. Default is 0, meaning no constant bias is applied. If a float or int is given, the same constant bias is applied to all axes. The values of each axis can be set individually by passing a list of length 3.operating_temperature (
float
, optional) – The operating temperature of the sensor in Kelvin. At 298.15 K (25 °C), the sensor is assumed to operate ideally, no temperature related noise is applied. Default is 298.15.temperature_bias (
float
,list
, optional) – The temperature bias of the sensor in sensor units/K. Default is 0, meaning no temperature bias is applied. If a float or int is given, the same temperature bias is applied to all axes. The values of each axis can be set individually by passing a list of length 3.temperature_scale_factor (
float
,list
, optional) – The temperature scale factor of the sensor in %/K. Default is 0, meaning no temperature scale factor is applied. If a float or int is given, the same temperature scale factor is applied to all axes. The values of each axis can be set individually by passing a list of length 3.cross_axis_sensitivity (
float
, optional) – Skewness of the sensor’s axes in percentage. Default is 0, meaning no cross-axis sensitivity is applied.name (
str
, optional) – The name of the sensor. Default is “Sensor”.
- Return type:
None
See also
TODO
- quantize(value)[source]#
Quantize the sensor measurement
- Parameters:
value (
float
) – The value to quantize- Returns:
The quantized value
- Return type:
float