1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-13 19:50:34 +00:00

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
d_ls_pvt->galileo_almanac=*galileo_almanac;
DLOG(INFO) << "New Galileo Almanac has arrived ";
}else{
LOG(WARNING) << "msg_handler_telemetry unknown object type!";
}
}
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) :

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);
}
}else{
LOG(WARNING) << "msg_handler_telemetry unknown object type!";
}
}
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
d_ls_pvt->galileo_almanac=*galileo_almanac;
DLOG(INFO) << "New Galileo Almanac has arrived ";
}else{
LOG(WARNING) << "msg_handler_telemetry unknown object type!";
}
}
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)
{
// get object for this SV (mandatory)
std::shared_ptr<Galileo_Ephemeris> tmp_obj= std::make_shared<Galileo_Ephemeris>();
*tmp_obj = d_nav.get_ephemeris();//notice that the read operation will clear the valid flag
std::shared_ptr<Galileo_Ephemeris> tmp_obj= std::make_shared<Galileo_Ephemeris>( d_nav.get_ephemeris());
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
}
if (d_nav.have_new_iono_and_GST() == true)
{
// get object for this SV (mandatory)
std::shared_ptr<Galileo_Iono> tmp_obj= std::make_shared<Galileo_Iono>();
*tmp_obj = 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());
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
}
if (d_nav.have_new_utc_model() == true)
{
// get object for this SV (mandatory)
std::shared_ptr<Galileo_Utc_Model> tmp_obj= std::make_shared<Galileo_Utc_Model>();
*tmp_obj = 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());
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
}
if (d_nav.have_new_almanac() == true)
{
std::shared_ptr<Galileo_Almanac> tmp_obj= std::make_shared<Galileo_Almanac>();
*tmp_obj = d_nav.get_almanac();
std::shared_ptr<Galileo_Almanac> tmp_obj= std::make_shared<Galileo_Almanac>(d_nav.get_almanac());
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
//debug
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
if (d_nav.have_new_ephemeris() == true)
{
// get ephemeris object for this SV
Galileo_Ephemeris ephemeris = d_nav.get_ephemeris();//notice that the read operation will clear the valid flag
//std::cout<<"New Galileo Ephemeris received for SV "<<d_satellite.get_PRN()<<std::endl;
d_ephemeris_queue->push(ephemeris);
std::shared_ptr<Galileo_Ephemeris> tmp_obj= std::make_shared<Galileo_Ephemeris>(d_nav.get_ephemeris());
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
}
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::cout<<"New Galileo IONO model (and UTC) received for SV "<<d_satellite.get_PRN()<<std::endl;
d_iono_queue->push(iono);
std::shared_ptr<Galileo_Iono> tmp_obj= std::make_shared<Galileo_Iono>(d_nav.get_iono());
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
}
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::cout<<"New Galileo UTC model received for SV "<<d_satellite.get_PRN()<<std::endl;
d_utc_model_queue->push(utc_model);
std::shared_ptr<Galileo_Utc_Model> tmp_obj= std::make_shared<Galileo_Utc_Model>(d_nav.get_utc_model());
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
}
}
@ -260,10 +256,6 @@ galileo_e5a_telemetry_decoder_cc::galileo_e5a_telemetry_decoder_cc(
d_sign_init = 0;
d_flag_preamble = false;
d_ephemeris_queue = 0;
d_iono_queue = 0;
d_utc_model_queue = 0;
d_almanac_queue = 0;
d_channel = 0;
Prn_timestamp_at_preamble_ms = 0;
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();
void set_satellite(Gnss_Satellite satellite); //!< Set satellite PRN
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
*/
@ -117,15 +113,6 @@ private:
// navigation message vars
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;
bool d_dump;
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)
{
// get ephemeris object for this SV (mandatory)
std::shared_ptr<Gps_Ephemeris> tmp_obj= std::make_shared<Gps_Ephemeris>();
*tmp_obj = d_GPS_FSM.d_nav.get_ephemeris();
std::shared_ptr<Gps_Ephemeris> tmp_obj= std::make_shared<Gps_Ephemeris>(d_GPS_FSM.d_nav.get_ephemeris());
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
}
break;
case 4: // Possible IONOSPHERE and UTC model update (page 18)
if (d_GPS_FSM.d_nav.flag_iono_valid == true)
{
std::shared_ptr<Gps_Iono> tmp_obj= std::make_shared<Gps_Iono>();
*tmp_obj = d_GPS_FSM.d_nav.get_iono(); //notice that the read operation will clear the valid flag
std::shared_ptr<Gps_Iono> tmp_obj= std::make_shared<Gps_Iono>(d_GPS_FSM.d_nav.get_iono());
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
}
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>();
*tmp_obj = d_GPS_FSM.d_nav.get_utc_model(); //notice that the read operation will clear the valid flag
std::shared_ptr<Gps_Utc_Model> tmp_obj= std::make_shared<Gps_Utc_Model>(d_GPS_FSM.d_nav.get_utc_model());
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
}
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_input_symbols = false;
d_channel = 0;
d_iono_queue = 0;
d_ephemeris_queue = 0;
d_flag_valid_word = false;
d_TOW_at_current_symbol = 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)
{
// 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::cout << "New GPS CNAV Ephemeris received for SV " << ephemeris.i_satellite_PRN << std::endl;
d_ephemeris_queue->push(ephemeris);
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 " << tmp_obj->i_satellite_PRN << std::endl;
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
}
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;
d_iono_queue->push(iono);
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
}
}
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)
{
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)
{
//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);
}
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;
@ -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);
}
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 align_samples();
concurrent_queue<Gps_CNAV_Iono> *d_iono_queue;
concurrent_queue<Gps_CNAV_Ephemeris> *d_ephemeris_queue;
bool d_dump;
Gnss_Satellite d_satellite;
int d_channel;

