Adding Galileo E6 HAS message transport system

This commit is contained in:
Javier Arribas 2021-06-02 17:13:46 +02:00
parent 3c74930c7d
commit 0ad8dc3efe
7 changed files with 222 additions and 0 deletions

View File

@ -186,6 +186,21 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
boost::bind(&rtklib_pvt_gs::msg_handler_telemetry, this, _1));
#endif
#endif
//Galileo E6 HAS messages
this->message_port_register_in(pmt::mp("E6_HAS_to_PVT"));
//TODO: bind the Galileo E6 HAS message input with the desired function
// this->set_msg_handler(pmt::mp("E6_HAS_to_PVT"),
//#if HAS_GENERIC_LAMBDA
// [this](auto&& PH1) { msg_handler_telemetry(PH1); });
//#else
//#if USE_BOOST_BIND_PLACEHOLDERS
// boost::bind(&rtklib_pvt_gs::msg_handler_telemetry, this, boost::placeholders::_1));
//#else
// boost::bind(&rtklib_pvt_gs::msg_handler_telemetry, this, _1));
//#endif
//#endif
// initialize kml_printer
const std::string kml_dump_filename = d_dump_filename;
d_kml_output_enabled = conf_.kml_output_enabled;

View File

@ -65,6 +65,9 @@ galileo_telemetry_decoder_gs::galileo_telemetry_decoder_gs(
this->message_port_register_out(pmt::mp("telemetry"));
// Control messages to tracking block
this->message_port_register_out(pmt::mp("telemetry_to_trk"));
//register Gal E6 messages HAS out
this->message_port_register_out(pmt::mp("E6_HAS_from_TLM"));
d_last_valid_preamble = 0;
d_sent_tlm_failed_msg = false;
d_band = '1';
@ -537,9 +540,12 @@ void galileo_telemetry_decoder_gs::decode_CNAV_word(float *page_symbols, int32_t
}
else
{
//TODO: do not send HAS data over telemetry msg port
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';
//Send HAS data to HAS processing class
this->message_port_pub(pmt::mp("E6_HAS_from_TLM"), pmt::make_any(tmp_obj));
}
}
}

View File

@ -15,6 +15,7 @@ set(CORE_LIBS_SOURCES
channel_status_msg_receiver.cc
channel_event.cc
command_event.cc
galileo_e6_has_msg_receiver.cc
)
set(CORE_LIBS_HEADERS

View File

@ -0,0 +1,96 @@
/*!
* \file galileo_e6_has_msg_receiver.cc
* \brief GNU Radio block that receives asynchronous Galileo E6 HAS message sections from Galileo E6 telemetry blocks
* \author Javier Arribas, 2021. jarribas(at)cttc.es
*
* -----------------------------------------------------------------------------
*
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2021 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
*/
#include "galileo_e6_has_msg_receiver.h"
#include "galileo_has_data.h" // For Galileo HAS messages
#include <boost/any.hpp>
#include <glog/logging.h>
#include <gnuradio/gr_complex.h>
#include <gnuradio/io_signature.h>
#include <cstddef>
#include <cstdint>
#include <typeinfo>
#include <utility>
#if HAS_GENERIC_LAMBDA
#else
#include <boost/bind/bind.hpp>
#endif
galileo_e6_has_msg_receiver_sptr galileo_e6_has_msg_receiver_make()
{
return galileo_e6_has_msg_receiver_sptr(new galileo_e6_has_msg_receiver());
}
galileo_e6_has_msg_receiver::galileo_e6_has_msg_receiver() : gr::block("galileo_e6_has_msg_receiver", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
{
//register Gal E6 HAS input message port
this->message_port_register_in(pmt::mp("E6_HAS_from_TLM"));
this->set_msg_handler(pmt::mp("E6_HAS_from_TLM"),
#if HAS_GENERIC_LAMBDA
[this](auto&& PH1) { msg_handler_galileo_e6_has(PH1); });
#else
#if USE_BOOST_BIND_PLACEHOLDERS
boost::bind(&galileo_e6_has_msg_receiver::msg_handler_galileo_e6_has, this, boost::placeholders::_1));
#else
boost::bind(&galileo_e6_has_msg_receiver::msg_handler_galileo_e6_has, this, _1));
#endif
#endif
//register Gal E6 processed HAS out
this->message_port_register_out(pmt::mp("E6_HAS_to_PVT"));
}
void galileo_e6_has_msg_receiver::msg_handler_galileo_e6_has(const pmt::pmt_t& msg)
{
gr::thread::scoped_lock lock(d_setlock); // require mutex with msg_handler_galileo_e6_has function called by the scheduler
//1. receive the PMT message and reconstruct the object...
try
{
const size_t msg_type_hash_code = pmt::any_ref(msg).type().hash_code();
//TODO: change example
// ****************** Gnss_Synchro received ************************
if (msg_type_hash_code == typeid(std::shared_ptr<Galileo_HAS_data>).hash_code())
{
const auto HAS_data_obj_obj = boost::any_cast<std::shared_ptr<Galileo_HAS_data>>(pmt::any_ref(msg));
// store/ do things with the data
}
else
{
LOG(WARNING) << "channel_status_msg_receiver unknown object type!";
}
}
catch (const boost::bad_any_cast& e)
{
LOG(WARNING) << "channel_status_msg_receiver Bad any_cast: " << e.what();
}
//2. Trigger the HAS processing function if required
//TODO
//3. Send the resulting decoded HAS data (if available) to PVT
//TODO: change example
Gnss_Synchro dummy;
this->message_port_pub(pmt::mp("E6_HAS_to_PVT"), pmt::make_any(dummy));
//TODO
}

