mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/SPATZ.git
synced 2025-09-29 05:17:33 +00:00
Latest updates to data conversion
This commit is contained in:
@@ -32,7 +32,7 @@ class Accelerometer(Sensor):
|
||||
orientation: NDArray = np.identity(3),
|
||||
offset: float = 0,
|
||||
transforms: List[Transform] = []):
|
||||
"""_summary_
|
||||
"""Accelerometer sensor base class.
|
||||
|
||||
Args:
|
||||
dataset (Dataset): A dataset object to fetch data from.
|
||||
@@ -50,30 +50,8 @@ class Accelerometer(Sensor):
|
||||
self._orientation = orientation
|
||||
|
||||
def _get_data(self) -> ArrayLike | float:
|
||||
"""
|
||||
acc = self._dataset.get_acceleration('global')
|
||||
|
||||
self._logger.write('global_ax', acc[0], self._get_name())
|
||||
self._logger.write('global_ay', acc[1], self._get_name())
|
||||
self._logger.write('global_az', acc[2], self._get_name())
|
||||
|
||||
# Convert FL to body
|
||||
acc = self._dataset.global_to_local() @ acc
|
||||
acc += self._dataset.global_to_local() @ np.array([0, 0, g])
|
||||
|
||||
self._logger.write('local_x', acc[0], self._get_name())
|
||||
self._logger.write('local_y', acc[1], self._get_name())
|
||||
self._logger.write('local_z', acc[2], self._get_name())
|
||||
|
||||
# Rotate the acceleration vector to accomodate the accelerometer's orientation on the rocket.
|
||||
acc = self._orientation @ acc
|
||||
|
||||
# Add the effects of the imu's offset.
|
||||
omega = self._dataset.get_angular_velocity()
|
||||
acc += (np.cross(omega, self._offset) + np.cross(omega, np.cross(omega, self._offset)))
|
||||
"""
|
||||
|
||||
acc = self._dataset.get_acceleration('local')
|
||||
acc += self._dataset.global_to_local() @ np.array([g, 0, 0])
|
||||
|
||||
return acc
|
||||
|
@@ -6,16 +6,26 @@ from numpy.typing import ArrayLike
|
||||
from spatz.dataset import ArrayLike, Dataset
|
||||
from spatz.logger import ArrayLike, Logger
|
||||
from spatz.sensors import IMU, Accelerometer, Gyroscope, CoordSystem
|
||||
from spatz.transforms import Transform, GaussianNoise
|
||||
from spatz.transforms import Transform, GaussianNoise, DriftingBias
|
||||
|
||||
|
||||
class IAM_20380HT(Gyroscope):
|
||||
def __init__(self, dataset: Dataset, logger: Logger, orientation=np.identity(3), transforms: List[Transform] = []):
|
||||
super().__init__(dataset, logger, orientation, transforms)
|
||||
|
||||
self.__bias = DriftingBias(np.zeros(3), np.array([0.00218, 0.00105, 0.00203]), 400)
|
||||
self.__constant_bias = np.random.normal(0, 2, 3)
|
||||
self.__normal = GaussianNoise(0, np.array([0.0049272, 0.00557833, 0.00407826]))
|
||||
|
||||
|
||||
def _get_name(self) -> AnyStr:
|
||||
return 'IAM-20380HT'
|
||||
|
||||
def _sensor_specific_effects(self, x: ArrayLike) -> ArrayLike:
|
||||
x = (x / np.pi) * 180
|
||||
|
||||
t = self._dataset.get_time()
|
||||
x = self.__constant_bias + self.__normal(t, self.__bias(t, x))
|
||||
|
||||
return x
|
||||
|
@@ -13,7 +13,7 @@ class SCA3300(Accelerometer):
|
||||
def __init__(self, dataset: Dataset, logger: Logger, orientation=np.identity(3), offset=0, transforms: List[Transform] = []):
|
||||
super().__init__(dataset, logger, orientation, offset, transforms)
|
||||
|
||||
self.__noise = GaussianNoise(0, 0.001)
|
||||
self.__noise = GaussianNoise(0, 0.01)
|
||||
|
||||
def _get_name(self) -> AnyStr:
|
||||
return 'SCA3300'
|
||||
|
@@ -34,7 +34,7 @@ class PressureSensor(Sensor):
|
||||
if self._ts_effects:
|
||||
# Pre-defined constants.
|
||||
_p = 3e6
|
||||
sigma = 40
|
||||
sigma = 100
|
||||
|
||||
# How far away from transsonic speed (mach 1) are we?
|
||||
vvec = self._dataset.get_velocity('global')
|
||||
|
Reference in New Issue
Block a user