| 1 |
|
| 2 |
// Copyright (c) 2003-2019 Xsens Technologies B.V. or subsidiaries worldwide. |
| 3 |
// All rights reserved. |
| 4 |
// |
| 5 |
// Redistribution and use in source and binary forms, with or without modification, |
| 6 |
// are permitted provided that the following conditions are met: |
| 7 |
// |
| 8 |
// 1. Redistributions of source code must retain the above copyright notice, |
| 9 |
// this list of conditions, and the following disclaimer. |
| 10 |
// |
| 11 |
// 2. Redistributions in binary form must reproduce the above copyright notice, |
| 12 |
// this list of conditions, and the following disclaimer in the documentation |
| 13 |
// and/or other materials provided with the distribution. |
| 14 |
// |
| 15 |
// 3. Neither the names of the copyright holders nor the names of their contributors |
| 16 |
// may be used to endorse or promote products derived from this software without |
| 17 |
// specific prior written permission. |
| 18 |
// |
| 19 |
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY |
| 20 |
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 21 |
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL |
| 22 |
// THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 |
// SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT |
| 24 |
// OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 25 |
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR |
| 26 |
// TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 27 |
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.THE LAWS OF THE NETHERLANDS |
| 28 |
// SHALL BE EXCLUSIVELY APPLICABLE AND ANY DISPUTES SHALL BE FINALLY SETTLED UNDER THE RULES |
| 29 |
// OF ARBITRATION OF THE INTERNATIONAL CHAMBER OF COMMERCE IN THE HAGUE BY ONE OR MORE |
| 30 |
// ARBITRATORS APPOINTED IN ACCORDANCE WITH SAID RULES. |
| 31 |
// |
| 32 |
|
| 33 |
#ifndef XSRAWGNSSPVTDATA_H |
| 34 |
#define XSRAWGNSSPVTDATA_H |
| 35 |
|
| 36 |
#include "pstdint.h" |
| 37 |
|
| 38 |
#ifdef _MSC_VER |
| 39 |
#pragma pack(push, 1) |
| 40 |
#elif defined (__ICCARM__) |
| 41 |
_Pragma("pack(push, 1)") |
| 42 |
#endif |
| 43 |
|
| 44 |
#ifndef __cplusplus |
| 45 |
#define XSRAWGNSSPVTDATA_INITIALIZER { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } |
| 46 |
#else |
| 47 |
#include <cstring> |
| 48 |
#endif |
| 49 |
|
| 50 |
// The valid flag from the PVT package has the following fields, x is the valid flag. |
| 51 |
#define GNSS_PVT_VALID_DATE(x) (0x01 & x) // UTC date is valid |
| 52 |
#define GNSS_PVT_VALID_TIME(x) (0x02 & x) // UTC time of day is valid |
| 53 |
#define GNSS_PVT_VALID_RESOLVE(x) (0x04 & x) // UTC time of day has been fully resolved |
| 54 |
|
| 55 |
/*! \brief A container for GNSS Position Velocity and Time data |
| 56 |
*/ |
| 57 |
struct XsRawGnssPvtData |
| 58 |
{ |
| 59 |
uint32_t m_itow; //!< GNSS time of week (ms) |
| 60 |
uint16_t m_year; //!< Year (UTC) |
| 61 |
uint8_t m_month; //!< Month (UTC) |
| 62 |
uint8_t m_day; //!< Day of Month (UTC) |
| 63 |
uint8_t m_hour; //!< Hour of day 0..23 (UTC) |
| 64 |
uint8_t m_min; //!< Minute of hour 0..59 (UTC) |
| 65 |
uint8_t m_sec; //!< Seconds of minute 0..60 (UTC) |
| 66 |
uint8_t m_valid; /*!< Validity Flags |
| 67 |
bit(0) = Set if UTC Date is valid |
| 68 |
bit(1) = Set if UTC Time of Day if valid |
| 69 |
bit(2) = Set if UTC Time of Day has been fully resolved (no seconds uncertainty) |
| 70 |
*/ |
| 71 |
uint32_t m_tAcc; //!< Time accuracy estimate (ns) (UTC) |
| 72 |
int32_t m_nano; //!< Fraction of second (ns) -1e9..1e9 (UTC) |
| 73 |
uint8_t m_fixType; /*!< GNSSfix Type, range 0..5 |
| 74 |
0x00 = No Fix |
| 75 |
0x01 = Dead Reckoning only |
| 76 |
0x02 = 2D-Fix |
| 77 |
0x03 = 3D-Fix |
| 78 |
0x04 = GNSS + dead reckoning combined |
| 79 |
0x05 = Time only fix |
| 80 |
0x06..0xff: reserved |
| 81 |
*/ |
| 82 |
uint8_t m_flags; /*!< Fix Status Flags |
| 83 |
bit(0) = Set if there is a valid fix (i.e. within DOP & accuracy masks) |
| 84 |
bit(1) = Set if differential corrections were applied |
| 85 |
bit(2..4) = Reserved (Ignore) |
| 86 |
bit(5) = Set if heading of vehicle is valid |
| 87 |
*/ |
| 88 |
|
| 89 |
uint8_t m_numSv; //!< Number of satellites used in Nav Solution |
| 90 |
uint8_t m_res1; //!< Reserved for future use (1) |
| 91 |
int32_t m_lon; //!< Longitude (deg) (scaling 1e-7) |
| 92 |
int32_t m_lat; //!< Latitude (deg) (scaling 1e-7) |
| 93 |
int32_t m_height; //!< Height above ellipsoid (mm) |
| 94 |
int32_t m_hMsl; //!< Height above mean sea level (mm) |
| 95 |
|
| 96 |
uint32_t m_hAcc; //!< Horizontal accuracy estimate (mm) |
| 97 |
uint32_t m_vAcc; //!< Vertical accuracy estimate (mm) |
| 98 |
|
| 99 |
int32_t m_velN; //!< NED north velocity (mm/s) |
| 100 |
int32_t m_velE; //!< NED east velocity (mm/s) |
| 101 |
int32_t m_velD; //!< NED down velocity (mm/s) |
| 102 |
int32_t m_gSpeed; //!< 2D Ground Speed (mm/s) |
| 103 |
int32_t m_headMot; //!< 2D Heading of motion (deg) (scaling 1e-5) |
| 104 |
|
| 105 |
uint32_t m_sAcc; //!< Speed accuracy estimate (mm/s) |
| 106 |
uint32_t m_headAcc; //!< Heading accuracy estimate (both motion and vehicle) (deg) (scaling 1-e5) |
| 107 |
int32_t m_headVeh; //!< 2D Heading of vehicle (deg) (scaling 1e-5) |
| 108 |
|
| 109 |
uint16_t m_gdop; //!< Geometric DOP (scaling 0.01) |
| 110 |
uint16_t m_pdop; //!< Position DOP (scaling 0.01) |
| 111 |
uint16_t m_tdop; //!< Time DOP (scaling 0.01) |
| 112 |
uint16_t m_vdop; //!< Vertical DOP (scaling 0.01) |
| 113 |
uint16_t m_hdop; //!< Horizontal DOP (scaling 0.01) |
| 114 |
uint16_t m_ndop; //!< Northing DOP (scaling 0.01) |
| 115 |
uint16_t m_edop; //!< Easting DOP (scaling 0.01) |
| 116 |
|
| 117 |
#ifdef __cplusplus |
| 118 |
/*! \brief Returns true if all fields of this and \a other are exactly identical */ |
| 119 |
inline bool operator == (const XsRawGnssPvtData& other) const |
| 120 |
{ |
| 121 |
// direct memory comparison is allowed because all fields line up properly |
| 122 |
return std::memcmp(this, &other, sizeof(XsRawGnssPvtData)) == 0; |
| 123 |
} |
| 124 |
#endif |
| 125 |
|
| 126 |
}; |
| 127 |
typedef struct XsRawGnssPvtData XsRawGnssPvtData; |
| 128 |
|
| 129 |
#ifdef _MSC_VER |
| 130 |
#pragma pack(pop) |
| 131 |
#elif defined (__ICCARM__) |
| 132 |
_Pragma("pack(pop)") |
| 133 |
#endif |
| 134 |
|
| 135 |
#endif |