Skip to content

Commit e5a8abd

Browse files
committed
feat: added flag to ignore bitmask from CPS
1 parent 6f4817a commit e5a8abd

File tree

6 files changed

+52
-11
lines changed

6 files changed

+52
-11
lines changed

dependency/generator/tokoro/data/set.cpp

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#include "constant.hpp"
21
#include "set.hpp"
2+
#include "constant.hpp"
33
#include "decode.hpp"
44

55
#pragma GCC diagnostic push
@@ -42,7 +42,8 @@ LOGLET_MODULE3(tokoro, data, set);
4242
namespace generator {
4343
namespace tokoro {
4444

45-
bool CorrectionPointSet::array_to_index(long array_index, CorrectionPointInfo* result) const NOEXCEPT {
45+
bool CorrectionPointSet::array_to_index(long array_index,
46+
CorrectionPointInfo* result) const NOEXCEPT {
4647
long array_count = 0;
4748
long absolute_index = 0;
4849
for (long y = 0; y <= number_of_steps_latitude; y++) {
@@ -52,14 +53,18 @@ bool CorrectionPointSet::array_to_index(long array_index, CorrectionPointInfo* r
5253
auto is_valid = (bitmask & bit) != 0;
5354

5455
if (array_count == array_index) {
55-
result->array_index = array_index;
56-
result->absolute_index = absolute_index;
57-
result->is_valid = is_valid;
58-
result->latitude_index = y;
59-
result->longitude_index = x;
60-
result->position.x = reference_point_latitude - static_cast<double>(y) * step_of_latitude;
61-
result->position.y = reference_point_longitude + static_cast<double>(x) * step_of_longitude;
62-
result->position.z = 0;
56+
if (result) {
57+
result->array_index = array_index;
58+
result->absolute_index = absolute_index;
59+
result->is_valid = is_valid;
60+
result->latitude_index = y;
61+
result->longitude_index = x;
62+
result->position.x =
63+
reference_point_latitude - static_cast<double>(y) * step_of_latitude;
64+
result->position.y =
65+
reference_point_longitude + static_cast<double>(x) * step_of_longitude;
66+
result->position.z = 0;
67+
}
6368
return true;
6469
}
6570

dependency/generator/tokoro/generator.cpp

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,15 +524,18 @@ std::vector<rtcm::Message> ReferenceStation::produce() NOEXCEPT {
524524
//
525525

526526
Generator::Generator() NOEXCEPT {
527+
FUNCTION_SCOPE();
527528
mIodConsistencyCheck = false;
528529
mUseReceptionTimeForOrbitAndClockCorrections = false;
529530
mUseOrbitCorrectionInIteration = false;
531+
mIgnoreBitmask = false;
530532
}
531533

532534
Generator::~Generator() NOEXCEPT = default;
533535

534536
std::shared_ptr<ReferenceStation>
535537
Generator::define_reference_station(ReferenceStationConfig const& config) NOEXCEPT {
538+
FUNCTION_SCOPE();
536539
INFOF("define reference station:");
537540
INFOF(" ground position (itrf): (%f, %f, %f)", config.itrf_ground_position.x,
538541
config.itrf_ground_position.y, config.itrf_ground_position.z);
@@ -635,7 +638,26 @@ void Generator::find_correction_point_set(ProvideAssistanceData_r9_IEs const& me
635638
}
636639
correction_point_set.bitmask = bitmask;
637640

638-
mCorrectionPointSet.reset(new CorrectionPointSet(correction_point_set));
641+
auto cps_ptr = new CorrectionPointSet(correction_point_set);
642+
643+
DEBUGF(" grid_point_count: %u", grid_point_count);
644+
for (long i = 0; i < 64; i++) {
645+
CorrectionPointInfo cpi{};
646+
if (cps_ptr->array_to_index(i, &cpi)) {
647+
DEBUGF(" %2ld: %2ld/%2ld %ld/%ld %s %+18.14f %+18.14f %+18.14f", i,
648+
cpi.absolute_index, cpi.array_index, cpi.latitude_index, cpi.longitude_index,
649+
cpi.is_valid ? "ok" : "--", cpi.position.x, cpi.position.y, cpi.position.z);
650+
} else {
651+
DEBUGF(" %2ld: invalid", i);
652+
}
653+
}
654+
655+
if (mIgnoreBitmask) {
656+
NOTICEF("ignoring correction point bitmask");
657+
cps_ptr->bitmask = 0xFFFFFFFFFFFFFFFF;
658+
}
659+
660+
mCorrectionPointSet.reset(cps_ptr);
639661
} else {
640662
// TODO(ewasjon): [low-priority] Support list of correction points
641663
WARNF("unsupported correction point type");

dependency/generator/tokoro/include/generator/tokoro/generator.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ class Generator {
146146
void set_iod_consistency_check(bool enabled) NOEXCEPT { mIodConsistencyCheck = enabled; }
147147
void set_rtoc(bool enabled) NOEXCEPT { mUseReceptionTimeForOrbitAndClockCorrections = enabled; }
148148
void set_ocit(bool enabled) NOEXCEPT { mUseOrbitCorrectionInIteration = enabled; }
149+
void set_ignore_bitmask(bool enabled) NOEXCEPT { mIgnoreBitmask = enabled; }
149150
void set_antex(std::unique_ptr<format::antex::Antex> antex) NOEXCEPT {
150151
mAntex = std::move(antex);
151152
}
@@ -177,6 +178,7 @@ class Generator {
177178
bool mIodConsistencyCheck;
178179
bool mUseReceptionTimeForOrbitAndClockCorrections;
179180
bool mUseOrbitCorrectionInIteration;
181+
bool mIgnoreBitmask;
180182

181183
friend struct Satellite;
182184
friend class ReferenceStation;

examples/client/config.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ struct TokoroConfig {
326326
bool use_ionospheric_height_correction;
327327

328328
std::string antex_file;
329+
bool ignore_bitmask;
329330
};
330331
#endif
331332

examples/client/config/tokoro.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,13 @@ static args::ValueFlag<std::string> gAntexFile{
242242
{"tkr-antex-file"},
243243
};
244244

245+
static args::Flag gIgnoreBitmask{
246+
gGroup,
247+
"ignore-bitmask",
248+
"Ignore GNSS-SSR-CorrectionPoints bitmask",
249+
{"tkr-ignore-bitmask"},
250+
};
251+
245252
static void setup() {
246253
gVrsModeArg.HelpChoices({"fixed", "dynamic"});
247254
gVrsModeArg.HelpDefault("dynamic");
@@ -292,6 +299,7 @@ static void parse(Config* config) {
292299
tokoro.time_step = 1.0;
293300

294301
tokoro.antex_file = "";
302+
tokoro.ignore_bitmask = false;
295303

296304
if (gEnable) tokoro.enabled = true;
297305
if (gNoGPS) tokoro.generate_gps = false;
@@ -374,6 +382,7 @@ static void parse(Config* config) {
374382
if (gUseTroposphericModel) tokoro.use_tropospheric_model = true;
375383
if (gUseIonosphericHeightCorrection) tokoro.use_ionospheric_height_correction = true;
376384
if (gAntexFile) tokoro.antex_file = gAntexFile.Get();
385+
if (gIgnoreBitmask) tokoro.ignore_bitmask = true;
377386
}
378387

379388
static void dump(TokoroConfig const& config) {
@@ -434,6 +443,7 @@ static void dump(TokoroConfig const& config) {
434443
config.use_ionospheric_height_correction ? "true" : "false");
435444

436445
DEBUGF("antex file: \"%s\"", config.antex_file.c_str());
446+
DEBUGF("ignore bitmask: %s", config.ignore_bitmask ? "true" : "false");
437447
}
438448

439449
} // namespace tokoro

examples/client/processor/tokoro.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ Tokoro::Tokoro(OutputConfig const& output, TokoroConfig const& config,
130130
mGenerator->set_iod_consistency_check(mConfig.iod_consistency_check);
131131
mGenerator->set_rtoc(mConfig.rtoc);
132132
mGenerator->set_ocit(mConfig.ocit);
133+
mGenerator->set_ignore_bitmask(mConfig.ignore_bitmask);
133134

134135
if (!config.antex_file.empty()) {
135136
auto result = format::antex::Antex::from_file(config.antex_file);

0 commit comments

Comments
 (0)