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.
init(start_mode=STMOD_HOT, sat_set=SAT_GPS|SAT_GLONASS, cycle=1000)
Arguments:
- start_mode – start mode
- sat_set – set of GNSS satellites
- 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, lessTTFF
thanWARM
;STMOD_HOT
: hot Start;STMOD_HOT_ACC
: hot Start, better accuracy, lessTTFF
thanHOT
;STMOD_HOT_ACC2
: hot Start, better accuracy, lessTTFF
thanACC
;STMOD_HOT_ACC3
: optimized hot start, betterTTFF
thanHOT
;
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
: GPSSAT_GLONASS
: GlonassSAT_SBAS
: SBASSAT_QZ_L1CA
: L1CASAT_IMES
: IMESSAT_QZ_L1S
: L1SSAT_BEIDOU
: BeiDouSAT_GALILEO
: Galileo
Raises:
- UnsupportedError - when cycle is not a multiple of 1000.
- IOError - when initialization fails.
deinit()
Stops and de-initializes the GNSS system.
Raises: IOError - when de-initialization fails.
wait()
Waits for updated GNSS data to become available.
Raises: IOError - when the operation fails.
read(read_filter=FILTER_RECEIVER_POSITION | FILTER_RECEIVER_DATETIME)
Arguments: read_filter – bitmap to filter data to be read to save RAM.
Reads GNSS data. To be called after wait()
to be sure of reading updated data.
Returns a GNSSData()
object filled according to selected filters. Available filters are:
FILTER_TIMESTAMP
: fillsGNSSData.timestamp
FILTER_RECEIVER_SATS
: fillsGNSSData.receiver.sats
FILTER_RECEIVER_POSITION
: fillsGNSSData.receiver.position
, except forGNSSData.receiver.position.precision
FILTER_RECEIVER_POSITION_PRECISION
: fillsGNSSData.receiver.position
, includingGNSSData.receiver.position.precision
FILTER_RECEIVER_DATETIME
: fillsGNSSData.receiver.datetime
FILTER_RECEIVER
: fillsGNSSData.receiver
FILTER_SATS_DATA
: fillsGNSSData.sats
Raises: IOError - when read fails, for example if read()
is called immediately after init()
without waiting proper initialization time calling wait()
function.
class GNSSData
Class to store GNSS data retrieved by read()
calls.
N.B. Each attribute might be filled depending on selected read filter.
List of attributes:
GNSSData.timestamp
: integer timestampGNSSData.receiver
:Receiver()
instanceGNSSData.sats
: tuple ofSatelliteData()
instances
class Receiver
Class to store Receiver info retrieved by read()
calls.
N.B. Each attribute might be filled depending on selected read filter.
List of attributes:
Receiver.sats
:ReceiverSats()
instanceReceiver.position
:ReceiverPosition()
instanceReceiver.datetime
:ReceiverDatetime()
instance
class ReceiverSats
Class to store Receiver Satellites info retrieved by read()
calls.
N.B. Each attribute might be filled depending on selected read filter.
List of attributes:
ReceiverSats.numsv
: number of visible satellitesReceiverSats.numsv_tracking
: number of tracking satellitesReceiverSats.numsv_calcpos
: number of satellites to calculate the positionReceiverSats.numsv_calcvel
: number of satellites to calculate the velocityReceiverSats.svtype
: used sv system, bitfield.bit0:GPS
,bit1:GLONASS
,bit2:SBAS
,bit3:QZSS_L1CA
,bit4:IMES
,bit5:QZSS_L1SAIF
,bit6:Beidu
,bit7:Galileo
ReceiverSats.pos_svtype
: used sv system to calculate position, bitfieldReceiverSats.vel_svtype
: used sv system to calculate velocity, bitfield
class ReceiverPosition
Class to store Receiver Position info retrieved by read()
calls.
N.B. Each attribute might be filled depending on selected read filter.
List of attributes:
ReceiverPosition.type
: position type.0:Invalid
,1:GNSS
,2:IMES
,3:user set
,4:previous
ReceiverPosition.dgps
:0:SGPS
,1:DGPS
ReceiverPosition.pos_fixmode
:1:Invalid
,2:2D
,3:3D
ReceiverPosition.vel_fixmode
:1:Invalid
,2:2D VZ
,3:2D Offset
,4:3D
,5:1D
,6:PRED
ReceiverPosition.assist
: bit field[7..5] Reserved
[4] AEP Velocity
[3] AEP Position
[2] CEP Velocity
[1] CEP Position
,[0] user set
ReceiverPosition.pos_dataexist
:0:none
,1:exist
ReceiverPosition.possource
: position source.0:Invalid
,1:GNSS
,2:IMES
,3:user set
,4:previous
ReceiverPosition.tcxo_offset
: TCXO offset[Hz]
ReceiverPosition.latitude
: latitude[degree]
ReceiverPosition.longitude
: longitude[degree]
ReceiverPosition.altitude
: altitude[m]
ReceiverPosition.geoid
: geoid height[m]
ReceiverPosition.velocity
: velocity[m/s]
ReceiverPosition.direction
: direction[degree]
ReceiverPosition.precision
:ReceiverPositionPrecision()
instance
class ReceiverPositionPrecision
ReceiverPositionPrecision.pos_dop
:DOP()
instanceReceiverPositionPrecision.vel_idx
:DOP()
instanceReceiverPositionPrecision.pos_accuracy
:Variance()
instance
class DOP
Class to store Dilution of Precision.
Dop.pdop
: position DOPDop.hdop
: horizontal DOPDop.vdop
: vertical DOPDop.tdop
: time DOPDop.ewdop
: East-West DOPDop.nsdop
: North-South DOPDop.majdop
: Stdev of semi-major axisDop.mindop
: Stdev of semi-minor axisDop.oridop
: orientation of semi-major axis[deg]
class Variance
Class to store Variance.
Variance.hvar
: horizontal varianceVariance.vvar
: vertical variance
Utils¶
double_to_dmf(x)
Arguments: x – double to convert.
Converts from double format to degree-minute-frac format.
Returns a tuple of four elements: (sign, degree, minute, frac)
.