Beispiel #1
0
class LinkedDataModel(LinkedDataModelBase):
    
    press = linked_loggable(Bme280.DataModel.press, NAME_BME280)
    temp = linked_loggable(Bme280.DataModel.temp, NAME_BME280)
    acc = linked_loggable(Bno055.DataModel.acc, NAME_BNO055)
    
    @cached_loggable
    def altitude(self):
        return press2alti(self.press, self.temp)
Beispiel #2
0
class ChildLoggingModel(LinkedDataModelBase):
    press = linked_loggable(Bme280.DataModel.press, child_setting.NAME_BME280)
    temp = linked_loggable(Bme280.DataModel.temp, child_setting.NAME_BME280)
    irradiance = linked_loggable(Opt3002.DataModel.irradiance,
                                 child_setting.NAME_OPT3002)
    longitude = linked_loggable(SamM8Q.DataModel.longitude,
                                child_setting.NAME_GPS)
    latitude = linked_loggable(SamM8Q.DataModel.latitude,
                               child_setting.NAME_GPS)

    @cached_loggable
    def altitude(self):
        return press2alti(self.press,
                          self.temp) - whole_setting.ALTITUDE_GROUND
class LoggingModel(LinkedDataModelBase):
    press = linked_loggable(Bme280.DataModel.press, setting.NAME_BME280)
    temp = linked_loggable(Bme280.DataModel.temp, setting.NAME_BME280)
    acc = linked_loggable(Bno055.DataModel.acc_lin,
                          setting.NAME_BNO055,
                          logging=False)
    gravity = linked_loggable(Bno055.DataModel.acc_gra,
                              setting.NAME_BNO055,
                              logging=False)
    euler = linked_loggable(Bno055.DataModel.euler,
                            setting.NAME_BNO055,
                            logging=False)
    altitude_gps = linked_loggable(SamM8Q.DataModel.altitude, setting.NAME_GPS)
    longitude = linked_loggable(SamM8Q.DataModel.longitude, setting.NAME_GPS)
    latitude = linked_loggable(SamM8Q.DataModel.latitude, setting.NAME_GPS)

    @cached_loggable
    def altitude(self):
        return press2alti(self.press, self.temp)

    @cached_loggable
    def altitude_relative(self):
        return self.altitude - whole_setting.ALTITUDE_GROUND

    @loggable
    def acc_x(self):
        return self.acc[0]

    @loggable
    def acc_y(self):
        return self.acc[1]

    @loggable
    def acc_z(self):
        return self.acc[2]

    @loggable
    def gra_x(self):
        return self.gravity[0]

    @loggable
    def gra_y(self):
        return self.gravity[1]

    @loggable
    def gra_z(self):
        return self.gravity[2]

    @loggable
    def heading(self):
        return self.euler[0]

    @loggable
    def pitch(self):
        return self.euler[1]

    @loggable
    def roll(self):
        return self.euler[2]
Beispiel #4
0
class RunningModel(LinkedDataModelBase):

    longitude = linked_loggable(SamM8Q.DataModel.longitude, setting.NAME_GPS)
    latitude = linked_loggable(SamM8Q.DataModel.latitude, setting.NAME_GPS)
    mag = linked_loggable(Bno055.DataModel.mag, setting.NAME_BNO055)
    euler = linked_loggable(Bno055.DataModel.euler, setting.NAME_BNO055)

    def setup(self):
        self._navi_goal = Navigator(Position(*setting.POSITION_GOAL))
        self._navi_child = Navigator(Position(*setting.POSITION_CHILD))

    @loggable
    def heading(self):
        return self.euler[0]

    @cached_property
    def position(self):
        if self.latitude is None or self.longitude is None:
            return None
        return Position(self.longitude, self.latitude, degree=True)

    @cached_loggable
    def distance2goal(self):
        if self.latitude is None or self.longitude is None:
            return None
        return self._navi_goal.delta_distance(self.postition)

    @cached_loggable
    def offset_angle2goal(self):
        if self.latitude is None or self.longitude is None:
            return None
        return self._navi_goal.delta_angle(self.position, self.heading)

    @cached_loggable
    def distance2child(self):
        if self.latitude is None or self.longitude is None:
            return None
        postition = Position(self.longitude, self.latitude, degree=True)
        return self._navi_child.delta_distance(postition)

    @cached_loggable
    def offset_angle2child(self):
        if self.latitude is None or self.longitude is None:
            return None
        return self._navi_child.delta_angle(self.position, self.heading)
Beispiel #5
0
class RunningModel(LinkedDataModelBase):

    TEMP_GOAL = [0., 0.]

    longitude = linked_loggable(SamM8Q.DataModel.longitude, setting.NAME_GPS)
    latitude = linked_loggable(SamM8Q.DataModel.latitude, setting.NAME_GPS)
    euler = linked_loggable(Bno055.DataModel.euler,
                            setting.NAME_BNO055,
                            logging=False)

    def setup(self) -> None:
        self._navi_goal_temp = Navigator(Position(*self.TEMP_GOAL))

    @cached_property
    def position(self):
        return Position(self.longitude, self.latitude, degree=True)

    @loggable
    def heading(self):
        return self.euler[0]

    @cached_loggable
    def offset_angle2goal(self):
        return self._navi_goal.delta_angle(self.position, self.heading)
Beispiel #6
0
class LinkedDataModel(LinkedDataModelBase):
    num = linked_loggable(NumberGenerator.DataModel.num, NAME_NUMBERGENERATOR)

    @cached_loggable
    def num_sqrt(self):
        return self.num**2