1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-31 03:14:56 +00:00

Merge branch 'piyush0411-Telemetry_Decoder' into next

This commit is contained in:
Carles Fernandez 2020-07-28 20:55:44 +02:00
commit 1298817534
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
9 changed files with 288 additions and 14 deletions

View File

@ -15,6 +15,7 @@ set(TELEMETRY_DECODER_ADAPTER_SOURCES
galileo_e1b_telemetry_decoder.cc
sbas_l1_telemetry_decoder.cc
galileo_e5a_telemetry_decoder.cc
galileo_e5b_telemetry_decoder.cc
glonass_l1_ca_telemetry_decoder.cc
glonass_l2_ca_telemetry_decoder.cc
beidou_b1i_telemetry_decoder.cc
@ -28,6 +29,7 @@ set(TELEMETRY_DECODER_ADAPTER_HEADERS
galileo_e1b_telemetry_decoder.h
sbas_l1_telemetry_decoder.h
galileo_e5a_telemetry_decoder.h
galileo_e5b_telemetry_decoder.h
glonass_l1_ca_telemetry_decoder.h
glonass_l2_ca_telemetry_decoder.h
beidou_b1i_telemetry_decoder.h

View File

@ -0,0 +1,94 @@
/*!
* \file galileo_e5b_telemetry_decoder.cc
* \brief Interface of an adapter of a GALILEO E5B NAV data decoder block
* to a TelemetryDecoderInterface
* \author Piyush Gupta 2020 piyush04111999@gmail.com.
* \note Code added as part of GSoC 2020 Program.
*
*
* -----------------------------------------------------------------------------
*
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
*/
#include "galileo_e5b_telemetry_decoder.h"
#include "configuration_interface.h"
#include <glog/logging.h>
GalileoE5bTelemetryDecoder::GalileoE5bTelemetryDecoder(
const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
in_streams_(in_streams),
out_streams_(out_streams)
{
const std::string default_dump_filename("./navigation.dat");
DLOG(INFO) << "role " << role;
dump_ = configuration->property(role + ".dump", false);
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename);
// make telemetry decoder object
telemetry_decoder_ = galileo_make_telemetry_decoder_gs(satellite_, 1, dump_); // unified galileo decoder set to INAV (frame_type=1)
DLOG(INFO) << "telemetry_decoder(" << telemetry_decoder_->unique_id() << ")";
channel_ = 0;
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";
}
if (out_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one output stream";
}
}
void GalileoE5bTelemetryDecoder::set_satellite(const Gnss_Satellite& satellite)
{
satellite_ = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
telemetry_decoder_->set_satellite(satellite_);
DLOG(INFO) << "GALILEO TELEMETRY DECODER: satellite set to " << satellite_;
}
void GalileoE5bTelemetryDecoder::connect(gr::top_block_sptr top_block)
{
if (top_block)
{
/* top_block is not null */
};
// Nothing to connect internally
DLOG(INFO) << "nothing to connect internally";
}
void GalileoE5bTelemetryDecoder::disconnect(gr::top_block_sptr top_block)
{
if (top_block)
{
/* top_block is not null */
};
// Nothing to disconnect
}
gr::basic_block_sptr GalileoE5bTelemetryDecoder::get_left_block()
{
return telemetry_decoder_;
}
gr::basic_block_sptr GalileoE5bTelemetryDecoder::get_right_block()
{
return telemetry_decoder_;
}

View File

@ -0,0 +1,110 @@
/*!
* \file galileo_e5b_telemetry_decoder.h
* \brief Interface of an adapter of a GALILEO E5B NAV data decoder block
* to a TelemetryDecoderInterface
* \author Piyush Gupta 2020 piyush04111999@gmail.com.
* \note Code added as part of GSoC 2020 Program.
*
*
* -----------------------------------------------------------------------------
*
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_GALILEO_E5B_TELEMETRY_DECODER_H
#define GNSS_SDR_GALILEO_E5B_TELEMETRY_DECODER_H
#include "galileo_telemetry_decoder_gs.h"
#include "gnss_satellite.h"
#include "gnss_synchro.h"
#include "telemetry_decoder_interface.h"
#include <gnuradio/runtime_types.h> // for basic_block_sptr, top_block_sptr
#include <cstddef> // for size_t
#include <string>
class ConfigurationInterface;
/*!
* \brief This class implements a NAV data decoder for Galileo INAV frames in E5b radio link
*/
class GalileoE5bTelemetryDecoder : public TelemetryDecoderInterface
{
public:
GalileoE5bTelemetryDecoder(
const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
~GalileoE5bTelemetryDecoder() = default;
/*!
* \brief Returns "Galileo_E5b_Telemetry_Decoder"
*/
inline std::string implementation() override
{
return "Galileo_E5b_Telemetry_Decoder";
}
/*!
* \brief Connect
*/
void connect(gr::top_block_sptr top_block) override;
/*!
* \brief Disconnect
*/
void disconnect(gr::top_block_sptr top_block) override;
/*!
* \brief Get left block
*/
gr::basic_block_sptr get_left_block() override;
/*!
* \brief Get right block
*/
gr::basic_block_sptr get_right_block() override;
void set_satellite(const Gnss_Satellite& satellite) override;
inline std::string role() override
{
return role_;
}
inline void set_channel(int channel) override { telemetry_decoder_->set_channel(channel); }
inline void reset() override
{
telemetry_decoder_->reset();
}
inline size_t item_size() override
{
return sizeof(Gnss_Synchro);
}
private:
galileo_telemetry_decoder_gs_sptr telemetry_decoder_;
Gnss_Satellite satellite_;
std::string dump_filename_;
std::string role_;
int channel_;
unsigned int in_streams_;
unsigned int out_streams_;
bool dump_;
};
#endif // GNSS_SDR_GALILEO_E5B_TELEMETRY_DECODER_H

View File

@ -1,8 +1,10 @@
/*!
* \file galileo_telemetry_decoder_gs.cc
* \brief Implementation of a Galileo unified INAV and FNAV message demodulator block
* \brief Implementation of a Galileo unified INAV and FNAV message demodulator
* block
* \author Javier Arribas 2018. jarribas(at)cttc.es
*
*
* -----------------------------------------------------------------------------
*
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
@ -21,6 +23,7 @@
#include "galileo_telemetry_decoder_gs.h"
#include "Galileo_E1.h" // for GALILEO_E1_CODE_PERIOD_MS
#include "Galileo_E5a.h" // for GALILEO_E5A_CODE_PERIO...
#include "Galileo_E5b.h" // for GALILEO_E5B_CODE_PERIOD_MS
#include "convolutional.h"
#include "display.h"
#include "galileo_almanac_helper.h" // for Galileo_Almanac_Helper
@ -62,6 +65,7 @@ galileo_telemetry_decoder_gs::galileo_telemetry_decoder_gs(
this->message_port_register_out(pmt::mp("telemetry_to_trk"));
d_last_valid_preamble = 0;
d_sent_tlm_failed_msg = false;
d_band = '1';
// initialize internal vars
d_dump = dump;
@ -73,7 +77,7 @@ galileo_telemetry_decoder_gs::galileo_telemetry_decoder_gs(
{
case 1: // INAV
{
d_PRN_code_period_ms = static_cast<uint32_t>(GALILEO_E1_CODE_PERIOD_MS);
d_PRN_code_period_ms = static_cast<uint32_t>(GALILEO_E1_CODE_PERIOD_MS); // for Galileo E5b is also 4 ms
d_bits_per_preamble = GALILEO_INAV_PREAMBLE_LENGTH_BITS;
// set the preamble
d_samples_per_preamble = GALILEO_INAV_PREAMBLE_LENGTH_BITS;
@ -256,11 +260,25 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in
d_inav_nav.split_page(page_String, flag_even_word_arrived);
if (d_inav_nav.get_flag_CRC_test() == true)
{
DLOG(INFO) << "Galileo E1 CRC correct in channel " << d_channel << " from satellite " << d_satellite;
if (d_band == '1')
{
DLOG(INFO) << "Galileo E1 CRC correct in channel " << d_channel << " from satellite " << d_satellite;
}
else if (d_band == '7')
{
DLOG(INFO) << "Galileo E5b CRC correct in channel " << d_channel << " from satellite " << d_satellite;
}
}
else
{
DLOG(INFO) << "Galileo E1 CRC error in channel " << d_channel << " from satellite " << d_satellite;
if (d_band == '1')
{
DLOG(INFO) << "Galileo E1 CRC error in channel " << d_channel << " from satellite " << d_satellite;
}
else if (d_band == '7')
{
DLOG(INFO) << "Galileo E5b CRC error in channel " << d_channel << " from satellite " << d_satellite;
}
}
flag_even_word_arrived = 0;
}
@ -276,21 +294,42 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in
{
// get object for this SV (mandatory)
const std::shared_ptr<Galileo_Ephemeris> tmp_obj = std::make_shared<Galileo_Ephemeris>(d_inav_nav.get_ephemeris());
std::cout << "New Galileo E1 I/NAV message received in channel " << d_channel << ": ephemeris from satellite " << d_satellite << '\n';
if (d_band == '1')
{
std::cout << "New Galileo E1 I/NAV message received in channel " << d_channel << ": ephemeris from satellite " << d_satellite << '\n';
}
else if (d_band == '7')
{
std::cout << TEXT_BLUE << "New Galileo E5b I/NAV message received in channel " << d_channel << ": ephemeris from satellite " << d_satellite << TEXT_RESET << '\n';
}
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
}
if (d_inav_nav.have_new_iono_and_GST() == true)
{
// get object for this SV (mandatory)
const std::shared_ptr<Galileo_Iono> tmp_obj = std::make_shared<Galileo_Iono>(d_inav_nav.get_iono());
std::cout << "New Galileo E1 I/NAV message received in channel " << d_channel << ": iono/GST model parameters from satellite " << d_satellite << '\n';
if (d_band == '1')
{
std::cout << "New Galileo E1 I/NAV message received in channel " << d_channel << ": iono/GST model parameters from satellite " << d_satellite << '\n';
}
else if (d_band == '7')
{
std::cout << TEXT_BLUE << "New Galileo E5b I/NAV message received in channel " << d_channel << ": iono/GST model parameters from satellite " << d_satellite << TEXT_RESET << '\n';
}
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
}
if (d_inav_nav.have_new_utc_model() == true)
{
// get object for this SV (mandatory)
const std::shared_ptr<Galileo_Utc_Model> tmp_obj = std::make_shared<Galileo_Utc_Model>(d_inav_nav.get_utc_model());
std::cout << "New Galileo E1 I/NAV message received in channel " << d_channel << ": UTC model parameters from satellite " << d_satellite << '\n';
if (d_band == '1')
{
std::cout << "New Galileo E1 I/NAV message received in channel " << d_channel << ": UTC model parameters from satellite " << d_satellite << '\n';
}
else if (d_band == '7')
{
std::cout << TEXT_BLUE << "New Galileo E5b I/NAV message received in channel " << d_channel << ": UTC model parameters from satellite " << d_satellite << TEXT_RESET << '\n';
}
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
d_delta_t = tmp_obj->A_0G_10 + tmp_obj->A_1G_10 * (static_cast<double>(d_TOW_at_current_symbol_ms) / 1000.0 - tmp_obj->t_0G_10 + 604800 * (std::fmod(static_cast<float>(d_inav_nav.get_Galileo_week() - tmp_obj->WN_0G_10), 64.0)));
DLOG(INFO) << "delta_t=" << d_delta_t << "[s]";
@ -300,7 +339,14 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in
const std::shared_ptr<Galileo_Almanac_Helper> tmp_obj = std::make_shared<Galileo_Almanac_Helper>(d_inav_nav.get_almanac());
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
// debug
std::cout << "Galileo E1 I/NAV almanac received in channel " << d_channel << " from satellite " << d_satellite << '\n';
if (d_band == '1')
{
std::cout << "Galileo E1 I/NAV almanac received in channel " << d_channel << " from satellite " << d_satellite << '\n';
}
else if (d_band == '7')
{
std::cout << "Galileo E5b I/NAV almanac received in channel " << d_channel << " from satellite " << d_satellite << '\n';
}
DLOG(INFO) << "Current parameters:";
DLOG(INFO) << "d_TOW_at_current_symbol_ms=" << d_TOW_at_current_symbol_ms;
DLOG(INFO) << "d_nav.WN_0=" << d_inav_nav.get_Galileo_week();
@ -432,6 +478,8 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
Gnss_Synchro current_symbol{}; // structure to save the synchronization information and send the output object to the next block
// 1. Copy the current tracking output
current_symbol = in[0][0];
d_band = current_symbol.Signal[0];
// add new symbol to the symbol queue
switch (d_frame_type)
{
@ -502,7 +550,6 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
{
// correlate with preamble
int32_t corr_value = 0;
int32_t preamble_diff = 0;
if (d_symbol_history.size() > d_required_symbols)
{
// ******* preamble correlation ********
@ -520,7 +567,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
if (abs(corr_value) >= d_samples_per_preamble)
{
// check preamble separation
preamble_diff = static_cast<int32_t>(d_sample_counter - d_preamble_index);
const auto preamble_diff = static_cast<int32_t>(d_sample_counter - d_preamble_index);
if (abs(preamble_diff - d_preamble_period_symbols) == 0)
{
// try to decode frame
@ -644,7 +691,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
{
// TOW_5 refers to the even preamble, but when we decode it we are in the odd part, so 1 second later plus the decoding delay
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_inav_nav.get_TOW5() * 1000.0);
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>(GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * GALILEO_E1_CODE_PERIOD_MS);
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>(GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * d_PRN_code_period_ms);
d_inav_nav.set_TOW5_flag(false);
}
@ -652,13 +699,13 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
{
// TOW_6 refers to the even preamble, but when we decode it we are in the odd part, so 1 second later plus the decoding delay
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_inav_nav.get_TOW6() * 1000.0);
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>(GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * GALILEO_E1_CODE_PERIOD_MS);
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>(GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * d_PRN_code_period_ms);
d_inav_nav.set_TOW6_flag(false);
}
else
{
// this page has no timing information
d_TOW_at_current_symbol_ms += static_cast<uint32_t>(GALILEO_E1_CODE_PERIOD_MS); // + GALILEO_INAV_PAGE_PART_SYMBOLS*GALILEO_E1_CODE_PERIOD_S;
d_TOW_at_current_symbol_ms += static_cast<uint32_t>(d_PRN_code_period_ms); // + GALILEO_INAV_PAGE_PART_SYMBOLS*GALILEO_E1_CODE_PERIOD_S;
}
}
break;

View File

@ -1,8 +1,10 @@
/*!
* \file galileo_telemetry_decoder_gs.h
* \brief Implementation of a Galileo unified INAV and FNAV message demodulator block
* \brief Implementation of a Galileo unified INAV and FNAV message demodulator
* block
* \author Javier Arribas 2018. jarribas(at)cttc.es
*
*
* -----------------------------------------------------------------------------
*
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
@ -70,6 +72,7 @@ public:
int general_work(int noutput_items, gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
private:
friend galileo_telemetry_decoder_gs_sptr galileo_make_telemetry_decoder_gs(
const Gnss_Satellite &satellite,
@ -129,6 +132,8 @@ private:
uint32_t d_TOW_at_current_symbol_ms;
uint32_t d_max_symbols_without_valid_frame;
char d_band; // This variable will store which band we are dealing with (Galileo E1 or E5b)
bool d_sent_tlm_failed_msg;
bool d_flag_frame_sync;
bool d_flag_PLL_180_deg_phase_locked;

View File

@ -57,6 +57,7 @@
#include "galileo_e5a_telemetry_decoder.h"
#include "galileo_e5b_dll_pll_tracking.h"
#include "galileo_e5b_pcps_acquisition.h"
#include "galileo_e5b_telemetry_decoder.h"
#include "glonass_l1_ca_dll_pll_c_aid_tracking.h"
#include "glonass_l1_ca_dll_pll_tracking.h"
#include "glonass_l1_ca_pcps_acquisition.h"
@ -1209,6 +1210,12 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetBlock(
out_streams);
block = std::move(block_);
}
else if (implementation == "Galileo_E5b_Telemetry_Decoder")
{
std::unique_ptr<GNSSBlockInterface> block_ = std::make_unique<GalileoE5bTelemetryDecoder>(configuration, role, in_streams,
out_streams);
block = std::move(block_);
}
else if (implementation == "GLONASS_L1_CA_Telemetry_Decoder")
{
std::unique_ptr<GNSSBlockInterface> block_ = std::make_unique<GlonassL1CaTelemetryDecoder>(configuration, role, in_streams,
@ -1634,6 +1641,12 @@ std::unique_ptr<TelemetryDecoderInterface> GNSSBlockFactory::GetTlmBlock(
out_streams);
block = std::move(block_);
}
else if (implementation == "Galileo_E5b_Telemetry_Decoder")
{
std::unique_ptr<TelemetryDecoderInterface> block_ = std::make_unique<GalileoE5bTelemetryDecoder>(configuration, role, in_streams,
out_streams);
block = std::move(block_);
}
else if (implementation == "GPS_L2C_Telemetry_Decoder")
{
std::unique_ptr<TelemetryDecoderInterface> block_ = std::make_unique<GpsL2CTelemetryDecoder>(configuration, role, in_streams,

View File

@ -33,6 +33,7 @@ constexpr double GALILEO_E5B_CODE_CHIP_RATE_CPS = 1.023e7; //!< Galileo E5b c
constexpr double GALILEO_E5B_I_TIERED_CODE_PERIOD_S = 0.004; //!< Galileo E5b-I tiered code period [s]
constexpr double GALILEO_E5B_Q_TIERED_CODE_PERIOD_S = 0.100; //!< Galileo E5b-Q tiered code period [s]
constexpr double GALILEO_E5B_CODE_PERIOD_S = 0.001; //!< Galileo E5b primary code period [s]
constexpr int32_t GALILEO_E5B_CODE_PERIOD_MS = 1; //!< Galileo E5b primary code period [ms]
constexpr int32_t GALILEO_E5B_CODE_LENGTH_CHIPS = 10230; //!< Galileo E5b primary code length [chips]
constexpr int32_t GALILEO_E5B_I_SECONDARY_CODE_LENGTH = 4; //!< Galileo E5b-I secondary code length [chips]
constexpr int32_t GALILEO_E5B_Q_SECONDARY_CODE_LENGTH = 100; //!< Galileo E5b-Q secondary code length [chips]

View File

@ -19,6 +19,7 @@
#include "galileo_ephemeris.h"
#include "Galileo_E1.h"
#include "Galileo_E5b.h"
#include <cmath>

View File

@ -23,6 +23,7 @@
#define GNSS_SDR_GALILEO_NAVIGATION_MESSAGE_H
#include "Galileo_E1.h"
#include "Galileo_E5b.h"
#include "Galileo_INAV.h"
#include "galileo_almanac_helper.h"
#include "galileo_ephemeris.h"