More telemetry global queues migration to GNURadio asynchronous messages

and
some
code cleaning
This commit is contained in:
Javier Arribas 2016-04-13 16:19:15 +02:00
parent b56183f93b
commit 7560a158f0
15 changed files with 144 additions and 306 deletions

View File

@ -83,12 +83,14 @@ void galileo_e1_pvt_cc::msg_handler_telemetry(pmt::pmt_t msg)
// update/insert new ephemeris record to the global ephemeris map // update/insert new ephemeris record to the global ephemeris map
d_ls_pvt->galileo_almanac=*galileo_almanac; d_ls_pvt->galileo_almanac=*galileo_almanac;
DLOG(INFO) << "New Galileo Almanac has arrived "; DLOG(INFO) << "New Galileo Almanac has arrived ";
}else{
LOG(WARNING) << "msg_handler_telemetry unknown object type!";
} }
} }
catch(boost::bad_any_cast& e) catch(boost::bad_any_cast& e)
{ {
DLOG(WARNING) << "msg_handler_telemetry Bad any cast!\n"; LOG(WARNING) << "msg_handler_telemetry Bad any cast!\n";
} }
} }
galileo_e1_pvt_cc::galileo_e1_pvt_cc(unsigned int nchannels, boost::shared_ptr<gr::msg_queue> queue, bool dump, std::string dump_filename, int averaging_depth, bool flag_averaging, int output_rate_ms, int display_rate_ms, bool flag_nmea_tty_port, std::string nmea_dump_filename, std::string nmea_dump_devname, bool flag_rtcm_server, bool flag_rtcm_tty_port, std::string rtcm_dump_devname) : galileo_e1_pvt_cc::galileo_e1_pvt_cc(unsigned int nchannels, boost::shared_ptr<gr::msg_queue> queue, bool dump, std::string dump_filename, int averaging_depth, bool flag_averaging, int output_rate_ms, int display_rate_ms, bool flag_nmea_tty_port, std::string nmea_dump_filename, std::string nmea_dump_devname, bool flag_rtcm_server, bool flag_rtcm_tty_port, std::string rtcm_dump_devname) :

View File

@ -128,12 +128,14 @@ void gps_l1_ca_pvt_cc::msg_handler_telemetry(pmt::pmt_t msg)
{ {
rp->log_rinex_sbs(rp->sbsFile, sbas_raw_msg); rp->log_rinex_sbs(rp->sbsFile, sbas_raw_msg);
} }
}else{
LOG(WARNING) << "msg_handler_telemetry unknown object type!";
} }
} }
catch(boost::bad_any_cast& e) catch(boost::bad_any_cast& e)
{ {
DLOG(WARNING) << "msg_handler_telemetry Bad any cast!\n"; LOG(WARNING) << "msg_handler_telemetry Bad any cast!\n";
} }
} }

View File

@ -116,12 +116,14 @@ void hybrid_pvt_cc::msg_handler_telemetry(pmt::pmt_t msg)
// update/insert new ephemeris record to the global ephemeris map // update/insert new ephemeris record to the global ephemeris map
d_ls_pvt->galileo_almanac=*galileo_almanac; d_ls_pvt->galileo_almanac=*galileo_almanac;
DLOG(INFO) << "New Galileo Almanac has arrived "; DLOG(INFO) << "New Galileo Almanac has arrived ";
}else{
LOG(WARNING) << "msg_handler_telemetry unknown object type!";
} }
} }
catch(boost::bad_any_cast& e) catch(boost::bad_any_cast& e)
{ {
DLOG(WARNING) << "msg_handler_telemetry Bad any cast!\n"; LOG(WARNING) << "msg_handler_telemetry Bad any cast!";
} }
} }

View File

