mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-18 21:23:02 +00:00
Expose usage of Protocol Buffers to the configuration
This commit is contained in:
parent
b3ca9bda99
commit
6c9154aede
@ -741,6 +741,11 @@ Rtklib_Pvt::Rtklib_Pvt(ConfigurationInterface* configuration,
|
|||||||
pvt_output_parameters.monitor_enabled = configuration->property(role + ".enable_monitor", false);
|
pvt_output_parameters.monitor_enabled = configuration->property(role + ".enable_monitor", false);
|
||||||
pvt_output_parameters.udp_addresses = configuration->property(role + ".monitor_client_addresses", std::string("127.0.0.1"));
|
pvt_output_parameters.udp_addresses = configuration->property(role + ".monitor_client_addresses", std::string("127.0.0.1"));
|
||||||
pvt_output_parameters.udp_port = configuration->property(role + ".monitor_udp_port", 1234);
|
pvt_output_parameters.udp_port = configuration->property(role + ".monitor_udp_port", 1234);
|
||||||
|
pvt_output_parameters.protobuf_enabled = configuration->property(role + ".enable_protobuf", true);
|
||||||
|
if (configuration->property("Monitor.enable_protobuf", false) == true)
|
||||||
|
{
|
||||||
|
pvt_output_parameters.protobuf_enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
// Show time in local zone
|
// Show time in local zone
|
||||||
pvt_output_parameters.show_local_time_zone = configuration->property(role + ".show_local_time_zone", false);
|
pvt_output_parameters.show_local_time_zone = configuration->property(role + ".show_local_time_zone", false);
|
||||||
|
@ -347,7 +347,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
|
|||||||
std::sort(udp_addr_vec.begin(), udp_addr_vec.end());
|
std::sort(udp_addr_vec.begin(), udp_addr_vec.end());
|
||||||
udp_addr_vec.erase(std::unique(udp_addr_vec.begin(), udp_addr_vec.end()), udp_addr_vec.end());
|
udp_addr_vec.erase(std::unique(udp_addr_vec.begin(), udp_addr_vec.end()), udp_addr_vec.end());
|
||||||
|
|
||||||
udp_sink_ptr = std::unique_ptr<Monitor_Pvt_Udp_Sink>(new Monitor_Pvt_Udp_Sink(udp_addr_vec, conf_.udp_port));
|
udp_sink_ptr = std::unique_ptr<Monitor_Pvt_Udp_Sink>(new Monitor_Pvt_Udp_Sink(udp_addr_vec, conf_.udp_port, conf_.protobuf_enabled));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
|
||||||
Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(std::vector<std::string> addresses, const uint16_t& port) : socket{io_service}
|
Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(std::vector<std::string> addresses, const uint16_t& port, bool protobuf_enabled) : socket{io_service}
|
||||||
{
|
{
|
||||||
for (const auto& address : addresses)
|
for (const auto& address : addresses)
|
||||||
{
|
{
|
||||||
@ -71,14 +71,18 @@ Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(std::vector<std::string> addresses, c
|
|||||||
monitor_pvt.hdop = 0.0;
|
monitor_pvt.hdop = 0.0;
|
||||||
monitor_pvt.vdop = 0.0;
|
monitor_pvt.vdop = 0.0;
|
||||||
|
|
||||||
serdes = Serdes_Monitor_Pvt();
|
use_protobuf = protobuf_enabled;
|
||||||
|
if (use_protobuf)
|
||||||
|
{
|
||||||
|
serdes = Serdes_Monitor_Pvt();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Monitor_Pvt_Udp_Sink::write_monitor_pvt(const Monitor_Pvt& monitor_pvt, bool protobuf)
|
bool Monitor_Pvt_Udp_Sink::write_monitor_pvt(const Monitor_Pvt& monitor_pvt)
|
||||||
{
|
{
|
||||||
std::string outbound_data;
|
std::string outbound_data;
|
||||||
if (protobuf == false)
|
if (use_protobuf == false)
|
||||||
{
|
{
|
||||||
std::ostringstream archive_stream;
|
std::ostringstream archive_stream;
|
||||||
boost::archive::binary_oarchive oa{archive_stream};
|
boost::archive::binary_oarchive oa{archive_stream};
|
||||||
|
@ -39,8 +39,8 @@
|
|||||||
class Monitor_Pvt_Udp_Sink
|
class Monitor_Pvt_Udp_Sink
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Monitor_Pvt_Udp_Sink(std::vector<std::string> addresses, const uint16_t &port);
|
Monitor_Pvt_Udp_Sink(std::vector<std::string> addresses, const uint16_t &port, bool protobuf_enabled);
|
||||||
bool write_monitor_pvt(const Monitor_Pvt &monitor_pvt, bool protobuf = false);
|
bool write_monitor_pvt(const Monitor_Pvt &monitor_pvt);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
boost::asio::io_service io_service;
|
boost::asio::io_service io_service;
|
||||||
@ -49,6 +49,7 @@ private:
|
|||||||
std::vector<boost::asio::ip::udp::endpoint> endpoints;
|
std::vector<boost::asio::ip::udp::endpoint> endpoints;
|
||||||
Monitor_Pvt monitor_pvt;
|
Monitor_Pvt monitor_pvt;
|
||||||
Serdes_Monitor_Pvt serdes;
|
Serdes_Monitor_Pvt serdes;
|
||||||
|
bool use_protobuf;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,6 +69,7 @@ Pvt_Conf::Pvt_Conf()
|
|||||||
rtcm_output_file_path = std::string(".");
|
rtcm_output_file_path = std::string(".");
|
||||||
|
|
||||||
monitor_enabled = false;
|
monitor_enabled = false;
|
||||||
|
protobuf_enabled = true;
|
||||||
udp_port = 0;
|
udp_port = 0;
|
||||||
|
|
||||||
show_local_time_zone = false;
|
show_local_time_zone = false;
|
||||||
|
@ -80,6 +80,7 @@ public:
|
|||||||
std::string rtcm_output_file_path;
|
std::string rtcm_output_file_path;
|
||||||
|
|
||||||
bool monitor_enabled;
|
bool monitor_enabled;
|
||||||
|
bool protobuf_enabled;
|
||||||
std::string udp_addresses;
|
std::string udp_addresses;
|
||||||
int udp_port;
|
int udp_port;
|
||||||
|
|
||||||
|
@ -41,26 +41,29 @@
|
|||||||
gnss_synchro_monitor_sptr gnss_synchro_make_monitor(unsigned int n_channels,
|
gnss_synchro_monitor_sptr gnss_synchro_make_monitor(unsigned int n_channels,
|
||||||
int decimation_factor,
|
int decimation_factor,
|
||||||
int udp_port,
|
int udp_port,
|
||||||
const std::vector<std::string>& udp_addresses)
|
const std::vector<std::string>& udp_addresses,
|
||||||
|
bool enable_protobuf)
|
||||||
{
|
{
|
||||||
return gnss_synchro_monitor_sptr(new gnss_synchro_monitor(n_channels,
|
return gnss_synchro_monitor_sptr(new gnss_synchro_monitor(n_channels,
|
||||||
decimation_factor,
|
decimation_factor,
|
||||||
udp_port,
|
udp_port,
|
||||||
udp_addresses));
|
udp_addresses,
|
||||||
|
enable_protobuf));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
gnss_synchro_monitor::gnss_synchro_monitor(unsigned int n_channels,
|
gnss_synchro_monitor::gnss_synchro_monitor(unsigned int n_channels,
|
||||||
int decimation_factor,
|
int decimation_factor,
|
||||||
int udp_port,
|
int udp_port,
|
||||||
const std::vector<std::string>& udp_addresses) : gr::sync_block("gnss_synchro_monitor",
|
const std::vector<std::string>& udp_addresses,
|
||||||
gr::io_signature::make(n_channels, n_channels, sizeof(Gnss_Synchro)),
|
bool enable_protobuf) : gr::sync_block("gnss_synchro_monitor",
|
||||||
gr::io_signature::make(0, 0, 0))
|
gr::io_signature::make(n_channels, n_channels, sizeof(Gnss_Synchro)),
|
||||||
|
gr::io_signature::make(0, 0, 0))
|
||||||
{
|
{
|
||||||
d_decimation_factor = decimation_factor;
|
d_decimation_factor = decimation_factor;
|
||||||
d_nchannels = n_channels;
|
d_nchannels = n_channels;
|
||||||
|
|
||||||
udp_sink_ptr = std::unique_ptr<Gnss_Synchro_Udp_Sink>(new Gnss_Synchro_Udp_Sink(udp_addresses, udp_port));
|
udp_sink_ptr = std::unique_ptr<Gnss_Synchro_Udp_Sink>(new Gnss_Synchro_Udp_Sink(udp_addresses, udp_port, enable_protobuf));
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,8 @@ using gnss_synchro_monitor_sptr = boost::shared_ptr<gnss_synchro_monitor>;
|
|||||||
gnss_synchro_monitor_sptr gnss_synchro_make_monitor(unsigned int n_channels,
|
gnss_synchro_monitor_sptr gnss_synchro_make_monitor(unsigned int n_channels,
|
||||||
int decimation_factor,
|
int decimation_factor,
|
||||||
int udp_port,
|
int udp_port,
|
||||||
const std::vector<std::string>& udp_addresses);
|
const std::vector<std::string>& udp_addresses,
|
||||||
|
bool enable_protobuf);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief This class implements a monitoring block which allows sending
|
* \brief This class implements a monitoring block which allows sending
|
||||||
@ -63,12 +64,14 @@ private:
|
|||||||
friend gnss_synchro_monitor_sptr gnss_synchro_make_monitor(unsigned int n_channels,
|
friend gnss_synchro_monitor_sptr gnss_synchro_make_monitor(unsigned int n_channels,
|
||||||
int decimation_factor,
|
int decimation_factor,
|
||||||
int udp_port,
|
int udp_port,
|
||||||
const std::vector<std::string>& udp_addresses);
|
const std::vector<std::string>& udp_addresses,
|
||||||
|
bool enable_protobuf);
|
||||||
|
|
||||||
gnss_synchro_monitor(unsigned int n_channels,
|
gnss_synchro_monitor(unsigned int n_channels,
|
||||||
int decimation_factor,
|
int decimation_factor,
|
||||||
int udp_port,
|
int udp_port,
|
||||||
const std::vector<std::string>& udp_addresses);
|
const std::vector<std::string>& udp_addresses,
|
||||||
|
bool enable_protobuf);
|
||||||
|
|
||||||
unsigned int d_nchannels;
|
unsigned int d_nchannels;
|
||||||
int d_decimation_factor;
|
int d_decimation_factor;
|
||||||
|
@ -35,9 +35,13 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
Gnss_Synchro_Udp_Sink::Gnss_Synchro_Udp_Sink(std::vector<std::string> addresses, const uint16_t& port) : socket{io_service}
|
Gnss_Synchro_Udp_Sink::Gnss_Synchro_Udp_Sink(std::vector<std::string> addresses, const uint16_t& port, bool enable_protobuf) : socket{io_service}
|
||||||
{
|
{
|
||||||
serdes = Serdes_Gnss_Synchro();
|
use_protobuf = enable_protobuf;
|
||||||
|
if (enable_protobuf)
|
||||||
|
{
|
||||||
|
serdes = Serdes_Gnss_Synchro();
|
||||||
|
}
|
||||||
for (const auto& address : addresses)
|
for (const auto& address : addresses)
|
||||||
{
|
{
|
||||||
boost::asio::ip::udp::endpoint endpoint(boost::asio::ip::address::from_string(address, error), port);
|
boost::asio::ip::udp::endpoint endpoint(boost::asio::ip::address::from_string(address, error), port);
|
||||||
@ -46,10 +50,10 @@ Gnss_Synchro_Udp_Sink::Gnss_Synchro_Udp_Sink(std::vector<std::string> addresses,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Gnss_Synchro_Udp_Sink::write_gnss_synchro(const std::vector<Gnss_Synchro>& stocks, bool protocolbuffers)
|
bool Gnss_Synchro_Udp_Sink::write_gnss_synchro(const std::vector<Gnss_Synchro>& stocks)
|
||||||
{
|
{
|
||||||
std::string outbound_data;
|
std::string outbound_data;
|
||||||
if (protocolbuffers == false)
|
if (use_protobuf == false)
|
||||||
{
|
{
|
||||||
std::ostringstream archive_stream;
|
std::ostringstream archive_stream;
|
||||||
boost::archive::binary_oarchive oa{archive_stream};
|
boost::archive::binary_oarchive oa{archive_stream};
|
||||||
|
@ -48,8 +48,8 @@
|
|||||||
class Gnss_Synchro_Udp_Sink
|
class Gnss_Synchro_Udp_Sink
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Gnss_Synchro_Udp_Sink(std::vector<std::string> addresses, const uint16_t& port);
|
Gnss_Synchro_Udp_Sink(std::vector<std::string> addresses, const uint16_t& port, bool enable_protobuf);
|
||||||
bool write_gnss_synchro(const std::vector<Gnss_Synchro>& stocks, bool protocolbuffers = false);
|
bool write_gnss_synchro(const std::vector<Gnss_Synchro>& stocks);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
boost::asio::io_service io_service;
|
boost::asio::io_service io_service;
|
||||||
@ -58,6 +58,7 @@ private:
|
|||||||
std::vector<boost::asio::ip::udp::endpoint> endpoints;
|
std::vector<boost::asio::ip::udp::endpoint> endpoints;
|
||||||
std::vector<Gnss_Synchro> stocks;
|
std::vector<Gnss_Synchro> stocks;
|
||||||
Serdes_Gnss_Synchro serdes;
|
Serdes_Gnss_Synchro serdes;
|
||||||
|
bool use_protobuf;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ void GNSSFlowgraph::connect()
|
|||||||
}
|
}
|
||||||
|
|
||||||
DLOG(INFO) << "blocks connected internally";
|
DLOG(INFO) << "blocks connected internally";
|
||||||
// Signal Source (i) > Signal conditioner (i) >
|
// Signal Source (i) > Signal conditioner (i) >
|
||||||
#ifndef ENABLE_FPGA
|
#ifndef ENABLE_FPGA
|
||||||
int RF_Channels = 0;
|
int RF_Channels = 0;
|
||||||
int signal_conditioner_ID = 0;
|
int signal_conditioner_ID = 0;
|
||||||
@ -444,20 +444,20 @@ void GNSSFlowgraph::connect()
|
|||||||
// create a FIR low pass filter
|
// create a FIR low pass filter
|
||||||
std::vector<float> taps;
|
std::vector<float> taps;
|
||||||
|
|
||||||
// float beta = 7.0;
|
// float beta = 7.0;
|
||||||
// float halfband = 0.5;
|
// float halfband = 0.5;
|
||||||
// float fractional_bw = 0.4;
|
// float fractional_bw = 0.4;
|
||||||
// float rate = 1.0 / static_cast<float>(decimation);
|
// float rate = 1.0 / static_cast<float>(decimation);
|
||||||
//
|
//
|
||||||
// float trans_width = rate * (halfband - fractional_bw);
|
// float trans_width = rate * (halfband - fractional_bw);
|
||||||
// float mid_transition_band = rate * halfband - trans_width / 2.0;
|
// float mid_transition_band = rate * halfband - trans_width / 2.0;
|
||||||
//
|
//
|
||||||
// taps = gr::filter::firdes::low_pass(1.0,
|
// taps = gr::filter::firdes::low_pass(1.0,
|
||||||
// 1.0,
|
// 1.0,
|
||||||
// mid_transition_band,
|
// mid_transition_band,
|
||||||
// trans_width,
|
// trans_width,
|
||||||
// gr::filter::firdes::win_type::WIN_KAISER,
|
// gr::filter::firdes::win_type::WIN_KAISER,
|
||||||
// beta);
|
// beta);
|
||||||
|
|
||||||
taps = gr::filter::firdes::low_pass(1.0,
|
taps = gr::filter::firdes::low_pass(1.0,
|
||||||
fs,
|
fs,
|
||||||
@ -526,7 +526,6 @@ void GNSSFlowgraph::connect()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Signal Source > Signal conditioner >> Channels >> Observables
|
// Signal Source > Signal conditioner >> Channels >> Observables
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -556,6 +555,7 @@ void GNSSFlowgraph::connect()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Put channels fixed to a given satellite at the beginning of the vector, then the rest
|
// Put channels fixed to a given satellite at the beginning of the vector, then the rest
|
||||||
std::vector<unsigned int> vector_of_channels;
|
std::vector<unsigned int> vector_of_channels;
|
||||||
for (unsigned int i = 0; i < channels_count_; i++)
|
for (unsigned int i = 0; i < channels_count_; i++)
|
||||||
@ -1169,7 +1169,6 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
|
|||||||
}
|
}
|
||||||
acq_channels_count_++;
|
acq_channels_count_++;
|
||||||
DLOG(INFO) << "Channel " << ch_index << " Starting acquisition " << channels_[ch_index]->get_signal().get_satellite() << ", Signal " << channels_[ch_index]->get_signal().get_signal_str();
|
DLOG(INFO) << "Channel " << ch_index << " Starting acquisition " << channels_[ch_index]->get_signal().get_satellite() << ", Signal " << channels_[ch_index]->get_signal().get_signal_str();
|
||||||
|
|
||||||
#ifndef ENABLE_FPGA
|
#ifndef ENABLE_FPGA
|
||||||
channels_[ch_index]->start_acquisition();
|
channels_[ch_index]->start_acquisition();
|
||||||
#else
|
#else
|
||||||
@ -1704,7 +1703,11 @@ void GNSSFlowgraph::init()
|
|||||||
* Instantiate the receiver monitor block, if required
|
* Instantiate the receiver monitor block, if required
|
||||||
*/
|
*/
|
||||||
enable_monitor_ = configuration_->property("Monitor.enable_monitor", false);
|
enable_monitor_ = configuration_->property("Monitor.enable_monitor", false);
|
||||||
|
bool enable_protobuf = configuration_->property("Monitor.enable_protobuf", true);
|
||||||
|
if (configuration_->property("PVT.enable_protobuf", false) == true)
|
||||||
|
{
|
||||||
|
enable_protobuf = true;
|
||||||
|
}
|
||||||
std::string address_string = configuration_->property("Monitor.client_addresses", std::string("127.0.0.1"));
|
std::string address_string = configuration_->property("Monitor.client_addresses", std::string("127.0.0.1"));
|
||||||
std::vector<std::string> udp_addr_vec = split_string(address_string, '_');
|
std::vector<std::string> udp_addr_vec = split_string(address_string, '_');
|
||||||
std::sort(udp_addr_vec.begin(), udp_addr_vec.end());
|
std::sort(udp_addr_vec.begin(), udp_addr_vec.end());
|
||||||
@ -1715,7 +1718,7 @@ void GNSSFlowgraph::init()
|
|||||||
GnssSynchroMonitor_ = gnss_synchro_make_monitor(channels_count_,
|
GnssSynchroMonitor_ = gnss_synchro_make_monitor(channels_count_,
|
||||||
configuration_->property("Monitor.decimation_factor", 1),
|
configuration_->property("Monitor.decimation_factor", 1),
|
||||||
configuration_->property("Monitor.udp_port", 1234),
|
configuration_->property("Monitor.udp_port", 1234),
|
||||||
udp_addr_vec);
|
udp_addr_vec, enable_protobuf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user