from typing import List, AnyStr

from numpy.typing import ArrayLike
from spatz.dataset import ArrayLike, Dataset
from spatz.logger import ArrayLike, Logger
from spatz.sensors import IMU, Accelerometer, Gyroscope
from spatz.transforms import Transform


class BHI160Gyro(Gyroscope):
    def __init__(self, dataset: Dataset, logger: Logger, offset: float = 0, transforms: List[Transform] = []):
        super().__init__(dataset, logger, offset, transforms)

    def _get_name(self) -> AnyStr:
        return 'BHI160'

    def _get_data(self) -> ArrayLike:
        rots = self._dataset.fetch_values(['roll_l', 'pitch_l', 'yaw_l'])

        return rots

    def _sensor_specific_effects(self, x: ArrayLike) -> ArrayLike:
        return x
    

class BHI160Acc(Accelerometer):
    def __init__(self, dataset: Dataset, logger: Logger, offset: float = 0, transforms: List[Transform] = []):
        super().__init__(dataset, logger, offset, transforms)

    def _get_name(self) -> AnyStr:
        return 'BHI160'
    
    def _sensor_specific_effects(self, x: ArrayLike) -> ArrayLike:
        return x
