Ejemplo n.º 1
0
 def __init__(self, date=None):
     from morse.sensors._magnetometer import Magnetometer as Mag
     self._mag = Mag(os.path.join(MORSE_COMPONENTS, 'WMM.COF'))
     self._coord_conv = CoordinateConverter.instance()
     if date:
         self._date = date
     else:
         self._date = _decimal_date(datetime.date.today())
Ejemplo n.º 2
0
 def __init__(self, date = None):
     from morse.sensors._magnetometer import Magnetometer as Mag
     self._mag = Mag(os.path.join(MORSE_COMPONENTS, 'WMM.COF'))
     self._coord_conv = CoordinateConverter.instance()
     if date:
         self._date = date
     else:
         self._date = _decimal_date(datetime.date.today())
Ejemplo n.º 3
0
class MagnetoDriver(object):
    def __init__(self, date=None):
        from morse.sensors._magnetometer import Magnetometer as Mag
        self._mag = Mag(os.path.join(MORSE_COMPONENTS, 'WMM.COF'))
        self._coord_conv = CoordinateConverter.instance()
        if date:
            self._date = date
        else:
            self._date = _decimal_date(datetime.date.today())

    def compute(self, pose):
        pos = numpy.matrix(pose.translation)
        pos_lla = self._coord_conv.ltp_to_geodetic(pos)
        (decl, incl, f, h, x, y,
         z) = self._mag.compute(degrees(pos_lla[0, 0]), degrees(pos_lla[0, 1]),
                                pos_lla[0, 2] / 1000.0, self._date)
        mag_field = mathutils.Vector((x, y, z))
        return mag_field * pose.rotation_matrix
Ejemplo n.º 4
0
class MagnetoDriver(object):
    def __init__(self, date=None):
        from morse.sensors._magnetometer import Magnetometer as Mag

        self._mag = Mag(os.path.join(MORSE_COMPONENTS, "WMM.COF"))
        self._coord_conv = CoordinateConverter.instance()
        if date:
            self._date = date
        else:
            self._date = _decimal_date(datetime.date.today())

    def compute(self, pose):
        pos = pose.translation
        pos_lla = self._coord_conv.ltp_to_geodetic(pos)
        (decl, incl, f, h, x, y, z) = self._mag.compute(
            degrees(pos_lla[0]), degrees(pos_lla[1]), pos_lla[2] / 1000.0, self._date
        )
        mag_field = mathutils.Vector((x, y, z))
        return mag_field * pose.rotation_matrix