View File

@ -0,0 +1,57 @@
/*!
* \file GALILEO_E6_HAS_msg_receiver.h
* \brief GNU Radio block that receives asynchronous Galileo E6 HAS message sections from Galileo E6 telemetry blocks
* \author Javier Arribas, 2021. jarribas(at)cttc.es
*
* -----------------------------------------------------------------------------
*
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2021 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_GALILEO_E6_HAS_MSG_RECEIVER_CC_H
#define GNSS_SDR_GALILEO_E6_HAS_MSG_RECEIVER_CC_H
#include "gnss_block_interface.h"
#include "gnss_synchro.h"
#include "monitor_pvt.h"
#include <gnuradio/block.h>
#include <pmt/pmt.h>
#include <map>
#include <memory>
/** \addtogroup Core
* \{ */
/** \addtogroup Core_Receiver_Library
* \{ */
class galileo_e6_has_msg_receiver;
using galileo_e6_has_msg_receiver_sptr = gnss_shared_ptr<galileo_e6_has_msg_receiver>;
galileo_e6_has_msg_receiver_sptr galileo_e6_has_msg_receiver_make();
/*!
* \brief GNU Radio block that receives asynchronous galileo e6 has messages from tlm blocks
*/
class galileo_e6_has_msg_receiver : public gr::block
{
public:
~galileo_e6_has_msg_receiver() = default; //!< Default destructor
private:
friend galileo_e6_has_msg_receiver_sptr galileo_e6_has_msg_receiver_make();
galileo_e6_has_msg_receiver();
void msg_handler_galileo_e6_has(const pmt::pmt_t& msg);
};
/** \} */
/** \} */
#endif // GNSS_SDR_GALILEO_E6_HAS_MSG_RECEIVER_CC_H

View File

@ -99,6 +99,8 @@ void GNSSFlowgraph::init()
channels_status_ = channel_status_msg_receiver_make();
gal_e6_has_rx_ = galileo_e6_has_msg_receiver_make();
// 1. read the number of RF front-ends available (one file_source per RF front-end)
int sources_count_deprecated = configuration_->property("Receiver.sources_count", 1);
sources_count_ = configuration_->property("GNSS-SDR.num_sources", sources_count_deprecated);
@ -443,6 +445,11 @@ int GNSSFlowgraph::connect_desktop_flowgraph()
return 1;
}
if (connect_gal_e6_has() != 0)
{
return 1;
}
// Activate acquisition in enabled channels
for (int i = 0; i < channels_count_; i++)
{
@ -1529,6 +1536,42 @@ int GNSSFlowgraph::connect_monitors()
return 0;
}
int GNSSFlowgraph::connect_gal_e6_has()
{
try
{
bool gal_e6_channels = false;
for (int i = 0; i < channels_count_; i++)
{
const std::string gnss_signal = channels_.at(i)->get_signal().get_signal_str();
std::string gnss_system;
Gnss_Signal signal_value;
switch (mapStringValues_[gnss_signal])
{
case evGAL_E6:
top_block_->msg_connect(channels_.at(i)->get_right_block(), pmt::mp("E6_HAS_from_TLM"), gal_e6_has_rx_, pmt::mp("E6_HAS_from_TLM"));
gal_e6_channels = true;
break;
default:
break;
}
}
if (gal_e6_channels == true)
{
top_block_->msg_connect(gal_e6_has_rx_, pmt::mp("E6_HAS_to_PVT"), pvt_->get_left_block(), pmt::mp("E6_HAS_to_PVT"));
}
}
catch (const std::exception& e)
{
LOG(ERROR) << "Can't connect Galileo E6 HAS msg ports: " << e.what();
top_block_->disconnect_all();
return 1;
}
DLOG(INFO) << "Galileo E6 HAS message ports connected";
return 0;
}
int GNSSFlowgraph::disconnect_monitors()
{

View File

@ -26,6 +26,7 @@
#include "channel_status_msg_receiver.h"
#include "concurrent_queue.h"
#include "galileo_e6_has_msg_receiver.h"
#include "gnss_sdr_sample_counter.h"
#include "gnss_signal.h"
#include "pvt_interface.h"
@ -176,6 +177,7 @@ private:
int connect_channels_to_observables();
int connect_observables_to_pvt();
int connect_monitors();
int connect_gal_e6_has();
int connect_gnss_synchro_monitor();
int connect_acquisition_monitor();
int connect_tracking_monitor();
@ -244,6 +246,8 @@ private:
gr::basic_block_sptr GnssSynchroAcquisitionMonitor_;
gr::basic_block_sptr GnssSynchroTrackingMonitor_;
channel_status_msg_receiver_sptr channels_status_; // class that receives and stores the current status of the receiver channels
galileo_e6_has_msg_receiver_sptr gal_e6_has_rx_;
gnss_sdr_sample_counter_sptr ch_out_sample_counter_;
#if ENABLE_FPGA
gnss_sdr_fpga_sample_counter_sptr ch_out_fpga_sample_counter_;