Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for QZSS constellation [OI-1792] #1414

Merged
merged 4 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 2 additions & 0 deletions .github/workflows/c.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ jobs:

runs-on: ubuntu-latest
container: ubuntu:18.04
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
Comment on lines +34 to +35
Copy link
Contributor Author

@cstolowicz cstolowicz Jul 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was added in order to solve an error on the workflow. Discussion can be found here


steps:

Expand Down
4 changes: 4 additions & 0 deletions c/include/libsbp/gnss_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
#define SBP_GNSSSIGNAL_BDS2_B2 (13)
#define SBP_GNSSSIGNAL_GAL_E1B (14)
#define SBP_GNSSSIGNAL_GAL_E7I (20)
#define SBP_GNSSSIGNAL_QZS_L1CA (31)
#define SBP_GNSSSIGNAL_QZS_L2CL (36)
#define SBP_GNSSSIGNAL_QZS_L5Q (39)
#define SBP_GNSSSIGNAL_BDS3_B2A (47)
/**
* Encoded length of sbp_gnss_signal_t
Expand All @@ -58,6 +61,7 @@

#define SBP_SVID_GPS (0)
#define SBP_SVID_BDS (3)
#define SBP_SVID_QZS (4)
#define SBP_SVID_GAL (5)
/**
* Encoded length of sbp_sv_id_t
Expand Down
7 changes: 6 additions & 1 deletion c/include/libsbp/integrity/MSG_SSR_FLAG_HIGH_LEVEL.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ extern "C" {
* be a satellite, SSR grid point, or SSR tile. A group of aggregated elements
* being monitored for integrity could refer to:
*
* - Satellites in a particular {GPS, GAL, BDS} constellation.
* - Satellites in a particular {GPS, GAL, BDS, QZSS} constellation.
*
* - Satellites in the line-of-sight of a particular SSR tile.
*
Expand Down Expand Up @@ -111,6 +111,11 @@ typedef struct {
*/
u8 use_bds_sat;

/**
* Use QZSS satellites.
*/
u8 use_qzss_sat;

/**
* Reserved
*/
Expand Down
20 changes: 19 additions & 1 deletion c/include/libsbp/integrity_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,30 @@
#define SBP_SSR_FLAG_HIGH_LEVEL_USE_BDS_SATELLITES_WARNING (1)
#define SBP_SSR_FLAG_HIGH_LEVEL_USE_BDS_SATELLITES_ALERT (2)
#define SBP_SSR_FLAG_HIGH_LEVEL_USE_BDS_SATELLITES_NOT_MONITORED (3)
#define SBP_SSR_FLAG_HIGH_LEVEL_USE_QZSS_SATELLITES_MASK (0x7u)
#define SBP_SSR_FLAG_HIGH_LEVEL_USE_QZSS_SATELLITES_SHIFT (0u)
#define SBP_SSR_FLAG_HIGH_LEVEL_USE_QZSS_SATELLITES_GET(flags) \
((u8)((u8)((flags) >> SBP_SSR_FLAG_HIGH_LEVEL_USE_QZSS_SATELLITES_SHIFT) & \
SBP_SSR_FLAG_HIGH_LEVEL_USE_QZSS_SATELLITES_MASK))
#define SBP_SSR_FLAG_HIGH_LEVEL_USE_QZSS_SATELLITES_SET(flags, val) \
do { \
(flags) = (u8)( \
(flags & (~(SBP_SSR_FLAG_HIGH_LEVEL_USE_QZSS_SATELLITES_MASK \
<< SBP_SSR_FLAG_HIGH_LEVEL_USE_QZSS_SATELLITES_SHIFT))) | \
(((val) & (SBP_SSR_FLAG_HIGH_LEVEL_USE_QZSS_SATELLITES_MASK)) \
<< (SBP_SSR_FLAG_HIGH_LEVEL_USE_QZSS_SATELLITES_SHIFT))); \
} while (0)