@ -250,28 +250,25 @@ void galileo_e1b_telemetry_decoder_cc::decode_word(double *page_part_symbols,int
if (d_nav.have_new_ephemeris() == true) if (d_nav.have_new_ephemeris() == true)
{ {
// get object for this SV (mandatory) // get object for this SV (mandatory)
std::shared_ptr<Galileo_Ephemeris> tmp_obj= std::make_shared<Galileo_Ephemeris>(); std::shared_ptr<Galileo_Ephemeris> tmp_obj= std::make_shared<Galileo_Ephemeris>( d_nav.get_ephemeris());
*tmp_obj = d_nav.get_ephemeris();//notice that the read operation will clear the valid flag
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
} }
if (d_nav.have_new_iono_and_GST() == true) if (d_nav.have_new_iono_and_GST() == true)
{ {
// get object for this SV (mandatory) // get object for this SV (mandatory)
std::shared_ptr<Galileo_Iono> tmp_obj= std::make_shared<Galileo_Iono>(); std::shared_ptr<Galileo_Iono> tmp_obj= std::make_shared<Galileo_Iono>(d_nav.get_iono());
*tmp_obj = d_nav.get_iono(); //notice that the read operation will clear the valid flag
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
} }
if (d_nav.have_new_utc_model() == true) if (d_nav.have_new_utc_model() == true)
{ {
// get object for this SV (mandatory) // get object for this SV (mandatory)
std::shared_ptr<Galileo_Utc_Model> tmp_obj= std::make_shared<Galileo_Utc_Model>(); std::shared_ptr<Galileo_Utc_Model> tmp_obj= std::make_shared<Galileo_Utc_Model>(d_nav.get_utc_model());
*tmp_obj = d_nav.get_utc_model(); //notice that the read operation will clear the valid flag
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
} }
if (d_nav.have_new_almanac() == true) if (d_nav.have_new_almanac() == true)
{ {
std::shared_ptr<Galileo_Almanac> tmp_obj= std::make_shared<Galileo_Almanac>(); std::shared_ptr<Galileo_Almanac> tmp_obj= std::make_shared<Galileo_Almanac>(d_nav.get_almanac());
*tmp_obj = d_nav.get_almanac();
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
//debug //debug
std::cout << "Galileo almanac received!" << std::endl; std::cout << "Galileo almanac received!" << std::endl;

View File

@ -170,22 +170,18 @@ void galileo_e5a_telemetry_decoder_cc::decode_word(double *page_symbols,int fram
// 4. Push the new navigation data to the queues // 4. Push the new navigation data to the queues
if (d_nav.have_new_ephemeris() == true) if (d_nav.have_new_ephemeris() == true)
{ {
// get ephemeris object for this SV std::shared_ptr<Galileo_Ephemeris> tmp_obj= std::make_shared<Galileo_Ephemeris>(d_nav.get_ephemeris());
Galileo_Ephemeris ephemeris = d_nav.get_ephemeris();//notice that the read operation will clear the valid flag this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
//std::cout<<"New Galileo Ephemeris received for SV "<<d_satellite.get_PRN()<<std::endl;
d_ephemeris_queue->push(ephemeris);
} }
if (d_nav.have_new_iono_and_GST() == true) if (d_nav.have_new_iono_and_GST() == true)
{ {
Galileo_Iono iono = d_nav.get_iono(); //notice that the read operation will clear the valid flag std::shared_ptr<Galileo_Iono> tmp_obj= std::make_shared<Galileo_Iono>(d_nav.get_iono());
//std::cout<<"New Galileo IONO model (and UTC) received for SV "<<d_satellite.get_PRN()<<std::endl; this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
d_iono_queue->push(iono);
} }
if (d_nav.have_new_utc_model() == true) if (d_nav.have_new_utc_model() == true)
{ {
Galileo_Utc_Model utc_model = d_nav.get_utc_model(); //notice that the read operation will clear the valid flag std::shared_ptr<Galileo_Utc_Model> tmp_obj= std::make_shared<Galileo_Utc_Model>(d_nav.get_utc_model());
//std::cout<<"New Galileo UTC model received for SV "<<d_satellite.get_PRN()<<std::endl; this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
d_utc_model_queue->push(utc_model);
} }
} }
@ -260,10 +256,6 @@ galileo_e5a_telemetry_decoder_cc::galileo_e5a_telemetry_decoder_cc(
d_sign_init = 0; d_sign_init = 0;
d_flag_preamble = false; d_flag_preamble = false;
d_ephemeris_queue = 0;
d_iono_queue = 0;
d_utc_model_queue = 0;
d_almanac_queue = 0;
d_channel = 0; d_channel = 0;
Prn_timestamp_at_preamble_ms = 0; Prn_timestamp_at_preamble_ms = 0;
flag_TOW_set = false; flag_TOW_set = false;
@ -612,27 +604,3 @@ void galileo_e5a_telemetry_decoder_cc::set_channel(int channel)
} }
} }
} }
void galileo_e5a_telemetry_decoder_cc::set_ephemeris_queue(concurrent_queue<Galileo_Ephemeris> *ephemeris_queue)
{
d_ephemeris_queue = ephemeris_queue;
}
void galileo_e5a_telemetry_decoder_cc::set_iono_queue(concurrent_queue<Galileo_Iono> *iono_queue)
{
d_iono_queue = iono_queue;
}
void galileo_e5a_telemetry_decoder_cc::set_almanac_queue(concurrent_queue<Galileo_Almanac> *almanac_queue)
{
d_almanac_queue = almanac_queue;
}
void galileo_e5a_telemetry_decoder_cc::set_utc_model_queue(concurrent_queue<Galileo_Utc_Model> *utc_model_queue)
{
d_utc_model_queue = utc_model_queue;
}

View File

