mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2026-05-27 07:42:15 +00:00
Add QZSS L1 telemetry decoder, make room in the RINEX printer
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
#include "gps_iono.h"
|
||||
#include "gps_navigation_message.h"
|
||||
#include "gps_utc_model.h"
|
||||
#include "rtklib.h"
|
||||
#include "rtklib_solver.h"
|
||||
#include <boost/date_time/gregorian/gregorian.hpp>
|
||||
#include <boost/date_time/local_time/local_time.hpp>
|
||||
@@ -65,6 +66,7 @@ const std::unordered_map<std::string, char> satelliteSystem = {
|
||||
{"SBAS payload", 'S'},
|
||||
{"Galileo", 'E'},
|
||||
{"Beidou", 'C'},
|
||||
{"QZSS", 'J'},
|
||||
{"Mixed", 'M'}}; // RINEX v3.02 codes
|
||||
|
||||
|
||||
@@ -94,6 +96,10 @@ std::string signal_flag_to_string(signal_flag flag)
|
||||
return "B1";
|
||||
case BDS_B3:
|
||||
return "B3";
|
||||
case QZS_J1:
|
||||
return "J1";
|
||||
case QZS_J5:
|
||||
return "J5";
|
||||
}
|
||||
|
||||
throw std::runtime_error("Invalid signal");
|
||||
@@ -104,7 +110,7 @@ std::map<std::string, signal_flag> string_to_signal_flag_map()
|
||||
{
|
||||
std::map<std::string, signal_flag> convertion_map;
|
||||
|
||||
for (const auto flag : {GPS_1C, GPS_2S, GPS_L5, GAL_1B, GAL_E5a, GAL_E5b, GAL_E6, GLO_1G, GLO_2G, BDS_B1, BDS_B3})
|
||||
for (const auto flag : {GPS_1C, GPS_2S, GPS_L5, GAL_1B, GAL_E5a, GAL_E5b, GAL_E6, GLO_1G, GLO_2G, BDS_B1, BDS_B3, QZS_J1, QZS_J5})
|
||||
{
|
||||
convertion_map[signal_flag_to_string(flag)] = flag;
|
||||
}
|
||||
@@ -124,7 +130,7 @@ std::map<char, std::set<signal_flag>> get_constel_signal_flags(const Signal_Enab
|
||||
{
|
||||
std::map<char, std::set<signal_flag>> constel_signal_flags;
|
||||
|
||||
for (const auto& it : std::map<char, std::set<signal_flag>>{{'G', {GPS_1C, GPS_2S, GPS_L5}}, {'E', {GAL_1B, GAL_E5a, GAL_E5b, GAL_E6}}, {'R', {GLO_1G, GLO_2G}}, {'C', {BDS_B1, BDS_B3}}})
|
||||
for (const auto& it : std::map<char, std::set<signal_flag>>{{'G', {GPS_1C, GPS_2S, GPS_L5}}, {'E', {GAL_1B, GAL_E5a, GAL_E5b, GAL_E6}}, {'R', {GLO_1G, GLO_2G}}, {'C', {BDS_B1, BDS_B3}}, {'J', {QZS_J1, QZS_J5}}})
|
||||
{
|
||||
for (const auto flag : it.second)
|
||||
{
|
||||
@@ -139,6 +145,18 @@ std::map<char, std::set<signal_flag>> get_constel_signal_flags(const Signal_Enab
|
||||
}
|
||||
|
||||
|
||||
bool is_qzss_prn(uint32_t prn)
|
||||
{
|
||||
return prn >= MINPRNQZS && prn <= MAXPRNQZS;
|
||||
}
|
||||
|
||||
|
||||
uint32_t to_rinex_qzss_prn(uint32_t prn)
|
||||
{
|
||||
return prn - MINPRNQZS + 1;
|
||||
}
|
||||
|
||||
|
||||
Constellation_Observables_Map get_constellation_observables_map(
|
||||
const std::map<char, std::set<signal_flag>>& constel_signal_flags,
|
||||
const std::map<int32_t, Gnss_Synchro>& observables)
|
||||
@@ -254,6 +272,8 @@ std::map<std::string, std::string> getObservationCodes()
|
||||
{"BEIDOU_B3_I", "6I"},
|
||||
{"BEIDOU_B3_Q", "6Q"},
|
||||
{"BEIDOU_B3_IQ", "6X"},
|
||||
{"QZSS_L1_CA", "1C"},
|
||||
{"QZSS_L5_I", "5I"},
|
||||
{"PULSAR_X1", "X1"},
|
||||
{"PULSAR_X5", "X5"},
|
||||
|
||||
@@ -1589,7 +1609,11 @@ void add_constellation_obs_sat_record_lines(std::fstream& out, const std::string
|
||||
|
||||
if (version == 3)
|
||||
{
|
||||
const auto prn = it.first;
|
||||
auto prn = it.first;
|
||||
if (system_char == satelliteSystem.at("QZSS"))
|
||||
{
|
||||
prn = to_rinex_qzss_prn(prn);
|
||||
}
|
||||
line += system_char;
|
||||
if (static_cast<int32_t>(prn) < 10)
|
||||
{
|
||||
@@ -1631,6 +1655,10 @@ void add_constellation_obs_sat_record_lines(std::fstream& out, const Signal_Enab
|
||||
{
|
||||
add_constellation_obs_sat_record_lines(out, "Beidou", observables, version);
|
||||
}
|
||||
if (flags.has_qzss)
|
||||
{
|
||||
add_constellation_obs_sat_record_lines(out, "QZSS", observables, version);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1887,6 +1915,20 @@ void add_obs_sys_obs_type_beidou(std::fstream& out,
|
||||
}
|
||||
|
||||
|
||||
void add_obs_sys_obs_type_qzss(std::fstream& out,
|
||||
const Signal_Enabled_Flags& flags,
|
||||
const std::map<std::string, std::string>& observationType,
|
||||
const std::map<std::string, std::string>& observationCode)
|
||||
{
|
||||
const std::map<uint32_t, std::string> signal_to_code_map = {
|
||||
{QZS_J1, "QZSS_L1_CA"},
|
||||
{QZS_J5, "QZSS_L5_I"},
|
||||
};
|
||||
|
||||
add_obs_sys_obs_type(out, "QZSS", flags, observationType, observationCode, signal_to_code_map);
|
||||
}
|
||||
|
||||
|
||||
void add_obs_sys_obs_type_v2(std::fstream& out,
|
||||
const std::string& codeKey,
|
||||
const std::map<std::string, std::string>& observationType,
|
||||
@@ -2229,6 +2271,10 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver,
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (d_flags.has_qzss && !has_gps_lnav_eph)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
double seconds{};
|
||||
boost::posix_time::ptime system_time;
|
||||
@@ -2266,6 +2312,12 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver,
|
||||
seconds = fmod(rx_time, 60);
|
||||
system_time_str = "BDS";
|
||||
}
|
||||
else if (d_flags.has_qzss)
|
||||
{
|
||||
system_time = Rinex_Printer::compute_GPS_time(gps_ephemeris_iter->second, rx_time);
|
||||
seconds = fmod(rx_time, 60);
|
||||
system_time_str = "QZS";
|
||||
}
|
||||
|
||||
if (system_time.is_not_a_date_time())
|
||||
{
|
||||
@@ -2485,6 +2537,10 @@ void Rinex_Printer::log_rinex_nav_gps_nav(const std::map<int32_t, Gps_Ephemeris>
|
||||
|
||||
if (d_version == 2)
|
||||
{
|
||||
if (is_qzss_prn(eph.PRN))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
line += rightJustify(std::to_string(eph.PRN), 2);
|
||||
line += std::string(1, ' ');
|
||||
line += get_datetime_v2(p_utc_time);
|
||||
@@ -2501,7 +2557,9 @@ void Rinex_Printer::log_rinex_nav_gps_nav(const std::map<int32_t, Gps_Ephemeris>
|
||||
}
|
||||
if (d_version == 3)
|
||||
{
|
||||
out << get_nav_sv_epoch_svclk_line(p_utc_time, sys_char, eph.PRN, eph.af0, eph.af1, eph.af2) << '\n';
|
||||
const auto sat_system_char = is_qzss_prn(eph.PRN) ? satelliteSystem.at("QZSS") : sys_char;
|
||||
const auto rinex_prn = is_qzss_prn(eph.PRN) ? to_rinex_qzss_prn(eph.PRN) : eph.PRN;
|
||||
out << get_nav_sv_epoch_svclk_line(p_utc_time, sat_system_char, rinex_prn, eph.af0, eph.af1, eph.af2) << '\n';
|
||||
}
|
||||
|
||||
// -------- BROADCAST ORBIT - 1
|
||||
@@ -2862,6 +2920,11 @@ void Rinex_Printer::rinex_nav_header(std::fstream& out,
|
||||
type = "C: BEIDOU";
|
||||
constellation = "BEIDOU";
|
||||
}
|
||||
else if (d_flags.only_qzss)
|
||||
{
|
||||
type = "J: QZSS";
|
||||
constellation = "QZSS";
|
||||
}
|
||||
else
|
||||
{
|
||||
type = "M: MIXED";
|
||||
@@ -2928,6 +2991,11 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out,
|
||||
type = "Beidou";
|
||||
header_constellation = "BEIDOU";
|
||||
}
|
||||
else if (d_flags.only_qzss)
|
||||
{
|
||||
type = "QZSS";
|
||||
header_constellation = "QZSS";
|
||||
}
|
||||
else
|
||||
{
|
||||
type = "Mixed";
|
||||
@@ -2951,6 +3019,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out,
|
||||
{
|
||||
constellations.emplace_back("BDS");
|
||||
}
|
||||
if (d_flags.has_qzss)
|
||||
{
|
||||
constellations.emplace_back("QZS");
|
||||
}
|
||||
|
||||
header_constellation += " (";
|
||||
|
||||
@@ -3004,6 +3076,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out,
|
||||
{
|
||||
add_obs_sys_obs_type_beidou(out, d_flags, observationType, observationCode);
|
||||
}
|
||||
if (d_flags.has_qzss)
|
||||
{
|
||||
add_obs_sys_obs_type_qzss(out, d_flags, observationType, observationCode);
|
||||
}
|
||||
|
||||
// -------- Signal Strength units
|
||||
add_obs_signal_strength(out);
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
|
||||
#include "qzss_l1_telemetry_decoder.h"
|
||||
// #include "qzss_l1_telemetry_decoder_gs.h"
|
||||
#include "gps_l1_ca_telemetry_decoder_gs.h"
|
||||
|
||||
|
||||
QzssL1TelemetryDecoder::QzssL1TelemetryDecoder(
|
||||
@@ -30,5 +30,5 @@ QzssL1TelemetryDecoder::QzssL1TelemetryDecoder(
|
||||
in_streams,
|
||||
out_streams)
|
||||
{
|
||||
// TODO: InitializeDecoder(qzss_l1_make_telemetry_decoder_gs(satellite(), tlm_parameters_));
|
||||
InitializeDecoder(gps_l1_ca_make_telemetry_decoder_gs(satellite(), tlm_parameters_, L1LnavSystem::QZSS));
|
||||
}
|
||||
+92
-63
@@ -66,55 +66,73 @@ namespace wht = std;
|
||||
#endif
|
||||
|
||||
gps_l1_ca_telemetry_decoder_gs_sptr
|
||||
gps_l1_ca_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, const Tlm_Conf &conf)
|
||||
gps_l1_ca_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, const Tlm_Conf &conf, L1LnavSystem system)
|
||||
{
|
||||
return gps_l1_ca_telemetry_decoder_gs_sptr(new gps_l1_ca_telemetry_decoder_gs(satellite, conf));
|
||||
return gps_l1_ca_telemetry_decoder_gs_sptr(new gps_l1_ca_telemetry_decoder_gs(satellite, conf, system));
|
||||
}
|
||||
|
||||
|
||||
gps_l1_ca_telemetry_decoder_gs::gps_l1_ca_telemetry_decoder_gs(
|
||||
const Gnss_Satellite &satellite,
|
||||
const Tlm_Conf &conf) : telemetry_impl_interface("gps_navigation_gs",
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))),
|
||||
d_dump_filename(conf.dump_filename),
|
||||
d_sample_counter(0ULL),
|
||||
d_preamble_index(0ULL),
|
||||
d_last_valid_preamble(0),
|
||||
d_bits_per_preamble(GPS_CA_PREAMBLE_LENGTH_BITS),
|
||||
d_samples_per_preamble(GPS_CA_PREAMBLE_LENGTH_BITS),
|
||||
d_preamble_period_symbols(GPS_SUBFRAME_BITS),
|
||||
d_CRC_error_counter(0),
|
||||
d_channel(0),
|
||||
d_required_symbols(GPS_SUBFRAME_BITS),
|
||||
d_prev_GPS_frame_4bytes(0),
|
||||
d_stat(0),
|
||||
d_TOW_at_Preamble_ms(0),
|
||||
d_TOW_at_current_symbol_ms(0),
|
||||
d_flag_frame_sync(false),
|
||||
d_flag_preamble(false),
|
||||
d_sent_tlm_failed_msg(false),
|
||||
d_flag_PLL_180_deg_phase_locked(false),
|
||||
d_flag_TOW_set(false),
|
||||
d_dump(conf.dump),
|
||||
d_dump_mat(conf.dump_mat),
|
||||
d_remove_dat(conf.remove_dat),
|
||||
d_enable_navdata_monitor(conf.enable_navdata_monitor),
|
||||
d_dump_crc_stats(conf.dump_crc_stats),
|
||||
d_tow_to_trk(conf.tow_to_trk)
|
||||
const Tlm_Conf &conf,
|
||||
L1LnavSystem system) : telemetry_impl_interface("gps_navigation_gs",
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))),
|
||||
d_system(system),
|
||||
d_dump_filename(conf.dump_filename),
|
||||
d_sample_counter(0ULL),
|
||||
d_preamble_index(0ULL),
|
||||
d_last_valid_preamble(0),
|
||||
d_bits_per_preamble(GPS_CA_PREAMBLE_LENGTH_BITS),
|
||||
d_samples_per_preamble(GPS_CA_PREAMBLE_LENGTH_BITS),
|
||||
d_preamble_period_symbols(GPS_SUBFRAME_BITS),
|
||||
d_CRC_error_counter(0),
|
||||
d_channel(0),
|
||||
d_required_symbols(GPS_SUBFRAME_BITS),
|
||||
d_prev_GPS_frame_4bytes(0),
|
||||
d_stat(0),
|
||||
d_TOW_at_Preamble_ms(0),
|
||||
d_TOW_at_current_symbol_ms(0),
|
||||
d_flag_frame_sync(false),
|
||||
d_flag_preamble(false),
|
||||
d_sent_tlm_failed_msg(false),
|
||||
d_flag_PLL_180_deg_phase_locked(false),
|
||||
d_flag_TOW_set(false),
|
||||
d_dump(conf.dump),
|
||||
d_dump_mat(conf.dump_mat),
|
||||
d_remove_dat(conf.remove_dat),
|
||||
d_enable_navdata_monitor(conf.enable_navdata_monitor),
|
||||
d_dump_crc_stats(conf.dump_crc_stats),
|
||||
d_tow_to_trk(conf.tow_to_trk)
|
||||
{
|
||||
configure_basic_outputs();
|
||||
|
||||
if (d_system == L1LnavSystem::GPS)
|
||||
{
|
||||
d_nav = std::make_unique<Gps_Navigation_Message>(LnavSystem::GPS);
|
||||
}
|
||||
else
|
||||
{
|
||||
d_nav = std::make_unique<Gps_Navigation_Message>(LnavSystem::QZSS);
|
||||
}
|
||||
|
||||
if (d_enable_navdata_monitor)
|
||||
{
|
||||
// register nav message monitor out
|
||||
this->message_port_register_out(pmt::mp("Nav_msg_from_TLM"));
|
||||
d_nav_msg_packet.system = std::string("G");
|
||||
d_nav_msg_packet.signal = std::string("1C");
|
||||
if (d_system == L1LnavSystem::GPS)
|
||||
{
|
||||
d_nav_msg_packet.system = std::string("G");
|
||||
d_nav_msg_packet.signal = std::string("1C");
|
||||
}
|
||||
else
|
||||
{
|
||||
d_nav_msg_packet.system = std::string("J");
|
||||
d_nav_msg_packet.signal = std::string("J1");
|
||||
}
|
||||
}
|
||||
|
||||
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
||||
DLOG(INFO) << "Initializing GPS L1 TELEMETRY DECODER";
|
||||
DLOG(INFO) << "Initializing " << ((d_system == L1LnavSystem::GPS) ? "GPS" : "QZSS") << " L1 TELEMETRY DECODER";
|
||||
|
||||
// set the preamble
|
||||
// preamble bits to sampled symbols
|
||||
@@ -152,7 +170,9 @@ gps_l1_ca_telemetry_decoder_gs::gps_l1_ca_telemetry_decoder_gs(
|
||||
|
||||
gps_l1_ca_telemetry_decoder_gs::~gps_l1_ca_telemetry_decoder_gs()
|
||||
{
|
||||
DLOG(INFO) << "GPS L1 C/A Telemetry decoder block (channel " << d_channel << ") destructor called.";
|
||||
DLOG(INFO) << ((d_system == L1LnavSystem::GPS) ? "GPS" : "QZSS")
|
||||
<< " L1 C/A Telemetry decoder block (channel "
|
||||
<< d_channel << ") destructor called.";
|
||||
size_t pos = 0;
|
||||
if (d_dump_file.is_open() == true)
|
||||
{
|
||||
@@ -215,10 +235,17 @@ bool gps_l1_ca_telemetry_decoder_gs::gps_word_parityCheck(uint32_t gpsword)
|
||||
|
||||
void gps_l1_ca_telemetry_decoder_gs::set_satellite(const Gnss_Satellite &satellite)
|
||||
{
|
||||
d_nav = Gps_Navigation_Message();
|
||||
if (d_system == L1LnavSystem::GPS)
|
||||
{
|
||||
d_nav = std::make_unique<Gps_Navigation_Message>(LnavSystem::GPS);
|
||||
}
|
||||
else
|
||||
{
|
||||
d_nav = std::make_unique<Gps_Navigation_Message>(LnavSystem::QZSS);
|
||||
}
|
||||
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
||||
DLOG(INFO) << "Setting decoder Finite State Machine to satellite " << d_satellite;
|
||||
d_nav.set_satellite_PRN(d_satellite.get_PRN());
|
||||
d_nav->set_satellite_PRN(d_satellite.get_PRN());
|
||||
DLOG(INFO) << "Navigation Satellite set to " << d_satellite;
|
||||
}
|
||||
|
||||
@@ -226,7 +253,7 @@ void gps_l1_ca_telemetry_decoder_gs::set_satellite(const Gnss_Satellite &satelli
|
||||
void gps_l1_ca_telemetry_decoder_gs::set_channel(int32_t channel)
|
||||
{
|
||||
d_channel = channel;
|
||||
d_nav.set_channel(channel);
|
||||
d_nav->set_channel(channel);
|
||||
DLOG(INFO) << "Navigation channel set to " << channel;
|
||||
|
||||
configure_dump_file(d_channel, d_dump, d_dump_filename, d_dump_file);
|
||||
@@ -327,58 +354,58 @@ bool gps_l1_ca_telemetry_decoder_gs::decode_subframe(double cn0, bool flag_inver
|
||||
}
|
||||
d_nav_msg_packet.nav_message = subframe_bits.to_string();
|
||||
}
|
||||
const int32_t subframe_ID = d_nav.subframe_decoder(subframe.data()); // decode the subframe
|
||||
const int32_t subframe_ID = d_nav->subframe_decoder(subframe.data()); // decode the subframe
|
||||
if (subframe_ID > 0 && subframe_ID < 6)
|
||||
{
|
||||
switch (subframe_ID)
|
||||
{
|
||||
case 1:
|
||||
if (d_nav.satellite_validation() == true)
|
||||
if (d_nav->satellite_validation() == true)
|
||||
{
|
||||
// get ephemeris object for this SV (mandatory)
|
||||
const std::shared_ptr<Gps_Ephemeris> tmp_obj = std::make_shared<Gps_Ephemeris>(d_nav.get_ephemeris());
|
||||
const std::shared_ptr<Gps_Ephemeris> tmp_obj = std::make_shared<Gps_Ephemeris>(d_nav->get_ephemeris());
|
||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||
}
|
||||
|
||||
break;
|
||||
case 2:
|
||||
if (d_nav.satellite_validation() == true)
|
||||
if (d_nav->satellite_validation() == true)
|
||||
{
|
||||
// get ephemeris object for this SV (mandatory)
|
||||
const std::shared_ptr<Gps_Ephemeris> tmp_obj = std::make_shared<Gps_Ephemeris>(d_nav.get_ephemeris());
|
||||
const std::shared_ptr<Gps_Ephemeris> tmp_obj = std::make_shared<Gps_Ephemeris>(d_nav->get_ephemeris());
|
||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||
}
|
||||
|
||||
break;
|
||||
case 3: // we have a new set of ephemeris data for the current SV
|
||||
if (d_nav.satellite_validation() == true)
|
||||
if (d_nav->satellite_validation() == true)
|
||||
{
|
||||
// get ephemeris object for this SV (mandatory)
|
||||
const std::shared_ptr<Gps_Ephemeris> tmp_obj = std::make_shared<Gps_Ephemeris>(d_nav.get_ephemeris());
|
||||
const std::shared_ptr<Gps_Ephemeris> tmp_obj = std::make_shared<Gps_Ephemeris>(d_nav->get_ephemeris());
|
||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||
}
|
||||
break;
|
||||
case 4: // Possible IONOSPHERE and UTC model update (page 18)
|
||||
if (d_nav.get_flag_iono_valid() == true)
|
||||
if (d_nav->get_flag_iono_valid() == true)
|
||||
{
|
||||
const std::shared_ptr<Gps_Iono> tmp_obj = std::make_shared<Gps_Iono>(d_nav.get_iono());
|
||||
const std::shared_ptr<Gps_Iono> tmp_obj = std::make_shared<Gps_Iono>(d_nav->get_iono());
|
||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||
}
|
||||
if (d_nav.get_flag_utc_model_valid() == true)
|
||||
if (d_nav->get_flag_utc_model_valid() == true)
|
||||
{
|
||||
const std::shared_ptr<Gps_Utc_Model> tmp_obj = std::make_shared<Gps_Utc_Model>(d_nav.get_utc_model());
|
||||
const std::shared_ptr<Gps_Utc_Model> tmp_obj = std::make_shared<Gps_Utc_Model>(d_nav->get_utc_model());
|
||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||
}
|
||||
if (d_nav.almanac_validation() == true)
|
||||
if (d_nav->almanac_validation() == true)
|
||||
{
|
||||
const std::shared_ptr<Gps_Almanac> tmp_obj = std::make_shared<Gps_Almanac>(d_nav.get_almanac());
|
||||
const std::shared_ptr<Gps_Almanac> tmp_obj = std::make_shared<Gps_Almanac>(d_nav->get_almanac());
|
||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
if (d_nav.almanac_validation() == true)
|
||||
if (d_nav->almanac_validation() == true)
|
||||
{
|
||||
const std::shared_ptr<Gps_Almanac> tmp_obj = std::make_shared<Gps_Almanac>(d_nav.get_almanac());
|
||||
const std::shared_ptr<Gps_Almanac> tmp_obj = std::make_shared<Gps_Almanac>(d_nav->get_almanac());
|
||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||
}
|
||||
break;
|
||||
@@ -390,10 +417,10 @@ bool gps_l1_ca_telemetry_decoder_gs::decode_subframe(double cn0, bool flag_inver
|
||||
#else
|
||||
const auto default_precision{std::cout.precision()};
|
||||
#endif
|
||||
std::cout << "New GPS NAV message received in channel " << this->d_channel << ": "
|
||||
std::cout << "New " << ((d_system == L1LnavSystem::GPS) ? "GPS" : "QZSS") << " NAV message received in channel " << this->d_channel << ": "
|
||||
<< "subframe "
|
||||
<< subframe_ID << " from satellite "
|
||||
<< Gnss_Satellite(std::string("GPS"), d_nav.get_satellite_PRN())
|
||||
<< Gnss_Satellite(std::string((d_system == L1LnavSystem::GPS) ? "GPS" : "QZSS"), d_nav->get_satellite_PRN())
|
||||
<< " with CN0=" << std::setprecision(2) << cn0 << std::setprecision(default_precision)
|
||||
<< " dB-Hz" << std::endl;
|
||||
return true;
|
||||
@@ -465,7 +492,7 @@ void gps_l1_ca_telemetry_decoder_gs::frame_synchronization(const Gnss_Synchro &c
|
||||
{
|
||||
d_flag_PLL_180_deg_phase_locked = false;
|
||||
}
|
||||
DLOG(INFO) << "Preamble detection for GPS L1 satellite " << this->d_satellite;
|
||||
DLOG(INFO) << "Preamble detection for " << ((d_system == L1LnavSystem::GPS) ? "GPS" : "QZSS") << " L1 satellite " << this->d_satellite;
|
||||
d_prev_GPS_frame_4bytes = 0;
|
||||
if (decode_subframe(current_gs.CN0_dB_hz, d_flag_PLL_180_deg_phase_locked))
|
||||
{
|
||||
@@ -475,7 +502,8 @@ void gps_l1_ca_telemetry_decoder_gs::frame_synchronization(const Gnss_Synchro &c
|
||||
if (!d_flag_frame_sync)
|
||||
{
|
||||
d_flag_frame_sync = true;
|
||||
LOG(INFO) << "Successful frame synchronization in channel " << d_channel << " for satellite " << this->d_satellite
|
||||
LOG(INFO) << "Successful frame synchronization in channel " << d_channel << " for "
|
||||
<< ((d_system == L1LnavSystem::GPS) ? "GPS" : "QZSS") << " L1 satellite " << this->d_satellite
|
||||
<< " at d_sample_counter=" << d_sample_counter;
|
||||
}
|
||||
d_stat = 1; // preamble acquired
|
||||
@@ -575,15 +603,16 @@ int gps_l1_ca_telemetry_decoder_gs::general_work(int noutput_items __attribute__
|
||||
// 2. Add the telemetry decoder information
|
||||
if (d_flag_preamble == true)
|
||||
{
|
||||
if (!(d_nav.get_TOW() == 0))
|
||||
if (!(d_nav->get_TOW() == 0))
|
||||
{
|
||||
d_TOW_at_current_symbol_ms = static_cast<uint32_t>(d_nav.get_TOW() * 1000.0);
|
||||
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_nav.get_TOW() * 1000.0);
|
||||
d_TOW_at_current_symbol_ms = static_cast<uint32_t>(d_nav->get_TOW() * 1000.0);
|
||||
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_nav->get_TOW() * 1000.0);
|
||||
d_flag_TOW_set = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
DLOG(INFO) << "Received GPS L1 TOW equal to zero at sat " << d_nav.get_satellite_PRN();
|
||||
DLOG(INFO) << "Received " << ((d_system == L1LnavSystem::GPS) ? "GPS" : "QZSS")
|
||||
<< " L1 TOW equal to zero at sat " << d_nav->get_satellite_PRN();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -677,11 +706,11 @@ int gps_l1_ca_telemetry_decoder_gs::general_work(int noutput_items __attribute__
|
||||
if (d_tow_to_trk)
|
||||
{
|
||||
const std::shared_ptr<TOW_to_trk> tmp_tow_obj = std::make_shared<TOW_to_trk>(TOW_to_trk(
|
||||
std::string("1C"),
|
||||
((d_system == L1LnavSystem::GPS) ? std::string("1C") : std::string("J1")),
|
||||
d_channel,
|
||||
d_TOW_at_current_symbol_ms,
|
||||
current_symbol.Tracking_sample_counter,
|
||||
d_nav.get_GPS_week(), d_nav.get_satellite_PRN()));
|
||||
d_nav->get_GPS_week(), d_nav->get_satellite_PRN()));
|
||||
this->message_port_pub(pmt::mp("telemetry_to_trk"), pmt::make_any(tmp_tow_obj));
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,11 @@
|
||||
* GNU Radio blocks for the demodulation of GNSS navigation messages.
|
||||
* \{ */
|
||||
|
||||
enum class L1LnavSystem
|
||||
{
|
||||
GPS,
|
||||
QZSS
|
||||
};
|
||||
|
||||
class gps_l1_ca_telemetry_decoder_gs;
|
||||
|
||||
@@ -42,7 +47,8 @@ using gps_l1_ca_telemetry_decoder_gs_sptr = gnss_shared_ptr<gps_l1_ca_telemetry_
|
||||
|
||||
gps_l1_ca_telemetry_decoder_gs_sptr gps_l1_ca_make_telemetry_decoder_gs(
|
||||
const Gnss_Satellite &satellite,
|
||||
const Tlm_Conf &conf);
|
||||
const Tlm_Conf &conf,
|
||||
L1LnavSystem system = L1LnavSystem::GPS);
|
||||
|
||||
/*!
|
||||
* \brief This class implements a block that decodes the NAV data defined in IS-GPS-200M
|
||||
@@ -64,9 +70,10 @@ public:
|
||||
private:
|
||||
friend gps_l1_ca_telemetry_decoder_gs_sptr gps_l1_ca_make_telemetry_decoder_gs(
|
||||
const Gnss_Satellite &satellite,
|
||||
const Tlm_Conf &conf);
|
||||
const Tlm_Conf &conf,
|
||||
L1LnavSystem system);
|
||||
|
||||
gps_l1_ca_telemetry_decoder_gs(const Gnss_Satellite &satellite, const Tlm_Conf &conf);
|
||||
gps_l1_ca_telemetry_decoder_gs(const Gnss_Satellite &satellite, const Tlm_Conf &conf, L1LnavSystem system);
|
||||
|
||||
void check_tlm_separation();
|
||||
void frame_synchronization(const Gnss_Synchro ¤t_gs);
|
||||
@@ -74,7 +81,8 @@ private:
|
||||
bool gps_word_parityCheck(uint32_t gpsword);
|
||||
bool decode_subframe(double cn0, bool flag_invert);
|
||||
|
||||
Gps_Navigation_Message d_nav;
|
||||
L1LnavSystem d_system;
|
||||
std::unique_ptr<Gps_Navigation_Message> d_nav;
|
||||
Gnss_Satellite d_satellite;
|
||||
Nav_Message_Packet d_nav_msg_packet;
|
||||
std::unique_ptr<Tlm_CRC_Stats> d_Tlm_CRC_Stats;
|
||||
|
||||
@@ -25,13 +25,19 @@
|
||||
#include <limits> // for std::numeric_limits
|
||||
|
||||
|
||||
Gps_Navigation_Message::Gps_Navigation_Message()
|
||||
Gps_Navigation_Message::Gps_Navigation_Message(LnavSystem system)
|
||||
: d_system(system)
|
||||
{
|
||||
auto gnss_sat = Gnss_Satellite();
|
||||
const std::string _system("GPS");
|
||||
for (uint32_t i = 1; i < 33; i++)
|
||||
|
||||
const std::string sys_str = (d_system == LnavSystem::GPS) ? "GPS" : "QZSS";
|
||||
|
||||
uint32_t prn_min = (d_system == LnavSystem::GPS) ? 1 : 193;
|
||||
uint32_t prn_max = (d_system == LnavSystem::GPS) ? 32 : 202;
|
||||
|
||||
for (uint32_t i = prn_min; i <= prn_max; ++i)
|
||||
{
|
||||
satelliteBlock[i] = gnss_sat.what_block(_system, i);
|
||||
satelliteBlock[i] = gnss_sat.what_block(sys_str, i);
|
||||
almanacHealth[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,11 @@
|
||||
/** \addtogroup System_Parameters
|
||||
* \{ */
|
||||
|
||||
enum class LnavSystem
|
||||
{
|
||||
GPS,
|
||||
QZSS
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief This class decodes a GPS NAV Data message as described in IS-GPS-200M
|
||||
@@ -49,7 +54,7 @@ public:
|
||||
/*!
|
||||
* Default constructor
|
||||
*/
|
||||
Gps_Navigation_Message();
|
||||
explicit Gps_Navigation_Message(LnavSystem system = LnavSystem::GPS);
|
||||
|
||||
/*!
|
||||
* \brief Obtain a GPS SV Ephemeris class filled with current SV data
|
||||
@@ -151,6 +156,8 @@ private:
|
||||
|
||||
std::map<int32_t, std::string> satelliteBlock; //!< Map that stores to which block the PRN belongs https://www.navcen.uscg.gov/?Do=constellationStatus
|
||||
|
||||
LnavSystem d_system;
|
||||
|
||||
// broadcast orbit 1
|
||||
int32_t d_TOW{}; // Time of GPS Week of the ephemeris set (taken from subframes TOW) [s]
|
||||
int32_t d_TOW_SF1{}; // Time of GPS Week from HOW word of Subframe 1 [s]
|
||||
|
||||
Reference in New Issue
Block a user