#define SBP_SSR_FLAG_HIGH_LEVEL_USE_QZSS_SATELLITES_NOMINAL (0)
#define SBP_SSR_FLAG_HIGH_LEVEL_USE_QZSS_SATELLITES_WARNING (1)
#define SBP_SSR_FLAG_HIGH_LEVEL_USE_QZSS_SATELLITES_ALERT (2)
#define SBP_SSR_FLAG_HIGH_LEVEL_USE_QZSS_SATELLITES_NOT_MONITORED (3)
/**
* The maximum number of items that can be stored in
* sbp_msg_ssr_flag_high_level_t::reserved before the maximum SBP message size
* is exceeded
*/
#define SBP_MSG_SSR_FLAG_HIGH_LEVEL_RESERVED_MAX 6u
#define SBP_MSG_SSR_FLAG_HIGH_LEVEL_RESERVED_MAX 5u

#define SBP_SSR_FLAG_HIGH_LEVEL_USE_TROPO_GRID_POINTS_MASK (0x7u)
#define SBP_SSR_FLAG_HIGH_LEVEL_USE_TROPO_GRID_POINTS_SHIFT (0u)
Expand Down
3 changes: 3 additions & 0 deletions c/include/libsbp/ssr_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@

#define SBP_SSR_ORBIT_CLOCK_BOUNDS_GPS (0)
#define SBP_SSR_ORBIT_CLOCK_BOUNDS_BDS (3)
#define SBP_SSR_ORBIT_CLOCK_BOUNDS_QZS (4)
#define SBP_SSR_ORBIT_CLOCK_BOUNDS_GAL (5)
/**
* The maximum number of items that can be stored in
Expand Down Expand Up @@ -476,6 +477,7 @@

#define SBP_SSR_CODE_PHASE_BIASES_BOUNDS_GPS (0)
#define SBP_SSR_CODE_PHASE_BIASES_BOUNDS_BDS (3)
#define SBP_SSR_CODE_PHASE_BIASES_BOUNDS_QZS (4)
#define SBP_SSR_CODE_PHASE_BIASES_BOUNDS_GAL (5)
/**
* The maximum number of items that can be stored in
Expand Down Expand Up @@ -518,6 +520,7 @@

#define SBP_SSR_ORBIT_CLOCK_BOUNDS_DEGRADATION_GPS (0)
#define SBP_SSR_ORBIT_CLOCK_BOUNDS_DEGRADATION_BDS (3)
#define SBP_SSR_ORBIT_CLOCK_BOUNDS_DEGRADATION_QZS (4)
#define SBP_SSR_ORBIT_CLOCK_BOUNDS_DEGRADATION_GAL (5)
/**
* Encoded length of sbp_msg_ssr_orbit_clock_bounds_degradation_t
Expand Down
11 changes: 11 additions & 0 deletions c/src/integrity.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ bool sbp_msg_ssr_flag_high_level_encode_internal(
if (!sbp_u8_encode(ctx, &msg->use_bds_sat)) {
return false;
}
if (!sbp_u8_encode(ctx, &msg->use_qzss_sat)) {
return false;
}
for (size_t i = 0; i < SBP_MSG_SSR_FLAG_HIGH_LEVEL_RESERVED_MAX; i++) {
if (!sbp_u8_encode(ctx, &msg->reserved[i])) {
return false;
Expand Down Expand Up @@ -233,6 +236,9 @@ bool sbp_msg_ssr_flag_high_level_decode_internal(
if (!sbp_u8_decode(ctx, &msg->use_bds_sat)) {
return false;
}
if (!sbp_u8_decode(ctx, &msg->use_qzss_sat)) {
return false;
}
for (uint8_t i = 0; i < SBP_MSG_SSR_FLAG_HIGH_LEVEL_RESERVED_MAX; i++) {
if (!sbp_u8_decode(ctx, &msg->reserved[i])) {
return false;
Expand Down Expand Up @@ -332,6 +338,11 @@ int sbp_msg_ssr_flag_high_level_cmp(const sbp_msg_ssr_flag_high_level_t *a,
return ret;
}

ret = sbp_u8_cmp(&a->use_qzss_sat, &b->use_qzss_sat);
if (ret != 0) {
return ret;
}

for (uint8_t i = 0; i < SBP_MSG_SSR_FLAG_HIGH_LEVEL_RESERVED_MAX; i++) {
ret = sbp_u8_cmp(&a->reserved[i], &b->reserved[i]);
if (ret != 0) {
Expand Down
41 changes: 21 additions & 20 deletions c/test/auto_check_sbp_integrity_MsgSsrFlagHighLevel.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ START_TEST(test_auto_check_sbp_integrity_MsgSsrFlagHighLevel) {
u8 encoded_frame[] = {
85, 185, 11, 66, 0, 31, 180, 0, 0, 0, 3, 0, 104,
1, 0, 0, 6, 0, 10, 20, 0, 30, 0, 40, 1, 2,
3, 0, 0, 0, 0, 0, 0, 4, 5, 6, 7, 102, 67,
3, 4, 0, 0, 0, 0, 0, 5, 6, 7, 8, 105, 3,
};

dummy_reset();
Expand Down Expand Up @@ -124,8 +124,6 @@ START_TEST(test_auto_check_sbp_integrity_MsgSsrFlagHighLevel) {

test_msg.ssr_flag_high_level.reserved[4] = 0;

test_msg.ssr_flag_high_level.reserved[5] = 0;

test_msg.ssr_flag_high_level.ssr_sol_id = 10;

test_msg.ssr_flag_high_level.tile_id = 30;
Expand All @@ -138,13 +136,15 @@ START_TEST(test_auto_check_sbp_integrity_MsgSsrFlagHighLevel) {

test_msg.ssr_flag_high_level.use_gps_sat = 1;

test_msg.ssr_flag_high_level.use_iono_grid_point_sat_los = 7;
test_msg.ssr_flag_high_level.use_iono_grid_point_sat_los = 8;

test_msg.ssr_flag_high_level.use_iono_grid_points = 6;

test_msg.ssr_flag_high_level.use_iono_grid_points = 5;
test_msg.ssr_flag_high_level.use_iono_tile_sat_los = 7;

test_msg.ssr_flag_high_level.use_iono_tile_sat_los = 6;
test_msg.ssr_flag_high_level.use_qzss_sat = 4;

test_msg.ssr_flag_high_level.use_tropo_grid_points = 4;
test_msg.ssr_flag_high_level.use_tropo_grid_points = 5;

sbp_message_send(&sbp_state, SbpMsgSsrFlagHighLevel, 66, &test_msg,
&dummy_write);
Expand Down Expand Up @@ -225,11 +225,6 @@ START_TEST(test_auto_check_sbp_integrity_MsgSsrFlagHighLevel) {
"incorrect value for last_msg.msg.ssr_flag_high_level.reserved[4], "
"expected 0, is %" PRId64,
(int64_t)last_msg.msg.ssr_flag_high_level.reserved[4]);
ck_assert_msg(
last_msg.msg.ssr_flag_high_level.reserved[5] == 0,
"incorrect value for last_msg.msg.ssr_flag_high_level.reserved[5], "
"expected 0, is %" PRId64,
(int64_t)last_msg.msg.ssr_flag_high_level.reserved[5]);

ck_assert_msg(
last_msg.msg.ssr_flag_high_level.ssr_sol_id == 10,
Expand Down Expand Up @@ -268,30 +263,36 @@ START_TEST(test_auto_check_sbp_integrity_MsgSsrFlagHighLevel) {
(int64_t)last_msg.msg.ssr_flag_high_level.use_gps_sat);

ck_assert_msg(
last_msg.msg.ssr_flag_high_level.use_iono_grid_point_sat_los == 7,
last_msg.msg.ssr_flag_high_level.use_iono_grid_point_sat_los == 8,
"incorrect value for "
"last_msg.msg.ssr_flag_high_level.use_iono_grid_point_sat_los, "
"expected 7, is %" PRId64,
"expected 8, is %" PRId64,
(int64_t)last_msg.msg.ssr_flag_high_level.use_iono_grid_point_sat_los);

ck_assert_msg(
last_msg.msg.ssr_flag_high_level.use_iono_grid_points == 5,
last_msg.msg.ssr_flag_high_level.use_iono_grid_points == 6,
"incorrect value for "
"last_msg.msg.ssr_flag_high_level.use_iono_grid_points, expected 5, is "
"last_msg.msg.ssr_flag_high_level.use_iono_grid_points, expected 6, is "
"%" PRId64,
(int64_t)last_msg.msg.ssr_flag_high_level.use_iono_grid_points);

ck_assert_msg(
last_msg.msg.ssr_flag_high_level.use_iono_tile_sat_los == 6,
last_msg.msg.ssr_flag_high_level.use_iono_tile_sat_los == 7,
"incorrect value for "
"last_msg.msg.ssr_flag_high_level.use_iono_tile_sat_los, expected 6, "
"last_msg.msg.ssr_flag_high_level.use_iono_tile_sat_los, expected 7, "
"is %" PRId64,
(int64_t)last_msg.msg.ssr_flag_high_level.use_iono_tile_sat_los);

ck_assert_msg(
last_msg.msg.ssr_flag_high_level.use_tropo_grid_points == 4,
last_msg.msg.ssr_flag_high_level.use_qzss_sat == 4,
"incorrect value for last_msg.msg.ssr_flag_high_level.use_qzss_sat, "
"expected 4, is %" PRId64,
(int64_t)last_msg.msg.ssr_flag_high_level.use_qzss_sat);

ck_assert_msg(
last_msg.msg.ssr_flag_high_level.use_tropo_grid_points == 5,
"incorrect value for "
"last_msg.msg.ssr_flag_high_level.use_tropo_grid_points, expected 4, "
"last_msg.msg.ssr_flag_high_level.use_tropo_grid_points, expected 5, "
"is %" PRId64,
(int64_t)last_msg.msg.ssr_flag_high_level.use_tropo_grid_points);
}
Expand Down
30 changes: 14 additions & 16 deletions c/test/cpp/auto_check_sbp_integrity_MsgSsrFlagHighLevel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,17 @@ class Testauto_check_sbp_integrity_MsgSsrFlagHighLevel0
assign(test_msg_.reserved[3], 0);

assign(test_msg_.reserved[4], 0);

assign(test_msg_.reserved[5], 0);
assign(test_msg_.ssr_sol_id, 10);
assign(test_msg_.tile_id, 30);
assign(test_msg_.tile_set_id, 20);
assign(test_msg_.use_bds_sat, 3);
assign(test_msg_.use_gal_sat, 2);
assign(test_msg_.use_gps_sat, 1);
assign(test_msg_.use_iono_grid_point_sat_los, 7);
assign(test_msg_.use_iono_grid_points, 5);
assign(test_msg_.use_iono_tile_sat_los, 6);
assign(test_msg_.use_tropo_grid_points, 4);
assign(test_msg_.use_iono_grid_point_sat_los, 8);
assign(test_msg_.use_iono_grid_points, 6);
assign(test_msg_.use_iono_tile_sat_los, 7);
assign(test_msg_.use_qzss_sat, 4);
assign(test_msg_.use_tropo_grid_points, 5);
}

class SlowReader final : public sbp::IReader {
Expand Down Expand Up @@ -298,7 +297,7 @@ class Testauto_check_sbp_integrity_MsgSsrFlagHighLevel0
info.msg_type = static_cast<sbp_msg_type_t>(SbpMsgSsrFlagHighLevel);
info.sender_id = 66;
info.preamble = 0x55;
info.crc = 0x4366;
info.crc = 0x0369;
info.encoded_frame = encoded_frame_;
info.frame_len = sizeof(encoded_frame_);
info.encoded_payload = encoded_payload_;
Expand Down Expand Up @@ -404,11 +403,11 @@ class Testauto_check_sbp_integrity_MsgSsrFlagHighLevel0
sbp_msg_ssr_flag_high_level_t test_msg_{};
uint8_t encoded_frame_[31 + 8] = {
85, 185, 11, 66, 0, 31, 180, 0, 0, 0, 3, 0, 104, 1, 0, 0, 6, 0, 10, 20,
0, 30, 0, 40, 1, 2, 3, 0, 0, 0, 0, 0, 0, 4, 5, 6, 7, 102, 67,
0, 30, 0, 40, 1, 2, 3, 4, 0, 0, 0, 0, 0, 5, 6, 7, 8, 105, 3,
};
uint8_t encoded_payload_[31] = {
180, 0, 0, 0, 3, 0, 104, 1, 0, 0, 6, 0, 10, 20, 0, 30,
0, 40, 1, 2, 3, 0, 0, 0, 0, 0, 0, 4, 5, 6, 7,
0, 40, 1, 2, 3, 4, 0, 0, 0, 0, 0, 5, 6, 7, 8,
};
};

Expand Down Expand Up @@ -726,13 +725,6 @@ TEST_F(Testauto_check_sbp_integrity_MsgSsrFlagHighLevel0, Comparison) {
make_lesser_greater(lesser.reserved[4], greater.reserved[4]);
comparison_tests(lesser, greater);
}

{
sbp_msg_ssr_flag_high_level_t lesser = info.test_msg;
sbp_msg_ssr_flag_high_level_t greater = info.test_msg;
make_lesser_greater(lesser.reserved[5], greater.reserved[5]);
comparison_tests(lesser, greater);
}
{
sbp_msg_ssr_flag_high_level_t lesser = info.test_msg;
sbp_msg_ssr_flag_high_level_t greater = info.test_msg;
Expand Down Expand Up @@ -790,6 +782,12 @@ TEST_F(Testauto_check_sbp_integrity_MsgSsrFlagHighLevel0, Comparison) {
greater.use_iono_tile_sat_los);
comparison_tests(lesser, greater);
}
{
sbp_msg_ssr_flag_high_level_t lesser = info.test_msg;
sbp_msg_ssr_flag_high_level_t greater = info.test_msg;
make_lesser_greater(lesser.use_qzss_sat, greater.use_qzss_sat);
comparison_tests(lesser, greater);
}
{
sbp_msg_ssr_flag_high_level_t lesser = info.test_msg;
sbp_msg_ssr_flag_high_level_t greater = info.test_msg;
Expand Down
Binary file modified docs/sbp.pdf
Binary file not shown.
8 changes: 6 additions & 2 deletions haskell/src/SwiftNav/SBP/Integrity.hs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ msgSsrFlagHighLevel = 0x0BB9
-- could be a satellite, SSR grid point, or SSR tile. A group of aggregated
-- elements being monitored for integrity could refer to:
--
-- - Satellites in a particular {GPS, GAL, BDS} constellation.
-- - Satellites in a particular {GPS, GAL, BDS, QZSS} constellation.
--
-- - Satellites in the line-of-sight of a particular SSR tile.
--
Expand Down Expand Up @@ -125,6 +125,8 @@ data MsgSsrFlagHighLevel = MsgSsrFlagHighLevel
-- ^ Use GAL satellites.
, _msgSsrFlagHighLevel_use_bds_sat :: !Word8
-- ^ Use BDS satellites.
, _msgSsrFlagHighLevel_use_qzss_sat :: !Word8
-- ^ Use QZSS satellites.
, _msgSsrFlagHighLevel_reserved :: ![Word8]
-- ^ Reserved
, _msgSsrFlagHighLevel_use_tropo_grid_points :: !Word8
Expand All @@ -148,7 +150,8 @@ instance Binary MsgSsrFlagHighLevel where
_msgSsrFlagHighLevel_use_gps_sat <- getWord8
_msgSsrFlagHighLevel_use_gal_sat <- getWord8
_msgSsrFlagHighLevel_use_bds_sat <- getWord8
_msgSsrFlagHighLevel_reserved <- replicateM 6 getWord8
_msgSsrFlagHighLevel_use_qzss_sat <- getWord8
_msgSsrFlagHighLevel_reserved <- replicateM 5 getWord8
_msgSsrFlagHighLevel_use_tropo_grid_points <- getWord8
_msgSsrFlagHighLevel_use_iono_grid_points <- getWord8
_msgSsrFlagHighLevel_use_iono_tile_sat_los <- getWord8
Expand All @@ -165,6 +168,7 @@ instance Binary MsgSsrFlagHighLevel where
putWord8 _msgSsrFlagHighLevel_use_gps_sat
putWord8 _msgSsrFlagHighLevel_use_gal_sat
putWord8 _msgSsrFlagHighLevel_use_bds_sat
putWord8 _msgSsrFlagHighLevel_use_qzss_sat
mapM_ putWord8 _msgSsrFlagHighLevel_reserved
putWord8 _msgSsrFlagHighLevel_use_tropo_grid_points
putWord8 _msgSsrFlagHighLevel_use_iono_grid_points
Expand Down
12 changes: 9 additions & 3 deletions java/src/com/swiftnav/sbp/integrity/MsgSsrFlagHighLevel.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* SSR grid point, or SSR tile. A group of aggregated elements being monitored for integrity could
* refer to:
*
* <p>- Satellites in a particular {GPS, GAL, BDS} constellation.
* <p>- Satellites in a particular {GPS, GAL, BDS, QZSS} constellation.
*
* <p>- Satellites in the line-of-sight of a particular SSR tile.
*
Expand Down Expand Up @@ -81,6 +81,9 @@ public class MsgSsrFlagHighLevel extends SBPMessage {
/** Use BDS satellites. */
public int use_bds_sat;

