mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-13 02:40:32 +00:00
Exposing RTCM message rate to the configuration
This commit is contained in:
parent
37215a66ad
commit
818e09536b
@ -35,6 +35,7 @@
|
||||
#include <glog/logging.h>
|
||||
#include <boost/archive/xml_oarchive.hpp>
|
||||
#include <boost/archive/xml_iarchive.hpp>
|
||||
#include <boost/math/common_factor_rt.hpp>
|
||||
#include <boost/serialization/map.hpp>
|
||||
#include "configuration_interface.h"
|
||||
|
||||
@ -57,48 +58,53 @@ GpsL1CaPvt::GpsL1CaPvt(ConfigurationInterface* configuration,
|
||||
dump_ = configuration->property(role + ".dump", false);
|
||||
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename);
|
||||
// moving average depth parameters
|
||||
int averaging_depth;
|
||||
averaging_depth = configuration->property(role + ".averaging_depth", 10);
|
||||
bool flag_averaging;
|
||||
flag_averaging = configuration->property(role + ".flag_averaging", false);
|
||||
int averaging_depth = configuration->property(role + ".averaging_depth", 10);
|
||||
bool flag_averaging = configuration->property(role + ".flag_averaging", false);
|
||||
|
||||
// output rate
|
||||
int output_rate_ms;
|
||||
output_rate_ms = configuration->property(role + ".output_rate_ms", 500);
|
||||
int output_rate_ms = configuration->property(role + ".output_rate_ms", 500);
|
||||
|
||||
// display rate
|
||||
int display_rate_ms;
|
||||
display_rate_ms = configuration->property(role + ".display_rate_ms", 500);
|
||||
int display_rate_ms = configuration->property(role + ".display_rate_ms", 500);
|
||||
|
||||
// NMEA Printer settings
|
||||
bool flag_nmea_tty_port;
|
||||
flag_nmea_tty_port = configuration->property(role + ".flag_nmea_tty_port", false);
|
||||
std::string nmea_dump_filename;
|
||||
nmea_dump_filename = configuration->property(role + ".nmea_dump_filename", default_nmea_dump_filename);
|
||||
std::string nmea_dump_devname;
|
||||
nmea_dump_devname = configuration->property(role + ".nmea_dump_devname", default_nmea_dump_devname);
|
||||
bool flag_nmea_tty_port = configuration->property(role + ".flag_nmea_tty_port", false);
|
||||
std::string nmea_dump_filename = configuration->property(role + ".nmea_dump_filename", default_nmea_dump_filename);
|
||||
std::string nmea_dump_devname = configuration->property(role + ".nmea_dump_devname", default_nmea_dump_devname);
|
||||
|
||||
// RTCM Printer settings
|
||||
bool flag_rtcm_tty_port;
|
||||
flag_rtcm_tty_port = configuration->property(role + ".flag_rtcm_tty_port", false);
|
||||
std::string rtcm_dump_devname;
|
||||
rtcm_dump_devname = configuration->property(role + ".rtcm_dump_devname", default_rtcm_dump_devname);
|
||||
bool flag_rtcm_server;
|
||||
flag_rtcm_server = configuration->property(role + ".flag_rtcm_server", false);
|
||||
bool flag_rtcm_tty_port = configuration->property(role + ".flag_rtcm_tty_port", false);
|
||||
std::string rtcm_dump_devname = configuration->property(role + ".rtcm_dump_devname", default_rtcm_dump_devname);
|
||||
bool flag_rtcm_server = configuration->property(role + ".flag_rtcm_server", false);
|
||||
unsigned short rtcm_tcp_port = configuration->property(role + ".rtcm_tcp_port", 2101);
|
||||
unsigned short rtcm_station_id = configuration->property(role + ".rtcm_station_id", 1234);
|
||||
// RTCM message rates: least common multiple with output_rate_ms
|
||||
int rtcm_MT1019_rate_ms = boost::math::lcm(configuration->property(role + ".rtcm_MT1019_rate_ms", 5000), output_rate_ms);
|
||||
int rtcm_MSM_rate_ms = boost::math::lcm(configuration->property(role + ".rtcm_MSM_rate_ms", 1000), output_rate_ms);
|
||||
std::map<int,int> rtcm_msg_rate_ms;
|
||||
rtcm_msg_rate_ms[1019] = rtcm_MT1019_rate_ms;
|
||||
for (int k = 1071; k < 1078; k++) // All GPS MSM
|
||||
{
|
||||
rtcm_msg_rate_ms[k] = rtcm_MSM_rate_ms;
|
||||
}
|
||||
|
||||
// getting names from the config file, if available
|
||||
// default filename for assistance data
|
||||
const std::string eph_default_xml_filename = "./gps_ephemeris.xml";
|
||||
eph_xml_filename_= configuration->property("GNSS-SDR.SUPL_gps_ephemeris_xml", eph_default_xml_filename);
|
||||
|
||||
//const std::string utc_default_xml_filename = "./gps_utc_model.xml";
|
||||
//const std::string iono_default_xml_filename = "./gps_iono.xml";
|
||||
//const std::string ref_time_default_xml_filename = "./gps_ref_time.xml";
|
||||
//const std::string ref_location_default_xml_filename = "./gps_ref_location.xml";
|
||||
eph_xml_filename_= configuration->property("GNSS-SDR.SUPL_gps_ephemeris_xml", eph_default_xml_filename);
|
||||
|
||||
//std::string utc_xml_filename = configuration_->property("GNSS-SDR.SUPL_gps_utc_model.xml", utc_default_xml_filename);
|
||||
//std::string iono_xml_filename = configuration_->property("GNSS-SDR.SUPL_gps_iono_xml", iono_default_xml_filename);
|
||||
//std::string ref_time_xml_filename = configuration_->property("GNSS-SDR.SUPL_gps_ref_time_xml", ref_time_default_xml_filename);
|
||||
//std::string ref_location_xml_filename = configuration_->property("GNSS-SDR.SUPL_gps_ref_location_xml", ref_location_default_xml_filename);
|
||||
|
||||
// make PVT object
|
||||
pvt_ = gps_l1_ca_make_pvt_cc(in_streams_, dump_, dump_filename_, averaging_depth, flag_averaging, output_rate_ms, display_rate_ms, flag_nmea_tty_port, nmea_dump_filename, nmea_dump_devname, flag_rtcm_server, flag_rtcm_tty_port, rtcm_tcp_port, rtcm_station_id, rtcm_dump_devname );
|
||||
pvt_ = gps_l1_ca_make_pvt_cc(in_streams_, dump_, dump_filename_, averaging_depth, flag_averaging, output_rate_ms, display_rate_ms, flag_nmea_tty_port, nmea_dump_filename, nmea_dump_devname, flag_rtcm_server, flag_rtcm_tty_port, rtcm_tcp_port, rtcm_station_id, rtcm_msg_rate_ms, rtcm_dump_devname );
|
||||
DLOG(INFO) << "pvt(" << pvt_->unique_id() << ")";
|
||||
}
|
||||
|
||||
|
@ -56,6 +56,7 @@ gps_l1_ca_make_pvt_cc(unsigned int nchannels,
|
||||
bool flag_rtcm_tty_port,
|
||||
unsigned short rtcm_tcp_port,
|
||||
unsigned short rtcm_station_id,
|
||||
std::map<int,int> rtcm_msg_rate_ms,
|
||||
std::string rtcm_dump_devname)
|
||||
{
|
||||
return gps_l1_ca_pvt_cc_sptr(new gps_l1_ca_pvt_cc(nchannels,
|
||||
@ -72,6 +73,7 @@ gps_l1_ca_make_pvt_cc(unsigned int nchannels,
|
||||
flag_rtcm_tty_port,
|
||||
rtcm_tcp_port,
|
||||
rtcm_station_id,
|
||||
rtcm_msg_rate_ms,
|
||||
rtcm_dump_devname));
|
||||
}
|
||||
|
||||
@ -189,6 +191,7 @@ gps_l1_ca_pvt_cc::gps_l1_ca_pvt_cc(unsigned int nchannels,
|
||||
bool flag_rtcm_tty_port,
|
||||
unsigned short rtcm_tcp_port,
|
||||
unsigned short rtcm_station_id,
|
||||
std::map<int,int> rtcm_msg_rate_ms,
|
||||
std::string rtcm_dump_devname) :
|
||||
gr::block("gps_l1_ca_pvt_cc", gr::io_signature::make(nchannels, nchannels, sizeof(Gnss_Synchro)),
|
||||
gr::io_signature::make(0, 0, sizeof(gr_complex)) )
|
||||
@ -226,6 +229,22 @@ gps_l1_ca_pvt_cc::gps_l1_ca_pvt_cc(unsigned int nchannels,
|
||||
d_rtcm_tcp_port = rtcm_tcp_port;
|
||||
d_rtcm_station_id = rtcm_station_id;
|
||||
d_rtcm_printer = std::make_shared<Rtcm_Printer>(rtcm_dump_filename, flag_rtcm_server, flag_rtcm_tty_port, d_rtcm_tcp_port, d_rtcm_station_id, rtcm_dump_devname);
|
||||
if(rtcm_msg_rate_ms.find(1019) != rtcm_msg_rate_ms.end())
|
||||
{
|
||||
d_rtcm_MT1019_rate_ms = rtcm_msg_rate_ms[1019];
|
||||
}
|
||||
else
|
||||
{
|
||||
d_rtcm_MT1019_rate_ms = 5000; // default value if not set
|
||||
}
|
||||
if(rtcm_msg_rate_ms.find(1071) != rtcm_msg_rate_ms.end()) // whatever between 1071 and 1077
|
||||
{
|
||||
d_rtcm_MSM_rate_ms = rtcm_msg_rate_ms[1071];
|
||||
}
|
||||
else
|
||||
{
|
||||
d_rtcm_MSM_rate_ms = 1000; // default value if not set
|
||||
}
|
||||
b_rtcm_writing_started = false;
|
||||
|
||||
d_dump_filename.append("_raw.dat");
|
||||
@ -266,6 +285,7 @@ gps_l1_ca_pvt_cc::gps_l1_ca_pvt_cc(unsigned int nchannels,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
gps_l1_ca_pvt_cc::~gps_l1_ca_pvt_cc()
|
||||
{}
|
||||
|
||||
@ -367,14 +387,14 @@ int gps_l1_ca_pvt_cc::general_work (int noutput_items __attribute__((unused)), g
|
||||
}
|
||||
if(b_rtcm_writing_started)
|
||||
{
|
||||
if((d_sample_counter % 5000) == 0)
|
||||
if((d_sample_counter % d_rtcm_MT1019_rate_ms) == 0)
|
||||
{
|
||||
for(std::map<int,Gps_Ephemeris>::iterator gps_ephemeris_iter = d_ls_pvt->gps_ephemeris_map.begin(); gps_ephemeris_iter != d_ls_pvt->gps_ephemeris_map.end(); gps_ephemeris_iter++ )
|
||||
{
|
||||
d_rtcm_printer->Print_Rtcm_MT1019(gps_ephemeris_iter->second);
|
||||
}
|
||||
}
|
||||
if((d_sample_counter % 1000) == 0)
|
||||
if((d_sample_counter % d_rtcm_MSM_rate_ms) == 0)
|
||||
{
|
||||
std::map<int,Gps_Ephemeris>::iterator gps_ephemeris_iter;
|
||||
gps_ephemeris_iter = d_ls_pvt->gps_ephemeris_map.begin();
|
||||
|
@ -59,6 +59,7 @@ gps_l1_ca_pvt_cc_sptr gps_l1_ca_make_pvt_cc(unsigned int n_channels,
|
||||
bool flag_rtcm_tty_port,
|
||||
unsigned short rtcm_tcp_port,
|
||||
unsigned short rtcm_station_id,
|
||||
std::map<int,int> rtcm_msg_rate_ms,
|
||||
std::string rtcm_dump_devname
|
||||
);
|
||||
|
||||
@ -82,6 +83,7 @@ private:
|
||||
bool flag_rtcm_tty_port,
|
||||
unsigned short rtcm_tcp_port,
|
||||
unsigned short rtcm_station_id,
|
||||
std::map<int,int> rtcm_msg_rate_ms,
|
||||
std::string rtcm_dump_devname);
|
||||
gps_l1_ca_pvt_cc(unsigned int nchannels,
|
||||
bool dump,
|
||||
@ -97,6 +99,7 @@ private:
|
||||
bool flag_rtcm_tty_port,
|
||||
unsigned short rtcm_tcp_port,
|
||||
unsigned short rtcm_station_id,
|
||||
std::map<int,int> rtcm_msg_rate_ms,
|
||||
std::string rtcm_dump_devname);
|
||||
|
||||
void msg_handler_telemetry(pmt::pmt_t msg);
|
||||
@ -108,6 +111,8 @@ private:
|
||||
bool b_rtcm_writing_started;
|
||||
unsigned short d_rtcm_tcp_port;
|
||||
unsigned short d_rtcm_station_id;
|
||||
int d_rtcm_MT1019_rate_ms;
|
||||
int d_rtcm_MSM_rate_ms;
|
||||
|
||||
void print_receiver_status(Gnss_Synchro** channels_synchronization_data);
|
||||
int d_last_status_print_seg; //for status printer
|
||||
|
@ -58,6 +58,7 @@ public:
|
||||
virtual long property(std::string property_name, long default_value) = 0;
|
||||
virtual int property(std::string property_name, int default_value) = 0;
|
||||
virtual unsigned int property(std::string property_name, unsigned int default_value) = 0;
|
||||
virtual unsigned short property(std::string property_name, unsigned short default_value) = 0;
|
||||
virtual float property(std::string property_name, float default_value) = 0;
|
||||
virtual double property(std::string property_name, double default_value) = 0;
|
||||
virtual void set_property(std::string property_name, std::string value) = 0;
|
||||
|
@ -113,6 +113,22 @@ unsigned int StringConverter::convert(const std::string& value, unsigned int def
|
||||
}
|
||||
|
||||
|
||||
unsigned short StringConverter::convert(const std::string& value, unsigned short default_value)
|
||||
{
|
||||
std::stringstream stream(value);
|
||||
|
||||
unsigned short result;
|
||||
stream >> result;
|
||||
|
||||
if(stream.fail())
|
||||
{
|
||||
return default_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
float StringConverter::convert(const std::string& value, float default_value)
|
||||
|
@ -49,6 +49,7 @@ public:
|
||||
long convert(const std::string& value, long default_value);
|
||||
int convert(const std::string& value, int default_value);
|
||||
unsigned int convert(const std::string& value, unsigned int default_value);
|
||||
unsigned short convert(const std::string& value, unsigned short default_value);
|
||||
float convert(const std::string& value, float default_value);
|
||||
double convert(const std::string& value, double default_value);
|
||||
};
|
||||
|
@ -134,6 +134,21 @@ unsigned int FileConfiguration::property(std::string property_name, unsigned int
|
||||
|
||||
|
||||
|
||||
unsigned short FileConfiguration::property(std::string property_name, unsigned short default_value)
|
||||
{
|
||||
if(overrided_->is_present(property_name))
|
||||
{
|
||||
return overrided_->property(property_name, default_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string empty = "";
|
||||
return converter_->convert(property(property_name, empty), default_value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
float FileConfiguration::property(std::string property_name, float default_value)
|
||||
{
|
||||
if(overrided_->is_present(property_name))
|
||||
|
@ -66,6 +66,7 @@ public:
|
||||
long property(std::string property_name, long default_value);
|
||||
int property(std::string property_name, int default_value);
|
||||
unsigned int property(std::string property_name, unsigned int default_value);
|
||||
unsigned short property(std::string property_name, unsigned short default_value);
|
||||
float property(std::string property_name, float default_value);
|
||||
double property(std::string property_name, double default_value);
|
||||
void set_property(std::string property_name, std::string value);
|
||||
|
@ -87,6 +87,13 @@ unsigned int InMemoryConfiguration::property(std::string property_name, unsigned
|
||||
}
|
||||
|
||||
|
||||
unsigned short InMemoryConfiguration::property(std::string property_name, unsigned short default_value)
|
||||
{
|
||||
std::string empty = "";
|
||||
return converter_->convert(property(property_name, empty), default_value);
|
||||
}
|
||||
|
||||
|
||||
float InMemoryConfiguration::property(std::string property_name, float default_value)
|
||||
{
|
||||
std::string empty = "";
|
||||
|
@ -59,6 +59,7 @@ public:
|
||||
long property(std::string property_name, long default_value);
|
||||
int property(std::string property_name, int default_value);
|
||||
unsigned int property(std::string property_name, unsigned int default_value);
|
||||
unsigned short property(std::string property_name, unsigned short default_value);
|
||||
float property(std::string property_name, float default_value);
|
||||
double property(std::string property_name, double default_value);
|
||||
void set_property(std::string property_name, std::string value);
|
||||
|
Loading…
Reference in New Issue
Block a user