mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-13 11:40:33 +00:00
Applying patch by Leonardo Tonetto
0001-Saving-acquisition-assistance-data.patch
This commit is contained in:
parent
7db1180d0a
commit
f371823fc0
@ -64,12 +64,16 @@ extern concurrent_map<Gps_Iono> global_gps_iono_map;
|
||||
extern concurrent_map<Gps_Utc_Model> global_gps_utc_model_map;
|
||||
extern concurrent_map<Gps_Almanac> global_gps_almanac_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_Ephemeris> global_gps_ephemeris_queue;
|
||||
extern concurrent_queue<Gps_Iono> global_gps_iono_queue;
|
||||
extern concurrent_queue<Gps_Utc_Model> global_gps_utc_model_queue;
|
||||
extern concurrent_queue<Gps_Almanac> global_gps_almanac_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;
|
||||
|
||||
extern concurrent_map<Galileo_Ephemeris> global_galileo_ephemeris_map;
|
||||
extern concurrent_map<Galileo_Iono> global_galileo_iono_map;
|
||||
@ -110,6 +114,8 @@ ControlThread::~ControlThread()
|
||||
gps_ephemeris_data_write_to_XML();
|
||||
gps_iono_data_write_to_XML();
|
||||
gps_utc_model_data_write_to_XML();
|
||||
gps_ref_location_data_write_to_XML();
|
||||
gps_ref_time_data_write_to_XML();
|
||||
}
|
||||
|
||||
|
||||
@ -155,6 +161,8 @@ void ControlThread::run()
|
||||
gps_iono_data_collector_thread_ = boost::thread(&ControlThread::gps_iono_data_collector, this);
|
||||
gps_utc_model_data_collector_thread_ = boost::thread(&ControlThread::gps_utc_model_data_collector, this);
|
||||
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);
|
||||
|
||||
galileo_ephemeris_data_collector_thread_ = boost::thread(&ControlThread::galileo_ephemeris_data_collector, this);
|
||||
galileo_iono_data_collector_thread_ = boost::thread(&ControlThread::galileo_iono_data_collector, this);
|
||||
@ -174,6 +182,8 @@ void ControlThread::run()
|
||||
gps_iono_data_collector_thread_.timed_join(boost::posix_time::seconds(1));
|
||||
gps_utc_model_data_collector_thread_.timed_join(boost::posix_time::seconds(1));
|
||||
gps_acq_assist_data_collector_thread_.timed_join(boost::posix_time::seconds(1));
|
||||
gps_ref_location_data_collector_thread_.timed_join(boost::posix_time::seconds(1));
|
||||
gps_ref_time_data_collector_thread_.timed_join(boost::posix_time::seconds(1));
|
||||
|
||||
//Join Galileo threads
|
||||
galileo_ephemeris_data_collector_thread_.timed_join(boost::posix_time::seconds(1));
|
||||
@ -358,6 +368,16 @@ void ControlThread::init()
|
||||
std::cout << "SUPL: Received Acquisition assistance for GPS SV " << gps_acq_iter->first << std::endl;
|
||||
global_gps_acq_assist_queue.push(gps_acq_iter->second);
|
||||
}
|
||||
if (supl_client_acquisition_.gps_ref_loc.valid == true)
|
||||
{
|
||||
std::cout << "SUPL: Received Ref Location (Acquisition Assistance)" << std::endl;
|
||||
global_gps_ref_location_queue.push(supl_client_acquisition_.gps_ref_loc);
|
||||
}
|
||||
if (supl_client_acquisition_.gps_time.valid == true)
|
||||
{
|
||||
std::cout << "SUPL: Received Ref Time (Acquisition Assistance)" << std::endl;
|
||||
global_gps_ref_time_queue.push(supl_client_acquisition_.gps_time);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -567,23 +587,13 @@ void ControlThread::gps_iono_data_collector()
|
||||
{
|
||||
// ############ 1.bis READ EPHEMERIS/UTC_MODE/IONO QUEUE ####################
|
||||
Gps_Iono gps_iono;
|
||||
Gps_Iono gps_iono_old;
|
||||
while(stop_ == false)
|
||||
{
|
||||
global_gps_iono_queue.wait_and_pop(gps_iono);
|
||||
|
||||
LOG(INFO) << "New IONO record has arrived ";
|
||||
// insert new ephemeris record to the global ephemeris map
|
||||
if (global_gps_iono_map.read(0, gps_iono_old))
|
||||
{
|
||||
// TODO: Check the IONO timestamp. If it is newer, then update the iono
|
||||
global_gps_iono_map.write(0, gps_iono);
|
||||
}
|
||||
else
|
||||
{
|
||||
// insert new ephemeris record
|
||||
global_gps_iono_map.write(0, gps_iono);
|
||||
}
|
||||
// there is no timestamp for the iono data, new entries must always be added
|
||||
global_gps_iono_map.write(0, gps_iono);
|
||||
}
|
||||
}
|
||||
|
||||
@ -642,21 +652,75 @@ void ControlThread::gps_utc_model_data_collector()
|
||||
{
|
||||
global_gps_utc_model_queue.wait_and_pop(gps_utc);
|
||||
LOG(INFO) << "New UTC MODEL record has arrived with A0=" << gps_utc.d_A0;
|
||||
// insert new ephemeris record to the global ephemeris map
|
||||
// insert new utc record to the global utc model map
|
||||
if (global_gps_utc_model_map.read(0, gps_utc_old))
|
||||
{
|
||||
// TODO: Check the UTC MODEL timestamp. If it is newer, then update the UTC MODEL
|
||||
global_gps_utc_model_map.write(0, gps_utc);
|
||||
if (gps_utc.i_WN_T > gps_utc_old.i_WN_T)
|
||||
{
|
||||
global_gps_utc_model_map.write(0, gps_utc);
|
||||
}
|
||||
else if ((gps_utc.i_WN_T == gps_utc_old.i_WN_T) and (gps_utc.d_t_OT > gps_utc_old.d_t_OT))
|
||||
{
|
||||
global_gps_utc_model_map.write(0, gps_utc);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(INFO) << "Not updating the existing utc model";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// insert new ephemeris record
|
||||
// insert new utc model record
|
||||
global_gps_utc_model_map.write(0, gps_utc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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::galileo_utc_model_data_collector()
|
||||
{
|
||||
@ -761,7 +825,6 @@ void ControlThread::gps_iono_data_write_to_XML()
|
||||
//Save ephemeris to XML file
|
||||
std::string xml_filename = "gps_iono_rx.xml";
|
||||
std::map<int,Gps_Iono> map_copy;
|
||||
std::map<int,Gps_Iono>::iterator gps_iono_iter;
|
||||
|
||||
map_copy = global_gps_iono_map.get_map_copy();
|
||||
if (map_copy.size() > 0)
|
||||
@ -781,6 +844,53 @@ void ControlThread::gps_iono_data_write_to_XML()
|
||||
}
|
||||
}
|
||||
|
||||
void ControlThread::gps_ref_location_data_write_to_XML()
|
||||
{
|
||||
//Save reference location to XML file
|
||||
std::string xml_filename = "gps_ref_location_rx.xml";
|
||||
std::map<int,Gps_Ref_Location> map_copy;
|
||||
|
||||
map_copy = global_gps_ref_location_map.get_map_copy();
|
||||
if (map_copy.size() > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
std::ofstream ofs(xml_filename.c_str(), std::ofstream::trunc | std::ofstream::out);
|
||||
boost::archive::xml_oarchive xml(ofs);
|
||||
xml << boost::serialization::make_nvp("GNSS-SDR_ref_location_map", map_copy);
|
||||
ofs.close();
|
||||
LOG(INFO) << "Saved Ref Location data";
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
LOG(ERROR) << e.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ControlThread::gps_ref_time_data_write_to_XML()
|
||||
{
|
||||
//Save reference time to XML file
|
||||
std::string xml_filename = "gps_ref_time_rx.xml";
|
||||
std::map<int,Gps_Ref_Time> map_copy;
|
||||
|
||||
map_copy = global_gps_ref_time_map.get_map_copy();
|
||||
if (map_copy.size() > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
std::ofstream ofs(xml_filename.c_str(), std::ofstream::trunc | std::ofstream::out);
|
||||
boost::archive::xml_oarchive xml(ofs);
|
||||
xml << boost::serialization::make_nvp("GNSS-SDR_ref_time_map", map_copy);
|
||||
ofs.close();
|
||||
LOG(INFO) << "Saved Ref Time data";
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
LOG(ERROR) << e.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ControlThread::keyboard_listener()
|
||||
{
|
||||
|
@ -140,11 +140,31 @@ private:
|
||||
*/
|
||||
void gps_utc_model_data_collector();
|
||||
|
||||
/*
|
||||
* \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();
|
||||
|
||||
/*
|
||||
* \brief Write the latest GPS UTC model to XML file
|
||||
*/
|
||||
void gps_utc_model_data_write_to_XML();
|
||||
|
||||
/*
|
||||
* \brief Write the latest ref location to XML file (AGPS)
|
||||
*/
|
||||
void gps_ref_location_data_write_to_XML();
|
||||
|
||||
/*
|
||||
* \brief Write the latest ref time to XML file (AGPS)
|
||||
*/
|
||||
void gps_ref_time_data_write_to_XML();
|
||||
|
||||
/*
|
||||
* \brief Blocking function that reads the iono model queue and updates the shared map, accessible from the PVT block
|
||||
*/
|
||||
@ -187,6 +207,8 @@ private:
|
||||
boost::thread gps_iono_data_collector_thread_;
|
||||
boost::thread gps_utc_model_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_;
|
||||
|
@ -33,6 +33,8 @@
|
||||
#define GNSS_SDR_GPS_REF_LOCATION_H_
|
||||
|
||||
#include "GPS_L1_CA.h"
|
||||
#include "boost/assign.hpp"
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
|
||||
|
||||
/*!
|
||||
@ -50,6 +52,21 @@ public:
|
||||
* Default constructor
|
||||
*/
|
||||
Gps_Ref_Location();
|
||||
|
||||
template<class Archive>
|
||||
|
||||
/*!
|
||||
* \brief Serialize is a boost standard method to be called by the boost XML serialization. Here is used to save the Ref location on disk file.
|
||||
*/
|
||||
void serialize(Archive& archive, const unsigned int version)
|
||||
{
|
||||
using boost::serialization::make_nvp;
|
||||
|
||||
archive & make_nvp("valid", valid);
|
||||
archive & make_nvp("lat", lat);
|
||||
archive & make_nvp("lon", lon);
|
||||
archive & make_nvp("uncertainty", uncertainty);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -33,6 +33,8 @@
|
||||
#define GNSS_SDR_GPS_REF_TIME_H_
|
||||
|
||||
#include "GPS_L1_CA.h"
|
||||
#include "boost/assign.hpp"
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
|
||||
|
||||
/*!
|
||||
@ -51,6 +53,21 @@ public:
|
||||
* Default constructor
|
||||
*/
|
||||
Gps_Ref_Time();
|
||||
|
||||
template<class Archive>
|
||||
|
||||
/*!
|
||||
* \brief Serialize is a boost standard method to be called by the boost XML serialization. Here is used to save the ref time data on disk file.
|
||||
*/
|
||||
void serialize(Archive& archive, const unsigned int version)
|
||||
{
|
||||
using boost::serialization::make_nvp;
|
||||
archive & make_nvp("valid", valid);
|
||||
archive & make_nvp("d_TOW", d_TOW);
|
||||
archive & make_nvp("d_Week", d_Week);
|
||||
archive & make_nvp("d_tv_sec", d_tv_sec);
|
||||
archive & make_nvp("d_tv_usec", d_tv_usec);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,93 +1,16 @@
|
||||
/*!
|
||||
* \file main.cc
|
||||
* \brief Main file of the GNSS-SDR program.
|
||||
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||
*
|
||||
* It sets up the logging system, creates a ControlThread object,
|
||||
* makes it run, and releases memory back when the main thread has ended.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2013 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* GNSS-SDR is a software defined Global Navigation
|
||||
* Satellite Systems receiver
|
||||
*
|
||||
* This file is part of GNSS-SDR.
|
||||
*
|
||||
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* at your option) any later version.
|
||||
*
|
||||
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef GNSS_SDR_VERSION
|
||||
#define GNSS_SDR_VERSION "0.0.2"
|
||||
#endif
|
||||
|
||||
#include <ctime>
|
||||
#include <memory>
|
||||
#include <queue>
|
||||
#include <boost/exception/diagnostic_information.hpp>
|
||||
#include <boost/exception_ptr.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include <gflags/gflags.h>
|
||||
#include <glog/logging.h>
|
||||
#include <gnuradio/msg_queue.h>
|
||||
#include "control_thread.h"
|
||||
#include "concurrent_queue.h"
|
||||
#include "concurrent_map.h"
|
||||
#include "gps_ephemeris.h"
|
||||
#include "gps_almanac.h"
|
||||
#include "gps_iono.h"
|
||||
#include "gps_utc_model.h"
|
||||
#include "galileo_ephemeris.h"
|
||||
#include "galileo_almanac.h"
|
||||
#include "galileo_iono.h"
|
||||
#include "galileo_utc_model.h"
|
||||
#include "sbas_telemetry_data.h"
|
||||
#include "sbas_ionospheric_correction.h"
|
||||
#include "sbas_satellite_correction.h"
|
||||
#include "sbas_ephemeris.h"
|
||||
#include "sbas_time.h"
|
||||
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
DECLARE_string(log_dir);
|
||||
|
||||
/*!
|
||||
* \todo make this queue generic for all the GNSS systems (javi)
|
||||
*/
|
||||
|
||||
/*
|
||||
* Concurrent queues that communicates the Telemetry Decoder
|
||||
* to the Observables modules
|
||||
*/
|
||||
|
||||
// For GPS NAVIGATION
|
||||
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_queue<Gps_Ref_Location> global_gps_ref_location_queue;
|
||||
concurrent_queue<Gps_Ref_Time> global_gps_ref_time_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;
|
||||
concurrent_map<Gps_Almanac> global_gps_almanac_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;
|
||||
|
||||
// For GALILEO NAVIGATION
|
||||
concurrent_queue<Galileo_Ephemeris> global_galileo_ephemeris_queue;
|
||||
|
Loading…
Reference in New Issue
Block a user