mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-14 20:20:35 +00:00
Merge branch 'next' of https://github.com/gnss-sdr/gnss-sdr into tracking_debug
This commit is contained in:
commit
b9ca99303c
@ -100,7 +100,8 @@ include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(GROSMOSDR DEFAULT_MSG GROSMOSDR_LIBRARIES GROSMOSDR_INCLUDE_DIR)
|
||||
|
||||
if(GROSMOSDR_PKG_VERSION)
|
||||
set(GROSMOSDR_VERSION ${GROSMOSDR_PKG_VERSION})
|
||||
set(GROSMOSDR_VERSION_AUX ${GROSMOSDR_PKG_VERSION})
|
||||
string(REGEX REPLACE "^v" "" GROSMOSDR_VERSION ${GROSMOSDR_VERSION_AUX})
|
||||
endif()
|
||||
|
||||
set_package_properties(GROSMOSDR PROPERTIES
|
||||
|
@ -50,6 +50,7 @@ public:
|
||||
GOOGLE_PROTOBUF_VERIFY_VERSION;
|
||||
monitor_.New();
|
||||
}
|
||||
|
||||
~Serdes_Monitor_Pvt()
|
||||
{
|
||||
// google::protobuf::ShutdownProtobufLibrary();
|
||||
@ -94,7 +95,6 @@ public:
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
inline Monitor_Pvt readProtobuffer(const gnss_sdr::MonitorPvt& mon) //!< Deserialization
|
||||
{
|
||||
Monitor_Pvt monitor;
|
||||
|
@ -34,7 +34,7 @@
|
||||
#ifndef GNSS_SDR_HYBRID_OBSERVABLES_GS_H
|
||||
#define GNSS_SDR_HYBRID_OBSERVABLES_GS_H
|
||||
|
||||
#include <boost/circular_buffer.hpp> // for boost::curcular_buffer
|
||||
#include <boost/circular_buffer.hpp> // for boost::circular_buffer
|
||||
#include <boost/shared_ptr.hpp> // for boost::shared_ptr
|
||||
#include <gnuradio/block.h> // for block
|
||||
#include <gnuradio/types.h> // for gr_vector_int
|
||||
@ -50,8 +50,12 @@ class Gnss_circular_deque;
|
||||
|
||||
using hybrid_observables_gs_sptr = boost::shared_ptr<hybrid_observables_gs>;
|
||||
|
||||
hybrid_observables_gs_sptr
|
||||
hybrid_observables_gs_make(unsigned int nchannels_in, unsigned int nchannels_out, bool dump, bool dump_mat, std::string dump_filename);
|
||||
hybrid_observables_gs_sptr hybrid_observables_gs_make(
|
||||
unsigned int nchannels_in,
|
||||
unsigned int nchannels_out,
|
||||
bool dump,
|
||||
bool dump_mat,
|
||||
std::string dump_filename);
|
||||
|
||||
/*!
|
||||
* \brief This class implements a block that computes observables
|
||||
@ -60,38 +64,44 @@ class hybrid_observables_gs : public gr::block
|
||||
{
|
||||
public:
|
||||
~hybrid_observables_gs();
|
||||
void forecast(int noutput_items, gr_vector_int& ninput_items_required);
|
||||
int general_work(int noutput_items, gr_vector_int& ninput_items,
|
||||
gr_vector_const_void_star& input_items, gr_vector_void_star& output_items);
|
||||
void forecast(int noutput_items, gr_vector_int& ninput_items_required);
|
||||
|
||||
private:
|
||||
friend hybrid_observables_gs_sptr
|
||||
hybrid_observables_gs_make(uint32_t nchannels_in, uint32_t nchannels_out, bool dump, bool dump_mat, std::string dump_filename);
|
||||
hybrid_observables_gs(uint32_t nchannels_in, uint32_t nchannels_out, bool dump, bool dump_mat, std::string dump_filename);
|
||||
void msg_handler_pvt_to_observables(const pmt::pmt_t& msg);
|
||||
bool interpolate_data(Gnss_Synchro& out, const uint32_t& ch, const double& ti);
|
||||
bool interp_trk_obs(Gnss_Synchro& interpolated_obs, const uint32_t& ch, const uint64_t& rx_clock);
|
||||
double compute_T_rx_s(const Gnss_Synchro& a);
|
||||
void compute_pranges(std::vector<Gnss_Synchro>& data);
|
||||
void update_TOW(const std::vector<Gnss_Synchro>& data);
|
||||
int32_t save_matfile();
|
||||
friend hybrid_observables_gs_sptr hybrid_observables_gs_make(
|
||||
uint32_t nchannels_in,
|
||||
uint32_t nchannels_out,
|
||||
bool dump,
|
||||
bool dump_mat,
|
||||
std::string dump_filename);
|
||||
|
||||
//time history
|
||||
boost::circular_buffer<uint64_t> d_Rx_clock_buffer;
|
||||
//Tracking observable history
|
||||
Gnss_circular_deque<Gnss_Synchro>* d_gnss_synchro_history;
|
||||
//rx time follow GPST
|
||||
bool T_rx_TOW_set;
|
||||
hybrid_observables_gs(
|
||||
uint32_t nchannels_in,
|
||||
uint32_t nchannels_out,
|
||||
bool dump,
|
||||
bool dump_mat,
|
||||
std::string dump_filename);
|
||||
|
||||
bool T_rx_TOW_set; // rx time follow GPST
|
||||
bool d_dump;
|
||||
bool d_dump_mat;
|
||||
uint32_t T_rx_TOW_ms;
|
||||
uint32_t T_rx_remnant_to_20ms;
|
||||
uint32_t T_rx_step_ms;
|
||||
double T_rx_offset_ms;
|
||||
bool d_dump;
|
||||
bool d_dump_mat;
|
||||
uint32_t d_nchannels_in;
|
||||
uint32_t d_nchannels_out;
|
||||
double T_rx_offset_ms;
|
||||
std::string d_dump_filename;
|
||||
std::ofstream d_dump_file;
|
||||
boost::circular_buffer<uint64_t> d_Rx_clock_buffer; // time history
|
||||
Gnss_circular_deque<Gnss_Synchro>* d_gnss_synchro_history; // Tracking observable history
|
||||
void msg_handler_pvt_to_observables(const pmt::pmt_t& msg);
|
||||
double compute_T_rx_s(const Gnss_Synchro& a);
|
||||
bool interp_trk_obs(Gnss_Synchro& interpolated_obs, const uint32_t& ch, const uint64_t& rx_clock);
|
||||
void update_TOW(const std::vector<Gnss_Synchro>& data);
|
||||
void compute_pranges(std::vector<Gnss_Synchro>& data);
|
||||
int32_t save_matfile();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
#include "gnss_synchro.h"
|
||||
#include "gnss_synchro.pb.h" // file created by Protocol Buffers at compile time
|
||||
#include <cstring> // for memcpy
|
||||
#include <array>
|
||||
#include <vector>
|
||||
|
||||
|
||||
@ -52,6 +52,7 @@ public:
|
||||
GOOGLE_PROTOBUF_VERIFY_VERSION;
|
||||
observables.New();
|
||||
}
|
||||
|
||||
~Serdes_Gnss_Synchro()
|
||||
{
|
||||
google::protobuf::ShutdownProtobufLibrary();
|
||||
@ -60,21 +61,17 @@ public:
|
||||
inline std::string createProtobuffer(const std::vector<Gnss_Synchro>& vgs) //!< Serialization into a string
|
||||
{
|
||||
observables.Clear();
|
||||
|
||||
std::string data;
|
||||
for (auto gs : vgs)
|
||||
{
|
||||
gnss_sdr::GnssSynchro* obs = observables.add_observable();
|
||||
char c[2];
|
||||
c[0] = gs.System;
|
||||
c[1] = '\0';
|
||||
const std::string sys(c);
|
||||
char c = gs.System;
|
||||
const std::string sys(1, c);
|
||||
|
||||
char cc[3];
|
||||
std::array<char, 2> cc;
|
||||
cc[0] = gs.Signal[0];
|
||||
cc[1] = gs.Signal[1];
|
||||
cc[2] = '\0';
|
||||
const std::string sig(cc);
|
||||
const std::string sig(cc.cbegin(), cc.cend());
|
||||
|
||||
obs->set_system(sys);
|
||||
obs->set_signal(sig);
|
||||
@ -109,20 +106,18 @@ public:
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
inline std::vector<Gnss_Synchro> readProtobuffer(const gnss_sdr::Observables& obs) //!< Deserialization
|
||||
inline std::vector<Gnss_Synchro> readProtobuffer(const gnss_sdr::Observables& obs) const //!< Deserialization
|
||||
{
|
||||
std::vector<Gnss_Synchro> vgs;
|
||||
vgs.reserve(obs.observable_size());
|
||||
|
||||
for (int i = 0; i < obs.observable_size(); ++i)
|
||||
{
|
||||
const gnss_sdr::GnssSynchro& gs_read = obs.observable(i);
|
||||
Gnss_Synchro gs = Gnss_Synchro();
|
||||
const std::string& sys = gs_read.system();
|
||||
gs.System = *sys.c_str();
|
||||
const std::string& sig = gs_read.signal();
|
||||
std::memcpy(static_cast<void*>(gs.Signal), sig.c_str(), 3);
|
||||
gs.System = gs_read.system()[0];
|
||||
gs.Signal[0] = gs_read.signal()[0];
|
||||
gs.Signal[1] = gs_read.signal()[1];
|
||||
gs.Signal[2] = '\0';
|
||||
gs.PRN = gs_read.prn();
|
||||
gs.Channel_ID = gs_read.channel_id();
|
||||
|
||||
@ -153,6 +148,7 @@ public:
|
||||
}
|
||||
return vgs;
|
||||
}
|
||||
|
||||
private:
|
||||
gnss_sdr::Observables observables;
|
||||
};
|
||||
|
@ -95,13 +95,17 @@ TEST(Protobuf, Works)
|
||||
Gnss_Synchro gs_read = vgs_read[0];
|
||||
uint32_t prn_read = gs_read.PRN;
|
||||
uint32_t prn_read2 = vgs_read[1].PRN;
|
||||
std::string system_read(1, gs_read.System);
|
||||
std::string signal_read(gs_read.Signal);
|
||||
|
||||
// or without the need of gnss_synchro:
|
||||
int obs_size = obs.observable_size();
|
||||
uint32_t prn_read3 = obs.observable(0).prn();
|
||||
|
||||
EXPECT_EQ(prn_true, prn_read);
|
||||
EXPECT_EQ(sig, signal_read);
|
||||
EXPECT_EQ(sys, system_read);
|
||||
EXPECT_EQ(prn_true2, prn_read2);
|
||||
EXPECT_EQ(prn_true, prn_read3);
|
||||
EXPECT_EQ(prn_read, prn_read3);
|
||||
EXPECT_EQ(2, obs_size);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user