@ -68,10 +68,6 @@ public:
~galileo_e5a_telemetry_decoder_cc(); ~galileo_e5a_telemetry_decoder_cc();
void set_satellite(Gnss_Satellite satellite); //!< Set satellite PRN void set_satellite(Gnss_Satellite satellite); //!< Set satellite PRN
void set_channel(int channel); //!< Set receiver's channel void set_channel(int channel); //!< Set receiver's channel
void set_ephemeris_queue(concurrent_queue<Galileo_Ephemeris> *ephemeris_queue); //!< Set the satellite data queue
void set_iono_queue(concurrent_queue<Galileo_Iono> *iono_queue); //!< Set the iono data queue
void set_almanac_queue(concurrent_queue<Galileo_Almanac> *almanac_queue); //!< Set the almanac data queue
void set_utc_model_queue(concurrent_queue<Galileo_Utc_Model> *utc_model_queue); //!< Set the UTC model queue
/*! /*!
* \brief This is where all signal processing takes place * \brief This is where all signal processing takes place
*/ */
@ -117,15 +113,6 @@ private:
// navigation message vars // navigation message vars
Galileo_Fnav_Message d_nav; Galileo_Fnav_Message d_nav;
// Galileo ephemeris queue
concurrent_queue<Galileo_Ephemeris> *d_ephemeris_queue;
// ionospheric parameters queue
concurrent_queue<Galileo_Iono> *d_iono_queue;
// UTC model parameters queue
concurrent_queue<Galileo_Utc_Model> *d_utc_model_queue;
// Almanac queue
concurrent_queue<Galileo_Almanac> *d_almanac_queue;
boost::shared_ptr<gr::msg_queue> d_queue; boost::shared_ptr<gr::msg_queue> d_queue;
bool d_dump; bool d_dump;
Gnss_Satellite d_satellite; Gnss_Satellite d_satellite;

View File

@ -281,22 +281,19 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attribute_
if (d_GPS_FSM.d_nav.satellite_validation() == true) if (d_GPS_FSM.d_nav.satellite_validation() == true)
{ {
// get ephemeris object for this SV (mandatory) // get ephemeris object for this SV (mandatory)
std::shared_ptr<Gps_Ephemeris> tmp_obj= std::make_shared<Gps_Ephemeris>(); std::shared_ptr<Gps_Ephemeris> tmp_obj= std::make_shared<Gps_Ephemeris>(d_GPS_FSM.d_nav.get_ephemeris());
*tmp_obj = d_GPS_FSM.d_nav.get_ephemeris();
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
} }
break; break;
case 4: // Possible IONOSPHERE and UTC model update (page 18) case 4: // Possible IONOSPHERE and UTC model update (page 18)
if (d_GPS_FSM.d_nav.flag_iono_valid == true) if (d_GPS_FSM.d_nav.flag_iono_valid == true)
{ {
std::shared_ptr<Gps_Iono> tmp_obj= std::make_shared<Gps_Iono>(); std::shared_ptr<Gps_Iono> tmp_obj= std::make_shared<Gps_Iono>(d_GPS_FSM.d_nav.get_iono());
*tmp_obj = d_GPS_FSM.d_nav.get_iono(); //notice that the read operation will clear the valid flag
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
} }
if (d_GPS_FSM.d_nav.flag_utc_model_valid == true) if (d_GPS_FSM.d_nav.flag_utc_model_valid == true)
{ {
std::shared_ptr<Gps_Utc_Model> tmp_obj= std::make_shared<Gps_Utc_Model>(); std::shared_ptr<Gps_Utc_Model> tmp_obj= std::make_shared<Gps_Utc_Model>(d_GPS_FSM.d_nav.get_utc_model());
*tmp_obj = d_GPS_FSM.d_nav.get_utc_model(); //notice that the read operation will clear the valid flag
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
} }
break; break;

View File

