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

Move back constructor to .cc file. Fix Orbital Correction block reading

This commit is contained in:
Carles Fernandez 2021-09-24 19:37:38 +02:00
parent c00c6cbb27
commit 8d3548cae9
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
5 changed files with 105 additions and 83 deletions

View File

@ -85,18 +85,18 @@ target_link_libraries(core_libs
Gnuradio::runtime
Gnuradio::pmt
protobuf::libprotobuf
algorithms_libs
core_libs_supl
core_system_parameters
pvt_libs
PRIVATE
algorithms_libs
Boost::serialization
Gflags::gflags
Glog::glog
Pugixml::pugixml
)
if(NOT USE_GENERIC_LAMBDAS)
if(USE_GENERIC_LAMBDAS AND NOT GNURADIO_USES_STD_POINTERS)
target_link_libraries(core_libs PUBLIC Boost::headers)
else()
target_link_libraries(core_libs PRIVATE Boost::headers)
@ -117,20 +117,20 @@ if(USE_GENERIC_LAMBDAS)
set(has_generic_lambdas HAS_GENERIC_LAMBDA=1)
set(no_has_generic_lambdas HAS_GENERIC_LAMBDA=0)
target_compile_definitions(core_libs
PUBLIC
PRIVATE
"$<$<COMPILE_FEATURES:cxx_generic_lambdas>:${has_generic_lambdas}>"
"$<$<NOT:$<COMPILE_FEATURES:cxx_generic_lambdas>>:${no_has_generic_lambdas}>"
)
else()
target_compile_definitions(core_libs
PUBLIC
PRIVATE
-DHAS_GENERIC_LAMBDA=0
)
endif()
if(USE_BOOST_BIND_PLACEHOLDERS)
target_compile_definitions(core_libs
PUBLIC
PRIVATE
-DUSE_BOOST_BIND_PLACEHOLDERS=1
)
endif()

View File

