1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-15 12:40:35 +00:00

Make RINEX (nav & obs) annotation rate configurable

This commit is contained in:
Carles Fernandez 2018-06-05 21:41:13 +02:00
parent 8b72c8f940
commit a2a9fef7f7
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
3 changed files with 107 additions and 79 deletions

View File

@ -94,6 +94,8 @@ RtklibPvt::RtklibPvt(ConfigurationInterface* configuration,
{
rinex_version = 2;
}
int rinexobs_rate_ms = boost::math::lcm(configuration->property(role + ".rinexobs_rate_ms", 1000), output_rate_ms);
int rinexnav_rate_ms = boost::math::lcm(configuration->property(role + ".rinexnav_rate_ms", 6000), output_rate_ms);
// RTCM Printer settings
bool flag_rtcm_tty_port = configuration->property(role + ".flag_rtcm_tty_port", false);
@ -482,7 +484,7 @@ RtklibPvt::RtklibPvt(ConfigurationInterface* configuration,
rtkinit(&rtk, &rtklib_configuration_options);
// make PVT object
pvt_ = rtklib_make_pvt_cc(in_streams_, dump_, dump_filename_, output_rate_ms, display_rate_ms, flag_nmea_tty_port, nmea_dump_filename, nmea_dump_devname, rinex_version, flag_rtcm_server, flag_rtcm_tty_port, rtcm_tcp_port, rtcm_station_id, rtcm_msg_rate_ms, rtcm_dump_devname, type_of_receiver, rtk);
pvt_ = rtklib_make_pvt_cc(in_streams_, dump_, dump_filename_, output_rate_ms, display_rate_ms, flag_nmea_tty_port, nmea_dump_filename, nmea_dump_devname, rinex_version, rinexobs_rate_ms, rinexnav_rate_ms, flag_rtcm_server, flag_rtcm_tty_port, rtcm_tcp_port, rtcm_station_id, rtcm_msg_rate_ms, rtcm_dump_devname, type_of_receiver, rtk);
DLOG(INFO) << "pvt(" << pvt_->unique_id() << ")";
if (out_streams_ > 0)
{

View File

@ -57,6 +57,8 @@ rtklib_pvt_cc_sptr rtklib_make_pvt_cc(unsigned int nchannels,
std::string nmea_dump_filename,
std::string nmea_dump_devname,
int rinex_version,
int rinexobs_rate_ms,
int rinexnav_rate_ms,
bool flag_rtcm_server,
bool flag_rtcm_tty_port,
unsigned short rtcm_tcp_port,
@ -75,6 +77,8 @@ rtklib_pvt_cc_sptr rtklib_make_pvt_cc(unsigned int nchannels,
nmea_dump_filename,
nmea_dump_devname,
rinex_version,
rinexobs_rate_ms,
rinexnav_rate_ms,
flag_rtcm_server,
flag_rtcm_tty_port,
rtcm_tcp_port,
@ -235,11 +239,25 @@ std::map<int, Gps_Ephemeris> rtklib_pvt_cc::get_GPS_L1_ephemeris_map()
}
rtklib_pvt_cc::rtklib_pvt_cc(unsigned int nchannels, bool dump, std::string dump_filename,
int output_rate_ms, int display_rate_ms, bool flag_nmea_tty_port,
std::string nmea_dump_filename, std::string nmea_dump_devname, int rinex_version,
bool flag_rtcm_server, 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, const unsigned int type_of_receiver, rtk_t& rtk) : gr::sync_block("rtklib_pvt_cc",
rtklib_pvt_cc::rtklib_pvt_cc(unsigned int nchannels,
bool dump,
std::string dump_filename,
int output_rate_ms,
int display_rate_ms,
bool flag_nmea_tty_port,
std::string nmea_dump_filename,
std::string nmea_dump_devname,
int rinex_version,
int rinexobs_rate_ms,
int rinexnav_rate_ms,
bool flag_rtcm_server,
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,
const unsigned int type_of_receiver,
rtk_t& rtk) : gr::sync_block("rtklib_pvt_cc",
gr::io_signature::make(nchannels, nchannels, sizeof(Gnss_Synchro)),
gr::io_signature::make(0, 0, 0))
{
@ -332,6 +350,14 @@ rtklib_pvt_cc::rtklib_pvt_cc(unsigned int nchannels, bool dump, std::string dump
}
b_rtcm_writing_started = false;
// initialize RINEX printer
b_rinex_header_written = false;
b_rinex_header_updated = false;
d_rinex_version = rinex_version;
rp = std::make_shared<Rinex_Printer>(d_rinex_version);
d_rinexobs_rate_ms = rinexobs_rate_ms;
d_rinexnav_rate_ms = rinexnav_rate_ms;
d_dump_filename.append("_raw.dat");
dump_ls_pvt_filename.append("_ls_pvt.dat");
@ -340,11 +366,6 @@ rtklib_pvt_cc::rtklib_pvt_cc(unsigned int nchannels, bool dump, std::string dump
d_rx_time = 0.0;
b_rinex_header_written = false;
b_rinex_header_updated = false;
d_rinex_version = rinex_version;
rp = std::make_shared<Rinex_Printer>(d_rinex_version);
d_last_status_print_seg = 0;
// ############# ENABLE DATA FILE LOG #################
@ -473,6 +494,7 @@ rtklib_pvt_cc::~rtklib_pvt_cc()
{
LOG(WARNING) << "Failed to save GLONASS GNAV Ephemeris, map is empty";
}
if (d_dump_file.is_open() == true)
{
try
@ -495,15 +517,15 @@ bool rtklib_pvt_cc::observables_pairCompare_min(const std::pair<int, Gnss_Synchr
bool rtklib_pvt_cc::send_sys_v_ttff_msg(ttff_msgbuf ttff)
{
/* Fill Sys V message structures */
// Fill Sys V message structures
int msgsend_size;
ttff_msgbuf msg;
msg.ttff = ttff.ttff;
msgsend_size = sizeof(msg.ttff);
msg.mtype = 1; /* default message ID */
msg.mtype = 1; // default message ID
/* SEND SOLUTION OVER A MESSAGE QUEUE */
/* non-blocking Sys V message send */
// SEND SOLUTION OVER A MESSAGE QUEUE
// non-blocking Sys V message send
msgsnd(sysv_msqid, &msg, msgsend_size, IPC_NOWAIT);
return true;
}
@ -648,12 +670,12 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
{
flag_write_RTCM_MSM_output = true;
}
if (current_RX_time_ms % 1000 == 0) // TODO: Make it configurable
if (current_RX_time_ms % static_cast<unsigned int>(d_rinexobs_rate_ms) == 0)
{
flag_write_RINEX_obs_output = true;
}
if (current_RX_time_ms % 6000 == 0) // TODO: Make it configurable
if (current_RX_time_ms % static_cast<unsigned int>(d_rinexnav_rate_ms) == 0)
{
flag_write_RINEX_nav_output = true;
}
@ -2062,34 +2084,29 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
{
std::streamsize ss = std::cout.precision(); // save current precision
std::cout << TEXT_BOLD_GREEN
<< std::fixed
<< "Position at " << boost::posix_time::to_simple_string(d_ls_pvt->get_position_UTC_time())
<< std::setprecision(ss)
<< " UTC using " << d_ls_pvt->get_num_valid_observations()
<< std::setprecision(10)
<< " observations is Lat = " << d_ls_pvt->get_latitude() << " [deg], Long = " << d_ls_pvt->get_longitude()
<< std::setprecision(3)
<< std::setprecision(4)
<< " [deg], Height = " << d_ls_pvt->get_height() << " [m]" << TEXT_RESET << std::endl;
std::cout << TEXT_RED
<< std::setprecision(10)
<< "RX clock offset: " << d_ls_pvt->get_time_offset_s() << "[s]" << TEXT_RESET << std::endl;
std::cout << std::setprecision(ss);
LOG(INFO) << "RX clock offset: " << d_ls_pvt->get_time_offset_s() << "[s]";
// boost::posix_time::ptime p_time;
// gtime_t rtklib_utc_time = gpst2time(adjgpsweek(d_ls_pvt->gps_ephemeris_map.cbegin()->second.i_GPS_week), d_rx_time);
// p_time = boost::posix_time::from_time_t(rtklib_utc_time.time);
// p_time += boost::posix_time::microseconds(round(rtklib_utc_time.sec * 1e6));
// std::cout << TEXT_MAGENTA << "Observable RX time (GPST) " << boost::posix_time::to_simple_string(p_time) << TEXT_RESET << std::endl;
LOG(INFO) << "Position at " << boost::posix_time::to_simple_string(d_ls_pvt->get_position_UTC_time())
<< " UTC using " << d_ls_pvt->get_num_valid_observations() << " observations is Lat = " << d_ls_pvt->get_latitude() << " [deg], Long = " << d_ls_pvt->get_longitude()
<< " [deg], Height = " << d_ls_pvt->get_height() << " [m]";
/* std::cout << "Dilution of Precision at " << boost::posix_time::to_simple_string(d_ls_pvt->get_position_UTC_time())
<< " UTC using "<< d_ls_pvt->get_num_valid_observations()<<" observations is HDOP = " << d_ls_pvt->get_HDOP() << " VDOP = "
<< d_ls_pvt->get_VDOP() <<" TDOP = " << d_ls_pvt->get_TDOP()
<< " GDOP = " << d_ls_pvt->get_GDOP() << std::endl; */
<< " UTC using "<< d_ls_pvt->get_num_valid_observations() <<" observations is HDOP = " << d_ls_pvt->get_hdop() << " VDOP = "
<< d_ls_pvt->get_vdop()
<< " GDOP = " << d_ls_pvt->get_gdop() << std::endl; */
}
// MULTIPLEXED FILE RECORDING - Record results to file

View File

@ -62,6 +62,8 @@ rtklib_pvt_cc_sptr rtklib_make_pvt_cc(unsigned int n_channels,
std::string nmea_dump_filename,
std::string nmea_dump_devname,
int rinex_version,
int rinexobs_rate_ms,
int rinexnav_rate_ms,
bool flag_rtcm_server,
bool flag_rtcm_tty_port,
unsigned short rtcm_tcp_port,
@ -86,6 +88,8 @@ private:
std::string nmea_dump_filename,
std::string nmea_dump_devname,
int rinex_version,
int rinexobs_rate_ms,
int rinexnav_rate_ms,
bool flag_rtcm_server,
bool flag_rtcm_tty_port,
unsigned short rtcm_tcp_port,
@ -101,6 +105,9 @@ private:
bool b_rinex_header_written;
bool b_rinex_header_updated;
double d_rinex_version;
int d_rinexobs_rate_ms;
int d_rinexnav_rate_ms;
bool b_rtcm_writing_started;
int d_rtcm_MT1045_rate_ms; //!< Galileo Broadcast Ephemeris
int d_rtcm_MT1019_rate_ms; //!< GPS Broadcast Ephemeris (orbits)
@ -154,6 +161,8 @@ public:
std::string nmea_dump_filename,
std::string nmea_dump_devname,
int rinex_version,
int rinexobs_rate_ms,
int rinexnav_rate_ms,
bool flag_rtcm_server,
bool flag_rtcm_tty_port,
unsigned short rtcm_tcp_port,