@ -78,8 +78,6 @@ gps_l2_m_telemetry_decoder_cc::gps_l2_m_telemetry_decoder_cc(
d_flag_invert_buffer_symbols = false; d_flag_invert_buffer_symbols = false;
d_flag_invert_input_symbols = false; d_flag_invert_input_symbols = false;
d_channel = 0; d_channel = 0;
d_iono_queue = 0;
d_ephemeris_queue = 0;
d_flag_valid_word = false; d_flag_valid_word = false;
d_TOW_at_current_symbol = 0; d_TOW_at_current_symbol = 0;
d_TOW_at_Preamble = 0; d_TOW_at_Preamble = 0;
@ -203,15 +201,16 @@ int gps_l2_m_telemetry_decoder_cc::general_work (int noutput_items __attribute__
if (d_CNAV_Message.have_new_ephemeris() == true) if (d_CNAV_Message.have_new_ephemeris() == true)
{ {
// get ephemeris object for this SV // get ephemeris object for this SV
Gps_CNAV_Ephemeris ephemeris = d_CNAV_Message.get_ephemeris(); //notice that the read operation will clear the valid flag std::shared_ptr<Gps_CNAV_Ephemeris> tmp_obj= std::make_shared<Gps_CNAV_Ephemeris>(d_CNAV_Message.get_ephemeris());
std::cout << "New GPS CNAV Ephemeris received for SV " << ephemeris.i_satellite_PRN << std::endl; std::cout << "New GPS CNAV Ephemeris received for SV " << tmp_obj->i_satellite_PRN << std::endl;
d_ephemeris_queue->push(ephemeris); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
} }
if (d_CNAV_Message.have_new_iono() == true) if (d_CNAV_Message.have_new_iono() == true)
{ {
Gps_CNAV_Iono iono = d_CNAV_Message.get_iono(); //notice that the read operation will clear the valid flag std::shared_ptr<Gps_CNAV_Iono> tmp_obj= std::make_shared<Gps_CNAV_Iono>(d_CNAV_Message.get_iono());
std::cout << "New GPS CNAV IONO model received for SV " << d_satellite.get_PRN() << std::endl; std::cout << "New GPS CNAV IONO model received for SV " << d_satellite.get_PRN() << std::endl;
d_iono_queue->push(iono); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
} }
} }
break; break;
@ -434,7 +433,6 @@ void gps_l2_m_telemetry_decoder_cc::crc_verifier::reset()
} }
void gps_l2_m_telemetry_decoder_cc::crc_verifier::get_valid_frames(const std::vector<msg_candiate_int_t> & msg_candidates, std::vector<msg_candiate_int_t> & valid_msgs) void gps_l2_m_telemetry_decoder_cc::crc_verifier::get_valid_frames(const std::vector<msg_candiate_int_t> & msg_candidates, std::vector<msg_candiate_int_t> & valid_msgs)
{ {
std::vector <unsigned char> tmp_msg; std::vector <unsigned char> tmp_msg;
@ -461,7 +459,6 @@ void gps_l2_m_telemetry_decoder_cc::crc_verifier::get_valid_frames(const std::ve
} }
void gps_l2_m_telemetry_decoder_cc::crc_verifier::zerropad_back_and_convert_to_bytes(const std::vector<int> & msg_candidate, std::vector<unsigned char> & bytes) void gps_l2_m_telemetry_decoder_cc::crc_verifier::zerropad_back_and_convert_to_bytes(const std::vector<int> & msg_candidate, std::vector<unsigned char> & bytes)
{ {
//std::stringstream ss; //std::stringstream ss;
@ -487,8 +484,6 @@ void gps_l2_m_telemetry_decoder_cc::crc_verifier::zerropad_back_and_convert_to_b
// << std::setfill(' ') << std::resetiosflags(std::ios::hex); // << std::setfill(' ') << std::resetiosflags(std::ios::hex);
} }
void gps_l2_m_telemetry_decoder_cc::crc_verifier::zerropad_front_and_convert_to_bytes(const std::vector<int> & msg_candidate, std::vector<unsigned char> & bytes) void gps_l2_m_telemetry_decoder_cc::crc_verifier::zerropad_front_and_convert_to_bytes(const std::vector<int> & msg_candidate, std::vector<unsigned char> & bytes)
{ {
//std::stringstream ss; //std::stringstream ss;
@ -515,14 +510,3 @@ void gps_l2_m_telemetry_decoder_cc::crc_verifier::zerropad_front_and_convert_to_
// << std::setfill(' ') << std::resetiosflags(std::ios::hex); // << std::setfill(' ') << std::resetiosflags(std::ios::hex);
} }
void gps_l2_m_telemetry_decoder_cc::set_iono_queue(concurrent_queue<Gps_CNAV_Iono> *iono_queue)
{
d_iono_queue = iono_queue;
}
void gps_l2_m_telemetry_decoder_cc::set_ephemeris_queue(concurrent_queue<Gps_CNAV_Ephemeris> *ephemeris_queue)
{
d_ephemeris_queue = ephemeris_queue;
}

View File

@ -92,9 +92,6 @@ private:
void viterbi_decoder(double *page_part_symbols, int *page_part_bits); void viterbi_decoder(double *page_part_symbols, int *page_part_bits);
void align_samples(); void align_samples();
concurrent_queue<Gps_CNAV_Iono> *d_iono_queue;
concurrent_queue<Gps_CNAV_Ephemeris> *d_ephemeris_queue;
bool d_dump; bool d_dump;
Gnss_Satellite d_satellite; Gnss_Satellite d_satellite;
int d_channel; int d_channel;

View File

@ -57,13 +57,7 @@
#include "control_message_factory.h" #include "control_message_factory.h"
extern concurrent_map<Gps_Acq_Assist> global_gps_acq_assist_map; extern concurrent_map<Gps_Acq_Assist> global_gps_acq_assist_map;
extern concurrent_map<Gps_Ref_Time> global_gps_ref_time_map;
extern concurrent_map<Gps_Ref_Location> global_gps_ref_location_map;
extern concurrent_queue<Gps_Acq_Assist> global_gps_acq_assist_queue; extern concurrent_queue<Gps_Acq_Assist> global_gps_acq_assist_queue;
extern concurrent_queue<Gps_Ref_Location> global_gps_ref_location_queue;
extern concurrent_queue<Gps_Ref_Time> global_gps_ref_time_queue;
using google::LogMessage; using google::LogMessage;
@ -94,7 +88,6 @@ ControlThread::~ControlThread()
} }
/* /*
* Runs the control thread that manages the receiver control plane * Runs the control thread that manages the receiver control plane
* *
@ -131,12 +124,6 @@ void ControlThread::run()
// start the keyboard_listener thread // start the keyboard_listener thread
keyboard_thread_ = boost::thread(&ControlThread::keyboard_listener, this); keyboard_thread_ = boost::thread(&ControlThread::keyboard_listener, this);
//start the GNSS SV data collector thread
gps_acq_assist_data_collector_thread_= boost::thread(&ControlThread::gps_acq_assist_data_collector, this);
gps_ref_location_data_collector_thread_ = boost::thread(&ControlThread::gps_ref_location_data_collector, this);
gps_ref_time_data_collector_thread_ = boost::thread(&ControlThread::gps_ref_time_data_collector, this);
// Main loop to read and process the control messages // Main loop to read and process the control messages
while (flowgraph_->running() && !stop_) while (flowgraph_->running() && !stop_)
{ {
@ -147,15 +134,6 @@ void ControlThread::run()
std::cout << "Stopping GNSS-SDR, please wait!" << std::endl; std::cout << "Stopping GNSS-SDR, please wait!" << std::endl;
flowgraph_->stop(); flowgraph_->stop();
stop_ = true; stop_ = true;
// sending empty data to terminate the threads
global_gps_acq_assist_queue.push(Gps_Acq_Assist());
global_gps_ref_location_queue.push(Gps_Ref_Location());
global_gps_ref_time_queue.push(Gps_Ref_Time());
// Join GPS threads
gps_acq_assist_data_collector_thread_.join();
gps_ref_location_data_collector_thread_.join();
gps_ref_time_data_collector_thread_.join();
//Join keyboard thread //Join keyboard thread
#ifdef OLD_BOOST #ifdef OLD_BOOST
@ -183,89 +161,94 @@ void ControlThread::set_control_queue(boost::shared_ptr<gr::msg_queue> control_q
/* /*
* Returns true if reading was successful * Returns true if reading was successful
*/ */
//bool ControlThread::read_assistance_from_XML() bool ControlThread::read_assistance_from_XML()
//{ {
// // return variable (true == succeeded) // return variable (true == succeeded)
// bool ret = false; bool ret = false;
// // getting names from the config file, if available // getting names from the config file, if available
// std::string eph_xml_filename = configuration_->property("GNSS-SDR.SUPL_gps_ephemeris_xml", eph_default_xml_filename); std::string 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 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 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_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); std::string ref_location_xml_filename = configuration_->property("GNSS-SDR.SUPL_gps_ref_location_xml", ref_location_default_xml_filename);
//
// std::cout << "SUPL: Try read GPS ephemeris from XML file " << eph_xml_filename << std::endl; std::cout << "SUPL: Try read GPS ephemeris from XML file " << eph_xml_filename << std::endl;
// if (supl_client_ephemeris_.load_ephemeris_xml(eph_xml_filename) == true) if (supl_client_ephemeris_.load_ephemeris_xml(eph_xml_filename) == true)
// { {
// std::map<int,Gps_Ephemeris>::iterator gps_eph_iter; std::map<int,Gps_Ephemeris>::iterator gps_eph_iter;
// for(gps_eph_iter = supl_client_ephemeris_.gps_ephemeris_map.begin(); for(gps_eph_iter = supl_client_ephemeris_.gps_ephemeris_map.begin();
// gps_eph_iter != supl_client_ephemeris_.gps_ephemeris_map.end(); gps_eph_iter != supl_client_ephemeris_.gps_ephemeris_map.end();
// gps_eph_iter++) gps_eph_iter++)
// { {
// std::cout << "SUPL: Read XML Ephemeris for GPS SV " << gps_eph_iter->first << std::endl; std::cout << "SUPL: Read XML Ephemeris for GPS SV " << gps_eph_iter->first << std::endl;
// global_gps_ephemeris_queue.push(gps_eph_iter->second); std::shared_ptr<Gps_Ephemeris> tmp_obj= std::make_shared<Gps_Ephemeris>(gps_eph_iter->second);
// } flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
// ret = true; }
// } ret = true;
// else }
// { else
// std::cout << "ERROR: SUPL client error reading XML" << std::endl; {
// std::cout << "Disabling SUPL assistance..." << std::endl; std::cout << "ERROR: SUPL client error reading XML" << std::endl;
// } std::cout << "Disabling SUPL assistance..." << std::endl;
// // Only look for {utc, iono, ref time, ref location} if SUPL is enabled }
// bool enable_gps_supl_assistance = configuration_->property("GNSS-SDR.SUPL_gps_enabled", false); // Only look for {utc, iono, ref time, ref location} if SUPL is enabled
// if (enable_gps_supl_assistance == true) bool enable_gps_supl_assistance = configuration_->property("GNSS-SDR.SUPL_gps_enabled", false);
// { if (enable_gps_supl_assistance == true)
// // Try to read UTC model from XML {
// if (supl_client_acquisition_.load_utc_xml(utc_xml_filename) == true) // Try to read UTC model from XML
// { if (supl_client_acquisition_.load_utc_xml(utc_xml_filename) == true)
// LOG(INFO) << "SUPL: Read XML UTC model"; {
// global_gps_utc_model_queue.push(supl_client_acquisition_.gps_utc); LOG(INFO) << "SUPL: Read XML UTC model";
// } std::shared_ptr<Gps_Utc_Model> tmp_obj= std::make_shared<Gps_Utc_Model>(supl_client_acquisition_.gps_utc);
// else flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
// { }
// LOG(INFO) << "SUPL: couldn't read UTC model XML"; else
// } {
// LOG(INFO) << "SUPL: couldn't read UTC model XML";
// // Try to read Iono model from XML }
// if (supl_client_acquisition_.load_iono_xml(iono_xml_filename) == true)
// { // Try to read Iono model from XML
// LOG(INFO) << "SUPL: Read XML IONO model"; if (supl_client_acquisition_.load_iono_xml(iono_xml_filename) == true)
// global_gps_iono_queue.push(supl_client_acquisition_.gps_iono); {
// } LOG(INFO) << "SUPL: Read XML IONO model";
// else std::shared_ptr<Gps_Iono> tmp_obj= std::make_shared<Gps_Iono>(supl_client_acquisition_.gps_iono);
// { flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
// LOG(INFO) << "SUPL: couldn't read IONO model XML"; }
// } else
// {
// // Try to read Ref Time from XML LOG(INFO) << "SUPL: couldn't read IONO model XML";
// if (supl_client_acquisition_.load_ref_time_xml(ref_time_xml_filename) == true) }
// {
// LOG(INFO) << "SUPL: Read XML Ref Time"; // Try to read Ref Time from XML
// global_gps_ref_time_queue.push(supl_client_acquisition_.gps_time); if (supl_client_acquisition_.load_ref_time_xml(ref_time_xml_filename) == true)
// } {
// else LOG(INFO) << "SUPL: Read XML Ref Time";
// { std::shared_ptr<Gps_Ref_Time> tmp_obj= std::make_shared<Gps_Ref_Time>(supl_client_acquisition_.gps_time);
// LOG(INFO) << "SUPL: couldn't read Ref Time XML"; flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
// } }
// else
// // Try to read Ref Location from XML {
// if (supl_client_acquisition_.load_ref_location_xml(ref_location_xml_filename) == true) LOG(INFO) << "SUPL: couldn't read Ref Time XML";
// { }
// LOG(INFO) << "SUPL: Read XML Ref Location";
// global_gps_ref_location_queue.push(supl_client_acquisition_.gps_ref_loc); // Try to read Ref Location from XML
// } if (supl_client_acquisition_.load_ref_location_xml(ref_location_xml_filename) == true)
// else {
// { LOG(INFO) << "SUPL: Read XML Ref Location";
// LOG(INFO) << "SUPL: couldn't read Ref Location XML"; std::shared_ptr<Gps_Ref_Location> tmp_obj= std::make_shared<Gps_Ref_Location>(supl_client_acquisition_.gps_ref_loc);
// } flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
// } }
// else
// return ret; {
//} LOG(INFO) << "SUPL: couldn't read Ref Location XML";
}
}
return ret;
}
// Returns true if reading was successful //todo: The save assistance function needs to be moved to the PVT block because now the global maps are deprecated, and PVT is the only block that have all the information
//bool ControlThread::save_assistance_to_XML() //bool ControlThread::save_assistance_to_XML()
//{ //{
// // return variable (true == succeeded) // // return variable (true == succeeded)
@ -413,10 +396,8 @@ void ControlThread::init()
gps_eph_iter++) gps_eph_iter++)
{ {
std::cout << "SUPL: Received Ephemeris for GPS SV " << gps_eph_iter->first << std::endl; std::cout << "SUPL: Received Ephemeris for GPS SV " << gps_eph_iter->first << std::endl;
//TODO: Now the ephemeris are transported from telemetry decoder to PVT using msg queues. std::shared_ptr<Gps_Ephemeris> tmp_obj= std::make_shared<Gps_Ephemeris>(gps_eph_iter->second);
// in order to assist the receiver, it is needed to produce a GNURadio message from this thread to the PVT message queue flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
// global queues or maps are deprecated in this version
//global_gps_ephemeris_map.write(gps_eph_iter->second.i_satellite_PRN, gps_eph_iter->second);
} }
//Save ephemeris to XML file //Save ephemeris to XML file
std::string eph_xml_filename = configuration_->property("GNSS-SDR.SUPL_gps_ephemeris_xml", eph_default_xml_filename); std::string eph_xml_filename = configuration_->property("GNSS-SDR.SUPL_gps_ephemeris_xml", eph_default_xml_filename);
@ -452,20 +433,20 @@ void ControlThread::init()
gps_alm_iter++) gps_alm_iter++)
{ {
std::cout << "SUPL: Received Almanac for GPS SV " << gps_alm_iter->first << std::endl; std::cout << "SUPL: Received Almanac for GPS SV " << gps_alm_iter->first << std::endl;
//TODO: use msg queues std::shared_ptr<Gps_Almanac> tmp_obj= std::make_shared<Gps_Almanac>(gps_alm_iter->second);
//global_gps_almanac_queue.push(gps_alm_iter->second); flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
} }
if (supl_client_ephemeris_.gps_iono.valid == true) if (supl_client_ephemeris_.gps_iono.valid == true)
{ {
std::cout << "SUPL: Received GPS Iono" << std::endl; std::cout << "SUPL: Received GPS Iono" << std::endl;
//TODO: use msg queues std::shared_ptr<Gps_Iono> tmp_obj= std::make_shared<Gps_Iono>(supl_client_ephemeris_.gps_iono);
//global_gps_iono_map.write(0, supl_client_ephemeris_.gps_iono); flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
} }
if (supl_client_ephemeris_.gps_utc.valid == true) if (supl_client_ephemeris_.gps_utc.valid == true)
{ {
std::cout << "SUPL: Received GPS UTC Model" << std::endl; std::cout << "SUPL: Received GPS UTC Model" << std::endl;
//TODO: use msg queues std::shared_ptr<Gps_Utc_Model> tmp_obj= std::make_shared<Gps_Utc_Model>(supl_client_ephemeris_.gps_utc);
//global_gps_utc_model_map.write(0, supl_client_ephemeris_.gps_utc); flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
} }
} }
else else
@ -492,12 +473,14 @@ void ControlThread::init()
if (supl_client_acquisition_.gps_ref_loc.valid == true) if (supl_client_acquisition_.gps_ref_loc.valid == true)
{ {
std::cout << "SUPL: Received Ref Location (Acquisition Assistance)" << std::endl; std::cout << "SUPL: Received Ref Location (Acquisition Assistance)" << std::endl;
global_gps_ref_location_map.write(0, supl_client_acquisition_.gps_ref_loc); std::shared_ptr<Gps_Ref_Location> tmp_obj= std::make_shared<Gps_Ref_Location>(supl_client_acquisition_.gps_ref_loc);
flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
} }
if (supl_client_acquisition_.gps_time.valid == true) if (supl_client_acquisition_.gps_time.valid == true)
{ {
std::cout << "SUPL: Received Ref Time (Acquisition Assistance)" << std::endl; std::cout << "SUPL: Received Ref Time (Acquisition Assistance)" << std::endl;
global_gps_ref_time_map.write(0, supl_client_acquisition_.gps_time); std::shared_ptr<Gps_Ref_Time> tmp_obj= std::make_shared<Gps_Ref_Time>(supl_client_acquisition_.gps_time);
flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
} }
} }
else else
@ -596,52 +579,6 @@ void ControlThread::gps_acq_assist_data_collector()
} }
} }
void ControlThread::gps_ref_location_data_collector()
{
// ############ READ REF LOCATION ####################
Gps_Ref_Location gps_ref_location;
while(stop_ == false)
{
global_gps_ref_location_queue.wait_and_pop(gps_ref_location);
LOG(INFO) << "New ref location record has arrived with lat=" << gps_ref_location.lat << " lon=" << gps_ref_location.lon;
// insert new ref location record to the global ref location map
global_gps_ref_location_map.write(0, gps_ref_location);
}
}
void ControlThread::gps_ref_time_data_collector()
{
// ############ READ REF TIME ####################
Gps_Ref_Time gps_ref_time;
Gps_Ref_Time gps_ref_time_old;
while(stop_ == false)
{
global_gps_ref_time_queue.wait_and_pop(gps_ref_time);
LOG(INFO) << "New ref time record has arrived with TOW=" << gps_ref_time.d_TOW << " Week=" << gps_ref_time.d_Week;
// insert new ref time record to the global ref time map
if (global_gps_ref_time_map.read(0, gps_ref_time_old))
{
if (gps_ref_time.d_Week > gps_ref_time_old.d_Week)
{
global_gps_ref_time_map.write(0, gps_ref_time);
}
else if ((gps_ref_time.d_Week == gps_ref_time_old.d_Week) and (gps_ref_time.d_TOW > gps_ref_time_old.d_TOW))
{
global_gps_ref_time_map.write(0, gps_ref_time);
}
else
{
LOG(INFO) << "Not updating the existing ref time";
}
}
else
{
// insert new ref time record
global_gps_ref_time_map.write(0, gps_ref_time);
}
}
}
void ControlThread::keyboard_listener() void ControlThread::keyboard_listener()
{ {

View File

@ -124,7 +124,7 @@ private:
void init(); void init();
// Read {ephemeris, iono, utc, ref loc, ref time} assistance from a local XML file previously recorded // Read {ephemeris, iono, utc, ref loc, ref time} assistance from a local XML file previously recorded
//bool read_assistance_from_XML(); bool read_assistance_from_XML();
// Save {ephemeris, iono, utc, ref loc, ref time} assistance to a local XML file // Save {ephemeris, iono, utc, ref loc, ref time} assistance to a local XML file
//bool save_assistance_to_XML(); //bool save_assistance_to_XML();
@ -133,41 +133,11 @@ private:
void process_control_messages(); void process_control_messages();
/*
* \brief Blocking function that reads the ref location queue and updates the shared map
*/
void gps_ref_location_data_collector();
/*
* \brief Blocking function that reads the ref time queue and updates the shared map
*/
void gps_ref_time_data_collector();
/* /*
* Blocking function that reads the GPS assistance queue * Blocking function that reads the GPS assistance queue
*/ */
void gps_acq_assist_data_collector(); void gps_acq_assist_data_collector();
/*
* Blocking function that reads the Galileo ephemeris queue and updates the shared ephemeris map, accessible from the PVT block
*/
void galileo_ephemeris_data_collector();
/*
* Blocking function that reads the UTC model queue and updates the shared map, accessible from the PVT block
*/
void galileo_utc_model_data_collector();
/*
* Blocking function that reads the iono data queue and updates the shared map, accessible from the PVT block
*/
void galileo_iono_data_collector();
/*
* Blocking function that reads the galileo_almanac queue and updates the shared map, accessible from the PVT block
*/
void galileo_almanac_data_collector();
void apply_action(unsigned int what); void apply_action(unsigned int what);
std::shared_ptr<GNSSFlowgraph> flowgraph_; std::shared_ptr<GNSSFlowgraph> flowgraph_;
std::shared_ptr<ConfigurationInterface> configuration_; std::shared_ptr<ConfigurationInterface> configuration_;
@ -179,15 +149,8 @@ private:
unsigned int processed_control_messages_; unsigned int processed_control_messages_;
unsigned int applied_actions_; unsigned int applied_actions_;
boost::thread keyboard_thread_; boost::thread keyboard_thread_;
boost::thread gps_acq_assist_data_collector_thread_; boost::thread gps_acq_assist_data_collector_thread_;
boost::thread gps_ref_location_data_collector_thread_;
boost::thread gps_ref_time_data_collector_thread_;
boost::thread galileo_ephemeris_data_collector_thread_;
boost::thread galileo_utc_model_data_collector_thread_;
boost::thread galileo_iono_data_collector_thread_;
boost::thread galileo_almanac_data_collector_thread_;
void keyboard_listener(); void keyboard_listener();
// default filename for assistance data // default filename for assistance data

View File

@ -357,6 +357,14 @@ void GNSSFlowgraph::wait()
} }
bool GNSSFlowgraph::send_telemetry_msg(pmt::pmt_t msg)
{
//push ephemeris to PVT telemetry msg in port using a channel out port
// it uses the first channel as a message produces (it is already connected to PVT)
channels_.at(0)->get_right_block()->message_port_pub(pmt::mp("telemetry"), msg);
return true;
}
/* /*
* Applies an action to the flowgraph * Applies an action to the flowgraph
* *

View File

@ -107,7 +107,12 @@ public:
{ {
return running_; return running_;
} }
/*!
* \brief Sends a GNURadio asyncronous message from telemetry to PVT
*
* It is used to assist the receiver with external ephemeris data
*/
bool send_telemetry_msg(pmt::pmt_t msg);
private: private:
void init(); // Populates the SV PRN list available for acquisition and tracking void init(); // Populates the SV PRN list available for acquisition and tracking
void set_signals_list(); void set_signals_list();