@ -19,15 +19,24 @@
#include "galileo_e6_has_msg_receiver.h"
#include "display.h" // for colors in terminal
#include <boost/any.hpp> // for boost::any_cast
#include <glog/logging.h> // for DLOG
#include <algorithm> // for std::find, std::count
#include <cstddef> // for size_t
#include <iterator> // for std::back_inserter
#include <sstream> // for std::stringstream
#include <stdexcept> // for std::out_of_range
#include <typeinfo> // for typeid
#include "display.h" // for colors in terminal
#include "galileo_has_page.h" // for Galileo_HAS_page
#include "gnss_sdr_make_unique.h" // for std::make_unique in C++11
#include "reed_solomon.h" // for ReedSolomon
#include <boost/any.hpp> // for boost::any_cast
#include <glog/logging.h> // for DLOG
#include <gnuradio/io_signature.h> // for gr::io_signature::make
#include <algorithm> // for std::find, std::count
#include <cstddef> // for size_t
#include <iterator> // for std::back_inserter
#include <sstream> // for std::stringstream
#include <stdexcept> // for std::out_of_range
#include <typeinfo> // for typeid
#if HAS_GENERIC_LAMBDA
#else
#include <boost/bind/bind.hpp>
#endif
galileo_e6_has_msg_receiver_sptr galileo_e6_has_msg_receiver_make()
@ -36,6 +45,52 @@ 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 from telemetry blocks
this->message_port_register_in(pmt::mp("E6_HAS_from_TLM"));
// register nav message monitor out
this->message_port_register_out(pmt::mp("Nav_msg_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 async output message port towards PVT
this->message_port_register_out(pmt::mp("E6_HAS_to_PVT"));
// initialize Reed-Solomon decoder
d_rs = std::make_unique<ReedSolomon>();
// Reserve memory for decoding matrices and received PIDs
d_C_matrix = std::vector<std::vector<std::vector<uint8_t>>>(GALILEO_CNAV_INFORMATION_VECTOR_LENGTH, std::vector<std::vector<uint8_t>>(GALILEO_CNAV_MAX_NUMBER_SYMBOLS_ENCODED_BLOCK, std::vector<uint8_t>(GALILEO_CNAV_OCTETS_IN_SUBPAGE))); // 32 x 255 x 53
d_M_matrix = std::vector<std::vector<uint8_t>>(GALILEO_CNAV_INFORMATION_VECTOR_LENGTH, std::vector<uint8_t>(GALILEO_CNAV_OCTETS_IN_SUBPAGE)); // HAS message matrix 32 x 53
d_received_pids = std::vector<std::vector<uint8_t>>(HAS_MSG_NUMBER_MESSAGE_IDS, std::vector<uint8_t>());
// Reserve memory to store masks
d_nsat_in_mask_id = std::vector<int>(HAS_MSG_NUMBER_MASK_IDS);
d_gnss_id_in_mask = std::vector<std::vector<uint8_t>>(HAS_MSG_NUMBER_MASK_IDS, std::vector<uint8_t>(HAS_MSG_NUMBER_GNSS_IDS));
d_satellite_mask = std::vector<std::vector<uint64_t>>(HAS_MSG_NUMBER_MASK_IDS, std::vector<uint64_t>(HAS_MSG_NUMBER_GNSS_IDS));
d_signal_mask = std::vector<std::vector<uint16_t>>(HAS_MSG_NUMBER_MASK_IDS, std::vector<uint16_t>(HAS_MSG_NUMBER_GNSS_IDS));
d_cell_mask_availability_flag = std::vector<std::vector<bool>>(HAS_MSG_NUMBER_MASK_IDS, std::vector<bool>(HAS_MSG_NUMBER_GNSS_IDS));
d_cell_mask = std::vector<std::vector<std::vector<std::vector<bool>>>>(HAS_MSG_NUMBER_MASK_IDS, {HAS_MSG_NUMBER_GNSS_IDS, {HAS_MSG_NUMBER_SATELLITE_IDS, std::vector<bool>(HAS_MSG_NUMBER_SIGNAL_MASKS)}});
d_nsys_in_mask = std::vector<uint8_t>(HAS_MSG_NUMBER_MASK_IDS);
d_nav_message_mask = std::vector<std::vector<uint8_t>>(HAS_MSG_NUMBER_MASK_IDS, std::vector<uint8_t>(HAS_MSG_NUMBER_GNSS_IDS));
// Initialize values for d_nav_msg_packet
d_nav_msg_packet.system = std::string("E");
d_nav_msg_packet.signal = std::string("E6");
d_nav_msg_packet.prn = 0;
d_nav_msg_packet.tow_at_current_symbol_ms = 0;
}
void galileo_e6_has_msg_receiver::set_enable_navdata_monitor(bool enable)
{
d_enable_navdata_monitor = enable;
@ -429,12 +484,12 @@ void galileo_e6_has_msg_receiver::read_MT1_body(const std::string& message_body)
d_HAS_data.delta_cross_track = std::vector<int16_t>(Nsat);
for (int i = 0; i < Nsat; i++)
{
if (d_HAS_data.gnss_id_mask[i] == HAS_MSG_GPS_SYSTEM)
if (d_HAS_data.get_gnss_id(i) == HAS_MSG_GPS_SYSTEM)
{
d_HAS_data.gnss_iod[i] = read_has_message_body_uint16(message.substr(0, HAS_MSG_IOD_GPS_LENGTH));
message = std::string(message.begin() + HAS_MSG_IOD_GPS_LENGTH, message.end());
}
if (d_HAS_data.gnss_id_mask[i] == HAS_MSG_GALILEO_SYSTEM)
if (d_HAS_data.get_gnss_id(i) == HAS_MSG_GALILEO_SYSTEM)
{
d_HAS_data.gnss_iod[i] = read_has_message_body_uint16(message.substr(0, HAS_MSG_IOD_GAL_LENGTH));
message = std::string(message.begin() + HAS_MSG_IOD_GAL_LENGTH, message.end());

View File

@ -20,33 +20,26 @@
#ifndef GNSS_SDR_GALILEO_E6_HAS_MSG_RECEIVER_H
#define GNSS_SDR_GALILEO_E6_HAS_MSG_RECEIVER_H
#include "Galileo_CNAV.h" // for GALILEO_CNAV_* and HAS_MSG_* constants
#include "galileo_has_data.h" // for Galileo_HAS_data
#include "galileo_has_page.h" // for Galileo_HAS_page
#include "gnss_block_interface.h" // for gnss_shared_ptr
#include "gnss_sdr_make_unique.h" // for std::make_unique in C++11
#include "nav_message_packet.h" // for Nav_Message_Packet
#include "reed_solomon.h" // for ReedSolomon
#include <gnuradio/block.h> // for gr::block
#include <gnuradio/io_signature.h> // for gr::io_signature::make
#include <pmt/pmt.h> // for pmt::mp
#include <bitset> // for std::bitset
#include <cstdint> // for uint8_t, ...
#include <memory> // for std::unique_ptr
#include <string> // for std::string
#include <utility> // std::pair
#include <vector> // for std::vector
#if HAS_GENERIC_LAMBDA
#else
#include <boost/bind/bind.hpp> // for boost::bind
#endif
#include "Galileo_CNAV.h" // for GALILEO_CNAV_* constants
#include "galileo_has_data.h" // for Galileo_HAS_data
#include "gnss_block_interface.h" // for gnss_shared_ptr
#include "nav_message_packet.h" // for Nav_Message_Packet
#include <gnuradio/block.h> // for gr::block
#include <pmt/pmt.h> // for pmt::pmt_t
#include <bitset>
#include <cstdint>
#include <memory> // for std::unique_ptr
#include <string>
#include <utility> // std::pair
#include <vector>
/** \addtogroup Core
* \{ */
/** \addtogroup Core_Receiver_Library
* \{ */
class Galileo_HAS_page;
class ReedSolomon;
class galileo_e6_has_msg_receiver;
using galileo_e6_has_msg_receiver_sptr = gnss_shared_ptr<galileo_e6_has_msg_receiver>;
@ -67,51 +60,7 @@ public:
private:
friend galileo_e6_has_msg_receiver_sptr galileo_e6_has_msg_receiver_make();
inline 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 from telemetry blocks
this->message_port_register_in(pmt::mp("E6_HAS_from_TLM"));
// register nav message monitor out
this->message_port_register_out(pmt::mp("Nav_msg_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 async output message port towards PVT
this->message_port_register_out(pmt::mp("E6_HAS_to_PVT"));
// initialize Reed-Solomon decoder
d_rs = std::make_unique<ReedSolomon>();
// Reserve memory for decoding matrices and received PIDs
d_C_matrix = std::vector<std::vector<std::vector<uint8_t>>>(GALILEO_CNAV_INFORMATION_VECTOR_LENGTH, std::vector<std::vector<uint8_t>>(GALILEO_CNAV_MAX_NUMBER_SYMBOLS_ENCODED_BLOCK, std::vector<uint8_t>(GALILEO_CNAV_OCTETS_IN_SUBPAGE))); // 32 x 255 x 53
d_M_matrix = std::vector<std::vector<uint8_t>>(GALILEO_CNAV_INFORMATION_VECTOR_LENGTH, std::vector<uint8_t>(GALILEO_CNAV_OCTETS_IN_SUBPAGE)); // HAS message matrix 32 x 53
d_received_pids = std::vector<std::vector<uint8_t>>(HAS_MSG_NUMBER_MESSAGE_IDS, std::vector<uint8_t>());
// Reserve memory to store masks
d_nsat_in_mask_id = std::vector<int>(HAS_MSG_NUMBER_MASK_IDS);
d_gnss_id_in_mask = std::vector<std::vector<uint8_t>>(HAS_MSG_NUMBER_MASK_IDS, std::vector<uint8_t>(HAS_MSG_NUMBER_GNSS_IDS));
d_satellite_mask = std::vector<std::vector<uint64_t>>(HAS_MSG_NUMBER_MASK_IDS, std::vector<uint64_t>(HAS_MSG_NUMBER_GNSS_IDS));
d_signal_mask = std::vector<std::vector<uint16_t>>(HAS_MSG_NUMBER_MASK_IDS, std::vector<uint16_t>(HAS_MSG_NUMBER_GNSS_IDS));
d_cell_mask_availability_flag = std::vector<std::vector<bool>>(HAS_MSG_NUMBER_MASK_IDS, std::vector<bool>(HAS_MSG_NUMBER_GNSS_IDS));
d_cell_mask = std::vector<std::vector<std::vector<std::vector<bool>>>>(HAS_MSG_NUMBER_MASK_IDS, {HAS_MSG_NUMBER_GNSS_IDS, {HAS_MSG_NUMBER_SATELLITE_IDS, std::vector<bool>(HAS_MSG_NUMBER_SIGNAL_MASKS)}});
d_nsys_in_mask = std::vector<uint8_t>(HAS_MSG_NUMBER_MASK_IDS);
d_nav_message_mask = std::vector<std::vector<uint8_t>>(HAS_MSG_NUMBER_MASK_IDS, std::vector<uint8_t>(HAS_MSG_NUMBER_GNSS_IDS));
// Initialize values for d_nav_msg_packet
d_nav_msg_packet.system = std::string("E");
d_nav_msg_packet.signal = std::string("E6");
d_nav_msg_packet.prn = 0;
d_nav_msg_packet.tow_at_current_symbol_ms = 0;
};
galileo_e6_has_msg_receiver();
void msg_handler_galileo_e6_has(const pmt::pmt_t& msg);
void process_HAS_page(const Galileo_HAS_page& has_page);
@ -137,7 +86,7 @@ private:
std::unique_ptr<ReedSolomon> d_rs;
Galileo_HAS_data d_HAS_data{};
Nav_Message_Packet d_nav_msg_packet{};
Nav_Message_Packet d_nav_msg_packet;
// Store decoding matrices and received PIDs
std::vector<std::vector<std::vector<uint8_t>>> d_C_matrix;

View File

@ -382,3 +382,20 @@ std::vector<std::string> Galileo_HAS_data::get_signals_in_mask(uint8_t nsys) con
}
return signals_in_mask;
}
uint8_t Galileo_HAS_data::get_gnss_id(int nsat) const
{
uint8_t gnss_id_ = 0;
int number_sats = 0;
for (uint8_t i = 0; i < Nsys; i++)
{
number_sats += static_cast<int>(get_PRNs_in_mask(i).size());
if (nsat < number_sats)
{
return gnss_id_mask[i];
}
}
return gnss_id_;
}

View File

@ -54,6 +54,7 @@ public:
std::vector<int> get_PRNs_in_mask(uint8_t nsys) const;
std::vector<int> get_PRNs_in_submask(uint8_t nsys) const;
std::vector<std::string> get_signals_in_mask(uint8_t nsys) const;
uint8_t get_gnss_id(int nsat) const;
mt1_header header;
uint8_t has_status;