1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-11-13 13:47:15 +00:00

Merge branch 'next' of https://github.com/gnss-sdr/gnss-sdr into pps_lime

This commit is contained in:
Javier Arribas
2021-04-07 14:52:59 +02:00
32 changed files with 2811 additions and 524 deletions

View File

@@ -24,6 +24,7 @@
#include "galileo_almanac.h"
#include "galileo_almanac_helper.h"
#include "galileo_ephemeris.h"
#include "galileo_has_data.h"
#include "galileo_iono.h"
#include "galileo_utc_model.h"
#include "geojson_printer.h"
@@ -503,6 +504,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
d_galileo_utc_model_sptr_type_hash_code = typeid(std::shared_ptr<Galileo_Utc_Model>).hash_code();
d_galileo_almanac_helper_sptr_type_hash_code = typeid(std::shared_ptr<Galileo_Almanac_Helper>).hash_code();
d_galileo_almanac_sptr_type_hash_code = typeid(std::shared_ptr<Galileo_Almanac>).hash_code();
d_galileo_has_message_sptr_type_hash_code = typeid(std::shared_ptr<Galileo_HAS_data>).hash_code();
d_glonass_gnav_ephemeris_sptr_type_hash_code = typeid(std::shared_ptr<Glonass_Gnav_Ephemeris>).hash_code();
d_glonass_gnav_utc_model_sptr_type_hash_code = typeid(std::shared_ptr<Glonass_Gnav_Utc_Model>).hash_code();
d_glonass_gnav_almanac_sptr_type_hash_code = typeid(std::shared_ptr<Glonass_Gnav_Almanac>).hash_code();
@@ -1318,6 +1320,10 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
d_user_pvt_solver->galileo_almanac_map[galileo_alm->PRN] = *galileo_alm;
}
}
else if (msg_type_hash_code == d_galileo_has_message_sptr_type_hash_code)
{
// Store HAS message and print its content
}
// **************** GLONASS GNAV Telemetry *************************
else if (msg_type_hash_code == d_glonass_gnav_ephemeris_sptr_type_hash_code)

View File

@@ -216,6 +216,7 @@ private:
size_t d_galileo_utc_model_sptr_type_hash_code;
size_t d_galileo_almanac_helper_sptr_type_hash_code;
size_t d_galileo_almanac_sptr_type_hash_code;
size_t d_galileo_has_message_sptr_type_hash_code;
size_t d_glonass_gnav_ephemeris_sptr_type_hash_code;
size_t d_glonass_gnav_utc_model_sptr_type_hash_code;
size_t d_glonass_gnav_almanac_sptr_type_hash_code;

View File