View File

@ -85,12 +85,7 @@ DECLARE_string(log_dir);
// For GPS NAVIGATION (L1) // For GPS NAVIGATION (L1)
concurrent_queue<Gps_Acq_Assist> global_gps_acq_assist_queue; concurrent_queue<Gps_Acq_Assist> global_gps_acq_assist_queue;
concurrent_queue<Gps_Ref_Location> global_gps_ref_location_queue;
concurrent_queue<Gps_Ref_Time> global_gps_ref_time_queue;
concurrent_map<Gps_Acq_Assist> global_gps_acq_assist_map; concurrent_map<Gps_Acq_Assist> global_gps_acq_assist_map;
concurrent_map<Gps_Ref_Time> global_gps_ref_time_map;
concurrent_map<Gps_Ref_Location> global_gps_ref_location_map;
int main(int argc, char** argv) int main(int argc, char** argv)
{ {

View File

@ -88,12 +88,6 @@ std::string s3_ = s1_ + s2_;
DEFINE_string(config_file, s3_, DEFINE_string(config_file, s3_,
"Path to the file containing the configuration parameters"); "Path to the file containing the configuration parameters");
concurrent_queue<Gps_Ephemeris> global_gps_ephemeris_queue;
concurrent_queue<Gps_Iono> global_gps_iono_queue;
concurrent_queue<Gps_Utc_Model> global_gps_utc_model_queue;
concurrent_queue<Gps_Almanac> global_gps_almanac_queue;
concurrent_queue<Gps_Acq_Assist> global_gps_acq_assist_queue;
concurrent_map<Gps_Ephemeris> global_gps_ephemeris_map; concurrent_map<Gps_Ephemeris> global_gps_ephemeris_map;
concurrent_map<Gps_Iono> global_gps_iono_map; concurrent_map<Gps_Iono> global_gps_iono_map;
concurrent_map<Gps_Utc_Model> global_gps_utc_model_map; concurrent_map<Gps_Utc_Model> global_gps_utc_model_map;