mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2026-08-14 06:08:54 +00:00
Merge branch 'next' of github.com:gnss-sdr/gnss-sdr into bit-synch
This commit is contained in:
@@ -27,6 +27,7 @@ All notable changes to GNSS-SDR will be documented in this file.
|
||||
- Added a cycle-slip detector, with events reported in internal logging and
|
||||
RINEX observation files. This introduces a new field in `Gnss_Synchro` and in
|
||||
the corresponding `.proto` definition.
|
||||
- Improved tracking of GPS L2C(M) signals.
|
||||
|
||||
### Improvements in Maintainability:
|
||||
|
||||
|
||||
@@ -342,7 +342,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
|
||||
const std::string rtcm_dump_filename = d_dump_filename;
|
||||
if (conf_.flag_rtcm_server || conf_.flag_rtcm_tty_port || conf_.rtcm_output_file_enabled)
|
||||
{
|
||||
d_rtcm_printer = std::make_unique<Rtcm_Printer>(rtcm_dump_filename, conf_.rtcm_output_file_enabled, conf_.flag_rtcm_server, conf_.flag_rtcm_tty_port, conf_.rtcm_tcp_port, conf_.rtcm_station_id, conf_.rtcm_dump_devname, true, conf_.rtcm_output_file_path);
|
||||
d_rtcm_printer = std::make_unique<Rtcm_Printer>(rtcm_dump_filename, conf_.rtcm_output_file_enabled, conf_.flag_rtcm_server, conf_.flag_rtcm_tty_port, conf_.rtcm_tcp_port, conf_.rtcm_station_id, conf_.rtcm_dump_devname, d_signal_enabled_flags, true, conf_.rtcm_output_file_path);
|
||||
std::map<int, int> rtcm_msg_rate_ms = conf_.rtcm_msg_rate_ms;
|
||||
if (rtcm_msg_rate_ms.find(1019) != rtcm_msg_rate_ms.end())
|
||||
{
|
||||
@@ -2431,7 +2431,6 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
|
||||
d_rtcm_printer->Print_Rtcm_Messages(d_user_pvt_solver.get(),
|
||||
d_gnss_observables_map,
|
||||
d_rx_time,
|
||||
d_signal_enabled_flags,
|
||||
rtcm_MSM_enabled,
|
||||
rtcm_MT1019_enabled,
|
||||
rtcm_MT1020_enabled,
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include "gps_navigation_message.h"
|
||||
#include "gps_utc_model.h"
|
||||
#include "rtklib_solver.h"
|
||||
#include "signal_enabled_flags.h"
|
||||
#include <boost/date_time/gregorian/gregorian.hpp>
|
||||
#include <boost/date_time/local_time/local_time.hpp>
|
||||
#include <boost/date_time/time_zone_base.hpp>
|
||||
@@ -458,33 +457,23 @@ std::string getFilePath(const std::string& type, const std::string& base_name, c
|
||||
}
|
||||
|
||||
|
||||
std::string getNavFilePath(uint32_t signal_enabled_flags, int version, const std::string& base_name, const std::string& base_rinex_path)
|
||||
std::string getNavFilePath(const Signal_Enabled_Flags& flags, int version, const std::string& base_name, const std::string& base_rinex_path)
|
||||
{
|
||||
std::string type;
|
||||
const Signal_Enabled_Flags flags(signal_enabled_flags);
|
||||
|
||||
const auto has_gps = flags.check_any_enabled(GPS_1C, GPS_2S, GPS_L5);
|
||||
const auto has_galileo = flags.check_any_enabled(GAL_1B, GAL_E5a, GAL_E5b, GAL_E6);
|
||||
const auto has_glonass = flags.check_any_enabled(GLO_1G, GLO_2G);
|
||||
const auto has_beidou = flags.check_any_enabled(BDS_B1, BDS_B3);
|
||||
const auto only_gps = has_gps && !(has_galileo || has_glonass || has_beidou);
|
||||
const auto only_galileo = has_galileo && !(has_gps || has_glonass || has_beidou);
|
||||
const auto only_glonass = has_glonass && !(has_gps || has_galileo || has_beidou);
|
||||
const auto only_beidou = has_beidou && !(has_gps || has_galileo || has_glonass);
|
||||
|
||||
if (only_gps)
|
||||
if (flags.only_gps)
|
||||
{
|
||||
type = "RINEX_FILE_TYPE_GPS_NAV";
|
||||
}
|
||||
else if (only_galileo)
|
||||
else if (flags.only_galileo)
|
||||
{
|
||||
type = "RINEX_FILE_TYPE_GAL_NAV";
|
||||
}
|
||||
else if (only_glonass)
|
||||
else if (flags.only_glonass)
|
||||
{
|
||||
type = "RINEX_FILE_TYPE_GLO_NAV";
|
||||
}
|
||||
else if (only_beidou)
|
||||
else if (flags.only_beidou)
|
||||
{
|
||||
type = "RINEX_FILE_TYPE_BDS_NAV";
|
||||
}
|
||||
@@ -1413,6 +1402,7 @@ std::string get_obs_epoch_record_lines(const boost::posix_time::ptime& system_ti
|
||||
return line;
|
||||
}
|
||||
|
||||
|
||||
void add_obs_sat_record_line(const Gnss_Synchro& synchro, std::string& line, bool padding = true)
|
||||
{
|
||||
const int32_t ssi = signal_strength(synchro.CN0_dB_hz);
|
||||
@@ -1442,6 +1432,7 @@ void add_obs_sat_record_line(const Gnss_Synchro& synchro, std::string& line, boo
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void add_constellation_obs_sat_record_lines(std::fstream& out, const std::string& system, const Constellation_Observables_Map& observables, int version)
|
||||
{
|
||||
const auto system_char = satelliteSystem.at(system);
|
||||
@@ -1475,6 +1466,7 @@ void add_constellation_obs_sat_record_lines(std::fstream& out, const std::string
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void add_constellation_obs_sat_record_lines(std::fstream& out, const std::vector<std::string>& systems, const Constellation_Observables_Map& observables, int version)
|
||||
{
|
||||
for (const auto& system : systems)
|
||||
@@ -1483,6 +1475,7 @@ void add_constellation_obs_sat_record_lines(std::fstream& out, const std::vector
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::string get_nav_sv_epoch_svclk_line(const boost::posix_time::ptime& p_utc_time, char sys_char, uint32_t prn, double value0, double value1, double value2)
|
||||
{
|
||||
std::string line;
|
||||
@@ -1799,6 +1792,7 @@ void add_obs_glonass_code_phase_bias(std::fstream& out,
|
||||
out << line << '\n';
|
||||
}
|
||||
|
||||
|
||||
void add_obs_epoch_record(std::fstream& out, const boost::posix_time::ptime& system_time, double seconds, int version, const Constellation_Observables_Map& constel_observables)
|
||||
{
|
||||
std::string line = get_obs_epoch_record_lines(system_time, seconds, version);
|
||||
@@ -1836,6 +1830,7 @@ void add_obs_epoch_record(std::fstream& out, const boost::posix_time::ptime& sys
|
||||
out << line << '\n';
|
||||
}
|
||||
|
||||
|
||||
struct NavHeaderInfo
|
||||
{
|
||||
std::string prefix;
|
||||
@@ -1843,6 +1838,7 @@ struct NavHeaderInfo
|
||||
std::string new_line;
|
||||
};
|
||||
|
||||
|
||||
void update_nav_header_from_info(std::fstream& out, const std::string& filename, const std::vector<NavHeaderInfo>& infos)
|
||||
{
|
||||
std::vector<std::string> data;
|
||||
@@ -1893,12 +1889,10 @@ void update_nav_header_from_info(std::fstream& out, const std::string& filename,
|
||||
}
|
||||
|
||||
|
||||
int get_version(uint32_t signal_enabled_flags, int version)
|
||||
int get_version(const Signal_Enabled_Flags& flags, int version)
|
||||
{
|
||||
if (version == 2)
|
||||
{
|
||||
const Signal_Enabled_Flags flags(signal_enabled_flags);
|
||||
|
||||
if (flags.check_only_enabled(GPS_1C) ||
|
||||
flags.check_only_enabled(GLO_1G) ||
|
||||
flags.check_only_enabled(GPS_1C, GLO_1G))
|
||||
@@ -1930,14 +1924,14 @@ Rinex_Printer::Rinex_Printer(uint32_t signal_enabled_flags,
|
||||
int version,
|
||||
bool pre_2009_file) : observationType(getObservationTypes()),
|
||||
observationCode(getObservationCodes()),
|
||||
d_version(get_version(signal_enabled_flags, version)),
|
||||
d_flags(signal_enabled_flags),
|
||||
d_version(get_version(d_flags, version)),
|
||||
d_stringVersion(d_version == 2 ? "2.11" : "3.02"), // Only version 2.11 and 3.02
|
||||
d_fake_cnav_iode(1),
|
||||
d_rinex_header_updated(false),
|
||||
d_rinex_header_written(false),
|
||||
d_pre_2009_file(pre_2009_file),
|
||||
d_signal_enabled_flags(signal_enabled_flags),
|
||||
navfilename(getNavFilePath(signal_enabled_flags, d_version, base_name, base_rinex_path)),
|
||||
navfilename(getNavFilePath(d_flags, d_version, base_name, base_rinex_path)),
|
||||
obsfilename(getFilePath("RINEX_FILE_TYPE_OBS", base_name, base_rinex_path)),
|
||||
navGlofilename(getFilePath("RINEX_FILE_TYPE_GLO_NAV", base_name, base_rinex_path)),
|
||||
output_navfilename({navfilename})
|
||||
@@ -2023,16 +2017,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver,
|
||||
const auto glonass_gnav_ephemeris_iter = pvt_solver->glonass_gnav_ephemeris_map.cbegin();
|
||||
const auto beidou_dnav_ephemeris_iter = pvt_solver->beidou_dnav_ephemeris_map.cbegin();
|
||||
|
||||
const Signal_Enabled_Flags flags(d_signal_enabled_flags);
|
||||
const auto signal = enabled_signal_flags_to_string(flags);
|
||||
const auto has_gps = flags.check_any_enabled(GPS_1C, GPS_2S, GPS_L5);
|
||||
const auto has_galileo = flags.check_any_enabled(GAL_1B, GAL_E5a, GAL_E5b, GAL_E6);
|
||||
const auto has_glonass = flags.check_any_enabled(GLO_1G, GLO_2G);
|
||||
const auto has_beidou = flags.check_any_enabled(BDS_B1, BDS_B3);
|
||||
const auto only_galileo = has_galileo && !(has_gps || has_glonass || has_beidou);
|
||||
const auto only_glonass = has_glonass && !(has_gps || has_galileo || has_beidou);
|
||||
const auto only_beidou = has_beidou && !(has_gps || has_galileo || has_glonass);
|
||||
|
||||
const auto signal = enabled_signal_flags_to_string(d_flags);
|
||||
const bool has_gps_lnav_eph = !pvt_solver->gps_ephemeris_map.empty();
|
||||
const bool has_gps_cnav_eph = !pvt_solver->gps_cnav_ephemeris_map.empty();
|
||||
const bool has_galileo_eph = !pvt_solver->galileo_ephemeris_map.empty();
|
||||
@@ -2043,52 +2028,52 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver,
|
||||
{
|
||||
bool rinex_header_written = true;
|
||||
|
||||
if (flags.check_only_enabled(GPS_1C) && has_gps_lnav_eph)
|
||||
if (d_flags.check_only_enabled(GPS_1C) && has_gps_lnav_eph)
|
||||
{
|
||||
rinex_obs_header(obsFile, gps_ephemeris_iter->second, rx_time);
|
||||
rinex_nav_header(navFile, pvt_solver->gps_iono, pvt_solver->gps_utc_model, gps_ephemeris_iter->second);
|
||||
}
|
||||
else if ((flags.check_only_enabled(GPS_2S) || flags.check_only_enabled(GPS_L5)) && has_gps_cnav_eph)
|
||||
else if ((d_flags.check_only_enabled(GPS_2S) || d_flags.check_only_enabled(GPS_L5)) && has_gps_cnav_eph)
|
||||
{
|
||||
rinex_obs_header(obsFile, gps_cnav_ephemeris_iter->second, rx_time, signal);
|
||||
rinex_nav_header(navFile, pvt_solver->gps_cnav_iono, pvt_solver->gps_cnav_utc_model);
|
||||
}
|
||||
else if (only_galileo && has_galileo_eph)
|
||||
else if (d_flags.only_galileo && has_galileo_eph)
|
||||
{
|
||||
rinex_obs_header(obsFile, galileo_ephemeris_iter->second, rx_time, signal);
|
||||
rinex_nav_header(navFile, pvt_solver->galileo_iono, pvt_solver->galileo_utc_model);
|
||||
}
|
||||
else if (only_glonass && has_glonass_eph)
|
||||
else if (d_flags.only_glonass && has_glonass_eph)
|
||||
{
|
||||
rinex_obs_header(obsFile, glonass_gnav_ephemeris_iter->second, rx_time, signal);
|
||||
rinex_nav_header(navFile, pvt_solver->glonass_gnav_utc_model, glonass_gnav_ephemeris_iter->second);
|
||||
}
|
||||
else if (only_beidou && has_beidou_dnav_eph)
|
||||
else if (d_flags.only_beidou && has_beidou_dnav_eph)
|
||||
{
|
||||
rinex_obs_header(obsFile, beidou_dnav_ephemeris_iter->second, rx_time, signal);
|
||||
rinex_nav_header(navFile, pvt_solver->beidou_dnav_iono, pvt_solver->beidou_dnav_utc_model);
|
||||
}
|
||||
else if ((flags.check_only_enabled(GPS_1C, GPS_2S) ||
|
||||
flags.check_only_enabled(GPS_1C, GPS_L5) ||
|
||||
flags.check_only_enabled(GPS_1C, GPS_2S, GPS_L5)) &&
|
||||
else if ((d_flags.check_only_enabled(GPS_1C, GPS_2S) ||
|
||||
d_flags.check_only_enabled(GPS_1C, GPS_L5) ||
|
||||
d_flags.check_only_enabled(GPS_1C, GPS_2S, GPS_L5)) &&
|
||||
has_gps_lnav_eph && has_gps_cnav_eph)
|
||||
{
|
||||
rinex_obs_header(obsFile, gps_ephemeris_iter->second, gps_cnav_ephemeris_iter->second, rx_time, signal);
|
||||
rinex_nav_header(navFile, pvt_solver->gps_iono, pvt_solver->gps_utc_model, gps_ephemeris_iter->second);
|
||||
}
|
||||
else if ((flags.check_only_enabled(GPS_1C, GAL_1B) || flags.check_only_enabled(GPS_1C, GAL_E5a) || flags.check_only_enabled(GPS_1C, GAL_E5b)) &&
|
||||
else if ((d_flags.check_only_enabled(GPS_1C, GAL_1B) || d_flags.check_only_enabled(GPS_1C, GAL_E5a) || d_flags.check_only_enabled(GPS_1C, GAL_E5b)) &&
|
||||
has_gps_lnav_eph && has_galileo_eph)
|
||||
{
|
||||
rinex_obs_header(obsFile, gps_ephemeris_iter->second, galileo_ephemeris_iter->second, rx_time, signal);
|
||||
rinex_nav_header(navFile, pvt_solver->gps_iono, pvt_solver->gps_utc_model, gps_ephemeris_iter->second, pvt_solver->galileo_iono, pvt_solver->galileo_utc_model);
|
||||
}
|
||||
else if (flags.check_only_enabled(GPS_L5, GAL_E5a) &&
|
||||
else if (d_flags.check_only_enabled(GPS_L5, GAL_E5a) &&
|
||||
has_gps_cnav_eph && has_galileo_eph)
|
||||
{
|
||||
rinex_obs_header(obsFile, gps_cnav_ephemeris_iter->second, galileo_ephemeris_iter->second, rx_time, signal, signal);
|
||||
rinex_nav_header(navFile, pvt_solver->gps_cnav_iono, pvt_solver->gps_cnav_utc_model, pvt_solver->galileo_iono, pvt_solver->galileo_utc_model);
|
||||
}
|
||||
else if ((flags.check_only_enabled(GPS_1C, GLO_1G) || flags.check_only_enabled(GPS_1C, GLO_2G) || flags.check_only_enabled(GPS_1C, GLO_1G, GLO_2G)) &&
|
||||
else if ((d_flags.check_only_enabled(GPS_1C, GLO_1G) || d_flags.check_only_enabled(GPS_1C, GLO_2G) || d_flags.check_only_enabled(GPS_1C, GLO_1G, GLO_2G)) &&
|
||||
has_gps_lnav_eph && has_glonass_eph)
|
||||
{
|
||||
rinex_obs_header(obsFile, gps_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, rx_time, signal);
|
||||
@@ -2103,32 +2088,32 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver,
|
||||
output_navfilename.push_back(navGlofilename);
|
||||
}
|
||||
}
|
||||
else if ((flags.check_only_enabled(GLO_1G, GPS_2S) || flags.check_only_enabled(GLO_2G, GPS_2S)) &&
|
||||
else if ((d_flags.check_only_enabled(GLO_1G, GPS_2S) || d_flags.check_only_enabled(GLO_2G, GPS_2S)) &&
|
||||
has_gps_cnav_eph && has_glonass_eph)
|
||||
{
|
||||
rinex_obs_header(obsFile, gps_cnav_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, rx_time, signal);
|
||||
rinex_nav_header(navFile, pvt_solver->gps_cnav_iono, pvt_solver->gps_cnav_utc_model, pvt_solver->glonass_gnav_utc_model);
|
||||
}
|
||||
else if ((flags.check_only_enabled(GAL_1B, GLO_1G) || flags.check_only_enabled(GAL_1B, GLO_2G)) &&
|
||||
else if ((d_flags.check_only_enabled(GAL_1B, GLO_1G) || d_flags.check_only_enabled(GAL_1B, GLO_2G)) &&
|
||||
has_galileo_eph && has_glonass_eph)
|
||||
{
|
||||
rinex_obs_header(obsFile, galileo_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, rx_time, signal, signal);
|
||||
rinex_nav_header(navFile, pvt_solver->galileo_iono, pvt_solver->galileo_utc_model, pvt_solver->glonass_gnav_utc_model);
|
||||
}
|
||||
else if ((flags.check_only_enabled(GPS_1C, GAL_1B, GPS_L5, GAL_E5a) ||
|
||||
flags.check_only_enabled(GPS_1C, GAL_1B, GPS_L5, GAL_E5a, GAL_E6) ||
|
||||
flags.check_only_enabled(GPS_1C, GAL_1B, GPS_2S, GPS_L5, GAL_E5a)) &&
|
||||
else if ((d_flags.check_only_enabled(GPS_1C, GAL_1B, GPS_L5, GAL_E5a) ||
|
||||
d_flags.check_only_enabled(GPS_1C, GAL_1B, GPS_L5, GAL_E5a, GAL_E6) ||
|
||||
d_flags.check_only_enabled(GPS_1C, GAL_1B, GPS_2S, GPS_L5, GAL_E5a)) &&
|
||||
has_gps_lnav_eph && has_gps_cnav_eph && has_galileo_eph)
|
||||
{
|
||||
rinex_obs_header(obsFile, gps_ephemeris_iter->second, gps_cnav_ephemeris_iter->second, galileo_ephemeris_iter->second, rx_time, signal, signal);
|
||||
rinex_nav_header(navFile, pvt_solver->gps_iono, pvt_solver->gps_utc_model, gps_ephemeris_iter->second, pvt_solver->galileo_iono, pvt_solver->galileo_utc_model);
|
||||
}
|
||||
else if ((flags.check_only_enabled(GPS_1C, GAL_1B, GAL_E5a) || flags.check_only_enabled(GPS_1C, GAL_1B, GAL_E5b)) && has_gps_lnav_eph && has_galileo_eph)
|
||||
else if ((d_flags.check_only_enabled(GPS_1C, GAL_1B, GAL_E5a) || d_flags.check_only_enabled(GPS_1C, GAL_1B, GAL_E5b)) && has_gps_lnav_eph && has_galileo_eph)
|
||||
{
|
||||
rinex_obs_header(obsFile, gps_ephemeris_iter->second, galileo_ephemeris_iter->second, rx_time, signal);
|
||||
rinex_nav_header(navFile, pvt_solver->gps_iono, pvt_solver->gps_utc_model, gps_ephemeris_iter->second, pvt_solver->galileo_iono, pvt_solver->galileo_utc_model);
|
||||
}
|
||||
else if (flags.check_only_enabled(GPS_1C, GAL_E6) && has_gps_lnav_eph)
|
||||
else if (d_flags.check_only_enabled(GPS_1C, GAL_E6) && has_gps_lnav_eph)
|
||||
{
|
||||
if (has_galileo_eph)
|
||||
{
|
||||
@@ -2143,7 +2128,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver,
|
||||
rinex_nav_header(navFile, pvt_solver->gps_iono, pvt_solver->gps_utc_model, gps_ephemeris_iter->second);
|
||||
}
|
||||
}
|
||||
else if (has_beidou && has_beidou_dnav_eph)
|
||||
else if (d_flags.has_beidou && has_beidou_dnav_eph)
|
||||
{
|
||||
rinex_obs_header(obsFile, beidou_dnav_ephemeris_iter->second, rx_time, signal);
|
||||
// Not implemented for beidou
|
||||
@@ -2155,7 +2140,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver,
|
||||
|
||||
if (rinex_header_written)
|
||||
{
|
||||
if (has_gps_lnav_eph && !flags.check_any_enabled(GPS_L5)) // That's how it used to be, not sure why
|
||||
if (has_gps_lnav_eph && !d_flags.check_any_enabled(GPS_L5)) // That's how it used to be, not sure why
|
||||
{
|
||||
log_rinex_nav(navFile, pvt_solver->gps_ephemeris_map);
|
||||
}
|
||||
@@ -2190,14 +2175,14 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver,
|
||||
|
||||
if (d_rinex_header_written && flag_write_RINEX_obs_output) // The header is already written, we can now log the navigation message data
|
||||
{
|
||||
const auto constel_signal_flags = get_constel_signal_flags(flags);
|
||||
const auto constel_signal_flags = get_constel_signal_flags(d_flags);
|
||||
const auto constel_observables = get_constellation_observables_map(constel_signal_flags, gnss_observables_map);
|
||||
|
||||
double seconds;
|
||||
boost::posix_time::ptime system_time;
|
||||
|
||||
// Order is important
|
||||
if (flags.check_any_enabled(GPS_1C))
|
||||
if (d_flags.check_any_enabled(GPS_1C))
|
||||
{
|
||||
if (has_gps_lnav_eph)
|
||||
{
|
||||
@@ -2205,7 +2190,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver,
|
||||
seconds = fmod(rx_time, 60);
|
||||
}
|
||||
}
|
||||
else if (has_gps)
|
||||
else if (d_flags.has_gps)
|
||||
{
|
||||
if (has_gps_cnav_eph)
|
||||
{
|
||||
@@ -2213,7 +2198,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver,
|
||||
seconds = fmod(rx_time, 60);
|
||||
}
|
||||
}
|
||||
else if (has_galileo)
|
||||
else if (d_flags.has_galileo)
|
||||
{
|
||||
if (has_galileo_eph)
|
||||
{
|
||||
@@ -2221,7 +2206,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver,
|
||||
seconds = fmod(rx_time, 60);
|
||||
}
|
||||
}
|
||||
else if (has_glonass)
|
||||
else if (d_flags.has_glonass)
|
||||
{
|
||||
if (has_glonass_eph)
|
||||
{
|
||||
@@ -2230,7 +2215,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver,
|
||||
seconds = modf(rx_time, &int_sec) + system_time.time_of_day().seconds();
|
||||
}
|
||||
}
|
||||
else if (has_beidou)
|
||||
else if (d_flags.has_beidou)
|
||||
{
|
||||
if (has_beidou_dnav_eph)
|
||||
{
|
||||
@@ -2246,19 +2231,19 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver,
|
||||
|
||||
std::vector<std::string> constellations;
|
||||
|
||||
if (has_gps)
|
||||
if (d_flags.has_gps)
|
||||
{
|
||||
constellations.emplace_back("GPS");
|
||||
}
|
||||
if (has_galileo)
|
||||
if (d_flags.has_galileo)
|
||||
{
|
||||
constellations.emplace_back("Galileo");
|
||||
}
|
||||
if (has_glonass)
|
||||
if (d_flags.has_glonass)
|
||||
{
|
||||
constellations.emplace_back("GLONASS");
|
||||
}
|
||||
if (has_beidou)
|
||||
if (d_flags.has_beidou)
|
||||
{
|
||||
constellations.emplace_back("Beidou");
|
||||
}
|
||||
@@ -2266,7 +2251,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver,
|
||||
add_obs_epoch_record(obsFile, system_time, seconds, d_version, constel_observables);
|
||||
add_constellation_obs_sat_record_lines(obsFile, constellations, constel_observables, d_version);
|
||||
|
||||
if (flags.check_only_enabled(GPS_1C) && has_gps_lnav_eph)
|
||||
if (d_flags.check_only_enabled(GPS_1C) && has_gps_lnav_eph)
|
||||
{
|
||||
if (!d_rinex_header_updated && (pvt_solver->gps_utc_model.A0 != 0))
|
||||
{
|
||||
@@ -2275,7 +2260,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver,
|
||||
d_rinex_header_updated = true;
|
||||
}
|
||||
}
|
||||
else if (flags.check_only_enabled(GPS_1C, GPS_2S) && has_gps_lnav_eph && has_gps_cnav_eph)
|
||||
else if (d_flags.check_only_enabled(GPS_1C, GPS_2S) && has_gps_lnav_eph && has_gps_cnav_eph)
|
||||
{
|
||||
if (!d_rinex_header_updated && (pvt_solver->gps_utc_model.A0 != 0))
|
||||
{
|
||||
@@ -2284,7 +2269,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver,
|
||||
d_rinex_header_updated = true;
|
||||
}
|
||||
}
|
||||
else if (flags.check_only_enabled(GPS_1C, GPS_L5) && has_gps_lnav_eph && has_gps_cnav_eph)
|
||||
else if (d_flags.check_only_enabled(GPS_1C, GPS_L5) && has_gps_lnav_eph && has_gps_cnav_eph)
|
||||
{
|
||||
if (!d_rinex_header_updated && ((pvt_solver->gps_cnav_utc_model.A0 != 0) || (pvt_solver->gps_utc_model.A0 != 0)))
|
||||
{
|
||||
@@ -2301,7 +2286,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver,
|
||||
d_rinex_header_updated = true;
|
||||
}
|
||||
}
|
||||
else if (flags.check_only_enabled(GPS_2S) || flags.check_only_enabled(GPS_L5) || flags.check_only_enabled(GPS_2S, GPS_L5))
|
||||
else if (d_flags.check_only_enabled(GPS_2S) || d_flags.check_only_enabled(GPS_L5) || d_flags.check_only_enabled(GPS_2S, GPS_L5))
|
||||
{
|
||||
if (!d_rinex_header_updated && (pvt_solver->gps_cnav_utc_model.A0 != 0))
|
||||
{
|
||||
@@ -2310,7 +2295,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver,
|
||||
d_rinex_header_updated = true;
|
||||
}
|
||||
}
|
||||
else if (flags.check_only_enabled(GPS_1C, GPS_2S, GPS_L5))
|
||||
else if (d_flags.check_only_enabled(GPS_1C, GPS_2S, GPS_L5))
|
||||
{
|
||||
if (!d_rinex_header_updated && (pvt_solver->gps_utc_model.A0 != 0) && (has_gps_lnav_eph))
|
||||
{
|
||||
@@ -2319,7 +2304,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver,
|
||||
d_rinex_header_updated = true;
|
||||
}
|
||||
}
|
||||
else if (only_galileo)
|
||||
else if (d_flags.only_galileo)
|
||||
{
|
||||
if (!d_rinex_header_updated && (pvt_solver->galileo_utc_model.A0 != 0))
|
||||
{
|
||||
@@ -2328,7 +2313,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver,
|
||||
d_rinex_header_updated = true;
|
||||
}
|
||||
}
|
||||
else if (only_glonass)
|
||||
else if (d_flags.only_glonass)
|
||||
{
|
||||
if (!d_rinex_header_updated && (pvt_solver->glonass_gnav_utc_model.d_tau_c != 0))
|
||||
{
|
||||
@@ -2336,7 +2321,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver,
|
||||
d_rinex_header_updated = true;
|
||||
}
|
||||
}
|
||||
else if (only_beidou)
|
||||
else if (d_flags.only_beidou)
|
||||
{
|
||||
if (!d_rinex_header_updated && (pvt_solver->beidou_dnav_utc_model.A0_UTC != 0))
|
||||
{
|
||||
@@ -2345,7 +2330,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver,
|
||||
d_rinex_header_updated = true;
|
||||
}
|
||||
}
|
||||
else if ((flags.check_only_enabled(GPS_1C, GAL_1B) || flags.check_only_enabled(GPS_1C, GAL_1B, GAL_E6)) &&
|
||||
else if ((d_flags.check_only_enabled(GPS_1C, GAL_1B) || d_flags.check_only_enabled(GPS_1C, GAL_1B, GAL_E6)) &&
|
||||
has_gps_lnav_eph && has_galileo_eph)
|
||||
{
|
||||
if (!d_rinex_header_updated && (pvt_solver->gps_utc_model.A0 != 0))
|
||||
@@ -2355,7 +2340,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver,
|
||||
d_rinex_header_updated = true;
|
||||
}
|
||||
}
|
||||
else if ((flags.check_only_enabled(GPS_1C, GLO_1G) || flags.check_only_enabled(GPS_1C, GLO_2G) || flags.check_only_enabled(GPS_1C, GLO_1G, GLO_2G)) &&
|
||||
else if ((d_flags.check_only_enabled(GPS_1C, GLO_1G) || d_flags.check_only_enabled(GPS_1C, GLO_2G) || d_flags.check_only_enabled(GPS_1C, GLO_1G, GLO_2G)) &&
|
||||
has_gps_lnav_eph && has_glonass_eph)
|
||||
{
|
||||
if (!d_rinex_header_updated && (pvt_solver->gps_utc_model.A0 != 0))
|
||||
@@ -2365,7 +2350,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver,
|
||||
d_rinex_header_updated = true; // do not write header anymore
|
||||
}
|
||||
}
|
||||
else if (flags.check_only_enabled(GPS_L5, GAL_E5a))
|
||||
else if (d_flags.check_only_enabled(GPS_L5, GAL_E5a))
|
||||
{
|
||||
if (!d_rinex_header_updated && (pvt_solver->gps_cnav_utc_model.A0 != 0) && (pvt_solver->galileo_utc_model.A0 != 0))
|
||||
{
|
||||
@@ -2374,7 +2359,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver,
|
||||
d_rinex_header_updated = true; // do not write header anymore
|
||||
}
|
||||
}
|
||||
else if (flags.check_only_enabled(GAL_1B, GLO_1G) || flags.check_only_enabled(GAL_1B, GLO_2G))
|
||||
else if (d_flags.check_only_enabled(GAL_1B, GLO_1G) || d_flags.check_only_enabled(GAL_1B, GLO_2G))
|
||||
{
|
||||
if (!d_rinex_header_updated && (pvt_solver->galileo_utc_model.A0 != 0))
|
||||
{
|
||||
@@ -2383,7 +2368,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver,
|
||||
d_rinex_header_updated = true; // do not write header anymore
|
||||
}
|
||||
}
|
||||
else if (flags.check_only_enabled(GPS_2S, GLO_1G) || flags.check_only_enabled(GPS_2S, GLO_2G))
|
||||
else if (d_flags.check_only_enabled(GPS_2S, GLO_1G) || d_flags.check_only_enabled(GPS_2S, GLO_2G))
|
||||
{
|
||||
if (!d_rinex_header_updated && (pvt_solver->gps_cnav_utc_model.A0 != 0))
|
||||
{
|
||||
@@ -2392,7 +2377,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver,
|
||||
d_rinex_header_updated = true; // do not write header anymore
|
||||
}
|
||||
}
|
||||
else if (flags.check_only_enabled(GPS_1C, GAL_1B, GPS_L5, GAL_E5a))
|
||||
else if (d_flags.check_only_enabled(GPS_1C, GAL_1B, GPS_L5, GAL_E5a))
|
||||
{
|
||||
if (has_gps_lnav_eph && has_gps_cnav_eph && has_galileo_eph)
|
||||
{
|
||||
@@ -2412,7 +2397,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver,
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (flags.check_only_enabled(GPS_1C, GAL_1B, GAL_E5a))
|
||||
else if (d_flags.check_only_enabled(GPS_1C, GAL_1B, GAL_E5a))
|
||||
{
|
||||
if (has_gps_lnav_eph && has_galileo_eph)
|
||||
{
|
||||
@@ -2424,7 +2409,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver,
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (flags.check_only_enabled(GPS_1C, GAL_1B, GPS_L5, GAL_E5a, GAL_E6) || flags.check_only_enabled(GPS_1C, GAL_1B, GPS_2S, GPS_L5, GAL_E5a))
|
||||
else if (d_flags.check_only_enabled(GPS_1C, GAL_1B, GPS_L5, GAL_E5a, GAL_E6) || d_flags.check_only_enabled(GPS_1C, GAL_1B, GPS_2S, GPS_L5, GAL_E5a))
|
||||
{
|
||||
if (!d_rinex_header_updated && (pvt_solver->gps_utc_model.A0 != 0) && (pvt_solver->galileo_utc_model.A0 != 0) && (has_gps_lnav_eph))
|
||||
{
|
||||
@@ -2433,7 +2418,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver,
|
||||
d_rinex_header_updated = true;
|
||||
}
|
||||
}
|
||||
else if (flags.check_only_enabled(GPS_1C, GAL_E6) && has_gps_lnav_eph)
|
||||
else if (d_flags.check_only_enabled(GPS_1C, GAL_E6) && has_gps_lnav_eph)
|
||||
{
|
||||
if (has_galileo_eph)
|
||||
{
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#ifndef GNSS_SDR_RINEX_PRINTER_H
|
||||
#define GNSS_SDR_RINEX_PRINTER_H
|
||||
|
||||
#include "signal_enabled_flags.h"
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
#include <cstdint> // for int32_t
|
||||
#include <cstdlib> // for strtol, strtod
|
||||
@@ -544,6 +545,8 @@ private:
|
||||
const std::map<std::string, std::string> observationType; // PSEUDORANGE, CARRIER_PHASE, DOPPLER, SIGNAL_STRENGTH
|
||||
const std::map<std::string, std::string> observationCode; // GNSS observation descriptors
|
||||
|
||||
const Signal_Enabled_Flags d_flags;
|
||||
|
||||
const int d_version; // RINEX version (2 for 2.10/2.11 and 3 for 3.01)
|
||||
const std::string d_stringVersion; // RINEX version (2.10/2.11 or 3.01/3.02)
|
||||
|
||||
@@ -551,7 +554,6 @@ private:
|
||||
bool d_rinex_header_updated;
|
||||
bool d_rinex_header_written;
|
||||
const bool d_pre_2009_file;
|
||||
const uint32_t d_signal_enabled_flags;
|
||||
|
||||
const std::string navfilename; // Name of RINEX navigation file
|
||||
const std::string obsfilename; // Name of RINEX observation file
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include "gps_ephemeris.h"
|
||||
#include "rtcm.h"
|
||||
#include "rtklib_solver.h"
|
||||
#include "signal_enabled_flags.h"
|
||||
#include <boost/exception/diagnostic_information.hpp>
|
||||
#include <ctime> // for tm
|
||||
#include <exception> // for exception
|
||||
@@ -52,13 +51,15 @@ Rtcm_Printer::Rtcm_Printer(const std::string& filename,
|
||||
uint16_t rtcm_tcp_port,
|
||||
uint16_t rtcm_station_id,
|
||||
const std::string& rtcm_dump_devname,
|
||||
uint32_t signal_enabled_flags,
|
||||
bool time_tag_name,
|
||||
const std::string& base_path) : rtcm_base_path(base_path),
|
||||
rtcm_devname(rtcm_dump_devname),
|
||||
port(rtcm_tcp_port),
|
||||
station_id(rtcm_station_id),
|
||||
d_rtcm_has_written_once(false),
|
||||
d_rtcm_file_dump(flag_rtcm_file_dump)
|
||||
d_rtcm_file_dump(flag_rtcm_file_dump),
|
||||
d_flags(signal_enabled_flags)
|
||||
{
|
||||
const boost::posix_time::ptime pt = boost::posix_time::second_clock::local_time();
|
||||
const tm timeinfo = boost::posix_time::to_tm(pt);
|
||||
@@ -226,7 +227,6 @@ Rtcm_Printer::~Rtcm_Printer()
|
||||
void Rtcm_Printer::Print_Rtcm_Messages(const Rtklib_Solver* pvt_solver,
|
||||
const std::map<int, Gnss_Synchro>& gnss_observables_map,
|
||||
double rx_time,
|
||||
uint32_t signal_enabled_flags,
|
||||
bool rtcm_MSM_enabled,
|
||||
bool rtcm_MT1019_enabled,
|
||||
bool rtcm_MT1020_enabled,
|
||||
@@ -242,33 +242,26 @@ void Rtcm_Printer::Print_Rtcm_Messages(const Rtklib_Solver* pvt_solver,
|
||||
{
|
||||
try
|
||||
{
|
||||
const Signal_Enabled_Flags flags(signal_enabled_flags);
|
||||
const auto has_gps = flags.check_any_enabled(GPS_1C, GPS_2S, GPS_L5);
|
||||
const auto has_galileo = flags.check_any_enabled(GAL_1B, GAL_E5a, GAL_E5b, GAL_E6);
|
||||
const auto has_glonass = flags.check_any_enabled(GLO_1G, GLO_2G);
|
||||
const auto has_beidou = flags.check_any_enabled(BDS_B1, BDS_B3);
|
||||
const auto only_galileo = has_galileo && !(has_gps || has_glonass || has_beidou);
|
||||
const auto only_glonass = has_glonass && !(has_gps || has_galileo || has_beidou);
|
||||
const auto print_MT1019 = (!d_rtcm_has_written_once && rtcm_MT1019_enabled) || flag_write_RTCM_1019_output;
|
||||
const auto print_MT1020 = (!d_rtcm_has_written_once && rtcm_MT1020_enabled) || flag_write_RTCM_1020_output;
|
||||
const auto print_MT1045 = (!d_rtcm_has_written_once && rtcm_MT1045_enabled) || flag_write_RTCM_1045_output;
|
||||
const auto print_MSM = (!d_rtcm_has_written_once && rtcm_MSM_enabled) || flag_write_RTCM_MSM_output;
|
||||
|
||||
if (print_MT1019 && flags.check_any_enabled(GPS_1C))
|
||||
if (print_MT1019 && d_flags.check_any_enabled(GPS_1C))
|
||||
{
|
||||
for (const auto& gps_eph_iter : pvt_solver->gps_ephemeris_map)
|
||||
{
|
||||
Print_Rtcm_MT1019(gps_eph_iter.second);
|
||||
}
|
||||
}
|
||||
if (print_MT1020 && has_glonass)
|
||||
if (print_MT1020 && d_flags.has_glonass)
|
||||
{
|
||||
for (const auto& glonass_gnav_eph_iter : pvt_solver->glonass_gnav_ephemeris_map)
|
||||
{
|
||||
Print_Rtcm_MT1020(glonass_gnav_eph_iter.second, pvt_solver->glonass_gnav_utc_model);
|
||||
}
|
||||
}
|
||||
if (print_MT1045 && has_galileo)
|
||||
if (print_MT1045 && d_flags.has_galileo)
|
||||
{
|
||||
for (const auto& gal_eph_iter : pvt_solver->galileo_ephemeris_map)
|
||||
{
|
||||
@@ -277,7 +270,7 @@ void Rtcm_Printer::Print_Rtcm_Messages(const Rtklib_Solver* pvt_solver,
|
||||
}
|
||||
if (print_MSM)
|
||||
{
|
||||
if (rtcm_MT1077_enabled && (flags.check_only_enabled(GPS_1C) || flags.check_only_enabled(GPS_1C, GAL_E6)))
|
||||
if (rtcm_MT1077_enabled && (d_flags.check_only_enabled(GPS_1C) || d_flags.check_only_enabled(GPS_1C, GAL_E6)))
|
||||
{
|
||||
const auto gps_eph_iter = pvt_solver->gps_ephemeris_map.cbegin();
|
||||
if (gps_eph_iter != pvt_solver->gps_ephemeris_map.cend())
|
||||
@@ -285,7 +278,7 @@ void Rtcm_Printer::Print_Rtcm_Messages(const Rtklib_Solver* pvt_solver,
|
||||
Print_Rtcm_MSM(7, gps_eph_iter->second, {}, {}, {}, rx_time, gnss_observables_map, enable_rx_clock_correction, 0, 0, false, false);
|
||||
}
|
||||
}
|
||||
else if (rtcm_MT1077_enabled && (flags.check_only_enabled(GPS_1C, GPS_2S) || flags.check_only_enabled(GPS_1C, GPS_L5)))
|
||||
else if (rtcm_MT1077_enabled && (d_flags.check_only_enabled(GPS_1C, GPS_2S) || d_flags.check_only_enabled(GPS_1C, GPS_L5)))
|
||||
{
|
||||
const auto gps_eph_iter = pvt_solver->gps_ephemeris_map.cbegin();
|
||||
const auto gps_cnav_eph_iter = pvt_solver->gps_cnav_ephemeris_map.cbegin();
|
||||
@@ -294,7 +287,7 @@ void Rtcm_Printer::Print_Rtcm_Messages(const Rtklib_Solver* pvt_solver,
|
||||
Print_Rtcm_MSM(7, gps_eph_iter->second, gps_cnav_eph_iter->second, {}, {}, rx_time, gnss_observables_map, enable_rx_clock_correction, 0, 0, false, false);
|
||||
}
|
||||
}
|
||||
else if (rtcm_MT1097_enabled && only_galileo)
|
||||
else if (rtcm_MT1097_enabled && d_flags.only_galileo)
|
||||
{
|
||||
const auto gal_eph_iter = pvt_solver->galileo_ephemeris_map.cbegin();
|
||||
if (gal_eph_iter != pvt_solver->galileo_ephemeris_map.cend())
|
||||
@@ -302,7 +295,7 @@ void Rtcm_Printer::Print_Rtcm_Messages(const Rtklib_Solver* pvt_solver,
|
||||
Print_Rtcm_MSM(7, {}, {}, gal_eph_iter->second, {}, rx_time, gnss_observables_map, enable_rx_clock_correction, 0, 0, false, false);
|
||||
}
|
||||
}
|
||||
else if (rtcm_MT1087_enabled && only_glonass)
|
||||
else if (rtcm_MT1087_enabled && d_flags.only_glonass)
|
||||
{
|
||||
const auto glo_gnav_ephemeris_iter = pvt_solver->glonass_gnav_ephemeris_map.cbegin();
|
||||
if (glo_gnav_ephemeris_iter != pvt_solver->glonass_gnav_ephemeris_map.cend())
|
||||
@@ -317,10 +310,10 @@ void Rtcm_Printer::Print_Rtcm_Messages(const Rtklib_Solver* pvt_solver,
|
||||
auto gal_eph_iter = pvt_solver->galileo_ephemeris_map.cend();
|
||||
auto glonass_gnav_eph_iter = pvt_solver->glonass_gnav_ephemeris_map.cend();
|
||||
|
||||
bool search_gps_nav = flags.check_any_enabled(GPS_1C);
|
||||
bool search_gps_cnav = !search_gps_nav && flags.check_any_enabled(GPS_2S, GPS_L5);
|
||||
bool search_gal = has_galileo;
|
||||
bool search_glo = has_glonass;
|
||||
bool search_gps_nav = d_flags.check_any_enabled(GPS_1C);
|
||||
bool search_gps_cnav = !search_gps_nav && d_flags.check_any_enabled(GPS_2S, GPS_L5);
|
||||
bool search_gal = d_flags.has_galileo;
|
||||
bool search_glo = d_flags.has_glonass;
|
||||
|
||||
for (const auto& gnss_observables_iter : gnss_observables_map)
|
||||
{
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#ifndef GNSS_SDR_RTCM_PRINTER_H
|
||||
#define GNSS_SDR_RTCM_PRINTER_H
|
||||
|
||||
#include "signal_enabled_flags.h"
|
||||
#include <cstdint> // for int32_t
|
||||
#include <fstream> // for std::ofstream
|
||||
#include <map> // for std::map
|
||||
@@ -58,6 +59,7 @@ public:
|
||||
uint16_t rtcm_tcp_port,
|
||||
uint16_t rtcm_station_id,
|
||||
const std::string& rtcm_dump_devname,
|
||||
uint32_t signal_enabled_flags,
|
||||
bool time_tag_name = true,
|
||||
const std::string& base_path = ".");
|
||||
|
||||
@@ -72,7 +74,6 @@ public:
|
||||
void Print_Rtcm_Messages(const Rtklib_Solver* pvt_solver,
|
||||
const std::map<int, Gnss_Synchro>& gnss_observables_map,
|
||||
double rx_time,
|
||||
uint32_t signal_enabled_flags,
|
||||
bool rtcm_MSM_enabled,
|
||||
bool rtcm_MT1019_enabled,
|
||||
bool rtcm_MT1020_enabled,
|
||||
@@ -201,6 +202,7 @@ private:
|
||||
uint16_t station_id;
|
||||
bool d_rtcm_has_written_once;
|
||||
bool d_rtcm_file_dump;
|
||||
const Signal_Enabled_Flags d_flags;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -54,11 +54,19 @@ uint32_t flags_from_config(const ConfigurationInterface* configuration)
|
||||
} // namespace
|
||||
|
||||
|
||||
Signal_Enabled_Flags::Signal_Enabled_Flags(const ConfigurationInterface* configuration) : flags(flags_from_config(configuration))
|
||||
Signal_Enabled_Flags::Signal_Enabled_Flags(const ConfigurationInterface* configuration) : Signal_Enabled_Flags(flags_from_config(configuration))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Signal_Enabled_Flags::Signal_Enabled_Flags(uint32_t flags_) : flags(flags_)
|
||||
Signal_Enabled_Flags::Signal_Enabled_Flags(uint32_t flags_) : flags(flags_),
|
||||
has_gps(check_any_enabled(GPS_1C, GPS_2S, GPS_L5)),
|
||||
has_galileo(check_any_enabled(GAL_1B, GAL_E5a, GAL_E5b, GAL_E6)),
|
||||
has_glonass(check_any_enabled(GLO_1G, GLO_2G)),
|
||||
has_beidou(check_any_enabled(BDS_B1, BDS_B3)),
|
||||
only_gps(has_gps && !(has_galileo || has_glonass || has_beidou)),
|
||||
only_galileo(has_galileo && !(has_gps || has_glonass || has_beidou)),
|
||||
only_glonass(has_glonass && !(has_gps || has_galileo || has_beidou)),
|
||||
only_beidou(has_beidou && !(has_gps || has_galileo || has_glonass))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -67,6 +67,16 @@ public:
|
||||
}
|
||||
|
||||
const uint32_t flags;
|
||||
|
||||
const bool has_gps;
|
||||
const bool has_galileo;
|
||||
const bool has_glonass;
|
||||
const bool has_beidou;
|
||||
|
||||
const bool only_gps;
|
||||
const bool only_galileo;
|
||||
const bool only_glonass;
|
||||
const bool only_beidou;
|
||||
};
|
||||
|
||||
#endif // GNSS_SDR_SIGNAL_ENABLED_FLAGS_H
|
||||
|
||||
@@ -53,6 +53,127 @@ void gps_l2c_m_code_gen_complex(own::span<std::complex<float>> dest, uint32_t pr
|
||||
}
|
||||
}
|
||||
|
||||
void gps_l2c_m_code_gen_float_cl_zeroed(own::span<float> dest, uint32_t prn)
|
||||
{
|
||||
// dest must be at least GPS_L2_M_CODE_LENGTH_CHIPS_L_ZEROED
|
||||
// Layout: [ CM0, 0, CM1, 0, ..., CM10229, 0 ] -> 20460 "chips"
|
||||
|
||||
std::array<int32_t, GPS_L2_M_CODE_LENGTH_CHIPS> code_aux{};
|
||||
|
||||
if (prn > 0U && prn < 51U)
|
||||
{
|
||||
gps_l2c_m_code(code_aux, prn);
|
||||
}
|
||||
else
|
||||
{
|
||||
// out of range -> output zeros
|
||||
const int32_t n = std::min<int32_t>(static_cast<int32_t>(dest.size()),
|
||||
GPS_L2_M_CODE_LENGTH_CHIPS_L_ZEROED);
|
||||
for (int32_t i = 0; i < n; i++)
|
||||
{
|
||||
dest[i] = 0.0F;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const int32_t n = std::min<int32_t>(static_cast<int32_t>(dest.size()),
|
||||
GPS_L2_M_CODE_LENGTH_CHIPS_L_ZEROED);
|
||||
|
||||
for (int32_t i = 0; i < n; i++)
|
||||
{
|
||||
const bool is_cm_slot = ((i & 1) == 0); // even indices: CM, odd: CL (zeroed)
|
||||
|
||||
if (is_cm_slot)
|
||||
{
|
||||
const int32_t cm_idx = (i >> 1); // i/2 in [0..10229]
|
||||
dest[i] = 1.0F - 2.0F * static_cast<float>(code_aux[cm_idx]);
|
||||
}
|
||||
else
|
||||
{
|
||||
dest[i] = 0.0F; // CL slot zeroed
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void gps_l2c_m_code_gen_complex_sampled(
|
||||
own::span<std::complex<float>> dest,
|
||||
uint32_t prn,
|
||||
int32_t sampling_freq,
|
||||
bool cl_zeroed)
|
||||
{
|
||||
constexpr int32_t codeLength = GPS_L2_M_CODE_LENGTH_CHIPS; // 10230
|
||||
constexpr float tc_cm = 1.0F / static_cast<float>(GPS_L2_M_CODE_RATE_CPS); // 511.5 kcps
|
||||
constexpr float tc_l2c = tc_cm * 0.5F; // 1.023 Mcps (half-chip)
|
||||
|
||||
const float ts = 1.0F / static_cast<float>(sampling_freq);
|
||||
|
||||
// --- Load CM (M-code) ---
|
||||
std::array<int32_t, GPS_L2_M_CODE_LENGTH_CHIPS> code_aux{};
|
||||
if (prn > 0U && prn < 51U)
|
||||
{
|
||||
gps_l2c_m_code(code_aux, prn);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (auto &v : dest)
|
||||
{
|
||||
v = std::complex<float>(0.0F, 0.0F);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// --- Effective chip configuration ---
|
||||
const int32_t chips_per_epoch = cl_zeroed ? (2 * codeLength) : codeLength;
|
||||
const float tc_used = cl_zeroed ? tc_l2c : tc_cm;
|
||||
|
||||
const auto samplesPerCode = static_cast<int32_t>(
|
||||
static_cast<double>(sampling_freq) /
|
||||
(static_cast<double>(1.0F / tc_used) / static_cast<double>(chips_per_epoch)));
|
||||
|
||||
const int32_t nSamples =
|
||||
std::min<int32_t>(static_cast<int32_t>(dest.size()), samplesPerCode);
|
||||
|
||||
for (int32_t i = 0; i < nSamples; i++)
|
||||
{
|
||||
auto slotIndex =
|
||||
static_cast<int32_t>(std::floor(ts * static_cast<float>(i) / tc_used));
|
||||
|
||||
// Avoid rounding overflow at last sample
|
||||
if (i == nSamples - 1)
|
||||
{
|
||||
slotIndex = chips_per_epoch - 1;
|
||||
}
|
||||
|
||||
if (!cl_zeroed)
|
||||
{
|
||||
// --- Classic CM-only (511.5 kcps) ---
|
||||
const int32_t cm_idx = std::min<int32_t>(slotIndex, codeLength - 1);
|
||||
dest[i] = std::complex<float>(0.0F,
|
||||
1.0F - 2.0F * code_aux[cm_idx]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// --- L2C effective 1.023 Mcps, CL zeroed ---
|
||||
const bool is_cm_slot = ((slotIndex & 1) == 0);
|
||||
|
||||
if (is_cm_slot)
|
||||
{
|
||||
const int32_t cm_idx =
|
||||
std::min<int32_t>(slotIndex >> 1, codeLength - 1);
|
||||
|
||||
dest[i] = std::complex<float>(0.0F,
|
||||
1.0F - 2.0F * code_aux[cm_idx]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// CL slot → zeroed
|
||||
dest[i] = std::complex<float>(0.0F, 0.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void gps_l2c_m_code_gen_float(own::span<float> dest, uint32_t prn)
|
||||
{
|
||||
|
||||
@@ -40,9 +40,15 @@ void gps_l2c_m_code_gen_complex(own::span<std::complex<float>> dest, uint32_t pr
|
||||
//! Generates float GPS L2C M code for the desired SV ID
|
||||
void gps_l2c_m_code_gen_float(own::span<float> dest, uint32_t prn);
|
||||
|
||||
//! Generates float GPS L2C M code with double chip rate and L component zeroed for the desired SV ID
|
||||
void gps_l2c_m_code_gen_float_cl_zeroed(own::span<float> dest, uint32_t prn);
|
||||
|
||||
|
||||
//! Generates complex GPS L2C M code for the desired SV ID, and sampled to specific sampling frequency
|
||||
void gps_l2c_m_code_gen_complex_sampled(own::span<std::complex<float>> dest, uint32_t prn, int32_t sampling_freq);
|
||||
|
||||
//! Generates complex GPS L2C M code for the desired SV ID, and sampled to specific sampling frequency, optionally zeroing CL slots
|
||||
void gps_l2c_m_code_gen_complex_sampled(own::span<std::complex<float>> dest, uint32_t prn, int32_t sampling_freq, bool cl_zeroed);
|
||||
|
||||
/** \} */
|
||||
/** \} */
|
||||
|
||||
@@ -214,7 +214,7 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_)
|
||||
// GPS L2C has 1 trk symbol (20 ms) per tlm bit, no symbol integration required
|
||||
d_symbols_per_bit = GPS_L2_SAMPLES_PER_SYMBOL;
|
||||
d_correlation_length_ms = 20;
|
||||
d_code_samples_per_chip = 1;
|
||||
d_code_samples_per_chip = 2; // for CM code with CL slots zeroed
|
||||
// GPS L2 does not have pilot component nor secondary code
|
||||
d_secondary = false;
|
||||
d_trk_parameters.track_pilot = false;
|
||||
@@ -738,7 +738,7 @@ void dll_pll_veml_tracking::start_tracking()
|
||||
}
|
||||
else if (d_systemName == "GPS" && d_signal_type == "2S")
|
||||
{
|
||||
gps_l2c_m_code_gen_float(d_tracking_code, d_acquisition_gnss_synchro->PRN);
|
||||
gps_l2c_m_code_gen_float_cl_zeroed(d_tracking_code, d_acquisition_gnss_synchro->PRN);
|
||||
}
|
||||
else if (d_systemName == "GPS" && d_signal_type == "L5")
|
||||
{
|
||||
|
||||
@@ -32,15 +32,17 @@
|
||||
|
||||
|
||||
// carrier and code frequencies
|
||||
constexpr double GPS_L2_FREQ_HZ = FREQ2; //!< L2 [Hz]
|
||||
constexpr double GPS_L2_L_PERIOD_S = 1.5; //!< GPS L2 L code period [seconds]
|
||||
constexpr double GPS_L2_M_CODE_RATE_CPS = 0.5115e6; //!< GPS L2 M code rate [chips/s]
|
||||
constexpr double GPS_L2_M_PERIOD_S = 0.02; //!< GPS L2 M code period [seconds]
|
||||
constexpr double GPS_L2_L_CODE_RATE_CPS = 0.5115e6; //!< GPS L2 L code rate [chips/s]
|
||||
constexpr uint32_t GPS_L2_M_CODE_PERIOD_MS = 20; //!< GPS L2 L code period [ms]
|
||||
constexpr int32_t GPS_L2_M_CODE_LENGTH_CHIPS = 10230; //!< GPS L2 M code length [chips]
|
||||
constexpr int32_t GPS_L2_L_CODE_LENGTH_CHIPS = 767250; //!< GPS L2 L code length [chips]
|
||||
constexpr int32_t GPS_L2_CNAV_DATA_PAGE_BITS = 300; //!< GPS L2 CNAV page length, including preamble and CRC [bits]
|
||||
constexpr double GPS_L2_FREQ_HZ = FREQ2; //!< L2 [Hz]
|
||||
constexpr double GPS_L2_L_PERIOD_S = 1.5; //!< GPS L2 L code period [seconds]
|
||||
constexpr double GPS_L2_M_CODE_RATE_CPS = 0.5115e6; //!< GPS L2 M code rate [chips/s]
|
||||
constexpr double GPS_L2_M_CODE_RATE_L_ZEROED_CPS = 1.023e6; //!< GPS L2 M code rate with L2 M Zeroed [chips/s]
|
||||
constexpr double GPS_L2_M_PERIOD_S = 0.02; //!< GPS L2 M code period [seconds]
|
||||
constexpr double GPS_L2_L_CODE_RATE_CPS = 0.5115e6; //!< GPS L2 L code rate [chips/s]
|
||||
constexpr uint32_t GPS_L2_M_CODE_PERIOD_MS = 20; //!< GPS L2 L code period [ms]
|
||||
constexpr int32_t GPS_L2_M_CODE_LENGTH_CHIPS = 10230; //!< GPS L2 M code length [chips]
|
||||
constexpr int32_t GPS_L2_M_CODE_LENGTH_CHIPS_L_ZEROED = 2 * GPS_L2_M_CODE_LENGTH_CHIPS; //!< GPS L2 M code length with L2 CL zeroed [chips]
|
||||
constexpr int32_t GPS_L2_L_CODE_LENGTH_CHIPS = 767250; //!< GPS L2 L code length [chips]
|
||||
constexpr int32_t GPS_L2_CNAV_DATA_PAGE_BITS = 300; //!< GPS L2 CNAV page length, including preamble and CRC [bits]
|
||||
constexpr int32_t GPS_L2_SYMBOLS_PER_BIT = 2;
|
||||
constexpr int32_t GPS_L2_SAMPLES_PER_SYMBOL = 1;
|
||||
constexpr int32_t GPS_L2_CNAV_DATA_PAGE_SYMBOLS = 600;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include "gnss_sdr_make_unique.h"
|
||||
#include "rtcm_printer.h"
|
||||
#include "signal_enabled_flags.h"
|
||||
#include <string>
|
||||
|
||||
|
||||
@@ -29,7 +30,7 @@ TEST(RtcmPrinterTest, Instantiate)
|
||||
bool rtcm_file_output_enabled = false;
|
||||
unsigned short rtcm_tcp_port = 2101;
|
||||
unsigned short rtcm_station_id = 1234;
|
||||
auto RTCM_printer = std::make_unique<Rtcm_Printer>(filename, rtcm_file_output_enabled, flag_rtcm_server, flag_rtcm_tty_port, rtcm_tcp_port, rtcm_station_id, rtcm_dump_devname);
|
||||
auto RTCM_printer = std::make_unique<Rtcm_Printer>(filename, rtcm_file_output_enabled, flag_rtcm_server, flag_rtcm_tty_port, rtcm_tcp_port, rtcm_station_id, rtcm_dump_devname, GPS_1C);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +44,7 @@ TEST(RtcmPrinterTest, Run)
|
||||
unsigned short rtcm_tcp_port = 2101;
|
||||
unsigned short rtcm_station_id = 1234;
|
||||
|
||||
auto RTCM_printer = std::make_unique<Rtcm_Printer>(filename, rtcm_file_output_enabled, flag_rtcm_server, flag_rtcm_tty_port, rtcm_tcp_port, rtcm_station_id, rtcm_dump_devname);
|
||||
auto RTCM_printer = std::make_unique<Rtcm_Printer>(filename, rtcm_file_output_enabled, flag_rtcm_server, flag_rtcm_tty_port, rtcm_tcp_port, rtcm_station_id, rtcm_dump_devname, GPS_1C);
|
||||
|
||||
std::string reference_msg = "D300133ED7D30202980EDEEF34B4BD62AC0941986F33360B98";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user