.. module:: cxd5602gnss ************************ Sony CXD5602 GNSS Module ************************ This module implements the Zerynth driver for the Sony CXD5602 GNSS. It allows configuring and retrieving data from the GNSS module mounted on the Sony Spresense board. .. function:: init(start_mode=STMOD_HOT, sat_set=SAT_GPS|SAT_GLONASS, cycle=1000) :param start_mode: start mode :param sat_set: set of GNSS satellites :param cycle: positioning data evaluation cycle, must be multiple of 1000 Initializes and starts the GNSS system. ``start_mode`` can be one of (with ``TTFF`` meaning ``Time To First Fix``): * ``STMOD_COLD``: cold Start; * ``STMOD_WARM``: warm Start; * ``STMOD_WARM_ACC2``: warm Start, better accuracy, less ``TTFF`` than ``WARM``; * ``STMOD_HOT``: hot Start; * ``STMOD_HOT_ACC``: hot Start, better accuracy, less ``TTFF`` than ``HOT``; * ``STMOD_HOT_ACC2``: hot Start, better accuracy, less ``TTFF`` than ``ACC``; * ``STMOD_HOT_ACC3``: optimized hot start, better ``TTFF`` than ``HOT``; For more details on the start mode to choose refer to the `official documentation `_. ``sat_set`` is a bitmap containing the set of satellites to derive positioning data from. Supported satellites are: * ``SAT_GPS``: GPS * ``SAT_GLONASS``: Glonass * ``SAT_SBAS``: SBAS * ``SAT_QZ_L1CA``: L1CA * ``SAT_IMES``: IMES * ``SAT_QZ_L1S``: L1S * ``SAT_BEIDOU``: BeiDou * ``SAT_GALILEO``: Galileo :raise UnsupportedError: when cycle is not a multiple of 1000 :raise IOError: when initialization fails .. function:: deinit() Stops and de-initializes the GNSS system. :raise IOError: when de-initialization fails .. function:: wait() Waits for updated GNSS data to become available. :raise IOError: when the operation fails .. function:: read(read_filter=FILTER_RECEIVER_POSITION | FILTER_RECEIVER_DATETIME) :param read_filter: bitmap to filter data to be read to save RAM Reads GNSS data. To be called after :func:`wait` to be sure of reading updated data. Returns a :class:`GNSSData` object filled according to selected filters. Available filters are: * ``FILTER_TIMESTAMP``: fills ``GNSSData.timestamp`` * ``FILTER_RECEIVER_SATS``: fills ``GNSSData.receiver.sats`` * ``FILTER_RECEIVER_POSITION``: fills ``GNSSData.receiver.position``, except for ``GNSSData.receiver.position.precision`` * ``FILTER_RECEIVER_POSITION_PRECISION``: fills ``GNSSData.receiver.position``, including ``GNSSData.receiver.position.precision`` * ``FILTER_RECEIVER_DATETIME``: fills ``GNSSData.receiver.datetime`` * ``FILTER_RECEIVER``: fills ``GNSSData.receiver`` * ``FILTER_SATS_DATA``: fills ``GNSSData.sats`` :raise IOError: when read fails, for example if :func:`read` is called immediately after :func:`init` without waiting proper initialization time calling :func:`wait` function. .. class:: GNSSData() Class to store GNSS data retrieved by :func:`read` calls. **N.B.** Each attribute might be filled depending on selected read filter. List of attributes: * :attr:`GNSSData.timestamp`: integer timestamp * :attr:`GNSSData.receiver`: :class:`Receiver` instance * :attr:`GNSSData.sats`: tuple of :class:`SatelliteData` instances .. class:: Receiver() Class to store Receiver info retrieved by :func:`read` calls. **N.B.** Each attribute might be filled depending on selected read filter. List of attributes: * :attr:`Receiver.sats`: :class:`ReceiverSats` instance * :attr:`Receiver.position`: :class:`ReceiverPosition` instance * :attr:`Receiver.datetime`: :class:`ReceiverDatetime` instance .. class:: ReceiverSats() Class to store Receiver Satellites info retrieved by :func:`read` calls. **N.B.** Each attribute might be filled depending on selected read filter. List of attributes: * :attr:`ReceiverSats.numsv`: number of visible satellites * :attr:`ReceiverSats.numsv_tracking`: number of tracking satellites * :attr:`ReceiverSats.numsv_calcpos`: number of satellites to calculate the position * :attr:`ReceiverSats.numsv_calcvel`: number of satellites to calculate the velocity * :attr:`ReceiverSats.svtype`: used sv system, bitfield. ``bit0:GPS``, ``bit1:GLONASS``, ``bit2:SBAS``, ``bit3:QZSS_L1CA``, ``bit4:IMES``, ``bit5:QZSS_L1SAIF``, ``bit6:Beidu``, ``bit7:Galileo`` * :attr:`ReceiverSats.pos_svtype`: used sv system to calculate position, bitfield * :attr:`ReceiverSats.vel_svtype`: used sv system to calculate velocity, bitfield .. class:: ReceiverPosition() Class to store Receiver Position info retrieved by :func:`read` calls. **N.B.** Each attribute might be filled depending on selected read filter. List of attributes: * :attr:`ReceiverPosition.type`: position type. ``0:Invalid``, ``1:GNSS``, ``2:IMES``, ``3:user set``, ``4:previous`` * :attr:`ReceiverPosition.dgps`: ``0:SGPS``, ``1:DGPS`` * :attr:`ReceiverPosition.pos_fixmode`: ``1:Invalid``, ``2:2D``, ``3:3D`` * :attr:`ReceiverPosition.vel_fixmode`: ``1:Invalid``, ``2:2D VZ``, ``3:2D Offset``, ``4:3D``, ``5:1D``, ``6:PRED`` * :attr:`ReceiverPosition.assist`: bit field ``[7..5] Reserved`` ``[4] AEP Velocity`` ``[3] AEP Position`` ``[2] CEP Velocity`` ``[1] CEP Position``, ``[0] user set`` * :attr:`ReceiverPosition.pos_dataexist`: ``0:none``, ``1:exist`` * :attr:`ReceiverPosition.possource`: position source. ``0:Invalid``, ``1:GNSS``, ``2:IMES``, ``3:user set``, ``4:previous`` * :attr:`ReceiverPosition.tcxo_offset`: TCXO offset ``[Hz]`` * :attr:`ReceiverPosition.latitude`: latitude ``[degree]`` * :attr:`ReceiverPosition.longitude`: longitude ``[degree]`` * :attr:`ReceiverPosition.altitude`: altitude ``[m]`` * :attr:`ReceiverPosition.geoid`: geoid height ``[m]`` * :attr:`ReceiverPosition.velocity`: velocity ``[m/s]`` * :attr:`ReceiverPosition.direction`: direction ``[degree]`` * :attr:`ReceiverPosition.precision`: :class:`ReceiverPositionPrecision` instance .. class:: ReceiverPositionPrecision() * :attr:`ReceiverPositionPrecision.pos_dop`: :class:`DOP` instance * :attr:`ReceiverPositionPrecision.vel_idx`: :class:`DOP` instance * :attr:`ReceiverPositionPrecision.pos_accuracy`: :class:`Variance` instance .. class:: DOP() Class to store Dilution of Precision. * :attr:`Dop.pdop`: position DOP * :attr:`Dop.hdop`: horizontal DOP * :attr:`Dop.vdop`: vertical DOP * :attr:`Dop.tdop`: time DOP * :attr:`Dop.ewdop`: East-West DOP * :attr:`Dop.nsdop`: North-South DOP * :attr:`Dop.majdop`: Stdev of semi-major axis * :attr:`Dop.mindop`: Stdev of semi-minor axis * :attr:`Dop.oridop`: orientation of semi-major axis ``[deg]`` .. class:: Variance() Class to store Variance. * :attr:`Variance.hvar`: horizontal variance * :attr:`Variance.vvar`: vertical variance Utils ##### .. function:: double_to_dmf(x) :param x: double to convert Converts from double format to degree-minute-frac format. Returns a tuple of four elements: ``(sign, degree, minute, frac)``.