@@ -103,22 +103,6 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(const ConfigurationInterface *con
const int l1_band = configuration->property("Channels_1C.count", 0) +
configuration->property("Channels_1B.count", 0);
// by default the DMA transfers samples corresponding to two frequency bands to the FPGA
num_freq_bands_ = 2;
dma_buff_offset_pos_ = 0;
// if only one input file is specified in the configuration file then:
// if there is at least one channel assigned to frequency band 1 then the DMA transfers the samples to the L1 frequency band channels
// otherwise the DMA transfers the samples to the L2/L5 frequency band channels
if (filename1.empty())
{
num_freq_bands_ = 1;
if (l1_band != 0)
{
dma_buff_offset_pos_ = 2;
}
}
const double default_seconds_to_skip = 0.0;
const std::string empty_string;
@@ -140,6 +124,27 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(const ConfigurationInterface *con
filename1 = configuration->property(role + ".filename1", empty_string);
}
// by default the DMA transfers samples corresponding to two frequency bands to the FPGA
num_freq_bands_ = 2;
dma_buff_offset_pos_ = 0;
// if only one input file is specified in the configuration file then:
// if there is at least one channel assigned to frequency band 1 then the DMA transfers the samples to the L1 frequency band channels
// otherwise the DMA transfers the samples to the L2/L5 frequency band channels
// if more than one input file are specified then the DMA transfer the samples to both the L1 and the L2/L5 frequency channels.
if (filename1.empty())
{
num_freq_bands_ = 1;
if (l1_band != 0)
{
dma_buff_offset_pos_ = 2;
}
}
else
{
dma_buff_offset_pos_ = 2;
}
samples_ = configuration->property(role + ".samples", static_cast<int64_t>(0));
const double seconds_to_skip = configuration->property(role + ".seconds_to_skip", default_seconds_to_skip);
@@ -649,6 +654,7 @@ void Ad9361FpgaSignalSource::run_DMA_process(const std::string &filename0, const
// run the DMA
while (run_DMA)
{
dma_index = 0;
if (nbytes_remaining < read_buffer_size)
{
read_buffer_size = nbytes_remaining;
@@ -684,26 +690,26 @@ void Ad9361FpgaSignalSource::run_DMA_process(const std::string &filename0, const
}
// read filename 1 (if enabled)
dma_index = 0;
if (num_freq_bands_ > 1)
{
dma_index = 0;
try
{
infile1.read(reinterpret_cast<char *>(input_samples.data()), read_buffer_size);
infile2.read(reinterpret_cast<char *>(input_samples.data()), read_buffer_size);
}
catch (const std::ifstream::failure &e)
{
std::cerr << "Exception reading file " << filename1 << '\n';
break;
}
if (infile1)
if (infile2)
{
nread_elements = read_buffer_size;
}
else
{
// FLAG AS ERROR !! IT SHOULD NEVER HAPPEN
nread_elements = infile1.gcount();
nread_elements = infile2.gcount();
}
for (int index0 = 0; index0 < (nread_elements); index0 += 2)

View File

@@ -331,6 +331,15 @@ Fmcomms2SignalSource::Fmcomms2SignalSource(const ConfigurationInterface *configu
file_sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str());
DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")";
}
if (in_stream_ > 0)
{
LOG(ERROR) << "A signal source does not have an input stream";
}
if (out_stream_ > 1)
{
LOG(ERROR) << "This implementation only supports one output stream";
}
}

View File

@@ -1,6 +1,6 @@
/*!
* \file labsat_signal_source.cc
* \brief Labsat 2 and 3 front-end signal sampler driver
* \brief LabSat version 2, 3, and 3 Wideband format reader
* \author Javier Arribas, jarribas(at)cttc.es
*
* -----------------------------------------------------------------------------
@@ -8,7 +8,7 @@
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2021 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
@@ -19,6 +19,8 @@
#include "gnss_sdr_string_literals.h"
#include "labsat23_source.h"
#include <glog/logging.h>
#include <iostream>
#include <sstream>
using namespace std::string_literals;
@@ -37,7 +39,25 @@ LabsatSignalSource::LabsatSignalSource(const ConfigurationInterface* configurati
const int64_t sampling_frequency_deprecated = configuration->property(role + ".sampling_frequency", static_cast<int64_t>(16368000));
const int64_t throttle_frequency_sps = configuration->property(role + ".throttle_frequency_sps", static_cast<int64_t>(sampling_frequency_deprecated));
const int channel_selector = configuration->property(role + ".selected_channel", 1);
std::string channels_to_read = configuration->property(role + ".selected_channel", default_item_type);
std::stringstream ss(channels_to_read);
int found;
while (ss.good())
{
std::string substr;
getline(ss, substr, ',');
if (std::stringstream(substr) >> found)
{
if (found >= 1 && found <= 3)
{
channels_selector_vec_.push_back(found);
}
}
}
if (channels_selector_vec_.empty())
{
channels_selector_vec_.push_back(1);
}
const std::string default_filename("./example_capture.LS3");
filename_ = configuration->property(role + ".filename", default_filename);
@@ -47,7 +67,7 @@ LabsatSignalSource::LabsatSignalSource(const ConfigurationInterface* configurati
if (item_type_ == "gr_complex")
{
item_size_ = sizeof(gr_complex);
labsat23_source_ = labsat23_make_source_sptr(filename_.c_str(), channel_selector, queue, digital_io_enabled);
labsat23_source_ = labsat23_make_source_sptr(filename_.c_str(), channels_selector_vec_, queue, digital_io_enabled);
DLOG(INFO) << "Item size " << item_size_;
DLOG(INFO) << "labsat23_source_(" << labsat23_source_->unique_id() << ")";
}
@@ -58,49 +78,95 @@ LabsatSignalSource::LabsatSignalSource(const ConfigurationInterface* configurati
}
if (dump_)
{
DLOG(INFO) << "Dumping output into file " << dump_filename_;
DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")";
file_sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str());
std::vector<std::string> dump_filename;
file_sink_.reserve(channels_selector_vec_.size());
for (int i : channels_selector_vec_)
{
if (channels_selector_vec_.size() == 1)
{
dump_filename.push_back(dump_filename_);
}
else
{
std::string aux(dump_filename_.substr(0, dump_filename_.length() - 4));
std::string extension(dump_filename_.substr(dump_filename_.length() - 3, dump_filename_.length()));
if (i == 1)
{
aux += "_chA."s;
}
if (i == 2)
{
aux += "_chB."s;
}
if (i == 3)
{
aux += "_chC."s;
}
dump_filename.push_back(aux + extension);
}
std::cout << "Dumping output into file " << dump_filename.back() << '\n';
file_sink_.push_back(gr::blocks::file_sink::make(item_size_, dump_filename.back().c_str()));
DLOG(INFO) << "file_sink(" << file_sink_.back()->unique_id() << ")";
}
}
if (enable_throttle_control_)
{
throttle_ = gr::blocks::throttle::make(item_size_, throttle_frequency_sps);
for (auto it = channels_selector_vec_.begin(); it != channels_selector_vec_.end(); ++it)
{
throttle_.push_back(gr::blocks::throttle::make(item_size_, throttle_frequency_sps));
}
}
if (in_stream_ > 0)
{
LOG(ERROR) << "A signal source does not have an input stream";
}
if (out_stream_ > 1)
if (out_stream_ > 3)
{
LOG(ERROR) << "This implementation only supports one output stream";
LOG(ERROR) << "This implementation supports up to 3 output streams";
}
}
size_t LabsatSignalSource::getRfChannels() const
{
return channels_selector_vec_.size();
}
void LabsatSignalSource::connect(gr::top_block_sptr top_block)
{
if (enable_throttle_control_ == true)
{
top_block->connect(labsat23_source_, 0, throttle_, 0);
DLOG(INFO) << "connected labsat23_source_ to throttle";
if (dump_)
int rf_chan = 0;
for (const auto& th : throttle_)
{
top_block->connect(labsat23_source_, 0, file_sink_, 0);
DLOG(INFO) << "connected labsat23_source_to sink";
top_block->connect(labsat23_source_, rf_chan, th, 0);
DLOG(INFO) << "connected labsat23_source_ to throttle";
if (dump_)
{
top_block->connect(labsat23_source_, rf_chan, file_sink_[rf_chan], 0);
DLOG(INFO) << "connected labsat23_source_to sink";
}
rf_chan++;
}
}
else
{
if (dump_)
int rf_chan = 0;
for (auto it = channels_selector_vec_.begin(); it != channels_selector_vec_.end(); ++it)
{
top_block->connect(labsat23_source_, 0, file_sink_, 0);
DLOG(INFO) << "connected labsat23_source_ to sink";
}
else
{
DLOG(INFO) << "nothing to connect internally";
if (dump_)
{
top_block->connect(labsat23_source_, 0, file_sink_[rf_chan], 0);
DLOG(INFO) << "connected labsat23_source_ to sink";
}
else
{
DLOG(INFO) << "nothing to connect internally";
}
rf_chan++;
}
}
}
@@ -110,20 +176,30 @@ void LabsatSignalSource::disconnect(gr::top_block_sptr top_block)
{
if (enable_throttle_control_ == true)
{
top_block->disconnect(labsat23_source_, 0, throttle_, 0);
DLOG(INFO) << "disconnected labsat23_source_ to throttle";
if (dump_)
int rf_chan = 0;
for (const auto& th : throttle_)
{
top_block->disconnect(labsat23_source_, 0, file_sink_, 0);
DLOG(INFO) << "disconnected labsat23_source_ to sink";
top_block->disconnect(labsat23_source_, rf_chan, th, 0);
DLOG(INFO) << "disconnected labsat23_source_ to throttle";
if (dump_)
{
top_block->disconnect(labsat23_source_, rf_chan, file_sink_[rf_chan], 0);
DLOG(INFO) << "disconnected labsat23_source_ to sink";
}
rf_chan++;
}
}
else
{
if (dump_)
int rf_chan = 0;
for (auto it = channels_selector_vec_.begin(); it != channels_selector_vec_.end(); ++it)
{
top_block->disconnect(labsat23_source_, 0, file_sink_, 0);
DLOG(INFO) << "disconnected labsat23_source_ to sink";
if (dump_)
{
top_block->disconnect(labsat23_source_, rf_chan, file_sink_[rf_chan], 0);
DLOG(INFO) << "disconnected labsat23_source_ to sink";
}
rf_chan++;
}
}
}
@@ -140,7 +216,17 @@ gr::basic_block_sptr LabsatSignalSource::get_right_block()
{
if (enable_throttle_control_ == true)
{
return throttle_;
return throttle_[0];
}
return labsat23_source_;
}
gr::basic_block_sptr LabsatSignalSource::get_right_block(int i)
{
if (enable_throttle_control_ == true)
{
return throttle_[i];
}
return labsat23_source_;
}

View File

@@ -1,6 +1,6 @@
/*!
* \file labsat_signal_source.h
* \brief Labsat 2 and 3 front-end signal sampler driver
* \brief LabSat version 2, 3, and 3 Wideband format reader
* \author Javier Arribas, jarribas(at)cttc.es
*
* -----------------------------------------------------------------------------
@@ -8,7 +8,7 @@
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2021 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
@@ -27,6 +27,7 @@
#include <pmt/pmt.h>
#include <memory>
#include <string>
#include <vector>
/** \addtogroup Signal_Source
* \{ */
@@ -37,7 +38,8 @@
class ConfigurationInterface;
/*!
* \brief This class reads samples stored by a LabSat 2 or LabSat 3 device
* \brief This class reads samples stored in LabSat version 2, 3, and 3 Wideband
* format.
*/
class LabsatSignalSource : public SignalSourceBase
{
@@ -53,15 +55,18 @@ public:
return item_size_;
}
size_t getRfChannels() const override;
void connect(gr::top_block_sptr top_block) override;
void disconnect(gr::top_block_sptr top_block) override;
gr::basic_block_sptr get_left_block() override;
gr::basic_block_sptr get_right_block() override;
gr::basic_block_sptr get_right_block(int i) override;
private:
gr::block_sptr labsat23_source_;
gr::blocks::file_sink::sptr file_sink_;
gr::blocks::throttle::sptr throttle_;
std::vector<gr::blocks::file_sink::sptr> file_sink_;
std::vector<gr::blocks::throttle::sptr> throttle_;
std::vector<int> channels_selector_vec_;
std::string item_type_;
std::string filename_;

View File

@@ -1,7 +1,7 @@
/*!
* \file labsat23_source.h
*
* \brief Unpacks capture files in the Labsat 2 (ls2), Labsat 3 (ls3), or Labsat
* \brief Unpacks capture files in the LabSat 2 (ls2), LabSat 3 (ls3), or LabSat
* 3 Wideband (LS3W) formats.
* \author Javier Arribas jarribas (at) cttc.es
*
@@ -23,9 +23,11 @@
#include "gnss_block_interface.h"
#include <gnuradio/block.h>
#include <pmt/pmt.h>
#include <cstddef>
#include <cstdint>
#include <fstream>
#include <string>
#include <vector>
/** \addtogroup Signal_Source
* \{ */
@@ -39,12 +41,13 @@ using labsat23_source_sptr = gnss_shared_ptr<labsat23_source>;
labsat23_source_sptr labsat23_make_source_sptr(
const char *signal_file_basename,
int channel_selector,
const std::vector<int> &channel_selector,
Concurrent_Queue<pmt::pmt_t> *queue,
bool digital_io_enabled);
/*!
* \brief This class implements conversion between Labsat2 and 3 format byte packet samples to gr_complex
* \brief This class implements conversion between Labsat 2, 3 and 3 Wideband
* formats to gr_complex
*/
class labsat23_source : public gr::block
{
@@ -59,28 +62,29 @@ public:
private:
friend labsat23_source_sptr labsat23_make_source_sptr(
const char *signal_file_basename,
int channel_selector,
const std::vector<int> &channel_selector,
Concurrent_Queue<pmt::pmt_t> *queue,
bool digital_io_enabled);
labsat23_source(const char *signal_file_basename,
int channel_selector,
const std::vector<int> &channel_selector,
Concurrent_Queue<pmt::pmt_t> *queue,
bool digital_io_enabled);
std::string generate_filename();
int parse_header();
int getBit(uint8_t byte, int position);
int read_ls3w_ini(const std::string &filename);
int number_of_samples_per_ls3w_register() const;
void decode_samples_one_channel(int16_t input_short, gr_complex *out, int type);
void decode_ls3w_register_one_channel(uint64_t input, gr_complex *out) const;
void decode_ls3w_register(uint64_t input, std::vector<gr_complex *> &out, std::size_t output_pointer) const;
std::ifstream binary_input_file;
std::string d_signal_file_basename;
Concurrent_Queue<pmt::pmt_t> *d_queue;
int d_channel_selector_config;
std::vector<int> d_channel_selector_config;
int d_current_file_number;
uint8_t d_labsat_version;
uint8_t d_channel_selector;
@@ -90,6 +94,7 @@ private:
// Data members for Labsat 3 Wideband
std::string d_ls3w_OSC;
std::vector<int> d_ls3w_selected_channel_offset;
int64_t d_ls3w_SMP{};
int32_t d_ls3w_QUA{};
int32_t d_ls3w_CHN{};
@@ -101,7 +106,6 @@ private:
int32_t d_ls3w_BWB{};
int32_t d_ls3w_BWC{};
int d_ls3w_spare_bits{};
int d_ls3w_selected_channel_offset{};
int d_ls3w_samples_per_register{};
bool d_is_ls3w = false;
bool d_ls3w_digital_io_enabled = false;

View File

@@ -26,6 +26,7 @@
#include "display.h"
#include "galileo_almanac_helper.h" // for Galileo_Almanac_Helper
#include "galileo_ephemeris.h" // for Galileo_Ephemeris
#include "galileo_has_data.h" // For Galileo HAS messages
#include "galileo_iono.h" // for Galileo_Iono
#include "galileo_utc_model.h" // for Galileo_Utc_Model
#include "gnss_synchro.h"
@@ -512,15 +513,15 @@ void galileo_telemetry_decoder_gs::decode_CNAV_word(float *page_symbols, int32_t
// 4. If we have a new full message, read it
if (d_cnav_nav.have_new_HAS_message() == true)
{
// TODO: Retrieve data from message and send it somewhere
// Galileo_HAS_data has_data = d_cnav_nav.get_HAS_data();
if (d_cnav_nav.is_HAS_message_dummy())
if (d_cnav_nav.is_HAS_message_dummy() == true)
{
std::cout << TEXT_MAGENTA << "New Galileo E6 HAS message received in channel " << d_channel << " from satellite " << d_satellite << TEXT_RESET << '\n';
std::cout << TEXT_MAGENTA << "New Galileo E6 HAS dummy message received in channel " << d_channel << " from satellite " << d_satellite << TEXT_RESET << '\n';
}
else
{
std::cout << TEXT_MAGENTA << "New Galileo E6 HAS dummy message received in channel " << d_channel << " from satellite " << d_satellite << TEXT_RESET << '\n';
const std::shared_ptr<Galileo_HAS_data> tmp_obj = std::make_shared<Galileo_HAS_data>(d_cnav_nav.get_HAS_data());
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
std::cout << TEXT_MAGENTA << "New Galileo E6 HAS message received in channel " << d_channel << " from satellite " << d_satellite << TEXT_RESET << '\n';
}
}
}
@@ -649,7 +650,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
if (abs(corr_value) >= d_samples_per_preamble)
{
d_preamble_index = d_sample_counter; // record the preamble sample stamp
DLOG(INFO) << "Preamble detection for Galileo satellite " << this->d_satellite;
LOG(INFO) << "Preamble detection for Galileo satellite " << this->d_satellite << " in channel " << this->d_channel;
d_stat = 1; // enter into frame pre-detection status
}
}