1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-06-24 05:53:16 +00:00

Establish data path from Tlm to PVT for HAS data

This commit is contained in:
Carles Fernandez 2021-06-02 21:26:39 +02:00
parent bad7c7a529
commit deb49eeba3
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
4 changed files with 58 additions and 36 deletions

View File

@ -187,19 +187,18 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
#endif
#endif
//Galileo E6 HAS messages
// Galileo E6 HAS messages port in
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
this->set_msg_handler(pmt::mp("E6_HAS_to_PVT"),
#if HAS_GENERIC_LAMBDA
[this](auto&& PH1) { msg_handler_has_data(PH1); });
#else
#if USE_BOOST_BIND_PLACEHOLDERS
boost::bind(&rtklib_pvt_gs::msg_handler_has_data, this, boost::placeholders::_1));
#else
boost::bind(&rtklib_pvt_gs::msg_handler_has_data, this, _1));
#endif
#endif
// initialize kml_printer
const std::string kml_dump_filename = d_dump_filename;
@ -524,6 +523,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
d_beidou_dnav_iono_sptr_type_hash_code = typeid(std::shared_ptr<Beidou_Dnav_Iono>).hash_code();
d_beidou_dnav_utc_model_sptr_type_hash_code = typeid(std::shared_ptr<Beidou_Dnav_Utc_Model>).hash_code();
d_beidou_dnav_almanac_sptr_type_hash_code = typeid(std::shared_ptr<Beidou_Dnav_Almanac>).hash_code();
d_galileo_has_data_sptr_type_hash_code = typeid(std::shared_ptr<Galileo_HAS_data>).hash_code();
d_start = std::chrono::system_clock::now();
}
@ -1485,6 +1485,25 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
}
void rtklib_pvt_gs::msg_handler_has_data(const pmt::pmt_t& msg)
{
try
{
const size_t msg_type_hash_code = pmt::any_ref(msg).type().hash_code();
if (msg_type_hash_code == d_galileo_has_data_sptr_type_hash_code)
{
const auto has_data = boost::any_cast<std::shared_ptr<Galileo_HAS_data>>(pmt::any_ref(msg));
// TODO: Store HAS message
// std::cout << "HAS data received at PVT block.\n";
}
}
catch (const boost::bad_any_cast& e)
{
LOG(WARNING) << "msg_handler_telemetry Bad any_cast: " << e.what();
}
}
std::map<int, Gps_Ephemeris> rtklib_pvt_gs::get_gps_ephemeris_map() const
{
return d_internal_pvt_solver->gps_ephemeris_map;

View File

@ -133,6 +133,8 @@ private:
void msg_handler_telemetry(const pmt::pmt_t& msg);
void msg_handler_has_data(const pmt::pmt_t& msg);
void initialize_and_apply_carrier_phase_offset();
void apply_rx_clock_offset(std::map<int, Gnss_Synchro>& observables_map,
@ -224,6 +226,7 @@ private:
size_t d_beidou_dnav_iono_sptr_type_hash_code;
size_t d_beidou_dnav_utc_model_sptr_type_hash_code;
size_t d_beidou_dnav_almanac_sptr_type_hash_code;
size_t d_galileo_has_data_sptr_type_hash_code;
double d_rinex_version;
double d_rx_time;

View File

@ -1,6 +1,7 @@
/*!
* \file galileo_e6_has_msg_receiver.cc
* \brief GNU Radio block that receives asynchronous Galileo E6 HAS message sections from Galileo E6 telemetry blocks
* \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
*
* -----------------------------------------------------------------------------
@ -16,7 +17,8 @@
#include "galileo_e6_has_msg_receiver.h"
#include "galileo_has_data.h" // For Galileo HAS messages
#include "galileo_has_data.h" // for Galileo_HAS_data
#include "galileo_has_page.h" // for Galileo_HAS_page
#include <boost/any.hpp>
#include <glog/logging.h>
#include <gnuradio/gr_complex.h>
@ -40,7 +42,7 @@ galileo_e6_has_msg_receiver_sptr galileo_e6_has_msg_receiver_make()
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
// 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
@ -53,7 +55,7 @@ galileo_e6_has_msg_receiver::galileo_e6_has_msg_receiver() : gr::block("galileo_
#endif
#endif
//register Gal E6 processed HAS out
// register Gal E6 processed HAS out
this->message_port_register_out(pmt::mp("E6_HAS_to_PVT"));
}
@ -61,18 +63,16 @@ galileo_e6_has_msg_receiver::galileo_e6_has_msg_receiver() : gr::block("galileo_
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...
// 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())
if (msg_type_hash_code == typeid(std::shared_ptr<Galileo_HAS_page>).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
const auto HAS_data_obj_obj = boost::any_cast<std::shared_ptr<Galileo_HAS_page>>(pmt::any_ref(msg));
// std::cout << HAS_data_obj_obj->has_message_string << '\n';
// store / do things with the data
}
else
{
@ -84,13 +84,12 @@ void galileo_e6_has_msg_receiver::msg_handler_galileo_e6_has(const pmt::pmt_t& m
LOG(WARNING) << "channel_status_msg_receiver Bad any_cast: " << e.what();
}
//2. Trigger the HAS processing function if required
//TODO
// 2. Trigger the HAS processing function if required
// TODO
//3. Send the resulting decoded HAS data (if available) to PVT
// 3. Send the resulting decoded HAS data (if available) to PVT
//TODO: change example
Gnss_Synchro dummy;
// TODO: fill message object and send to PVT when ready
std::shared_ptr<Galileo_HAS_data> dummy{};
this->message_port_pub(pmt::mp("E6_HAS_to_PVT"), pmt::make_any(dummy));
//TODO
}

View File

@ -1,6 +1,7 @@
/*!
* \file GALILEO_E6_HAS_msg_receiver.h
* \brief GNU Radio block that receives asynchronous Galileo E6 HAS message sections from Galileo E6 telemetry blocks
* \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
*
* -----------------------------------------------------------------------------
@ -14,12 +15,11 @@
* -----------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_GALILEO_E6_HAS_MSG_RECEIVER_CC_H
#define GNSS_SDR_GALILEO_E6_HAS_MSG_RECEIVER_CC_H
#ifndef GNSS_SDR_GALILEO_E6_HAS_MSG_RECEIVER_H
#define GNSS_SDR_GALILEO_E6_HAS_MSG_RECEIVER_H
#include "gnss_block_interface.h"
#include "gnss_synchro.h"
#include "monitor_pvt.h"
#include "reed_solomon.h"
#include <gnuradio/block.h>
#include <pmt/pmt.h>
#include <map>
@ -49,9 +49,10 @@ 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);
ReedSolomon rs = ReedSolomon();
};
/** \} */
/** \} */
#endif // GNSS_SDR_GALILEO_E6_HAS_MSG_RECEIVER_CC_H
#endif // GNSS_SDR_GALILEO_E6_HAS_MSG_RECEIVER_H