diff --git a/c/include/libsbp/cpp/message_traits.h b/c/include/libsbp/cpp/message_traits.h index 4a22e72a6c..2c03396ea4 100644 --- a/c/include/libsbp/cpp/message_traits.h +++ b/c/include/libsbp/cpp/message_traits.h @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -1103,6 +1104,30 @@ struct MessageTraits { }; +template<> +struct MessageTraits { + static constexpr u16 id = 65295; +}; + + +template<> +struct MessageTraits { + static constexpr u16 id = 65511; +}; + + +template<> +struct MessageTraits { + static constexpr u16 id = 65512; +}; + + +template<> +struct MessageTraits { + static constexpr u16 id = 65513; +}; + + template<> struct MessageTraits { static constexpr u16 id = 65535; diff --git a/c/include/libsbp/solution_meta.h b/c/include/libsbp/solution_meta.h new file mode 100644 index 0000000000..9b66885236 --- /dev/null +++ b/c/include/libsbp/solution_meta.h @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2015-2018 Swift Navigation Inc. + * Contact: Swift Navigation + * + * This source is subject to the license found in the file 'LICENSE' which must + * be be distributed together with this source. All other rights reserved. + * + * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, + * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + */ + +/***************************************************************************** + * Automatically generated from yaml/swiftnav/sbp/solution_meta.yaml + * with generate.py. Please do not hand edit! + *****************************************************************************/ + +/** \defgroup solution_meta Solution_meta + * + * * Standardized Metadata messages for Fuzed Solution from Swift Navigation devices. + * \{ */ + +#ifndef LIBSBP_SOLUTION_META_MESSAGES_H +#define LIBSBP_SOLUTION_META_MESSAGES_H + +#include "common.h" + +SBP_PACK_START + + +/** Flags for a given solution input type. + * + * Metadata describing which sensors were involved in the solution. + * The structure is fixed no matter what the actual sensor type is. + * The sensor_type field tells you which sensor we are talking about. It also tells you + * whether the sensor data was actually used or not. + * The flags field, always a u8, contains the sensor-specific data. + * The content of flags, for each sensor type, is described in the relevant structures in this section. + */ +typedef struct SBP_ATTR_PACKED { + u8 sensor_type; /**< The type of sensor */ + u8 flags; /**< Refer to each InputType description [(XX)InputType] */ +} solution_input_type_t; + + +/** Solution Sensors Metadata + * + * This message contains all metadata about the sensors received and/or used in computing the Fuzed Solution. + * It focuses primarly, but not only, on GNSS metadata. + */ +#define SBP_MSG_SOLN_META 0xFF0F +typedef struct SBP_ATTR_PACKED { + u16 pdop; /**< Position Dilution of Precision, as per last available DOPS from Starling GNSS engine [0.01] */ + u16 hdop; /**< Horizontal Dilution of Precision, as per last available DOPS from Starling GNSS engine [0.01] */ + u16 vdop; /**< Vertical Dilution of Precision, as per last available DOPS from Starling GNSS engine [0.01] */ + u8 n_sats; /**< Number of satellites used in solution, as per last available DOPS from Starling GNSS engine */ + u16 age_corrections; /**< Age of the corrections (0xFFFF indicates invalid), as per last available AGE_CORRECTIONS from Starling GNSS engine [deciseconds] */ + u8 alignment_status; /**< Bits for reason why it cannot align (yet) */ + u32 last_used_gnss_pos_tow; /**< Tow of last-used GNSS position measurement [ms] */ + u32 last_used_gnss_vel_tow; /**< Tow of last-used GNSS velocity measurement [ms] */ + solution_input_type_t sol_in[0]; /**< Array of Metadata describing the sensors potentially involved in the solution. Each element in the array represents a single sensor type and consists of flags containing (meta)data pertaining to that specific single sensor. Refer to each (XX)InputType descriptor in the present doc. */ +} msg_soln_meta_t; + + +/** Flags for a given GNSS sensor used as input for the fuzed solution. + * + * Metadata around the GNSS sensors involved in the fuzed solution. Accessible through sol_in[N].flags + * in a MSG_SOLN_META. + * Note: Just to build descriptive tables in documentation and not actually used. + */ +#define SBP_GNSSInputType 0xFFE7 +typedef struct SBP_ATTR_PACKED { + u8 flags; /**< flags that store all relevant info specific to this sensor type. */ +} gnss_input_type_t; + + +/** Flags for a given IMU sensor used as input for the fuzed solution. + * + * Metadata around the IMU sensors involved in the fuzed solution. Accessible through sol_in[N].flags + * in a MSG_SOLN_META. + * Note: Just to build descriptive tables in documentation and not actually used. + */ +#define SBP_IMUInputType 0xFFE8 +typedef struct SBP_ATTR_PACKED { + u8 flags; /**< flags that store all relevant info specific to this sensor type. */ +} imu_input_type_t; + + +/** Flags for a given Odometry sensor used as input for the fuzed solution. + * + * Metadata around the Odometry sensors involved in the fuzed solution. Accessible through sol_in[N].flags + * in a MSG_SOLN_META. + * Note: Just to build descriptive tables in documentation and not actually used. + */ +#define SBP_OdoInputType 0xFFE9 +typedef struct SBP_ATTR_PACKED { + u8 flags; /**< flags that store all relevant info specific to this sensor type. */ +} odo_input_type_t; + + +/** \} */ + +SBP_PACK_END + +#endif /* LIBSBP_SOLUTION_META_MESSAGES_H */ \ No newline at end of file diff --git a/docs/sbp.pdf b/docs/sbp.pdf index 61b958a5f4..dae5122354 100644 Binary files a/docs/sbp.pdf and b/docs/sbp.pdf differ diff --git a/generator/sbpg/targets/java.py b/generator/sbpg/targets/java.py index 9120ea279f..12df4a6698 100755 --- a/generator/sbpg/targets/java.py +++ b/generator/sbpg/targets/java.py @@ -54,6 +54,7 @@ def classnameify(s): """ Makes a classname. """ + if '_' not in s: return s return ''.join(w if w in ACRONYMS else w.title() for w in s.split('_')) diff --git a/haskell/sbp.cabal b/haskell/sbp.cabal index 53bed17c70..393d028cf2 100644 --- a/haskell/sbp.cabal +++ b/haskell/sbp.cabal @@ -2,7 +2,7 @@ name: sbp version: 3.2.0 synopsis: SwiftNav's SBP Library homepage: https://github.com/swift-nav/libsbp -license: LGPL-3 +license: MIT author: Swift Navigation Inc. maintainer: Swift Navigation copyright: Copyright (C) 2015-2018 Swift Navigation, Inc. @@ -42,6 +42,7 @@ library , SwiftNav.SBP.Piksi , SwiftNav.SBP.Sbas , SwiftNav.SBP.Settings + , SwiftNav.SBP.SolutionMeta , SwiftNav.SBP.Ssr , SwiftNav.SBP.System , SwiftNav.SBP.Tracking diff --git a/haskell/src/SwiftNav/SBP.hs b/haskell/src/SwiftNav/SBP.hs index f4d4e77092..92b5e33df2 100644 --- a/haskell/src/SwiftNav/SBP.hs +++ b/haskell/src/SwiftNav/SBP.hs @@ -1,7 +1,7 @@ -- | -- Module: SwiftNav.SBP -- Copyright: Copyright (C) 2015-2018 Swift Navigation, Inc. --- License: LGPL-3 +-- License: MIT -- Maintainer: Swift Navigation -- Stability: experimental -- Portability: portable @@ -31,6 +31,7 @@ import SwiftNav.SBP.Orientation as Exports import SwiftNav.SBP.Piksi as Exports import SwiftNav.SBP.Sbas as Exports import SwiftNav.SBP.Settings as Exports +import SwiftNav.SBP.SolutionMeta as Exports import SwiftNav.SBP.Ssr as Exports import SwiftNav.SBP.System as Exports import SwiftNav.SBP.Tracking as Exports diff --git a/haskell/src/SwiftNav/SBP/Acquisition.hs b/haskell/src/SwiftNav/SBP/Acquisition.hs index 8c6b43cb0d..839f3cf43a 100644 --- a/haskell/src/SwiftNav/SBP/Acquisition.hs +++ b/haskell/src/SwiftNav/SBP/Acquisition.hs @@ -6,7 +6,7 @@ -- | -- Module: SwiftNav.SBP.Acquisition -- Copyright: Copyright (C) 2015-2018 Swift Navigation, Inc. --- License: LGPL-3 +-- License: MIT -- Maintainer: Swift Navigation -- Stability: experimental -- Portability: portable diff --git a/haskell/src/SwiftNav/SBP/Bootload.hs b/haskell/src/SwiftNav/SBP/Bootload.hs index 34bb12894e..c9847ee25e 100644 --- a/haskell/src/SwiftNav/SBP/Bootload.hs +++ b/haskell/src/SwiftNav/SBP/Bootload.hs @@ -6,7 +6,7 @@ -- | -- Module: SwiftNav.SBP.Bootload -- Copyright: Copyright (C) 2015-2018 Swift Navigation, Inc. --- License: LGPL-3 +-- License: MIT -- Maintainer: Swift Navigation -- Stability: experimental -- Portability: portable diff --git a/haskell/src/SwiftNav/SBP/ExtEvents.hs b/haskell/src/SwiftNav/SBP/ExtEvents.hs index 4786d4bbc3..9503f119c0 100644 --- a/haskell/src/SwiftNav/SBP/ExtEvents.hs +++ b/haskell/src/SwiftNav/SBP/ExtEvents.hs @@ -6,7 +6,7 @@ -- | -- Module: SwiftNav.SBP.ExtEvents -- Copyright: Copyright (C) 2015-2018 Swift Navigation, Inc. --- License: LGPL-3 +-- License: MIT -- Maintainer: Swift Navigation -- Stability: experimental -- Portability: portable diff --git a/haskell/src/SwiftNav/SBP/FileIo.hs b/haskell/src/SwiftNav/SBP/FileIo.hs index e4d1f36dc6..a0d695485d 100644 --- a/haskell/src/SwiftNav/SBP/FileIo.hs +++ b/haskell/src/SwiftNav/SBP/FileIo.hs @@ -6,7 +6,7 @@ -- | -- Module: SwiftNav.SBP.FileIo -- Copyright: Copyright (C) 2015-2018 Swift Navigation, Inc. --- License: LGPL-3 +-- License: MIT -- Maintainer: Swift Navigation -- Stability: experimental -- Portability: portable diff --git a/haskell/src/SwiftNav/SBP/Flash.hs b/haskell/src/SwiftNav/SBP/Flash.hs index 5262778a6e..2f462f401a 100644 --- a/haskell/src/SwiftNav/SBP/Flash.hs +++ b/haskell/src/SwiftNav/SBP/Flash.hs @@ -6,7 +6,7 @@ -- | -- Module: SwiftNav.SBP.Flash -- Copyright: Copyright (C) 2015-2018 Swift Navigation, Inc. --- License: LGPL-3 +-- License: MIT -- Maintainer: Swift Navigation -- Stability: experimental -- Portability: portable diff --git a/haskell/src/SwiftNav/SBP/Gnss.hs b/haskell/src/SwiftNav/SBP/Gnss.hs index d2c93a0387..5b160e9f4a 100644 --- a/haskell/src/SwiftNav/SBP/Gnss.hs +++ b/haskell/src/SwiftNav/SBP/Gnss.hs @@ -6,7 +6,7 @@ -- | -- Module: SwiftNav.SBP.Gnss -- Copyright: Copyright (C) 2015-2018 Swift Navigation, Inc. --- License: LGPL-3 +-- License: MIT -- Maintainer: Swift Navigation -- Stability: experimental -- Portability: portable diff --git a/haskell/src/SwiftNav/SBP/Imu.hs b/haskell/src/SwiftNav/SBP/Imu.hs index 1f8fa322b0..247e19d29a 100644 --- a/haskell/src/SwiftNav/SBP/Imu.hs +++ b/haskell/src/SwiftNav/SBP/Imu.hs @@ -6,7 +6,7 @@ -- | -- Module: SwiftNav.SBP.Imu -- Copyright: Copyright (C) 2015-2018 Swift Navigation, Inc. --- License: LGPL-3 +-- License: MIT -- Maintainer: Swift Navigation -- Stability: experimental -- Portability: portable diff --git a/haskell/src/SwiftNav/SBP/Linux.hs b/haskell/src/SwiftNav/SBP/Linux.hs index 0f30c49879..dd3a29bcb0 100644 --- a/haskell/src/SwiftNav/SBP/Linux.hs +++ b/haskell/src/SwiftNav/SBP/Linux.hs @@ -6,7 +6,7 @@ -- | -- Module: SwiftNav.SBP.Linux -- Copyright: Copyright (C) 2015-2018 Swift Navigation, Inc. --- License: LGPL-3 +-- License: MIT -- Maintainer: Swift Navigation -- Stability: experimental -- Portability: portable diff --git a/haskell/src/SwiftNav/SBP/Logging.hs b/haskell/src/SwiftNav/SBP/Logging.hs index 2a82473439..a36381a118 100644 --- a/haskell/src/SwiftNav/SBP/Logging.hs +++ b/haskell/src/SwiftNav/SBP/Logging.hs @@ -6,7 +6,7 @@ -- | -- Module: SwiftNav.SBP.Logging -- Copyright: Copyright (C) 2015-2018 Swift Navigation, Inc. --- License: LGPL-3 +-- License: MIT -- Maintainer: Swift Navigation -- Stability: experimental -- Portability: portable diff --git a/haskell/src/SwiftNav/SBP/Mag.hs b/haskell/src/SwiftNav/SBP/Mag.hs index 88ba9dfd82..318bdb91b2 100644 --- a/haskell/src/SwiftNav/SBP/Mag.hs +++ b/haskell/src/SwiftNav/SBP/Mag.hs @@ -6,7 +6,7 @@ -- | -- Module: SwiftNav.SBP.Mag -- Copyright: Copyright (C) 2015-2018 Swift Navigation, Inc. --- License: LGPL-3 +-- License: MIT -- Maintainer: Swift Navigation -- Stability: experimental -- Portability: portable diff --git a/haskell/src/SwiftNav/SBP/Msg.hs b/haskell/src/SwiftNav/SBP/Msg.hs index a8ca4f64b9..290607cc79 100644 --- a/haskell/src/SwiftNav/SBP/Msg.hs +++ b/haskell/src/SwiftNav/SBP/Msg.hs @@ -7,7 +7,7 @@ -- | -- Module: SwiftNav.SBP.Msg -- Copyright: Copyright (C) 2015-2018 Swift Navigation, Inc. --- License: LGPL-3 +-- License: MIT -- Maintainer: Swift Navigation -- Stability: experimental -- Portability: portable @@ -41,6 +41,7 @@ import SwiftNav.SBP.Orientation import SwiftNav.SBP.Piksi import SwiftNav.SBP.Sbas import SwiftNav.SBP.Settings +import SwiftNav.SBP.SolutionMeta import SwiftNav.SBP.Ssr import SwiftNav.SBP.System import SwiftNav.SBP.Tracking @@ -54,7 +55,9 @@ import SwiftNav.SBP.Types -- Includes SBPMsgUnknown for valid SBP messages with undefined message -- types and SBPMsgBadCRC for SBP messages with invalid CRC checksums. data SBPMsg = - SBPMsgAcqResult MsgAcqResult Msg + SBPGNSSInputType GNSSInputType Msg + | SBPIMUInputType IMUInputType Msg + | SBPMsgAcqResult MsgAcqResult Msg | SBPMsgAcqResultDepA MsgAcqResultDepA Msg | SBPMsgAcqResultDepB MsgAcqResultDepB Msg | SBPMsgAcqResultDepC MsgAcqResultDepC Msg @@ -199,6 +202,7 @@ data SBPMsg = | SBPMsgSettingsSave MsgSettingsSave Msg | SBPMsgSettingsWrite MsgSettingsWrite Msg | SBPMsgSettingsWriteResp MsgSettingsWriteResp Msg + | SBPMsgSolnMeta MsgSolnMeta Msg | SBPMsgSpecan MsgSpecan Msg | SBPMsgSpecanDep MsgSpecanDep Msg | SBPMsgSsrCodeBiases MsgSsrCodeBiases Msg @@ -241,6 +245,7 @@ data SBPMsg = | SBPMsgVelNedDepA MsgVelNedDepA Msg | SBPMsgVelNedGnss MsgVelNedGnss Msg | SBPMsgWheeltick MsgWheeltick Msg + | SBPOdoInputType OdoInputType Msg | SBPMsgBadCrc Msg | SBPMsgUnknown Msg deriving ( Show, Read, Eq ) @@ -254,6 +259,8 @@ instance Binary SBPMsg where decoder <$> get where decoder m@Msg {..} | checkCrc m /= _msgSBPCrc = SBPMsgBadCrc m + | _msgSBPType == gNSSInputType = SBPGNSSInputType (decode (fromStrict (unBytes _msgSBPPayload))) m + | _msgSBPType == iMUInputType = SBPIMUInputType (decode (fromStrict (unBytes _msgSBPPayload))) m | _msgSBPType == msgAcqResult = SBPMsgAcqResult (decode (fromStrict (unBytes _msgSBPPayload))) m | _msgSBPType == msgAcqResultDepA = SBPMsgAcqResultDepA (decode (fromStrict (unBytes _msgSBPPayload))) m | _msgSBPType == msgAcqResultDepB = SBPMsgAcqResultDepB (decode (fromStrict (unBytes _msgSBPPayload))) m @@ -399,6 +406,7 @@ instance Binary SBPMsg where | _msgSBPType == msgSettingsSave = SBPMsgSettingsSave (decode (fromStrict (unBytes _msgSBPPayload))) m | _msgSBPType == msgSettingsWrite = SBPMsgSettingsWrite (decode (fromStrict (unBytes _msgSBPPayload))) m | _msgSBPType == msgSettingsWriteResp = SBPMsgSettingsWriteResp (decode (fromStrict (unBytes _msgSBPPayload))) m + | _msgSBPType == msgSolnMeta = SBPMsgSolnMeta (decode (fromStrict (unBytes _msgSBPPayload))) m | _msgSBPType == msgSpecan = SBPMsgSpecan (decode (fromStrict (unBytes _msgSBPPayload))) m | _msgSBPType == msgSpecanDep = SBPMsgSpecanDep (decode (fromStrict (unBytes _msgSBPPayload))) m | _msgSBPType == msgSsrCodeBiases = SBPMsgSsrCodeBiases (decode (fromStrict (unBytes _msgSBPPayload))) m @@ -441,11 +449,14 @@ instance Binary SBPMsg where | _msgSBPType == msgVelNedDepA = SBPMsgVelNedDepA (decode (fromStrict (unBytes _msgSBPPayload))) m | _msgSBPType == msgVelNedGnss = SBPMsgVelNedGnss (decode (fromStrict (unBytes _msgSBPPayload))) m | _msgSBPType == msgWheeltick = SBPMsgWheeltick (decode (fromStrict (unBytes _msgSBPPayload))) m + | _msgSBPType == odoInputType = SBPOdoInputType (decode (fromStrict (unBytes _msgSBPPayload))) m | otherwise = SBPMsgUnknown m put sm = do putWord8 msgSBPPreamble encoder sm where + encoder (SBPGNSSInputType _ m) = put m + encoder (SBPIMUInputType _ m) = put m encoder (SBPMsgAcqResult _ m) = put m encoder (SBPMsgAcqResultDepA _ m) = put m encoder (SBPMsgAcqResultDepB _ m) = put m @@ -591,6 +602,7 @@ instance Binary SBPMsg where encoder (SBPMsgSettingsSave _ m) = put m encoder (SBPMsgSettingsWrite _ m) = put m encoder (SBPMsgSettingsWriteResp _ m) = put m + encoder (SBPMsgSolnMeta _ m) = put m encoder (SBPMsgSpecan _ m) = put m encoder (SBPMsgSpecanDep _ m) = put m encoder (SBPMsgSsrCodeBiases _ m) = put m @@ -633,6 +645,7 @@ instance Binary SBPMsg where encoder (SBPMsgVelNedDepA _ m) = put m encoder (SBPMsgVelNedGnss _ m) = put m encoder (SBPMsgWheeltick _ m) = put m + encoder (SBPOdoInputType _ m) = put m encoder (SBPMsgUnknown m) = put m encoder (SBPMsgBadCrc m) = put m @@ -642,6 +655,8 @@ instance FromJSON SBPMsg where payload <- o .: "payload" decoder msgType payload where decoder msgType payload + | msgType == gNSSInputType = SBPGNSSInputType <$> pure (decode (fromStrict (unBytes payload))) <*> parseJSON obj + | msgType == iMUInputType = SBPIMUInputType <$> pure (decode (fromStrict (unBytes payload))) <*> parseJSON obj | msgType == msgAcqResult = SBPMsgAcqResult <$> pure (decode (fromStrict (unBytes payload))) <*> parseJSON obj | msgType == msgAcqResultDepA = SBPMsgAcqResultDepA <$> pure (decode (fromStrict (unBytes payload))) <*> parseJSON obj | msgType == msgAcqResultDepB = SBPMsgAcqResultDepB <$> pure (decode (fromStrict (unBytes payload))) <*> parseJSON obj @@ -787,6 +802,7 @@ instance FromJSON SBPMsg where | msgType == msgSettingsSave = SBPMsgSettingsSave <$> pure (decode (fromStrict (unBytes payload))) <*> parseJSON obj | msgType == msgSettingsWrite = SBPMsgSettingsWrite <$> pure (decode (fromStrict (unBytes payload))) <*> parseJSON obj | msgType == msgSettingsWriteResp = SBPMsgSettingsWriteResp <$> pure (decode (fromStrict (unBytes payload))) <*> parseJSON obj + | msgType == msgSolnMeta = SBPMsgSolnMeta <$> pure (decode (fromStrict (unBytes payload))) <*> parseJSON obj | msgType == msgSpecan = SBPMsgSpecan <$> pure (decode (fromStrict (unBytes payload))) <*> parseJSON obj | msgType == msgSpecanDep = SBPMsgSpecanDep <$> pure (decode (fromStrict (unBytes payload))) <*> parseJSON obj | msgType == msgSsrCodeBiases = SBPMsgSsrCodeBiases <$> pure (decode (fromStrict (unBytes payload))) <*> parseJSON obj @@ -829,6 +845,7 @@ instance FromJSON SBPMsg where | msgType == msgVelNedDepA = SBPMsgVelNedDepA <$> pure (decode (fromStrict (unBytes payload))) <*> parseJSON obj | msgType == msgVelNedGnss = SBPMsgVelNedGnss <$> pure (decode (fromStrict (unBytes payload))) <*> parseJSON obj | msgType == msgWheeltick = SBPMsgWheeltick <$> pure (decode (fromStrict (unBytes payload))) <*> parseJSON obj + | msgType == odoInputType = SBPOdoInputType <$> pure (decode (fromStrict (unBytes payload))) <*> parseJSON obj | otherwise = SBPMsgUnknown <$> parseJSON obj parseJSON _ = mzero @@ -839,6 +856,8 @@ instance FromJSON SBPMsg where pure $ review _Object $ a' <> b' instance ToJSON SBPMsg where + toJSON (SBPGNSSInputType n m) = toJSON n <<>> toJSON m + toJSON (SBPIMUInputType n m) = toJSON n <<>> toJSON m toJSON (SBPMsgAcqResult n m) = toJSON n <<>> toJSON m toJSON (SBPMsgAcqResultDepA n m) = toJSON n <<>> toJSON m toJSON (SBPMsgAcqResultDepB n m) = toJSON n <<>> toJSON m @@ -984,6 +1003,7 @@ instance ToJSON SBPMsg where toJSON (SBPMsgSettingsSave _ m) = toJSON m toJSON (SBPMsgSettingsWrite n m) = toJSON n <<>> toJSON m toJSON (SBPMsgSettingsWriteResp n m) = toJSON n <<>> toJSON m + toJSON (SBPMsgSolnMeta n m) = toJSON n <<>> toJSON m toJSON (SBPMsgSpecan n m) = toJSON n <<>> toJSON m toJSON (SBPMsgSpecanDep n m) = toJSON n <<>> toJSON m toJSON (SBPMsgSsrCodeBiases n m) = toJSON n <<>> toJSON m @@ -1026,10 +1046,13 @@ instance ToJSON SBPMsg where toJSON (SBPMsgVelNedDepA n m) = toJSON n <<>> toJSON m toJSON (SBPMsgVelNedGnss n m) = toJSON n <<>> toJSON m toJSON (SBPMsgWheeltick n m) = toJSON n <<>> toJSON m + toJSON (SBPOdoInputType n m) = toJSON n <<>> toJSON m toJSON (SBPMsgBadCrc m) = toJSON m toJSON (SBPMsgUnknown m) = toJSON m instance HasMsg SBPMsg where + msg f (SBPGNSSInputType n m) = SBPGNSSInputType n <$> f m + msg f (SBPIMUInputType n m) = SBPIMUInputType n <$> f m msg f (SBPMsgAcqResult n m) = SBPMsgAcqResult n <$> f m msg f (SBPMsgAcqResultDepA n m) = SBPMsgAcqResultDepA n <$> f m msg f (SBPMsgAcqResultDepB n m) = SBPMsgAcqResultDepB n <$> f m @@ -1175,6 +1198,7 @@ instance HasMsg SBPMsg where msg f (SBPMsgSettingsSave n m) = SBPMsgSettingsSave n <$> f m msg f (SBPMsgSettingsWrite n m) = SBPMsgSettingsWrite n <$> f m msg f (SBPMsgSettingsWriteResp n m) = SBPMsgSettingsWriteResp n <$> f m + msg f (SBPMsgSolnMeta n m) = SBPMsgSolnMeta n <$> f m msg f (SBPMsgSpecan n m) = SBPMsgSpecan n <$> f m msg f (SBPMsgSpecanDep n m) = SBPMsgSpecanDep n <$> f m msg f (SBPMsgSsrCodeBiases n m) = SBPMsgSsrCodeBiases n <$> f m @@ -1217,5 +1241,6 @@ instance HasMsg SBPMsg where msg f (SBPMsgVelNedDepA n m) = SBPMsgVelNedDepA n <$> f m msg f (SBPMsgVelNedGnss n m) = SBPMsgVelNedGnss n <$> f m msg f (SBPMsgWheeltick n m) = SBPMsgWheeltick n <$> f m + msg f (SBPOdoInputType n m) = SBPOdoInputType n <$> f m msg f (SBPMsgUnknown m) = SBPMsgUnknown <$> f m msg f (SBPMsgBadCrc m) = SBPMsgBadCrc <$> f m \ No newline at end of file diff --git a/haskell/src/SwiftNav/SBP/Navigation.hs b/haskell/src/SwiftNav/SBP/Navigation.hs index 4873ed4807..6b1071d27d 100644 --- a/haskell/src/SwiftNav/SBP/Navigation.hs +++ b/haskell/src/SwiftNav/SBP/Navigation.hs @@ -6,7 +6,7 @@ -- | -- Module: SwiftNav.SBP.Navigation -- Copyright: Copyright (C) 2015-2018 Swift Navigation, Inc. --- License: LGPL-3 +-- License: MIT -- Maintainer: Swift Navigation -- Stability: experimental -- Portability: portable diff --git a/haskell/src/SwiftNav/SBP/Ndb.hs b/haskell/src/SwiftNav/SBP/Ndb.hs index 9672733087..fa47a59556 100644 --- a/haskell/src/SwiftNav/SBP/Ndb.hs +++ b/haskell/src/SwiftNav/SBP/Ndb.hs @@ -6,7 +6,7 @@ -- | -- Module: SwiftNav.SBP.Ndb -- Copyright: Copyright (C) 2015-2018 Swift Navigation, Inc. --- License: LGPL-3 +-- License: MIT -- Maintainer: Swift Navigation -- Stability: experimental -- Portability: portable diff --git a/haskell/src/SwiftNav/SBP/Observation.hs b/haskell/src/SwiftNav/SBP/Observation.hs index 3a6203ac60..4b6de57b50 100644 --- a/haskell/src/SwiftNav/SBP/Observation.hs +++ b/haskell/src/SwiftNav/SBP/Observation.hs @@ -6,7 +6,7 @@ -- | -- Module: SwiftNav.SBP.Observation -- Copyright: Copyright (C) 2015-2018 Swift Navigation, Inc. --- License: LGPL-3 +-- License: MIT -- Maintainer: Swift Navigation -- Stability: experimental -- Portability: portable diff --git a/haskell/src/SwiftNav/SBP/Orientation.hs b/haskell/src/SwiftNav/SBP/Orientation.hs index a2f2457b72..41a134f9ff 100644 --- a/haskell/src/SwiftNav/SBP/Orientation.hs +++ b/haskell/src/SwiftNav/SBP/Orientation.hs @@ -6,7 +6,7 @@ -- | -- Module: SwiftNav.SBP.Orientation -- Copyright: Copyright (C) 2015-2018 Swift Navigation, Inc. --- License: LGPL-3 +-- License: MIT -- Maintainer: Swift Navigation -- Stability: experimental -- Portability: portable diff --git a/haskell/src/SwiftNav/SBP/Piksi.hs b/haskell/src/SwiftNav/SBP/Piksi.hs index a204bc3107..f329e69301 100644 --- a/haskell/src/SwiftNav/SBP/Piksi.hs +++ b/haskell/src/SwiftNav/SBP/Piksi.hs @@ -6,7 +6,7 @@ -- | -- Module: SwiftNav.SBP.Piksi -- Copyright: Copyright (C) 2015-2018 Swift Navigation, Inc. --- License: LGPL-3 +-- License: MIT -- Maintainer: Swift Navigation -- Stability: experimental -- Portability: portable diff --git a/haskell/src/SwiftNav/SBP/Sbas.hs b/haskell/src/SwiftNav/SBP/Sbas.hs index 9dce731e65..56039a7cdf 100644 --- a/haskell/src/SwiftNav/SBP/Sbas.hs +++ b/haskell/src/SwiftNav/SBP/Sbas.hs @@ -6,7 +6,7 @@ -- | -- Module: SwiftNav.SBP.Sbas -- Copyright: Copyright (C) 2015-2018 Swift Navigation, Inc. --- License: LGPL-3 +-- License: MIT -- Maintainer: Swift Navigation -- Stability: experimental -- Portability: portable diff --git a/haskell/src/SwiftNav/SBP/Settings.hs b/haskell/src/SwiftNav/SBP/Settings.hs index ebbc11964a..136db14416 100644 --- a/haskell/src/SwiftNav/SBP/Settings.hs +++ b/haskell/src/SwiftNav/SBP/Settings.hs @@ -6,7 +6,7 @@ -- | -- Module: SwiftNav.SBP.Settings -- Copyright: Copyright (C) 2015-2018 Swift Navigation, Inc. --- License: LGPL-3 +-- License: MIT -- Maintainer: Swift Navigation -- Stability: experimental -- Portability: portable diff --git a/haskell/src/SwiftNav/SBP/SolutionMeta.hs b/haskell/src/SwiftNav/SBP/SolutionMeta.hs new file mode 100644 index 0000000000..4ee53eb5a7 --- /dev/null +++ b/haskell/src/SwiftNav/SBP/SolutionMeta.hs @@ -0,0 +1,209 @@ +{-# OPTIONS_GHC -fno-warn-unused-imports #-} +{-# LANGUAGE NoImplicitPrelude #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE RecordWildCards #-} + +-- | +-- Module: SwiftNav.SBP.SolutionMeta +-- Copyright: Copyright (C) 2015-2018 Swift Navigation, Inc. +-- License: MIT +-- Maintainer: Swift Navigation +-- Stability: experimental +-- Portability: portable +-- +-- \ + +module SwiftNav.SBP.SolutionMeta + ( module SwiftNav.SBP.SolutionMeta + ) where + +import BasicPrelude +import Control.Lens +import Control.Monad.Loops +import Data.Binary +import Data.Binary.Get +import Data.Binary.IEEE754 +import Data.Binary.Put +import Data.ByteString.Lazy hiding (ByteString) +import Data.Int +import Data.Word +import SwiftNav.SBP.TH +import SwiftNav.SBP.Types + +{-# ANN module ("HLint: ignore Use camelCase"::String) #-} +{-# ANN module ("HLint: ignore Redundant do"::String) #-} +{-# ANN module ("HLint: ignore Use newtype instead of data"::String) #-} + + +-- | SolutionInputType. +-- +-- Metadata describing which sensors were involved in the solution. The +-- structure is fixed no matter what the actual sensor type is. The sensor_type +-- field tells you which sensor we are talking about. It also tells you whether +-- the sensor data was actually used or not. The flags field, always a u8, +-- contains the sensor-specific data. The content of flags, for each sensor +-- type, is described in the relevant structures in this section. +data SolutionInputType = SolutionInputType + { _solutionInputType_sensor_type :: !Word8 + -- ^ The type of sensor + , _solutionInputType_flags :: !Word8 + -- ^ Refer to each InputType description + } deriving ( Show, Read, Eq ) + +instance Binary SolutionInputType where + get = do + _solutionInputType_sensor_type <- getWord8 + _solutionInputType_flags <- getWord8 + pure SolutionInputType {..} + + put SolutionInputType {..} = do + putWord8 _solutionInputType_sensor_type + putWord8 _solutionInputType_flags + +$(makeJSON "_solutionInputType_" ''SolutionInputType) +$(makeLenses ''SolutionInputType) + +msgSolnMeta :: Word16 +msgSolnMeta = 0xFF0F + +-- | SBP class for message MSG_SOLN_META (0xFF0F). +-- +-- This message contains all metadata about the sensors received and/or used in +-- computing the Fuzed Solution. It focuses primarly, but not only, on GNSS +-- metadata. +data MsgSolnMeta = MsgSolnMeta + { _msgSolnMeta_pdop :: !Word16 + -- ^ Position Dilution of Precision, as per last available DOPS from Starling + -- GNSS engine + , _msgSolnMeta_hdop :: !Word16 + -- ^ Horizontal Dilution of Precision, as per last available DOPS from + -- Starling GNSS engine + , _msgSolnMeta_vdop :: !Word16 + -- ^ Vertical Dilution of Precision, as per last available DOPS from Starling + -- GNSS engine + , _msgSolnMeta_n_sats :: !Word8 + -- ^ Number of satellites used in solution, as per last available DOPS from + -- Starling GNSS engine + , _msgSolnMeta_age_corrections :: !Word16 + -- ^ Age of the corrections (0xFFFF indicates invalid), as per last available + -- AGE_CORRECTIONS from Starling GNSS engine + , _msgSolnMeta_alignment_status :: !Word8 + -- ^ Bits for reason why it cannot align (yet) + , _msgSolnMeta_last_used_gnss_pos_tow :: !Word32 + -- ^ Tow of last-used GNSS position measurement + , _msgSolnMeta_last_used_gnss_vel_tow :: !Word32 + -- ^ Tow of last-used GNSS velocity measurement + , _msgSolnMeta_sol_in :: ![SolutionInputType] + -- ^ Array of Metadata describing the sensors potentially involved in the + -- solution. Each element in the array represents a single sensor type and + -- consists of flags containing (meta)data pertaining to that specific + -- single sensor. Refer to each (XX)InputType descriptor in the present + -- doc. + } deriving ( Show, Read, Eq ) + +instance Binary MsgSolnMeta where + get = do + _msgSolnMeta_pdop <- getWord16le + _msgSolnMeta_hdop <- getWord16le + _msgSolnMeta_vdop <- getWord16le + _msgSolnMeta_n_sats <- getWord8 + _msgSolnMeta_age_corrections <- getWord16le + _msgSolnMeta_alignment_status <- getWord8 + _msgSolnMeta_last_used_gnss_pos_tow <- getWord32le + _msgSolnMeta_last_used_gnss_vel_tow <- getWord32le + _msgSolnMeta_sol_in <- whileM (not <$> isEmpty) get + pure MsgSolnMeta {..} + + put MsgSolnMeta {..} = do + putWord16le _msgSolnMeta_pdop + putWord16le _msgSolnMeta_hdop + putWord16le _msgSolnMeta_vdop + putWord8 _msgSolnMeta_n_sats + putWord16le _msgSolnMeta_age_corrections + putWord8 _msgSolnMeta_alignment_status + putWord32le _msgSolnMeta_last_used_gnss_pos_tow + putWord32le _msgSolnMeta_last_used_gnss_vel_tow + mapM_ put _msgSolnMeta_sol_in + +$(makeSBP 'msgSolnMeta ''MsgSolnMeta) +$(makeJSON "_msgSolnMeta_" ''MsgSolnMeta) +$(makeLenses ''MsgSolnMeta) + +gNSSInputType :: Word16 +gNSSInputType = 0xFFE7 + +-- | SBP class for message GNSSInputType (0xFFE7). +-- +-- Metadata around the GNSS sensors involved in the fuzed solution. Accessible +-- through sol_in[N].flags +-- in a MSG_SOLN_META. Note: Just to build descriptive tables in documentation +-- and not actually used. +data GNSSInputType = GNSSInputType + { _gNSSInputType_flags :: !Word8 + -- ^ flags that store all relevant info specific to this sensor type. + } deriving ( Show, Read, Eq ) + +instance Binary GNSSInputType where + get = do + _gNSSInputType_flags <- getWord8 + pure GNSSInputType {..} + + put GNSSInputType {..} = do + putWord8 _gNSSInputType_flags + +$(makeSBP 'gNSSInputType ''GNSSInputType) +$(makeJSON "_gNSSInputType_" ''GNSSInputType) +$(makeLenses ''GNSSInputType) + +iMUInputType :: Word16 +iMUInputType = 0xFFE8 + +-- | SBP class for message IMUInputType (0xFFE8). +-- +-- Metadata around the IMU sensors involved in the fuzed solution. Accessible +-- through sol_in[N].flags +-- in a MSG_SOLN_META. Note: Just to build descriptive tables in documentation +-- and not actually used. +data IMUInputType = IMUInputType + { _iMUInputType_flags :: !Word8 + -- ^ flags that store all relevant info specific to this sensor type. + } deriving ( Show, Read, Eq ) + +instance Binary IMUInputType where + get = do + _iMUInputType_flags <- getWord8 + pure IMUInputType {..} + + put IMUInputType {..} = do + putWord8 _iMUInputType_flags + +$(makeSBP 'iMUInputType ''IMUInputType) +$(makeJSON "_iMUInputType_" ''IMUInputType) +$(makeLenses ''IMUInputType) + +odoInputType :: Word16 +odoInputType = 0xFFE9 + +-- | SBP class for message OdoInputType (0xFFE9). +-- +-- Metadata around the Odometry sensors involved in the fuzed solution. +-- Accessible through sol_in[N].flags +-- in a MSG_SOLN_META. Note: Just to build descriptive tables in documentation +-- and not actually used. +data OdoInputType = OdoInputType + { _odoInputType_flags :: !Word8 + -- ^ flags that store all relevant info specific to this sensor type. + } deriving ( Show, Read, Eq ) + +instance Binary OdoInputType where + get = do + _odoInputType_flags <- getWord8 + pure OdoInputType {..} + + put OdoInputType {..} = do + putWord8 _odoInputType_flags + +$(makeSBP 'odoInputType ''OdoInputType) +$(makeJSON "_odoInputType_" ''OdoInputType) +$(makeLenses ''OdoInputType) diff --git a/haskell/src/SwiftNav/SBP/Ssr.hs b/haskell/src/SwiftNav/SBP/Ssr.hs index 83295ad210..d07840639a 100644 --- a/haskell/src/SwiftNav/SBP/Ssr.hs +++ b/haskell/src/SwiftNav/SBP/Ssr.hs @@ -6,7 +6,7 @@ -- | -- Module: SwiftNav.SBP.Ssr -- Copyright: Copyright (C) 2015-2018 Swift Navigation, Inc. --- License: LGPL-3 +-- License: MIT -- Maintainer: Swift Navigation -- Stability: experimental -- Portability: portable diff --git a/haskell/src/SwiftNav/SBP/System.hs b/haskell/src/SwiftNav/SBP/System.hs index c29d829e7d..9d55350d86 100644 --- a/haskell/src/SwiftNav/SBP/System.hs +++ b/haskell/src/SwiftNav/SBP/System.hs @@ -6,7 +6,7 @@ -- | -- Module: SwiftNav.SBP.System -- Copyright: Copyright (C) 2015-2018 Swift Navigation, Inc. --- License: LGPL-3 +-- License: MIT -- Maintainer: Swift Navigation -- Stability: experimental -- Portability: portable diff --git a/haskell/src/SwiftNav/SBP/Tracking.hs b/haskell/src/SwiftNav/SBP/Tracking.hs index 703bc54a6a..572ba835d3 100644 --- a/haskell/src/SwiftNav/SBP/Tracking.hs +++ b/haskell/src/SwiftNav/SBP/Tracking.hs @@ -6,7 +6,7 @@ -- | -- Module: SwiftNav.SBP.Tracking -- Copyright: Copyright (C) 2015-2018 Swift Navigation, Inc. --- License: LGPL-3 +-- License: MIT -- Maintainer: Swift Navigation -- Stability: experimental -- Portability: portable diff --git a/haskell/src/SwiftNav/SBP/User.hs b/haskell/src/SwiftNav/SBP/User.hs index 15d342ca88..8e695fba93 100644 --- a/haskell/src/SwiftNav/SBP/User.hs +++ b/haskell/src/SwiftNav/SBP/User.hs @@ -6,7 +6,7 @@ -- | -- Module: SwiftNav.SBP.User -- Copyright: Copyright (C) 2015-2018 Swift Navigation, Inc. --- License: LGPL-3 +-- License: MIT -- Maintainer: Swift Navigation -- Stability: experimental -- Portability: portable diff --git a/haskell/src/SwiftNav/SBP/Vehicle.hs b/haskell/src/SwiftNav/SBP/Vehicle.hs index ddaad8d192..198509d59c 100644 --- a/haskell/src/SwiftNav/SBP/Vehicle.hs +++ b/haskell/src/SwiftNav/SBP/Vehicle.hs @@ -6,7 +6,7 @@ -- | -- Module: SwiftNav.SBP.Vehicle -- Copyright: Copyright (C) 2015-2018 Swift Navigation, Inc. --- License: LGPL-3 +-- License: MIT -- Maintainer: Swift Navigation -- Stability: experimental -- Portability: portable diff --git a/java/README.rst b/java/README.rst index d735a3cbbc..34c1ee3b1c 100644 --- a/java/README.rst +++ b/java/README.rst @@ -19,7 +19,7 @@ Build Javadoc documentation: Find compiled documentation in java/build/docs/javadoc Usage Examples --------------- +--------------- A simple example is provided to read from a serial port and write log messages, as well as the latitude, longitude, and altitude from MsgPosLLH to stdout. diff --git a/java/src/com/swiftnav/sbp/client/MessageTable.java b/java/src/com/swiftnav/sbp/client/MessageTable.java index 442416a4eb..f71ef7eb32 100644 --- a/java/src/com/swiftnav/sbp/client/MessageTable.java +++ b/java/src/com/swiftnav/sbp/client/MessageTable.java @@ -173,6 +173,10 @@ import com.swiftnav.sbp.settings.MsgSettingsReadByIndexDone; import com.swiftnav.sbp.settings.MsgSettingsRegister; import com.swiftnav.sbp.settings.MsgSettingsRegisterResp; +import com.swiftnav.sbp.solution_meta.MsgSolnMeta; +import com.swiftnav.sbp.solution_meta.GNSSInputType; +import com.swiftnav.sbp.solution_meta.IMUInputType; +import com.swiftnav.sbp.solution_meta.OdoInputType; import com.swiftnav.sbp.ssr.MsgSsrOrbitClock; import com.swiftnav.sbp.ssr.MsgSsrOrbitClockDepA; import com.swiftnav.sbp.ssr.MsgSsrCodeBiases; @@ -522,6 +526,14 @@ static SBPMessage dispatch(SBPMessage msg) throws SBPBinaryException { return new MsgSettingsRegister(msg); case MsgSettingsRegisterResp.TYPE: return new MsgSettingsRegisterResp(msg); + case MsgSolnMeta.TYPE: + return new MsgSolnMeta(msg); + case GNSSInputType.TYPE: + return new GNSSInputType(msg); + case IMUInputType.TYPE: + return new IMUInputType(msg); + case OdoInputType.TYPE: + return new OdoInputType(msg); case MsgSsrOrbitClock.TYPE: return new MsgSsrOrbitClock(msg); case MsgSsrOrbitClockDepA.TYPE: diff --git a/java/src/com/swiftnav/sbp/solution_meta/GNSSInputType.java b/java/src/com/swiftnav/sbp/solution_meta/GNSSInputType.java new file mode 100644 index 0000000000..28335e80ad --- /dev/null +++ b/java/src/com/swiftnav/sbp/solution_meta/GNSSInputType.java @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2015-2018 Swift Navigation Inc. + * Contact: Swift Navigation + * + * This source is subject to the license found in the file 'LICENSE' which must + * be be distributed together with this source. All other rights reserved. + * + * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, + * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + */ + +package com.swiftnav.sbp.solution_meta; + +import java.math.BigInteger; + +import com.swiftnav.sbp.SBPMessage; +import com.swiftnav.sbp.SBPBinaryException; +import com.swiftnav.sbp.SBPStruct; + +import org.json.JSONObject; +import org.json.JSONArray; + + +/** SBP class for message GNSSInputType (0xFFE7). + * + * You can have GNSSInputType inherent its fields directly from + * an inherited SBP object, or construct it inline using a dict of its + * fields. + * + * Metadata around the GNSS sensors involved in the fuzed solution. Accessible through sol_in[N].flags + * in a MSG_SOLN_META. + * Note: Just to build descriptive tables in documentation and not actually used. */ + +public class GNSSInputType extends SBPMessage { + public static final int TYPE = 0xFFE7; + + + /** flags that store all relevant info specific to this sensor type. */ + public int flags; + + + public GNSSInputType (int sender) { super(sender, TYPE); } + public GNSSInputType () { super(TYPE); } + public GNSSInputType (SBPMessage msg) throws SBPBinaryException { + super(msg); + assert msg.type != TYPE; + } + + @Override + protected void parse(Parser parser) throws SBPBinaryException { + /* Parse fields from binary */ + flags = parser.getU8(); + } + + @Override + protected void build(Builder builder) { + builder.putU8(flags); + } + + @Override + public JSONObject toJSON() { + JSONObject obj = super.toJSON(); + obj.put("flags", flags); + return obj; + } +} \ No newline at end of file diff --git a/java/src/com/swiftnav/sbp/solution_meta/IMUInputType.java b/java/src/com/swiftnav/sbp/solution_meta/IMUInputType.java new file mode 100644 index 0000000000..a6f76fff15 --- /dev/null +++ b/java/src/com/swiftnav/sbp/solution_meta/IMUInputType.java @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2015-2018 Swift Navigation Inc. + * Contact: Swift Navigation + * + * This source is subject to the license found in the file 'LICENSE' which must + * be be distributed together with this source. All other rights reserved. + * + * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, + * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + */ + +package com.swiftnav.sbp.solution_meta; + +import java.math.BigInteger; + +import com.swiftnav.sbp.SBPMessage; +import com.swiftnav.sbp.SBPBinaryException; +import com.swiftnav.sbp.SBPStruct; + +import org.json.JSONObject; +import org.json.JSONArray; + + +/** SBP class for message IMUInputType (0xFFE8). + * + * You can have IMUInputType inherent its fields directly from + * an inherited SBP object, or construct it inline using a dict of its + * fields. + * + * Metadata around the IMU sensors involved in the fuzed solution. Accessible through sol_in[N].flags + * in a MSG_SOLN_META. + * Note: Just to build descriptive tables in documentation and not actually used. */ + +public class IMUInputType extends SBPMessage { + public static final int TYPE = 0xFFE8; + + + /** flags that store all relevant info specific to this sensor type. */ + public int flags; + + + public IMUInputType (int sender) { super(sender, TYPE); } + public IMUInputType () { super(TYPE); } + public IMUInputType (SBPMessage msg) throws SBPBinaryException { + super(msg); + assert msg.type != TYPE; + } + + @Override + protected void parse(Parser parser) throws SBPBinaryException { + /* Parse fields from binary */ + flags = parser.getU8(); + } + + @Override + protected void build(Builder builder) { + builder.putU8(flags); + } + + @Override + public JSONObject toJSON() { + JSONObject obj = super.toJSON(); + obj.put("flags", flags); + return obj; + } +} \ No newline at end of file diff --git a/java/src/com/swiftnav/sbp/solution_meta/MsgSolnMeta.java b/java/src/com/swiftnav/sbp/solution_meta/MsgSolnMeta.java new file mode 100644 index 0000000000..f93bfcbd38 --- /dev/null +++ b/java/src/com/swiftnav/sbp/solution_meta/MsgSolnMeta.java @@ -0,0 +1,114 @@ +/* + * Copyright (C) 2015-2018 Swift Navigation Inc. + * Contact: Swift Navigation + * + * This source is subject to the license found in the file 'LICENSE' which must + * be be distributed together with this source. All other rights reserved. + * + * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, + * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + */ + +package com.swiftnav.sbp.solution_meta; + +import java.math.BigInteger; + +import com.swiftnav.sbp.SBPMessage; +import com.swiftnav.sbp.SBPBinaryException; +import com.swiftnav.sbp.SBPStruct; + +import org.json.JSONObject; +import org.json.JSONArray; + + +/** SBP class for message MSG_SOLN_META (0xFF0F). + * + * You can have MSG_SOLN_META inherent its fields directly from + * an inherited SBP object, or construct it inline using a dict of its + * fields. + * + * This message contains all metadata about the sensors received and/or used in computing the Fuzed Solution. + * It focuses primarly, but not only, on GNSS metadata. */ + +public class MsgSolnMeta extends SBPMessage { + public static final int TYPE = 0xFF0F; + + + /** Position Dilution of Precision, as per last available DOPS from Starling GNSS engine */ + public int pdop; + + /** Horizontal Dilution of Precision, as per last available DOPS from Starling GNSS engine */ + public int hdop; + + /** Vertical Dilution of Precision, as per last available DOPS from Starling GNSS engine */ + public int vdop; + + /** Number of satellites used in solution, as per last available DOPS from Starling GNSS engine */ + public int n_sats; + + /** Age of the corrections (0xFFFF indicates invalid), as per last available AGE_CORRECTIONS from Starling GNSS engine */ + public int age_corrections; + + /** Bits for reason why it cannot align (yet) */ + public int alignment_status; + + /** Tow of last-used GNSS position measurement */ + public long last_used_gnss_pos_tow; + + /** Tow of last-used GNSS velocity measurement */ + public long last_used_gnss_vel_tow; + + /** Array of Metadata describing the sensors potentially involved in the solution. Each element in the array represents a single sensor type and consists of flags containing (meta)data pertaining to that specific single sensor. Refer to each (XX)InputType descriptor in the present doc. */ + public SolutionInputType[] sol_in; + + + public MsgSolnMeta (int sender) { super(sender, TYPE); } + public MsgSolnMeta () { super(TYPE); } + public MsgSolnMeta (SBPMessage msg) throws SBPBinaryException { + super(msg); + assert msg.type != TYPE; + } + + @Override + protected void parse(Parser parser) throws SBPBinaryException { + /* Parse fields from binary */ + pdop = parser.getU16(); + hdop = parser.getU16(); + vdop = parser.getU16(); + n_sats = parser.getU8(); + age_corrections = parser.getU16(); + alignment_status = parser.getU8(); + last_used_gnss_pos_tow = parser.getU32(); + last_used_gnss_vel_tow = parser.getU32(); + sol_in = parser.getArray(SolutionInputType.class); + } + + @Override + protected void build(Builder builder) { + builder.putU16(pdop); + builder.putU16(hdop); + builder.putU16(vdop); + builder.putU8(n_sats); + builder.putU16(age_corrections); + builder.putU8(alignment_status); + builder.putU32(last_used_gnss_pos_tow); + builder.putU32(last_used_gnss_vel_tow); + builder.putArray(sol_in); + } + + @Override + public JSONObject toJSON() { + JSONObject obj = super.toJSON(); + obj.put("pdop", pdop); + obj.put("hdop", hdop); + obj.put("vdop", vdop); + obj.put("n_sats", n_sats); + obj.put("age_corrections", age_corrections); + obj.put("alignment_status", alignment_status); + obj.put("last_used_gnss_pos_tow", last_used_gnss_pos_tow); + obj.put("last_used_gnss_vel_tow", last_used_gnss_vel_tow); + obj.put("sol_in", SBPStruct.toJSONArray(sol_in)); + return obj; + } +} \ No newline at end of file diff --git a/java/src/com/swiftnav/sbp/solution_meta/OdoInputType.java b/java/src/com/swiftnav/sbp/solution_meta/OdoInputType.java new file mode 100644 index 0000000000..1a7bd9b739 --- /dev/null +++ b/java/src/com/swiftnav/sbp/solution_meta/OdoInputType.java @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2015-2018 Swift Navigation Inc. + * Contact: Swift Navigation + * + * This source is subject to the license found in the file 'LICENSE' which must + * be be distributed together with this source. All other rights reserved. + * + * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, + * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + */ + +package com.swiftnav.sbp.solution_meta; + +import java.math.BigInteger; + +import com.swiftnav.sbp.SBPMessage; +import com.swiftnav.sbp.SBPBinaryException; +import com.swiftnav.sbp.SBPStruct; + +import org.json.JSONObject; +import org.json.JSONArray; + + +/** SBP class for message OdoInputType (0xFFE9). + * + * You can have OdoInputType inherent its fields directly from + * an inherited SBP object, or construct it inline using a dict of its + * fields. + * + * Metadata around the Odometry sensors involved in the fuzed solution. Accessible through sol_in[N].flags + * in a MSG_SOLN_META. + * Note: Just to build descriptive tables in documentation and not actually used. */ + +public class OdoInputType extends SBPMessage { + public static final int TYPE = 0xFFE9; + + + /** flags that store all relevant info specific to this sensor type. */ + public int flags; + + + public OdoInputType (int sender) { super(sender, TYPE); } + public OdoInputType () { super(TYPE); } + public OdoInputType (SBPMessage msg) throws SBPBinaryException { + super(msg); + assert msg.type != TYPE; + } + + @Override + protected void parse(Parser parser) throws SBPBinaryException { + /* Parse fields from binary */ + flags = parser.getU8(); + } + + @Override + protected void build(Builder builder) { + builder.putU8(flags); + } + + @Override + public JSONObject toJSON() { + JSONObject obj = super.toJSON(); + obj.put("flags", flags); + return obj; + } +} \ No newline at end of file diff --git a/java/src/com/swiftnav/sbp/solution_meta/SolutionInputType.java b/java/src/com/swiftnav/sbp/solution_meta/SolutionInputType.java new file mode 100644 index 0000000000..60f00698cb --- /dev/null +++ b/java/src/com/swiftnav/sbp/solution_meta/SolutionInputType.java @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2015-2018 Swift Navigation Inc. + * Contact: Swift Navigation + * + * This source is subject to the license found in the file 'LICENSE' which must + * be be distributed together with this source. All other rights reserved. + * + * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, + * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + */ + +package com.swiftnav.sbp.solution_meta; + +import java.math.BigInteger; + +import com.swiftnav.sbp.SBPMessage; +import com.swiftnav.sbp.SBPBinaryException; +import com.swiftnav.sbp.SBPStruct; + +import org.json.JSONObject; +import org.json.JSONArray; +import com.swiftnav.sbp.SBPStruct; + +public class SolutionInputType extends SBPStruct { + + /** The type of sensor */ + public int sensor_type; + + /** Refer to each InputType description */ + public int flags; + + + public SolutionInputType () {} + + @Override + public SolutionInputType parse(SBPMessage.Parser parser) throws SBPBinaryException { + /* Parse fields from binary */ + sensor_type = parser.getU8(); + flags = parser.getU8(); + return this; + } + + @Override + public void build(SBPMessage.Builder builder) { + /* Build fields into binary */ + builder.putU8(sensor_type); + builder.putU8(flags); + } + + @Override + public JSONObject toJSON() { + JSONObject obj = new JSONObject(); + obj.put("sensor_type", sensor_type); + obj.put("flags", flags); + return obj; + } +} \ No newline at end of file diff --git a/javascript/sbp/solution_meta.js b/javascript/sbp/solution_meta.js new file mode 100644 index 0000000000..fce207e047 --- /dev/null +++ b/javascript/sbp/solution_meta.js @@ -0,0 +1,221 @@ +/** + * Copyright (C) 2015-2018 Swift Navigation Inc. + * Contact: Swift Navigation + * This source is subject to the license found in the file 'LICENSE' which must + * be distributed together with this source. All other rights reserved. + * + * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, + * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + */ + +/********************** + * Automatically generated from piksi/yaml/swiftnav/sbp/solution_meta.yaml with generate.py. + * Don't edit this by hand! + ********************** + * Package description: + * + * Standardized Metadata messages for Fuzed Solution from Swift Navigation devices. +***********************/ + +var SBP = require('./sbp'); +var Parser = require('./parser'); +var Int64 = require('node-int64'); +var UInt64 = require('cuint').UINT64; + +/** + * SBP class for message fragment SolutionInputType + * + * Metadata describing which sensors were involved in the solution. The structure + * is fixed no matter what the actual sensor type is. The sensor_type field tells + * you which sensor we are talking about. It also tells you whether the sensor data + * was actually used or not. The flags field, always a u8, contains the sensor- + * specific data. The content of flags, for each sensor type, is described in the + * relevant structures in this section. + * + * Fields in the SBP payload (`sbp.payload`): + * @field sensor_type number (unsigned 8-bit int, 1 byte) The type of sensor + * @field flags number (unsigned 8-bit int, 1 byte) Refer to each InputType description + * + * @param sbp An SBP object with a payload to be decoded. + */ +var SolutionInputType = function (sbp, fields) { + SBP.call(this, sbp); + this.messageType = "SolutionInputType"; + this.fields = (fields || this.parser.parse(sbp.payload)); + + return this; +}; +SolutionInputType.prototype = Object.create(SBP.prototype); +SolutionInputType.prototype.messageType = "SolutionInputType"; +SolutionInputType.prototype.constructor = SolutionInputType; +SolutionInputType.prototype.parser = new Parser() + .endianess('little') + .uint8('sensor_type') + .uint8('flags'); +SolutionInputType.prototype.fieldSpec = []; +SolutionInputType.prototype.fieldSpec.push(['sensor_type', 'writeUInt8', 1]); +SolutionInputType.prototype.fieldSpec.push(['flags', 'writeUInt8', 1]); + +/** + * SBP class for message MSG_SOLN_META (0xFF0F). + * + * This message contains all metadata about the sensors received and/or used in + * computing the Fuzed Solution. It focuses primarly, but not only, on GNSS + * metadata. + * + * Fields in the SBP payload (`sbp.payload`): + * @field pdop number (unsigned 16-bit int, 2 bytes) Position Dilution of Precision, as per last available DOPS from Starling GNSS + * engine + * @field hdop number (unsigned 16-bit int, 2 bytes) Horizontal Dilution of Precision, as per last available DOPS from Starling GNSS + * engine + * @field vdop number (unsigned 16-bit int, 2 bytes) Vertical Dilution of Precision, as per last available DOPS from Starling GNSS + * engine + * @field n_sats number (unsigned 8-bit int, 1 byte) Number of satellites used in solution, as per last available DOPS from Starling + * GNSS engine + * @field age_corrections number (unsigned 16-bit int, 2 bytes) Age of the corrections (0xFFFF indicates invalid), as per last available + * AGE_CORRECTIONS from Starling GNSS engine + * @field alignment_status number (unsigned 8-bit int, 1 byte) Bits for reason why it cannot align (yet) + * @field last_used_gnss_pos_tow number (unsigned 32-bit int, 4 bytes) Tow of last-used GNSS position measurement + * @field last_used_gnss_vel_tow number (unsigned 32-bit int, 4 bytes) Tow of last-used GNSS velocity measurement + * @field sol_in array Array of Metadata describing the sensors potentially involved in the solution. + * Each element in the array represents a single sensor type and consists of flags + * containing (meta)data pertaining to that specific single sensor. Refer to each + * (XX)InputType descriptor in the present doc. + * + * @param sbp An SBP object with a payload to be decoded. + */ +var MsgSolnMeta = function (sbp, fields) { + SBP.call(this, sbp); + this.messageType = "MSG_SOLN_META"; + this.fields = (fields || this.parser.parse(sbp.payload)); + + return this; +}; +MsgSolnMeta.prototype = Object.create(SBP.prototype); +MsgSolnMeta.prototype.messageType = "MSG_SOLN_META"; +MsgSolnMeta.prototype.msg_type = 0xFF0F; +MsgSolnMeta.prototype.constructor = MsgSolnMeta; +MsgSolnMeta.prototype.parser = new Parser() + .endianess('little') + .uint16('pdop') + .uint16('hdop') + .uint16('vdop') + .uint8('n_sats') + .uint16('age_corrections') + .uint8('alignment_status') + .uint32('last_used_gnss_pos_tow') + .uint32('last_used_gnss_vel_tow') + .array('sol_in', { type: SolutionInputType.prototype.parser, readUntil: 'eof' }); +MsgSolnMeta.prototype.fieldSpec = []; +MsgSolnMeta.prototype.fieldSpec.push(['pdop', 'writeUInt16LE', 2]); +MsgSolnMeta.prototype.fieldSpec.push(['hdop', 'writeUInt16LE', 2]); +MsgSolnMeta.prototype.fieldSpec.push(['vdop', 'writeUInt16LE', 2]); +MsgSolnMeta.prototype.fieldSpec.push(['n_sats', 'writeUInt8', 1]); +MsgSolnMeta.prototype.fieldSpec.push(['age_corrections', 'writeUInt16LE', 2]); +MsgSolnMeta.prototype.fieldSpec.push(['alignment_status', 'writeUInt8', 1]); +MsgSolnMeta.prototype.fieldSpec.push(['last_used_gnss_pos_tow', 'writeUInt32LE', 4]); +MsgSolnMeta.prototype.fieldSpec.push(['last_used_gnss_vel_tow', 'writeUInt32LE', 4]); +MsgSolnMeta.prototype.fieldSpec.push(['sol_in', 'array', SolutionInputType.prototype.fieldSpec, function () { return this.fields.array.length; }, null]); + +/** + * SBP class for message GNSSInputType (0xFFE7). + * + * Metadata around the GNSS sensors involved in the fuzed solution. Accessible + * through sol_in[N].flags + * in a MSG_SOLN_META. Note: Just to build descriptive tables in documentation and + * not actually used. + * + * Fields in the SBP payload (`sbp.payload`): + * @field flags number (unsigned 8-bit int, 1 byte) flags that store all relevant info specific to this sensor type. + * + * @param sbp An SBP object with a payload to be decoded. + */ +var GNSSInputType = function (sbp, fields) { + SBP.call(this, sbp); + this.messageType = "GNSSInputType"; + this.fields = (fields || this.parser.parse(sbp.payload)); + + return this; +}; +GNSSInputType.prototype = Object.create(SBP.prototype); +GNSSInputType.prototype.messageType = "GNSSInputType"; +GNSSInputType.prototype.msg_type = 0xFFE7; +GNSSInputType.prototype.constructor = GNSSInputType; +GNSSInputType.prototype.parser = new Parser() + .endianess('little') + .uint8('flags'); +GNSSInputType.prototype.fieldSpec = []; +GNSSInputType.prototype.fieldSpec.push(['flags', 'writeUInt8', 1]); + +/** + * SBP class for message IMUInputType (0xFFE8). + * + * Metadata around the IMU sensors involved in the fuzed solution. Accessible + * through sol_in[N].flags + * in a MSG_SOLN_META. Note: Just to build descriptive tables in documentation and + * not actually used. + * + * Fields in the SBP payload (`sbp.payload`): + * @field flags number (unsigned 8-bit int, 1 byte) flags that store all relevant info specific to this sensor type. + * + * @param sbp An SBP object with a payload to be decoded. + */ +var IMUInputType = function (sbp, fields) { + SBP.call(this, sbp); + this.messageType = "IMUInputType"; + this.fields = (fields || this.parser.parse(sbp.payload)); + + return this; +}; +IMUInputType.prototype = Object.create(SBP.prototype); +IMUInputType.prototype.messageType = "IMUInputType"; +IMUInputType.prototype.msg_type = 0xFFE8; +IMUInputType.prototype.constructor = IMUInputType; +IMUInputType.prototype.parser = new Parser() + .endianess('little') + .uint8('flags'); +IMUInputType.prototype.fieldSpec = []; +IMUInputType.prototype.fieldSpec.push(['flags', 'writeUInt8', 1]); + +/** + * SBP class for message OdoInputType (0xFFE9). + * + * Metadata around the Odometry sensors involved in the fuzed solution. Accessible + * through sol_in[N].flags + * in a MSG_SOLN_META. Note: Just to build descriptive tables in documentation and + * not actually used. + * + * Fields in the SBP payload (`sbp.payload`): + * @field flags number (unsigned 8-bit int, 1 byte) flags that store all relevant info specific to this sensor type. + * + * @param sbp An SBP object with a payload to be decoded. + */ +var OdoInputType = function (sbp, fields) { + SBP.call(this, sbp); + this.messageType = "OdoInputType"; + this.fields = (fields || this.parser.parse(sbp.payload)); + + return this; +}; +OdoInputType.prototype = Object.create(SBP.prototype); +OdoInputType.prototype.messageType = "OdoInputType"; +OdoInputType.prototype.msg_type = 0xFFE9; +OdoInputType.prototype.constructor = OdoInputType; +OdoInputType.prototype.parser = new Parser() + .endianess('little') + .uint8('flags'); +OdoInputType.prototype.fieldSpec = []; +OdoInputType.prototype.fieldSpec.push(['flags', 'writeUInt8', 1]); + +module.exports = { + SolutionInputType: SolutionInputType, + 0xFF0F: MsgSolnMeta, + MsgSolnMeta: MsgSolnMeta, + 0xFFE7: GNSSInputType, + GNSSInputType: GNSSInputType, + 0xFFE8: IMUInputType, + IMUInputType: IMUInputType, + 0xFFE9: OdoInputType, + OdoInputType: OdoInputType, +} \ No newline at end of file diff --git a/jsonschema/GNSSInputType.json b/jsonschema/GNSSInputType.json new file mode 100644 index 0000000000..0e92571d6f --- /dev/null +++ b/jsonschema/GNSSInputType.json @@ -0,0 +1,24 @@ +{ + "copyright": [ + "Copyright (C) 2019 Swift Navigation Inc.", + "Contact: Swift Navigation ", + "", + "This source is subject to the license found in the file 'LICENSE' which must", + "be be distributed together with this source. All other rights reserved.", + "", + "THIS CODE AND INFORMATION IS PROVIDED 'AS IS' WITHOUT WARRANTY OF ANY KIND,", + "EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED", + "WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE." + ], + "$schema": "http://json-schema.org/draft-06/schema#", + "$id": "#GNSSInputType", + "title":"GNSSInputType", + "description":"Metadata around the GNSS sensors involved in the fuzed solution. Accessible through sol_in[N].flags,\n in a MSG_SOLN_META.,\nNote: Just to build descriptive tables in documentation and not actually used.\n", + "type": "object", + "properties": { + "flags": {"type": "integer"} + }, + "required": [ + "flags" + ] +} \ No newline at end of file diff --git a/jsonschema/IMUInputType.json b/jsonschema/IMUInputType.json new file mode 100644 index 0000000000..4e107a6706 --- /dev/null +++ b/jsonschema/IMUInputType.json @@ -0,0 +1,24 @@ +{ + "copyright": [ + "Copyright (C) 2019 Swift Navigation Inc.", + "Contact: Swift Navigation ", + "", + "This source is subject to the license found in the file 'LICENSE' which must", + "be be distributed together with this source. All other rights reserved.", + "", + "THIS CODE AND INFORMATION IS PROVIDED 'AS IS' WITHOUT WARRANTY OF ANY KIND,", + "EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED", + "WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE." + ], + "$schema": "http://json-schema.org/draft-06/schema#", + "$id": "#IMUInputType", + "title":"IMUInputType", + "description":"Metadata around the IMU sensors involved in the fuzed solution. Accessible through sol_in[N].flags,\n in a MSG_SOLN_META.,\nNote: Just to build descriptive tables in documentation and not actually used.\n", + "type": "object", + "properties": { + "flags": {"type": "integer"} + }, + "required": [ + "flags" + ] +} \ No newline at end of file diff --git a/jsonschema/MsgSolnMeta.json b/jsonschema/MsgSolnMeta.json new file mode 100644 index 0000000000..70b32ed147 --- /dev/null +++ b/jsonschema/MsgSolnMeta.json @@ -0,0 +1,40 @@ +{ + "copyright": [ + "Copyright (C) 2019 Swift Navigation Inc.", + "Contact: Swift Navigation ", + "", + "This source is subject to the license found in the file 'LICENSE' which must", + "be be distributed together with this source. All other rights reserved.", + "", + "THIS CODE AND INFORMATION IS PROVIDED 'AS IS' WITHOUT WARRANTY OF ANY KIND,", + "EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED", + "WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE." + ], + "$schema": "http://json-schema.org/draft-06/schema#", + "$id": "#MsgSolnMeta", + "title":"MsgSolnMeta", + "description":"This message contains all metadata about the sensors received and/or used in computing the Fuzed Solution.,\nIt focuses primarly, but not only, on GNSS metadata.\n", + "type": "object", + "properties": { + "pdop": {"type": "integer"}, + "hdop": {"type": "integer"}, + "vdop": {"type": "integer"}, + "n_sats": {"type": "integer"}, + "age_corrections": {"type": "integer"}, + "alignment_status": {"type": "integer"}, + "last_used_gnss_pos_tow": {"type": "integer"}, + "last_used_gnss_vel_tow": {"type": "integer"}, + "sol_in": {"type": "array", "items": {"$ref": "SolutionInputType.json"}} + }, + "required": [ + "pdop", + "hdop", + "vdop", + "n_sats", + "age_corrections", + "alignment_status", + "last_used_gnss_pos_tow", + "last_used_gnss_vel_tow", + "sol_in" + ] +} \ No newline at end of file diff --git a/jsonschema/OdoInputType.json b/jsonschema/OdoInputType.json new file mode 100644 index 0000000000..4b32ddb3a0 --- /dev/null +++ b/jsonschema/OdoInputType.json @@ -0,0 +1,24 @@ +{ + "copyright": [ + "Copyright (C) 2019 Swift Navigation Inc.", + "Contact: Swift Navigation ", + "", + "This source is subject to the license found in the file 'LICENSE' which must", + "be be distributed together with this source. All other rights reserved.", + "", + "THIS CODE AND INFORMATION IS PROVIDED 'AS IS' WITHOUT WARRANTY OF ANY KIND,", + "EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED", + "WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE." + ], + "$schema": "http://json-schema.org/draft-06/schema#", + "$id": "#OdoInputType", + "title":"OdoInputType", + "description":"Metadata around the Odometry sensors involved in the fuzed solution. Accessible through sol_in[N].flags,\n in a MSG_SOLN_META.,\nNote: Just to build descriptive tables in documentation and not actually used.\n", + "type": "object", + "properties": { + "flags": {"type": "integer"} + }, + "required": [ + "flags" + ] +} \ No newline at end of file diff --git a/jsonschema/SolutionInputType.json b/jsonschema/SolutionInputType.json new file mode 100644 index 0000000000..5af81f030f --- /dev/null +++ b/jsonschema/SolutionInputType.json @@ -0,0 +1,26 @@ +{ + "copyright": [ + "Copyright (C) 2019 Swift Navigation Inc.", + "Contact: Swift Navigation ", + "", + "This source is subject to the license found in the file 'LICENSE' which must", + "be be distributed together with this source. All other rights reserved.", + "", + "THIS CODE AND INFORMATION IS PROVIDED 'AS IS' WITHOUT WARRANTY OF ANY KIND,", + "EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED", + "WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE." + ], + "$schema": "http://json-schema.org/draft-06/schema#", + "$id": "#SolutionInputType", + "title":"SolutionInputType", + "description":"Metadata describing which sensors were involved in the solution.,\nThe structure is fixed no matter what the actual sensor type is.,\nThe sensor_type field tells you which sensor we are talking about. It also tells you,\nwhether the sensor data was actually used or not.,\nThe flags field, always a u8, contains the sensor-specific data.,\nThe content of flags, for each sensor type, is described in the relevant structures in this section.\n", + "type": "object", + "properties": { + "sensor_type": {"type": "integer"}, + "flags": {"type": "integer"} + }, + "required": [ + "sensor_type", + "flags" + ] +} \ No newline at end of file diff --git a/proto/solution_meta.proto b/proto/solution_meta.proto new file mode 100644 index 0000000000..97df865aee --- /dev/null +++ b/proto/solution_meta.proto @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2018 Swift Navigation Inc. + * Contact: Swift Navigation + * + * This source is subject to the license found in the file 'LICENSE' which must + * be be distributed together with this source. All other rights reserved. + * + * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, + * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + */ + +syntax = "proto3"; + +/** Solution_Meta + * + * Standardized Metadata messages for Fuzed Solution from Swift Navigation devices. + */ + +package swiftnav.sbp.solution_meta; + + +/** Flags for a given solution input type. + * + * Metadata describing which sensors were involved in the solution. + * The structure is fixed no matter what the actual sensor type is. + * The sensor_type field tells you which sensor we are talking about. It also tells you + * whether the sensor data was actually used or not. + * The flags field, always a u8, contains the sensor-specific data. + * The content of flags, for each sensor type, is described in the relevant structures in this section. + */ +message SolutionInputType { + uint32 sensor_type = 1; + uint32 flags = 2; +} + +/** Solution Sensors Metadata + * + * This message contains all metadata about the sensors received and/or used in computing the Fuzed Solution. + * It focuses primarly, but not only, on GNSS metadata. + */ +message MsgSolnMeta { + uint32 pdop = 1; + uint32 hdop = 2; + uint32 vdop = 3; + uint32 n_sats = 4; + uint32 age_corrections = 5; + uint32 alignment_status = 6; + uint32 last_used_gnss_pos_tow = 7; + uint32 last_used_gnss_vel_tow = 8; + repeated SolutionInputType sol_in = 9; +} + +/** Flags for a given GNSS sensor used as input for the fuzed solution. + * + * Metadata around the GNSS sensors involved in the fuzed solution. Accessible through sol_in[N].flags + * in a MSG_SOLN_META. + * Note: Just to build descriptive tables in documentation and not actually used. + */ +message GNSSInputType { + uint32 flags = 1; +} + +/** Flags for a given IMU sensor used as input for the fuzed solution. + * + * Metadata around the IMU sensors involved in the fuzed solution. Accessible through sol_in[N].flags + * in a MSG_SOLN_META. + * Note: Just to build descriptive tables in documentation and not actually used. + */ +message IMUInputType { + uint32 flags = 1; +} + +/** Flags for a given Odometry sensor used as input for the fuzed solution. + * + * Metadata around the Odometry sensors involved in the fuzed solution. Accessible through sol_in[N].flags + * in a MSG_SOLN_META. + * Note: Just to build descriptive tables in documentation and not actually used. + */ +message OdoInputType { + uint32 flags = 1; +} \ No newline at end of file diff --git a/python/sbp/jit/solution_meta.py b/python/sbp/jit/solution_meta.py new file mode 100644 index 0000000000..29698d01bf --- /dev/null +++ b/python/sbp/jit/solution_meta.py @@ -0,0 +1,233 @@ +#!/usr/bin/env python +# Copyright (C) 2015-2018 Swift Navigation Inc. +# Contact: Swift Navigation +# +# This source is subject to the license found in the file 'LICENSE' which must +# be be distributed together with this source. All other rights reserved. +# +# THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, +# EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + + +""" +Standardized Metadata messages for Fuzed Solution from Swift Navigation devices. +""" + +import json + +import numpy as np + +from sbp.jit.msg import SBP, SENDER_ID +from sbp.jit.msg import get_u8, get_u16, get_u32, get_u64 +from sbp.jit.msg import get_s8, get_s16, get_s32, get_s64 +from sbp.jit.msg import get_f32, get_f64, judicious_round +from sbp.jit.msg import get_string, get_fixed_string, get_setting +from sbp.jit.msg import get_array, get_fixed_array + +# Automatically generated from piksi/yaml/swiftnav/sbp/solution_meta.yaml with generate.py. +# Please do not hand edit! +class SolutionInputType(object): + """SBP class for message SolutionInputType + + You can have SolutionInputType inherit its fields directly + from an inherited SBP object, or construct it inline using a dict + of its fields. + + + Metadata describing which sensors were involved in the solution. +The structure is fixed no matter what the actual sensor type is. +The sensor_type field tells you which sensor we are talking about. It also tells you +whether the sensor data was actually used or not. +The flags field, always a u8, contains the sensor-specific data. +The content of flags, for each sensor type, is described in the relevant structures in this section. + + + """ + __slots__ = ['sensor_type', + 'flags', + ] + @classmethod + def parse_members(cls, buf, offset, length): + ret = {} + (__sensor_type, offset, length) = get_u8(buf, offset, length) + ret['sensor_type'] = __sensor_type + (__flags, offset, length) = get_u8(buf, offset, length) + ret['flags'] = __flags + return ret, offset, length + + def _unpack_members(self, buf, offset, length): + res, off, length = self.parse_members(buf, offset, length) + if off == offset: + return {}, offset, length + self.sensor_type = res['sensor_type'] + self.flags = res['flags'] + return res, off, length + + +SBP_MSG_SOLN_META = 0xFF0F +class MsgSolnMeta(SBP): + """SBP class for message MSG_SOLN_META (0xFF0F). + + You can have MSG_SOLN_META inherit its fields directly + from an inherited SBP object, or construct it inline using a dict + of its fields. + + + This message contains all metadata about the sensors received and/or used in computing the Fuzed Solution. +It focuses primarly, but not only, on GNSS metadata. + + + """ + __slots__ = ['pdop', + 'hdop', + 'vdop', + 'n_sats', + 'age_corrections', + 'alignment_status', + 'last_used_gnss_pos_tow', + 'last_used_gnss_vel_tow', + 'sol_in', + ] + @classmethod + def parse_members(cls, buf, offset, length): + ret = {} + (__pdop, offset, length) = get_u16(buf, offset, length) + ret['pdop'] = __pdop + (__hdop, offset, length) = get_u16(buf, offset, length) + ret['hdop'] = __hdop + (__vdop, offset, length) = get_u16(buf, offset, length) + ret['vdop'] = __vdop + (__n_sats, offset, length) = get_u8(buf, offset, length) + ret['n_sats'] = __n_sats + (__age_corrections, offset, length) = get_u16(buf, offset, length) + ret['age_corrections'] = __age_corrections + (__alignment_status, offset, length) = get_u8(buf, offset, length) + ret['alignment_status'] = __alignment_status + (__last_used_gnss_pos_tow, offset, length) = get_u32(buf, offset, length) + ret['last_used_gnss_pos_tow'] = __last_used_gnss_pos_tow + (__last_used_gnss_vel_tow, offset, length) = get_u32(buf, offset, length) + ret['last_used_gnss_vel_tow'] = __last_used_gnss_vel_tow + (__sol_in, offset, length) = get_array(SolutionInputType.parse_members)(buf, offset, length) + ret['sol_in'] = __sol_in + return ret, offset, length + + def _unpack_members(self, buf, offset, length): + res, off, length = self.parse_members(buf, offset, length) + if off == offset: + return {}, offset, length + self.pdop = res['pdop'] + self.hdop = res['hdop'] + self.vdop = res['vdop'] + self.n_sats = res['n_sats'] + self.age_corrections = res['age_corrections'] + self.alignment_status = res['alignment_status'] + self.last_used_gnss_pos_tow = res['last_used_gnss_pos_tow'] + self.last_used_gnss_vel_tow = res['last_used_gnss_vel_tow'] + self.sol_in = res['sol_in'] + return res, off, length + + +SBP_GNSSInputType = 0xFFE7 +class Gnssinputtype(SBP): + """SBP class for message GNSSInputType (0xFFE7). + + You can have GNSSInputType inherit its fields directly + from an inherited SBP object, or construct it inline using a dict + of its fields. + + + Metadata around the GNSS sensors involved in the fuzed solution. Accessible through sol_in[N].flags + in a MSG_SOLN_META. +Note: Just to build descriptive tables in documentation and not actually used. + + + """ + __slots__ = ['flags', + ] + @classmethod + def parse_members(cls, buf, offset, length): + ret = {} + (__flags, offset, length) = get_u8(buf, offset, length) + ret['flags'] = __flags + return ret, offset, length + + def _unpack_members(self, buf, offset, length): + res, off, length = self.parse_members(buf, offset, length) + if off == offset: + return {}, offset, length + self.flags = res['flags'] + return res, off, length + + +SBP_IMUInputType = 0xFFE8 +class Imuinputtype(SBP): + """SBP class for message IMUInputType (0xFFE8). + + You can have IMUInputType inherit its fields directly + from an inherited SBP object, or construct it inline using a dict + of its fields. + + + Metadata around the IMU sensors involved in the fuzed solution. Accessible through sol_in[N].flags + in a MSG_SOLN_META. +Note: Just to build descriptive tables in documentation and not actually used. + + + """ + __slots__ = ['flags', + ] + @classmethod + def parse_members(cls, buf, offset, length): + ret = {} + (__flags, offset, length) = get_u8(buf, offset, length) + ret['flags'] = __flags + return ret, offset, length + + def _unpack_members(self, buf, offset, length): + res, off, length = self.parse_members(buf, offset, length) + if off == offset: + return {}, offset, length + self.flags = res['flags'] + return res, off, length + + +SBP_OdoInputType = 0xFFE9 +class Odoinputtype(SBP): + """SBP class for message OdoInputType (0xFFE9). + + You can have OdoInputType inherit its fields directly + from an inherited SBP object, or construct it inline using a dict + of its fields. + + + Metadata around the Odometry sensors involved in the fuzed solution. Accessible through sol_in[N].flags + in a MSG_SOLN_META. +Note: Just to build descriptive tables in documentation and not actually used. + + + """ + __slots__ = ['flags', + ] + @classmethod + def parse_members(cls, buf, offset, length): + ret = {} + (__flags, offset, length) = get_u8(buf, offset, length) + ret['flags'] = __flags + return ret, offset, length + + def _unpack_members(self, buf, offset, length): + res, off, length = self.parse_members(buf, offset, length) + if off == offset: + return {}, offset, length + self.flags = res['flags'] + return res, off, length + + + +msg_classes = { + 0xFF0F: MsgSolnMeta, + 0xFFE7: Gnssinputtype, + 0xFFE8: Imuinputtype, + 0xFFE9: Odoinputtype, +} \ No newline at end of file diff --git a/python/sbp/solution_meta.py b/python/sbp/solution_meta.py new file mode 100644 index 0000000000..a9bbba8332 --- /dev/null +++ b/python/sbp/solution_meta.py @@ -0,0 +1,487 @@ +#!/usr/bin/env python +# Copyright (C) 2015-2018 Swift Navigation Inc. +# Contact: Swift Navigation +# +# This source is subject to the license found in the file 'LICENSE' which must +# be be distributed together with this source. All other rights reserved. +# +# THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, +# EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + + +""" +Standardized Metadata messages for Fuzed Solution from Swift Navigation devices. +""" + +import json + +import construct + +from sbp.msg import SBP, SENDER_ID +from sbp.utils import fmt_repr, exclude_fields, walk_json_dict, containerize + +# Automatically generated from piksi/yaml/swiftnav/sbp/solution_meta.yaml with generate.py. +# Please do not hand edit! + + +class SolutionInputType(object): + """SolutionInputType. + + Metadata describing which sensors were involved in the solution. +The structure is fixed no matter what the actual sensor type is. +The sensor_type field tells you which sensor we are talking about. It also tells you +whether the sensor data was actually used or not. +The flags field, always a u8, contains the sensor-specific data. +The content of flags, for each sensor type, is described in the relevant structures in this section. + + + Parameters + ---------- + sensor_type : int + The type of sensor + flags : int + Refer to each InputType description + + """ + _parser = construct.Embedded(construct.Struct( + 'sensor_type' / construct.Int8ul, + 'flags' / construct.Int8ul,)) + __slots__ = [ + 'sensor_type', + 'flags', + ] + + def __init__(self, payload=None, **kwargs): + if payload: + self.from_binary(payload) + else: + self.sensor_type = kwargs.pop('sensor_type') + self.flags = kwargs.pop('flags') + + def __repr__(self): + return fmt_repr(self) + + def from_binary(self, d): + p = SolutionInputType._parser.parse(d) + for n in self.__class__.__slots__: + setattr(self, n, getattr(p, n)) + + def to_binary(self): + d = dict([(k, getattr(obj, k)) for k in self.__slots__]) + return SolutionInputType.build(d) + +SBP_MSG_SOLN_META = 0xFF0F +class MsgSolnMeta(SBP): + """SBP class for message MSG_SOLN_META (0xFF0F). + + You can have MSG_SOLN_META inherit its fields directly + from an inherited SBP object, or construct it inline using a dict + of its fields. + + + This message contains all metadata about the sensors received and/or used in computing the Fuzed Solution. +It focuses primarly, but not only, on GNSS metadata. + + + Parameters + ---------- + sbp : SBP + SBP parent object to inherit from. + pdop : int + Position Dilution of Precision, as per last available DOPS from Starling GNSS engine + hdop : int + Horizontal Dilution of Precision, as per last available DOPS from Starling GNSS engine + vdop : int + Vertical Dilution of Precision, as per last available DOPS from Starling GNSS engine + n_sats : int + Number of satellites used in solution, as per last available DOPS from Starling GNSS engine + age_corrections : int + Age of the corrections (0xFFFF indicates invalid), as per last available AGE_CORRECTIONS from Starling GNSS engine + alignment_status : int + Bits for reason why it cannot align (yet) + last_used_gnss_pos_tow : int + Tow of last-used GNSS position measurement + last_used_gnss_vel_tow : int + Tow of last-used GNSS velocity measurement + sol_in : array + Array of Metadata describing the sensors potentially involved in the solution. Each element in the array represents a single sensor type and consists of flags containing (meta)data pertaining to that specific single sensor. Refer to each (XX)InputType descriptor in the present doc. + sender : int + Optional sender ID, defaults to SENDER_ID (see sbp/msg.py). + + """ + _parser = construct.Struct( + 'pdop' / construct.Int16ul, + 'hdop' / construct.Int16ul, + 'vdop' / construct.Int16ul, + 'n_sats' / construct.Int8ul, + 'age_corrections' / construct.Int16ul, + 'alignment_status' / construct.Int8ul, + 'last_used_gnss_pos_tow' / construct.Int32ul, + 'last_used_gnss_vel_tow' / construct.Int32ul, + construct.GreedyRange('sol_in' / construct.Struct(SolutionInputType._parser)),) + __slots__ = [ + 'pdop', + 'hdop', + 'vdop', + 'n_sats', + 'age_corrections', + 'alignment_status', + 'last_used_gnss_pos_tow', + 'last_used_gnss_vel_tow', + 'sol_in', + ] + + def __init__(self, sbp=None, **kwargs): + if sbp: + super( MsgSolnMeta, + self).__init__(sbp.msg_type, sbp.sender, sbp.length, + sbp.payload, sbp.crc) + self.from_binary(sbp.payload) + else: + super( MsgSolnMeta, self).__init__() + self.msg_type = SBP_MSG_SOLN_META + self.sender = kwargs.pop('sender', SENDER_ID) + self.pdop = kwargs.pop('pdop') + self.hdop = kwargs.pop('hdop') + self.vdop = kwargs.pop('vdop') + self.n_sats = kwargs.pop('n_sats') + self.age_corrections = kwargs.pop('age_corrections') + self.alignment_status = kwargs.pop('alignment_status') + self.last_used_gnss_pos_tow = kwargs.pop('last_used_gnss_pos_tow') + self.last_used_gnss_vel_tow = kwargs.pop('last_used_gnss_vel_tow') + self.sol_in = kwargs.pop('sol_in') + + def __repr__(self): + return fmt_repr(self) + + @staticmethod + def from_json(s): + """Given a JSON-encoded string s, build a message object. + + """ + d = json.loads(s) + return MsgSolnMeta.from_json_dict(d) + + @staticmethod + def from_json_dict(d): + sbp = SBP.from_json_dict(d) + return MsgSolnMeta(sbp, **d) + + + def from_binary(self, d): + """Given a binary payload d, update the appropriate payload fields of + the message. + + """ + p = MsgSolnMeta._parser.parse(d) + for n in self.__class__.__slots__: + setattr(self, n, getattr(p, n)) + + def to_binary(self): + """Produce a framed/packed SBP message. + + """ + c = containerize(exclude_fields(self)) + self.payload = MsgSolnMeta._parser.build(c) + return self.pack() + + def into_buffer(self, buf, offset): + """Produce a framed/packed SBP message into the provided buffer and offset. + + """ + self.payload = containerize(exclude_fields(self)) + self.parser = MsgSolnMeta._parser + self.stream_payload.reset(buf, offset) + return self.pack_into(buf, offset, self._build_payload) + + def to_json_dict(self): + self.to_binary() + d = super( MsgSolnMeta, self).to_json_dict() + j = walk_json_dict(exclude_fields(self)) + d.update(j) + return d + +SBP_GNSSInputType = 0xFFE7 +class Gnssinputtype(SBP): + """SBP class for message GNSSInputType (0xFFE7). + + You can have GNSSInputType inherit its fields directly + from an inherited SBP object, or construct it inline using a dict + of its fields. + + + Metadata around the GNSS sensors involved in the fuzed solution. Accessible through sol_in[N].flags + in a MSG_SOLN_META. +Note: Just to build descriptive tables in documentation and not actually used. + + + Parameters + ---------- + sbp : SBP + SBP parent object to inherit from. + flags : int + flags that store all relevant info specific to this sensor type. + sender : int + Optional sender ID, defaults to SENDER_ID (see sbp/msg.py). + + """ + _parser = construct.Struct( + 'flags' / construct.Int8ul,) + __slots__ = [ + 'flags', + ] + + def __init__(self, sbp=None, **kwargs): + if sbp: + super( Gnssinputtype, + self).__init__(sbp.msg_type, sbp.sender, sbp.length, + sbp.payload, sbp.crc) + self.from_binary(sbp.payload) + else: + super( Gnssinputtype, self).__init__() + self.msg_type = SBP_GNSSInputType + self.sender = kwargs.pop('sender', SENDER_ID) + self.flags = kwargs.pop('flags') + + def __repr__(self): + return fmt_repr(self) + + @staticmethod + def from_json(s): + """Given a JSON-encoded string s, build a message object. + + """ + d = json.loads(s) + return Gnssinputtype.from_json_dict(d) + + @staticmethod + def from_json_dict(d): + sbp = SBP.from_json_dict(d) + return Gnssinputtype(sbp, **d) + + + def from_binary(self, d): + """Given a binary payload d, update the appropriate payload fields of + the message. + + """ + p = Gnssinputtype._parser.parse(d) + for n in self.__class__.__slots__: + setattr(self, n, getattr(p, n)) + + def to_binary(self): + """Produce a framed/packed SBP message. + + """ + c = containerize(exclude_fields(self)) + self.payload = Gnssinputtype._parser.build(c) + return self.pack() + + def into_buffer(self, buf, offset): + """Produce a framed/packed SBP message into the provided buffer and offset. + + """ + self.payload = containerize(exclude_fields(self)) + self.parser = Gnssinputtype._parser + self.stream_payload.reset(buf, offset) + return self.pack_into(buf, offset, self._build_payload) + + def to_json_dict(self): + self.to_binary() + d = super( Gnssinputtype, self).to_json_dict() + j = walk_json_dict(exclude_fields(self)) + d.update(j) + return d + +SBP_IMUInputType = 0xFFE8 +class Imuinputtype(SBP): + """SBP class for message IMUInputType (0xFFE8). + + You can have IMUInputType inherit its fields directly + from an inherited SBP object, or construct it inline using a dict + of its fields. + + + Metadata around the IMU sensors involved in the fuzed solution. Accessible through sol_in[N].flags + in a MSG_SOLN_META. +Note: Just to build descriptive tables in documentation and not actually used. + + + Parameters + ---------- + sbp : SBP + SBP parent object to inherit from. + flags : int + flags that store all relevant info specific to this sensor type. + sender : int + Optional sender ID, defaults to SENDER_ID (see sbp/msg.py). + + """ + _parser = construct.Struct( + 'flags' / construct.Int8ul,) + __slots__ = [ + 'flags', + ] + + def __init__(self, sbp=None, **kwargs): + if sbp: + super( Imuinputtype, + self).__init__(sbp.msg_type, sbp.sender, sbp.length, + sbp.payload, sbp.crc) + self.from_binary(sbp.payload) + else: + super( Imuinputtype, self).__init__() + self.msg_type = SBP_IMUInputType + self.sender = kwargs.pop('sender', SENDER_ID) + self.flags = kwargs.pop('flags') + + def __repr__(self): + return fmt_repr(self) + + @staticmethod + def from_json(s): + """Given a JSON-encoded string s, build a message object. + + """ + d = json.loads(s) + return Imuinputtype.from_json_dict(d) + + @staticmethod + def from_json_dict(d): + sbp = SBP.from_json_dict(d) + return Imuinputtype(sbp, **d) + + + def from_binary(self, d): + """Given a binary payload d, update the appropriate payload fields of + the message. + + """ + p = Imuinputtype._parser.parse(d) + for n in self.__class__.__slots__: + setattr(self, n, getattr(p, n)) + + def to_binary(self): + """Produce a framed/packed SBP message. + + """ + c = containerize(exclude_fields(self)) + self.payload = Imuinputtype._parser.build(c) + return self.pack() + + def into_buffer(self, buf, offset): + """Produce a framed/packed SBP message into the provided buffer and offset. + + """ + self.payload = containerize(exclude_fields(self)) + self.parser = Imuinputtype._parser + self.stream_payload.reset(buf, offset) + return self.pack_into(buf, offset, self._build_payload) + + def to_json_dict(self): + self.to_binary() + d = super( Imuinputtype, self).to_json_dict() + j = walk_json_dict(exclude_fields(self)) + d.update(j) + return d + +SBP_OdoInputType = 0xFFE9 +class Odoinputtype(SBP): + """SBP class for message OdoInputType (0xFFE9). + + You can have OdoInputType inherit its fields directly + from an inherited SBP object, or construct it inline using a dict + of its fields. + + + Metadata around the Odometry sensors involved in the fuzed solution. Accessible through sol_in[N].flags + in a MSG_SOLN_META. +Note: Just to build descriptive tables in documentation and not actually used. + + + Parameters + ---------- + sbp : SBP + SBP parent object to inherit from. + flags : int + flags that store all relevant info specific to this sensor type. + sender : int + Optional sender ID, defaults to SENDER_ID (see sbp/msg.py). + + """ + _parser = construct.Struct( + 'flags' / construct.Int8ul,) + __slots__ = [ + 'flags', + ] + + def __init__(self, sbp=None, **kwargs): + if sbp: + super( Odoinputtype, + self).__init__(sbp.msg_type, sbp.sender, sbp.length, + sbp.payload, sbp.crc) + self.from_binary(sbp.payload) + else: + super( Odoinputtype, self).__init__() + self.msg_type = SBP_OdoInputType + self.sender = kwargs.pop('sender', SENDER_ID) + self.flags = kwargs.pop('flags') + + def __repr__(self): + return fmt_repr(self) + + @staticmethod + def from_json(s): + """Given a JSON-encoded string s, build a message object. + + """ + d = json.loads(s) + return Odoinputtype.from_json_dict(d) + + @staticmethod + def from_json_dict(d): + sbp = SBP.from_json_dict(d) + return Odoinputtype(sbp, **d) + + + def from_binary(self, d): + """Given a binary payload d, update the appropriate payload fields of + the message. + + """ + p = Odoinputtype._parser.parse(d) + for n in self.__class__.__slots__: + setattr(self, n, getattr(p, n)) + + def to_binary(self): + """Produce a framed/packed SBP message. + + """ + c = containerize(exclude_fields(self)) + self.payload = Odoinputtype._parser.build(c) + return self.pack() + + def into_buffer(self, buf, offset): + """Produce a framed/packed SBP message into the provided buffer and offset. + + """ + self.payload = containerize(exclude_fields(self)) + self.parser = Odoinputtype._parser + self.stream_payload.reset(buf, offset) + return self.pack_into(buf, offset, self._build_payload) + + def to_json_dict(self): + self.to_binary() + d = super( Odoinputtype, self).to_json_dict() + j = walk_json_dict(exclude_fields(self)) + d.update(j) + return d + + +msg_classes = { + 0xFF0F: MsgSolnMeta, + 0xFFE7: Gnssinputtype, + 0xFFE8: Imuinputtype, + 0xFFE9: Odoinputtype, +} \ No newline at end of file diff --git a/python/sbp/table.py b/python/sbp/table.py index ca4bc72274..3a88aeceed 100755 --- a/python/sbp/table.py +++ b/python/sbp/table.py @@ -36,6 +36,7 @@ from . import orientation as orientation from . import sbas as sbas from . import ssr as ssr +from . import solution_meta as solmeta import warnings @@ -60,6 +61,7 @@ + list(orientation.msg_classes.items()) + list(sbas.msg_classes.items()) + list(ssr.msg_classes.items()) + + list(solmeta.msg_classes.items()) ) class InvalidSBPMessageType(NotImplementedError): diff --git a/python/tests/sbp/test_table.py b/python/tests/sbp/test_table.py index 7589c4d223..1256bd7390 100644 --- a/python/tests/sbp/test_table.py +++ b/python/tests/sbp/test_table.py @@ -33,6 +33,7 @@ from sbp import orientation as orientation from sbp import sbas as sbas from sbp import ssr as ssr +from sbp import solution_meta as solmeta import pytest import sbp.acquisition as acq @@ -44,7 +45,7 @@ def test_table_count(): Test number of available messages to deserialize. """ - number_of_messages = 187 + number_of_messages = 191 assert len(_SBP_TABLE) == number_of_messages def test_table_unqiue_count(): @@ -72,6 +73,7 @@ def test_table_unqiue_count(): + len(orientation.msg_classes) + len(sbas.msg_classes) + len(ssr.msg_classes) + + len(solmeta.msg_classes) ) assert len(_SBP_TABLE) == number_of_messages diff --git a/rust/sbp/Cargo.toml b/rust/sbp/Cargo.toml index 4010376516..99e68d48e3 100644 --- a/rust/sbp/Cargo.toml +++ b/rust/sbp/Cargo.toml @@ -11,7 +11,7 @@ version = "3.2.0" description = "Rust native implementation of SBP (Swift Binary Protocol) for communicating with devices made by Swift Navigation" authors = ["Swift Navigation "] repository = "https://github.com/swift-nav/libsbp" -license = "LGPL-3.0" +license = "MIT" categories = ["parsing"] edition = "2018" keywords = ["encoding", "parsing"] diff --git a/rust/sbp/src/messages/mod.rs b/rust/sbp/src/messages/mod.rs index 1412dda733..01b8be5f4d 100644 --- a/rust/sbp/src/messages/mod.rs +++ b/rust/sbp/src/messages/mod.rs @@ -24,6 +24,7 @@ pub mod orientation; pub mod piksi; pub mod sbas; pub mod settings; +pub mod solution_meta; pub mod ssr; pub mod system; pub mod tracking; @@ -188,6 +189,10 @@ use self::settings::MsgSettingsRegisterResp; use self::settings::MsgSettingsSave; use self::settings::MsgSettingsWrite; use self::settings::MsgSettingsWriteResp; +use self::solution_meta::GNSSInputType; +use self::solution_meta::IMUInputType; +use self::solution_meta::MsgSolnMeta; +use self::solution_meta::OdoInputType; use self::ssr::MsgSsrCodeBiases; use self::ssr::MsgSsrGridDefinition; use self::ssr::MsgSsrGriddedCorrection; @@ -420,6 +425,10 @@ pub enum SBP { MsgInsUpdates(MsgInsUpdates), MsgGnssTimeOffset(MsgGnssTimeOffset), MsgGroupMeta(MsgGroupMeta), + MsgSolnMeta(MsgSolnMeta), + GNSSInputType(GNSSInputType), + IMUInputType(IMUInputType), + OdoInputType(OdoInputType), MsgHeartbeat(MsgHeartbeat), Unknown(Unknown), } @@ -1357,6 +1366,26 @@ impl SBP { msg.set_sender_id(sender_id); Ok(SBP::MsgGroupMeta(msg)) } + 65295 => { + let mut msg = MsgSolnMeta::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSolnMeta(msg)) + } + 65511 => { + let mut msg = GNSSInputType::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::GNSSInputType(msg)) + } + 65512 => { + let mut msg = IMUInputType::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::IMUInputType(msg)) + } + 65513 => { + let mut msg = OdoInputType::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::OdoInputType(msg)) + } 65535 => { let mut msg = MsgHeartbeat::parse(payload)?; msg.set_sender_id(sender_id); @@ -1562,6 +1591,10 @@ impl SBP { SBP::MsgInsUpdates(msg) => msg, SBP::MsgGnssTimeOffset(msg) => msg, SBP::MsgGroupMeta(msg) => msg, + SBP::MsgSolnMeta(msg) => msg, + SBP::GNSSInputType(msg) => msg, + SBP::IMUInputType(msg) => msg, + SBP::OdoInputType(msg) => msg, SBP::MsgHeartbeat(msg) => msg, SBP::Unknown(msg) => msg, } diff --git a/rust/sbp/src/messages/solution_meta.rs b/rust/sbp/src/messages/solution_meta.rs new file mode 100644 index 0000000000..6156c2f621 --- /dev/null +++ b/rust/sbp/src/messages/solution_meta.rs @@ -0,0 +1,358 @@ +// Copyright (C) 2015-2018 Swift Navigation Inc. +// Contact: Swift Navigation +// +// This source is subject to the license found in the file 'LICENSE' which must +// be be distributed together with this source. All other rights reserved. +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, +// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + +//**************************************************************************** +// Automatically generated from yaml/swiftnav/sbp/solution_meta.yaml +// with generate.py. Please do not hand edit! +//****************************************************************************/ +//! Standardized Metadata messages for Fuzed Solution from Swift Navigation devices. + +extern crate byteorder; +#[allow(unused_imports)] +use self::byteorder::{LittleEndian, ReadBytesExt}; +#[cfg(feature = "sbp_serde")] +use serde::{Deserialize, Serialize}; + +#[allow(unused_imports)] +use crate::SbpString; + +/// Flags for a given GNSS sensor used as input for the fuzed solution. +/// +/// Metadata around the GNSS sensors involved in the fuzed solution. Accessible through sol_in[N].flags +/// in a MSG_SOLN_META. +/// Note: Just to build descriptive tables in documentation and not actually used. +/// +#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))] +#[derive(Debug, Clone)] +#[allow(non_snake_case)] +pub struct GNSSInputType { + pub sender_id: Option, + /// flags that store all relevant info specific to this sensor type. + pub flags: u8, +} + +impl GNSSInputType { + #[rustfmt::skip] + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( GNSSInputType{ + sender_id: None, + flags: _buf.read_u8()?, + } ) + } +} +impl super::SBPMessage for GNSSInputType { + fn get_message_type(&self) -> u16 { + 65511 + } + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } + + fn to_frame(&self) -> std::result::Result, crate::framer::FramerError> { + let trait_object = self as &dyn super::SBPMessage; + crate::framer::to_frame(trait_object) + } +} + +impl crate::serialize::SbpSerialize for GNSSInputType { + #[allow(unused_variables)] + fn append_to_sbp_buffer(&self, buf: &mut Vec) { + self.flags.append_to_sbp_buffer(buf); + } + + fn sbp_size(&self) -> usize { + let mut size = 0; + size += self.flags.sbp_size(); + size + } +} + +/// Flags for a given IMU sensor used as input for the fuzed solution. +/// +/// Metadata around the IMU sensors involved in the fuzed solution. Accessible through sol_in[N].flags +/// in a MSG_SOLN_META. +/// Note: Just to build descriptive tables in documentation and not actually used. +/// +#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))] +#[derive(Debug, Clone)] +#[allow(non_snake_case)] +pub struct IMUInputType { + pub sender_id: Option, + /// flags that store all relevant info specific to this sensor type. + pub flags: u8, +} + +impl IMUInputType { + #[rustfmt::skip] + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( IMUInputType{ + sender_id: None, + flags: _buf.read_u8()?, + } ) + } +} +impl super::SBPMessage for IMUInputType { + fn get_message_type(&self) -> u16 { + 65512 + } + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } + + fn to_frame(&self) -> std::result::Result, crate::framer::FramerError> { + let trait_object = self as &dyn super::SBPMessage; + crate::framer::to_frame(trait_object) + } +} + +impl crate::serialize::SbpSerialize for IMUInputType { + #[allow(unused_variables)] + fn append_to_sbp_buffer(&self, buf: &mut Vec) { + self.flags.append_to_sbp_buffer(buf); + } + + fn sbp_size(&self) -> usize { + let mut size = 0; + size += self.flags.sbp_size(); + size + } +} + +/// Solution Sensors Metadata +/// +/// This message contains all metadata about the sensors received and/or used in computing the Fuzed Solution. +/// It focuses primarly, but not only, on GNSS metadata. +/// +#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))] +#[derive(Debug, Clone)] +#[allow(non_snake_case)] +pub struct MsgSolnMeta { + pub sender_id: Option, + /// Position Dilution of Precision, as per last available DOPS from Starling + /// GNSS engine + pub pdop: u16, + /// Horizontal Dilution of Precision, as per last available DOPS from + /// Starling GNSS engine + pub hdop: u16, + /// Vertical Dilution of Precision, as per last available DOPS from Starling + /// GNSS engine + pub vdop: u16, + /// Number of satellites used in solution, as per last available DOPS from + /// Starling GNSS engine + pub n_sats: u8, + /// Age of the corrections (0xFFFF indicates invalid), as per last available + /// AGE_CORRECTIONS from Starling GNSS engine + pub age_corrections: u16, + /// Bits for reason why it cannot align (yet) + pub alignment_status: u8, + /// Tow of last-used GNSS position measurement + pub last_used_gnss_pos_tow: u32, + /// Tow of last-used GNSS velocity measurement + pub last_used_gnss_vel_tow: u32, + /// Array of Metadata describing the sensors potentially involved in the + /// solution. Each element in the array represents a single sensor type and + /// consists of flags containing (meta)data pertaining to that specific + /// single sensor. Refer to each (XX)InputType descriptor in the present + /// doc. + pub sol_in: Vec, +} + +impl MsgSolnMeta { + #[rustfmt::skip] + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgSolnMeta{ + sender_id: None, + pdop: _buf.read_u16::()?, + hdop: _buf.read_u16::()?, + vdop: _buf.read_u16::()?, + n_sats: _buf.read_u8()?, + age_corrections: _buf.read_u16::()?, + alignment_status: _buf.read_u8()?, + last_used_gnss_pos_tow: _buf.read_u32::()?, + last_used_gnss_vel_tow: _buf.read_u32::()?, + sol_in: SolutionInputType::parse_array(_buf)?, + } ) + } +} +impl super::SBPMessage for MsgSolnMeta { + fn get_message_type(&self) -> u16 { + 65295 + } + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } + + fn to_frame(&self) -> std::result::Result, crate::framer::FramerError> { + let trait_object = self as &dyn super::SBPMessage; + crate::framer::to_frame(trait_object) + } +} + +impl crate::serialize::SbpSerialize for MsgSolnMeta { + #[allow(unused_variables)] + fn append_to_sbp_buffer(&self, buf: &mut Vec) { + self.pdop.append_to_sbp_buffer(buf); + self.hdop.append_to_sbp_buffer(buf); + self.vdop.append_to_sbp_buffer(buf); + self.n_sats.append_to_sbp_buffer(buf); + self.age_corrections.append_to_sbp_buffer(buf); + self.alignment_status.append_to_sbp_buffer(buf); + self.last_used_gnss_pos_tow.append_to_sbp_buffer(buf); + self.last_used_gnss_vel_tow.append_to_sbp_buffer(buf); + self.sol_in.append_to_sbp_buffer(buf); + } + + fn sbp_size(&self) -> usize { + let mut size = 0; + size += self.pdop.sbp_size(); + size += self.hdop.sbp_size(); + size += self.vdop.sbp_size(); + size += self.n_sats.sbp_size(); + size += self.age_corrections.sbp_size(); + size += self.alignment_status.sbp_size(); + size += self.last_used_gnss_pos_tow.sbp_size(); + size += self.last_used_gnss_vel_tow.sbp_size(); + size += self.sol_in.sbp_size(); + size + } +} + +/// Flags for a given Odometry sensor used as input for the fuzed solution. +/// +/// Metadata around the Odometry sensors involved in the fuzed solution. Accessible through sol_in[N].flags +/// in a MSG_SOLN_META. +/// Note: Just to build descriptive tables in documentation and not actually used. +/// +#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))] +#[derive(Debug, Clone)] +#[allow(non_snake_case)] +pub struct OdoInputType { + pub sender_id: Option, + /// flags that store all relevant info specific to this sensor type. + pub flags: u8, +} + +impl OdoInputType { + #[rustfmt::skip] + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( OdoInputType{ + sender_id: None, + flags: _buf.read_u8()?, + } ) + } +} +impl super::SBPMessage for OdoInputType { + fn get_message_type(&self) -> u16 { + 65513 + } + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } + + fn to_frame(&self) -> std::result::Result, crate::framer::FramerError> { + let trait_object = self as &dyn super::SBPMessage; + crate::framer::to_frame(trait_object) + } +} + +impl crate::serialize::SbpSerialize for OdoInputType { + #[allow(unused_variables)] + fn append_to_sbp_buffer(&self, buf: &mut Vec) { + self.flags.append_to_sbp_buffer(buf); + } + + fn sbp_size(&self) -> usize { + let mut size = 0; + size += self.flags.sbp_size(); + size + } +} + +/// Flags for a given solution input type. +/// +/// Metadata describing which sensors were involved in the solution. +/// The structure is fixed no matter what the actual sensor type is. +/// The sensor_type field tells you which sensor we are talking about. It also tells you +/// whether the sensor data was actually used or not. +/// The flags field, always a u8, contains the sensor-specific data. +/// The content of flags, for each sensor type, is described in the relevant structures in this section. +/// +#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))] +#[derive(Debug, Clone)] +#[allow(non_snake_case)] +pub struct SolutionInputType { + /// The type of sensor + pub sensor_type: u8, + /// Refer to each InputType description + pub flags: u8, +} + +impl SolutionInputType { + #[rustfmt::skip] + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( SolutionInputType{ + sensor_type: _buf.read_u8()?, + flags: _buf.read_u8()?, + } ) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push(SolutionInputType::parse(buf)?); + } + Ok(v) + } + + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, crate::Error> { + let mut v = Vec::new(); + for _ in 0..n { + v.push(SolutionInputType::parse(buf)?); + } + Ok(v) + } +} + +impl crate::serialize::SbpSerialize for SolutionInputType { + #[allow(unused_variables)] + fn append_to_sbp_buffer(&self, buf: &mut Vec) { + self.sensor_type.append_to_sbp_buffer(buf); + self.flags.append_to_sbp_buffer(buf); + } + + fn sbp_size(&self) -> usize { + let mut size = 0; + size += self.sensor_type.sbp_size(); + size += self.flags.sbp_size(); + size + } +} diff --git a/spec/yaml/swiftnav/sbp/solution_meta.yaml b/spec/yaml/swiftnav/sbp/solution_meta.yaml new file mode 100644 index 0000000000..af43a01d10 --- /dev/null +++ b/spec/yaml/swiftnav/sbp/solution_meta.yaml @@ -0,0 +1,220 @@ +# Copyright (C) 2015 Swift Navigation Inc. +# Contact: Fergus Noble +# +# This source is subject to the license found in the file 'LICENSE' which must +# be be distributed together with this source. All other rights reserved. +# +# THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, +# EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + +package: swiftnav.sbp.solution_meta +description: Standardized Metadata messages for Fuzed Solution from Swift Navigation devices. +stable: True +public: True +include: + - types.yaml +definitions: + + # the actual union-like type of the elements going into the array sol_in in MSG_SOLN_META + - SolutionInputType: + short_desc: Flags for a given solution input type. + desc: | + Metadata describing which sensors were involved in the solution. + The structure is fixed no matter what the actual sensor type is. + The sensor_type field tells you which sensor we are talking about. It also tells you + whether the sensor data was actually used or not. + The flags field, always a u8, contains the sensor-specific data. + The content of flags, for each sensor type, is described in the relevant structures in this section. + type: u16 + fields: + - sensor_type: + type: u8 + desc: The type of sensor + fields: + - 0-2: + desc: The type of sensor + values: + - 0: GNSS Position (see GNSSInputType) + - 1: GNSS Velocity Displacement (see GNSSInputType) + - 2: GNSS Velocity Doppler (see GNSSInputType) + - 3: Odometry Ticks (see OdoInputType) + - 4: Odometry Speed (see OdoInputType) + - 5: IMU Sensor (see IMUInputType) + - 6: Reserved + - 7: Reserved + - 3-4: + desc: Whether this sensor input was actually used or not + values: + - 0: Unknown + - 1: Received and used + - 2: Received but not used + - 5-7: + desc: Reserved + - flags: + type: u8 + units: (XX)InputType + desc: Refer to each InputType description + + - MSG_SOLN_META: + id: 0xFF0F + short_desc: Solution Sensors Metadata + public: true + desc: | + This message contains all metadata about the sensors received and/or used in computing the Fuzed Solution. + It focuses primarly, but not only, on GNSS metadata. + fields: + - pdop: + type: u16 + units: 0.01 + desc: Position Dilution of Precision, as per last available DOPS from Starling GNSS engine + - hdop: + type: u16 + units: 0.01 + desc: Horizontal Dilution of Precision, as per last available DOPS from Starling GNSS engine + - vdop: + type: u16 + units: 0.01 + desc: Vertical Dilution of Precision, as per last available DOPS from Starling GNSS engine + - n_sats: + type: u8 + desc: Number of satellites used in solution, as per last available DOPS from Starling GNSS engine + - age_corrections: + type: u16 + units: deciseconds + desc: Age of the corrections (0xFFFF indicates invalid), as per last available AGE_CORRECTIONS from Starling GNSS engine + - alignment_status: + type: u8 + desc: Bits for reason why it cannot align (yet) + fields: + - 0-2: + desc: Bits for reason why it cannot align (yet) + values: + - 0: Unknown reason or already aligned + - 1: No seed values nor GNSS measurements + - 2: Seed values loaded but not GNSS measurements + - 3: Reserved + - 4: Reserved + - 5: Reserved + - 6: Reserved + - 7: Reserved + - 3-7: + desc: Reserved + - last_used_gnss_pos_tow: + type: u32 + units: ms + desc: Tow of last-used GNSS position measurement + - last_used_gnss_vel_tow: + type: u32 + units: ms + desc: Tow of last-used GNSS velocity measurement + - sol_in: + type: array + fill: SolutionInputType + desc: Array of Metadata describing the sensors potentially involved in the solution. + Each element in the array represents a single sensor type and consists of flags containing (meta)data + pertaining to that specific single sensor. Refer to each (XX)InputType descriptor in the present doc. + + ############################################# + # One structure definition per sensor class + # Feel free to add more sensor Classes. + # They must all consist of only a u8 flags field. + # This type are never used nor instantiated per se. + # These definitions are for reference and documentation purposes. + ############################################# + # for GNSS sensors + - GNSSInputType: + id: 0xFFE7 + short_desc: Flags for a given GNSS sensor used as input for the fuzed solution. + public: true + desc: | + Metadata around the GNSS sensors involved in the fuzed solution. Accessible through sol_in[N].flags + in a MSG_SOLN_META. + Note: Just to build descriptive tables in documentation and not actually used. + fields: + - flags: + type: u8 + desc: flags that store all relevant info specific to this sensor type. + fields: + - 0-1: + desc: Type of GNSS measurement + values: + - 0: GNSS Position + - 1: GNSS Velocity Doppler + - 2: GNSS Velocity Displacement + - 2-7: + desc: Reserved + + # for IMU sensors + - IMUInputType: + id: 0xFFE8 + short_desc: Flags for a given IMU sensor used as input for the fuzed solution. + public: true + desc: | + Metadata around the IMU sensors involved in the fuzed solution. Accessible through sol_in[N].flags + in a MSG_SOLN_META. + Note: Just to build descriptive tables in documentation and not actually used. + fields: + - flags: + type: u8 + desc: flags that store all relevant info specific to this sensor type. + fields: + - 0-1: + desc: IMU architecture + values: + - 0: 6-axis MEMS + - 1: Other type + - 2-3: + desc: IMU Grade + values: + - 0: Consumer Grade + - 1: Tactical grade + - 2: Intermediate Grade + - 3: Superior (Marine / Aviation) Grade + - 4-5: + desc: Time status + values: + - 0: Reference epoch is start of current GPS week + - 1: Reference epoch is time of system startup + - 2: Reference epoch is unknown + - 3: Reference epoch is last PPS + - 6-7: + desc: Reserved + + # for Odometry sensors + - OdoInputType: + id: 0xFFE9 + short_desc: Flags for a given Odometry sensor used as input for the fuzed solution. + public: true + desc: | + Metadata around the Odometry sensors involved in the fuzed solution. Accessible through sol_in[N].flags + in a MSG_SOLN_META. + Note: Just to build descriptive tables in documentation and not actually used. + fields: + - flags: + type: u8 + desc: flags that store all relevant info specific to this sensor type. + fields: + - 0-1: + desc: Odometer class + values: + - 0: Single or averaged ticks + - 1: Single or averaged speed + - 2: Multi-dimensional ticks + - 3: Multi-dimensional speed + - 2-3: + desc: Odometer grade + values: + - 0: Low Grade (e.g. quantisized CAN) + - 1: Medium Grade + - 2: Superior Grade + - 3: Reserved + - 4-5: + desc: Rate + values: + - 0: Fixed incoming rate + - 1: Incoming when triggered by minimum distance or speed + - 2: Reserved + - 3: Reserved + - 6-7: + desc: Reserved