Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions HOWTO.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ process. This is likely to change in the future.
1. Add a message definition to the approprate package, or create a new
one if needed. Read the **Message Guidelines** below.

2. Generate new clients and documentation by running `make
2. Increment `number_of_messages` in `python/tests/sbp/test_table.py`
by the corresponding number of new messages.

3. Generate new clients and documentation by running `make
all`. Verify that the generated code, which isn't too complicated,
meets your expectations, as allowed messages are limited by the
underlying language implementation. For example, you can't specify
Expand All @@ -26,12 +29,12 @@ process. This is likely to change in the future.
materialize a 0-length array C99 extension in the middle of the
struct. GCC won't compile this.

3. Add a [`test`](spec/tests/yaml/swiftnav/sbp) case and update the
appropriate language libaries. Run `make test`.
4. (Optional) Add a [`test`](spec/tests/yaml/swiftnav/sbp) case and
update the appropriate language libaries. Run `make test`.

4. Submit a pull request.
5. Submit a pull request.

5. If Swift's internal test tooling needs to be updated to use your
6. If Swift's internal test tooling needs to be updated to use your
new message, deploy the updated Python client first, and then the C
client. We haven't quite decided on the details of this process.

Expand Down
11 changes: 11 additions & 0 deletions c/include/libsbp/gnss.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@ the Slot ID in [1,28]
} sbp_gnss_signal_t;


/** Space vehicle identifier
*
* A (Constellation ID, satellite ID) tuple that uniquely identifies
* a space vehicle
*/
typedef struct SBP_ATTR_PACKED {
u8 satId; /**< ID of the space vehicle within its constellation */
u8 constellation; /**< Constellation ID to which the SV belongs */
} sv_id_t;


/** Deprecated
*
* Deprecated.
Expand Down
163 changes: 146 additions & 17 deletions c/include/libsbp/ssr.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,27 +49,116 @@ typedef struct SBP_ATTR_PACKED {
u8 code; /**< Signal constellation, band and code */
u8 integer_indicator; /**< Indicator for integer property */
u8 widelane_integer_indicator; /**< Indicator for two groups of Wide-Lane(s) integer property */
u8 discontinuity_counter; /**< Signal phase discontinuity counter.
u8 discontinuity_counter; /**< Signal phase discontinuity counter.
Increased for every discontinuity in phase.
*/
s32 bias; /**< Phase bias for specified signal [0.1 mm] */
} phase_biases_content_t;


/** Header for MSG_SSR_STEC_CORRECTION message
*
* A full set of STEC information will likely span multiple SBP
* messages, since SBP message a limited to 255 bytes. The header
* is used to tie multiple SBP messages into a sequence.
*/
typedef struct SBP_ATTR_PACKED {
sbp_gps_time_t time; /**< GNSS time of the STEC data */
u8 num_msgs; /**< Number of messages in the dataset */
u8 seq_num; /**< Position of this message in the dataset */
u16 ssr_update_interval; /**< update interval in seconds [seconds] */
u8 iod_ssr; /**< range 0 - 15 */
} stec_header_t;


/** Header for MSG_SSR_GRIDDED_CORRECTION
*
* The 3GPP message contains nested variable length arrays
* which are not suppported in SBP, so each grid point will
* be identified by the index.
*/
typedef struct SBP_ATTR_PACKED {
sbp_gps_time_t time; /**< GNSS time of the STEC data */
u16 num_msgs; /**< Number of messages in the dataset */
u16 seq_num; /**< Position of this message in the dataset */
u16 ssr_update_interval; /**< update interval in seconds [seconds] */
u8 iod_ssr; /**< range 0 - 15 */
u8 tropo_quality; /**< troposphere quality indicator [encoded value - see spec for details] */
} gridded_correction_header_t;


/** None
*
* STEC for the given satellite.
*/
typedef struct SBP_ATTR_PACKED {
sv_id_t sv_id; /**< Unique space vehicle identifier */
u8 stec_quality_indicator; /**< quality of STEC data [encoded value - see spec for details] */
s16 stec_coeff[4]; /**< coefficents of the STEC polynomial */
} stec_sat_element_t;


/** troposphere delay correction
*
* Contains wet vertical and hydrostatic vertical delay
*/
typedef struct SBP_ATTR_PACKED {
s16 hydro; /**< hydrostatic vertical delay [0.4 mm (add 2.3 m to get actual vert hydro delay)] */
s8 wet; /**< wet vertical delay [0.4 mm (add 0.252 m to get actual vert wet delay)] */
} tropospheric_delay_correction_t;


/** None
*
* STEC residual
*/
typedef struct SBP_ATTR_PACKED {
sv_id_t sv_id; /**< space vehicle identifier */
s16 residual; /**< STEC residual [0.04 TECU] */
} stec_residual_t;


/** Grid datum for troposphere and STEC residuals
*
* Contains one tropo datum, plus STEC residuals for each space
* vehicle
*/
typedef struct SBP_ATTR_PACKED {
u16 index; /**< index of the grid point */
tropospheric_delay_correction_t tropo_delay_correction; /**< Wet and Hydrostatic Vertical Delay */
stec_residual_t STEC_residuals[0]; /**< STEC Residual for the given space vehicle */
} grid_element_t;


/** Defines the grid for STEC and tropo grid messages
*
* Defines the grid for STEC and tropo grid messages.
* Also includes an RLE encoded validity list.
*/
typedef struct SBP_ATTR_PACKED {
u8 region_size_inverse; /**< inverse of region size [coded value - see spec] */
u16 area_width; /**< area width; see spec for details [coded value - 0 means not present (Swift convention)] */
u16 lat_nw_corner_enc; /**< encoded latitude of the northwest corner of the grid */
u16 lon_nw_corner_enc; /**< encoded longitude of the northwest corner of the grid */
u8 num_msgs; /**< Number of messages in the dataset */
u8 seq_num; /**< Postion of this message in the dataset */
} grid_definition_header_t;


/** Precise orbit and clock correction
*
* The precise orbit and clock correction message is
* to be applied as a delta correction to broadcast
* The precise orbit and clock correction message is
* to be applied as a delta correction to broadcast
* ephemeris and is typically an equivalent to the 1060
* and 1066 RTCM message types
*/
#define SBP_MSG_SSR_ORBIT_CLOCK 0x05DD
#define SBP_MSG_SSR_ORBIT_CLOCK 0x05DD
typedef struct SBP_ATTR_PACKED {
gps_time_sec_t time; /**< GNSS reference time of the correction */
sbp_gnss_signal_t sid; /**< GNSS signal identifier (16 bit) */
u8 update_interval; /**< Update interval between consecutive corrections [s] */
u8 iod_ssr; /**< IOD of the SSR correction. A change of Issue Of Data
SSR is used to indicate a change in the SSR
SSR is used to indicate a change in the SSR
generating configuration
*/
u32 iod; /**< Issue of broadcast ephemeris data or IODCRC (Beidou) */
Expand All @@ -87,18 +176,18 @@ generating configuration

/** Precise orbit and clock correction
*
* The precise orbit and clock correction message is
* to be applied as a delta correction to broadcast
* The precise orbit and clock correction message is
* to be applied as a delta correction to broadcast
* ephemeris and is typically an equivalent to the 1060
* and 1066 RTCM message types
*/
#define SBP_MSG_SSR_ORBIT_CLOCK_DEP_A 0x05DC
#define SBP_MSG_SSR_ORBIT_CLOCK_DEP_A 0x05DC
typedef struct SBP_ATTR_PACKED {
gps_time_sec_t time; /**< GNSS reference time of the correction */
sbp_gnss_signal_t sid; /**< GNSS signal identifier (16 bit) */
u8 update_interval; /**< Update interval between consecutive corrections [s] */
u8 iod_ssr; /**< IOD of the SSR correction. A change of Issue Of Data
SSR is used to indicate a change in the SSR
SSR is used to indicate a change in the SSR
generating configuration
*/
u8 iod; /**< Issue of broadcast ephemeris data */
Expand All @@ -118,16 +207,16 @@ generating configuration
*
* The precise code biases message is to be added
* to the pseudorange of the corresponding signal
* to get corrected pseudorange. It is typically
* to get corrected pseudorange. It is typically
* an equivalent to the 1059 and 1065 RTCM message types
*/
#define SBP_MSG_SSR_CODE_BIASES 0x05E1
#define SBP_MSG_SSR_CODE_BIASES 0x05E1
typedef struct SBP_ATTR_PACKED {
gps_time_sec_t time; /**< GNSS reference time of the correction */
sbp_gnss_signal_t sid; /**< GNSS signal identifier (16 bit) */
u8 update_interval; /**< Update interval between consecutive corrections [s] */
u8 iod_ssr; /**< IOD of the SSR correction. A change of Issue Of Data
SSR is used to indicate a change in the SSR
SSR is used to indicate a change in the SSR
generating configuration
*/
code_biases_content_t biases[0]; /**< Code biases for the different satellite signals */
Expand All @@ -138,18 +227,18 @@ generating configuration
*
* The precise phase biases message contains the biases
* to be added to the carrier phase of the corresponding
* signal to get corrected carrier phase measurement, as
* well as the satellite yaw angle to be applied to compute
* the phase wind-up correction.
* signal to get corrected carrier phase measurement, as
* well as the satellite yaw angle to be applied to compute
* the phase wind-up correction.
* It is typically an equivalent to the 1265 RTCM message types
*/
#define SBP_MSG_SSR_PHASE_BIASES 0x05E6
#define SBP_MSG_SSR_PHASE_BIASES 0x05E6
typedef struct SBP_ATTR_PACKED {
gps_time_sec_t time; /**< GNSS reference time of the correction */
sbp_gnss_signal_t sid; /**< GNSS signal identifier (16 bit) */
u8 update_interval; /**< Update interval between consecutive corrections [s] */
u8 iod_ssr; /**< IOD of the SSR correction. A change of Issue Of Data
SSR is used to indicate a change in the SSR
SSR is used to indicate a change in the SSR
generating configuration
*/
u8 dispersive_bias; /**< Indicator for the dispersive phase biases property.
Expand All @@ -164,6 +253,46 @@ satellite being tracked.
} msg_ssr_phase_biases_t;


/** Slant Total Electron Content
*
* The STEC per space vehicle, given as polynomial approximation for
* a given grid. This should be combined with SSR-GriddedCorrection
* message to get the state space representation of the atmospheric
* delay.
*/
#define SBP_MSG_SSR_STEC_CORRECTION 0x05EB
typedef struct SBP_ATTR_PACKED {
stec_header_t header; /**< Header of a STEC message */
stec_sat_element_t stec_sat_list[0]; /**< Array of STEC information for each space vehicle */
} msg_ssr_stec_correction_t;


/** Gridded troposphere and STEC residuals
*
* STEC residuals are per space vehicle, tropo is not.
*/
#define SBP_MSG_SSR_GRIDDED_CORRECTION 0x05F0
typedef struct SBP_ATTR_PACKED {
gridded_correction_header_t header; /**< Header of a Gridded Correction message */
grid_element_t element; /**< Tropo and STEC residuals for the given grid point */
} msg_ssr_gridded_correction_t;


/** None
*
* Definition of the grid for STEC and tropo messages
*/
#define SBP_MSG_SSR_GRID_DEFINITION 0x05F5
typedef struct SBP_ATTR_PACKED {
grid_definition_header_t header; /**< Header of a Gridded Correction message */
u8 rle_list[0]; /**< Run Length Encode list of quadrants that contain valid data.
The spec describes the encoding scheme in detail, but
essentially the index of the quadrants that contain transitions between
valid and invalid (and vice versa) are encoded as u8 integers.
*/
} msg_ssr_grid_definition_t;


/** \} */

SBP_PACK_END
Expand Down
Binary file modified docs/sbp.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion generator/sbpg/targets/javascript.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def render_source(output_dir, package_spec, jenv=JENV):
destination_filename = "%s/%s.js" % (directory, name)
py_template = jenv.get_template(TEMPLATE_NAME)
module_path = ".".join(package_spec.identifier.split(".")[1:-1])
includeMap = {'gnss': ['GnssSignal', 'GnssSignalDep', 'GPSTime', 'CarrierPhase', 'GPSTime', 'GPSTimeSec', 'GPSTimeDep'] }
includeMap = {'gnss': ['GnssSignal', 'GnssSignalDep', 'GPSTime', 'CarrierPhase', 'GPSTime', 'GPSTimeSec', 'GPSTimeDep', 'SvId'] }
includes = [".".join(i.split(".")[:-1]) for i in package_spec.includes]
includes = [(i, includeMap.get(i)) for i in includes if i != "types"]
with open(destination_filename, 'w') as f:
Expand Down
24 changes: 24 additions & 0 deletions haskell/src/SwiftNav/SBP/Gnss.hs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,30 @@ instance Binary GnssSignal where
$(makeJSON "_gnssSignal_" ''GnssSignal)
$(makeLenses ''GnssSignal)

-- | SvId.
--
-- A (Constellation ID, satellite ID) tuple that uniquely identifies a space
-- vehicle
data SvId = SvId
{ _svId_satId :: !Word8
-- ^ ID of the space vehicle within its constellation
, _svId_constellation :: !Word8
-- ^ Constellation ID to which the SV belongs
} deriving ( Show, Read, Eq )

instance Binary SvId where
get = do
_svId_satId <- getWord8
_svId_constellation <- getWord8
pure SvId {..}

put SvId {..} = do
putWord8 _svId_satId
putWord8 _svId_constellation

$(makeJSON "_svId_" ''SvId)
$(makeLenses ''SvId)

-- | GnssSignalDep.
--
-- Deprecated.
Expand Down
Loading