View File

@ -57,13 +57,7 @@
#include "control_message_factory.h"
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_Ref_Location> global_gps_ref_location_queue;
extern concurrent_queue<Gps_Ref_Time> global_gps_ref_time_queue;
using google::LogMessage;
@ -94,7 +88,6 @@ ControlThread::~ControlThread()
}
/*
* Runs the control thread that manages the receiver control plane
*
@ -131,12 +124,6 @@ void ControlThread::run()
// start the keyboard_listener thread
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
while (flowgraph_->running() && !stop_)
{
@ -147,15 +134,6 @@ void ControlThread::run()
std::cout << "Stopping GNSS-SDR, please wait!" << std::endl;
flowgraph_->stop();
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
#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
*/
//bool ControlThread::read_assistance_from_XML()
//{
// // return variable (true == succeeded)
// bool ret = false;
// // 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 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);
//
// 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)
// {
// std::map<int,Gps_Ephemeris>::iterator gps_eph_iter;
// for(gps_eph_iter = supl_client_ephemeris_.gps_ephemeris_map.begin();
// gps_eph_iter != supl_client_ephemeris_.gps_ephemeris_map.end();
// gps_eph_iter++)
// {
// std::cout << "SUPL: Read XML Ephemeris for GPS SV " << gps_eph_iter->first << std::endl;
// global_gps_ephemeris_queue.push(gps_eph_iter->second);
// }
// ret = true;
// }
// else
// {
// 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);
// if (enable_gps_supl_assistance == 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);
// }
// 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)
// {
// LOG(INFO) << "SUPL: Read XML IONO model";
// global_gps_iono_queue.push(supl_client_acquisition_.gps_iono);
// }
// else
// {
// LOG(INFO) << "SUPL: couldn't read IONO model XML";
// }
//
// // Try to read Ref Time from XML
// if (supl_client_acquisition_.load_ref_time_xml(ref_time_xml_filename) == true)
// {
// LOG(INFO) << "SUPL: Read XML Ref Time";
// global_gps_ref_time_queue.push(supl_client_acquisition_.gps_time);
// }
// else
// {
// LOG(INFO) << "SUPL: couldn't read Ref Time XML";
// }
//
// // Try to read Ref Location from XML
// if (supl_client_acquisition_.load_ref_location_xml(ref_location_xml_filename) == true)
// {
// LOG(INFO) << "SUPL: Read XML Ref Location";
// global_gps_ref_location_queue.push(supl_client_acquisition_.gps_ref_loc);
// }
// else
// {
// LOG(INFO) << "SUPL: couldn't read Ref Location XML";
// }
// }
//
// return ret;
//}
bool ControlThread::read_assistance_from_XML()
{
// return variable (true == succeeded)
bool ret = false;
// 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 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);
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)
{
std::map<int,Gps_Ephemeris>::iterator gps_eph_iter;
for(gps_eph_iter = supl_client_ephemeris_.gps_ephemeris_map.begin();
gps_eph_iter != supl_client_ephemeris_.gps_ephemeris_map.end();
gps_eph_iter++)
{
std::cout << "SUPL: Read XML Ephemeris for GPS SV " << gps_eph_iter->first << std::endl;
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;
}
else
{
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);
if (enable_gps_supl_assistance == 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";
std::shared_ptr<Gps_Utc_Model> tmp_obj= std::make_shared<Gps_Utc_Model>(supl_client_acquisition_.gps_utc);
flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
}
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)
{
LOG(INFO) << "SUPL: Read XML IONO model";
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));
}
else
{
LOG(INFO) << "SUPL: couldn't read IONO model XML";
}
// Try to read Ref Time from XML
if (supl_client_acquisition_.load_ref_time_xml(ref_time_xml_filename) == true)
{
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);
flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
}
else
{
LOG(INFO) << "SUPL: couldn't read Ref Time XML";
}
// Try to read Ref Location from XML
if (supl_client_acquisition_.load_ref_location_xml(ref_location_xml_filename) == true)
{
LOG(INFO) << "SUPL: Read XML Ref Location";
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
{
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()
//{
// // return variable (true == succeeded)
@ -413,10 +396,8 @@ void ControlThread::init()
gps_eph_iter++)
{
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.
// in order to assist the receiver, it is needed to produce a GNURadio message from this thread to the PVT message queue
// 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);
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));
}
//Save ephemeris to XML file
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++)
{
std::cout << "SUPL: Received Almanac for GPS SV " << gps_alm_iter->first << std::endl;
//TODO: use msg queues
//global_gps_almanac_queue.push(gps_alm_iter->second);
std::shared_ptr<Gps_Almanac> tmp_obj= std::make_shared<Gps_Almanac>(gps_alm_iter->second);
flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
}
if (supl_client_ephemeris_.gps_iono.valid == true)
{
std::cout << "SUPL: Received GPS Iono" << std::endl;
//TODO: use msg queues
//global_gps_iono_map.write(0, supl_client_ephemeris_.gps_iono);
std::shared_ptr<Gps_Iono> tmp_obj= std::make_shared<Gps_Iono>(supl_client_ephemeris_.gps_iono);
flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
}
if (supl_client_ephemeris_.gps_utc.valid == true)
{
std::cout << "SUPL: Received GPS UTC Model" << std::endl;
//TODO: use msg queues
//global_gps_utc_model_map.write(0, supl_client_ephemeris_.gps_utc);
std::shared_ptr<Gps_Utc_Model> tmp_obj= std::make_shared<Gps_Utc_Model>(supl_client_ephemeris_.gps_utc);
flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
}
}
else
@ -492,12 +473,14 @@ void ControlThread::init()
if (supl_client_acquisition_.gps_ref_loc.valid == true)
{
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)
{
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
@ -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()
{

View File

@ -124,7 +124,7 @@ private:
void init();
// 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
//bool save_assistance_to_XML();
@ -133,41 +133,11 @@ private:
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
*/
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);
std::shared_ptr<GNSSFlowgraph> flowgraph_;
std::shared_ptr<ConfigurationInterface> configuration_;
@ -179,15 +149,8 @@ private:
unsigned int processed_control_messages_;
unsigned int applied_actions_;
boost::thread keyboard_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();
// 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
*

View File

@ -107,7 +107,12 @@ public:
{
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:
void init(); // Populates the SV PRN list available for acquisition and tracking
void set_signals_list();

View File

@ -85,12 +85,7 @@ DECLARE_string(log_dir);
// For GPS NAVIGATION (L1)
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_Ref_Time> global_gps_ref_time_map;
concurrent_map<Gps_Ref_Location> global_gps_ref_location_map;
int main(int argc, char** argv)
{

View File

@ -88,12 +88,6 @@ std::string s3_ = s1_ + s2_;
DEFINE_string(config_file, s3_,
"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_Iono> global_gps_iono_map;
concurrent_map<Gps_Utc_Model> global_gps_utc_model_map;