/** Use QZSS satellites. */
public int use_qzss_sat;

/** Reserved */
public int[] reserved;

Expand Down Expand Up @@ -123,7 +126,8 @@ protected void parse(Parser parser) throws SBPBinaryException {
use_gps_sat = parser.getU8();
use_gal_sat = parser.getU8();
use_bds_sat = parser.getU8();
reserved = parser.getArrayofU8(6);
use_qzss_sat = parser.getU8();
reserved = parser.getArrayofU8(5);
use_tropo_grid_points = parser.getU8();
use_iono_grid_points = parser.getU8();
use_iono_tile_sat_los = parser.getU8();
Expand All @@ -141,7 +145,8 @@ protected void build(Builder builder) {
builder.putU8(use_gps_sat);
builder.putU8(use_gal_sat);
builder.putU8(use_bds_sat);
builder.putArrayofU8(reserved, 6);
builder.putU8(use_qzss_sat);
builder.putArrayofU8(reserved, 5);
builder.putU8(use_tropo_grid_points);
builder.putU8(use_iono_grid_points);
builder.putU8(use_iono_tile_sat_los);
Expand All @@ -160,6 +165,7 @@ public JSONObject toJSON() {
obj.put("use_gps_sat", use_gps_sat);
obj.put("use_gal_sat", use_gal_sat);
obj.put("use_bds_sat", use_bds_sat);
obj.put("use_qzss_sat", use_qzss_sat);
obj.put("reserved", new JSONArray(reserved));
obj.put("use_tropo_grid_points", use_tropo_grid_points);
obj.put("use_iono_grid_points", use_iono_grid_points);
Expand Down
Loading
Loading