Add work on warm start

This commit is contained in:
Carles Fernandez 2018-11-20 09:28:47 +01:00
parent e400319e7e
commit ea59abee77
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
10 changed files with 94 additions and 43 deletions

View File

@ -996,7 +996,7 @@ bool gnss_sdr_supl_client::load_ref_time_xml(const std::string file_name)
}
bool gnss_sdr_supl_client::save_ref_time_map_xml(const std::string file_name, std::map<int, Gps_Ref_Time> ref_time_map)
bool gnss_sdr_supl_client::save_ref_time_map_xml(const std::string file_name, std::map<int, Agnss_Ref_Time> ref_time_map)
{
if (ref_time_map.empty() == false)
{
@ -1043,7 +1043,7 @@ bool gnss_sdr_supl_client::load_ref_location_xml(const std::string file_name)
}
bool gnss_sdr_supl_client::save_ref_location_map_xml(const std::string file_name, std::map<int, Gps_Ref_Location> ref_location_map)
bool gnss_sdr_supl_client::save_ref_location_map_xml(const std::string file_name, std::map<int, Agnss_Ref_Location> ref_location_map)
{
if (ref_location_map.empty() == false)
{

View File

@ -38,6 +38,8 @@ extern "C"
{
#include "supl.h"
}
#include "agnss_ref_location.h"
#include "agnss_ref_time.h"
#include "GPS_L1_CA.h"
#include "gps_ephemeris.h"
#include "gps_iono.h"
@ -45,8 +47,6 @@ extern "C"
#include "gps_utc_model.h"
#include "gps_cnav_utc_model.h"
#include "gps_acq_assist.h"
#include "gps_ref_time.h"
#include "gps_ref_location.h"
#include "gps_cnav_ephemeris.h"
#include "galileo_ephemeris.h"
#include "galileo_utc_model.h"
@ -98,14 +98,14 @@ public:
Gps_Iono gps_iono;
Galileo_Iono gal_iono;
// reference time
Gps_Ref_Time gps_time;
Agnss_Ref_Time gps_time;
// UTC model
Gps_Utc_Model gps_utc;
Galileo_Utc_Model gal_utc;
Gps_CNAV_Utc_Model gps_cnav_utc;
Glonass_Gnav_Utc_Model glo_gnav_utc;
// reference location
Gps_Ref_Location gps_ref_loc;
Agnss_Ref_Location gps_ref_loc;
// Acquisition Assistance map
std::map<int, Gps_Acq_Assist> gps_acq_map;
@ -257,7 +257,7 @@ public:
* \brief Save ref time map to XML file
*/
bool save_ref_time_map_xml(const std::string file_name,
std::map<int, Gps_Ref_Time> ref_time_map);
std::map<int, Agnss_Ref_Time> ref_time_map);
/*!
* \brief Read ref location from XML file
@ -268,7 +268,7 @@ public:
* \brief Save ref location map to XML file
*/
bool save_ref_location_map_xml(std::string file_name,
std::map<int, Gps_Ref_Location> ref_location_map);
std::map<int, Agnss_Ref_Location> ref_location_map);
/*
* Prints SUPL data to std::cout. Use it for debug purposes only.

View File

@ -422,7 +422,7 @@ bool ControlThread::read_assistance_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);
std::shared_ptr<Agnss_Ref_Time> tmp_obj = std::make_shared<Agnss_Ref_Time>(supl_client_acquisition_.gps_time);
flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
}
else
@ -434,7 +434,7 @@ bool ControlThread::read_assistance_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);
std::shared_ptr<Agnss_Ref_Location> tmp_obj = std::make_shared<Agnss_Ref_Location>(supl_client_acquisition_.gps_ref_loc);
flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
}
else
@ -618,13 +618,15 @@ void ControlThread::assist_GNSS()
if (supl_client_acquisition_.gps_ref_loc.valid == true)
{
std::cout << "SUPL: Received Ref Location data (Acquisition Assistance)" << std::endl;
std::shared_ptr<Gps_Ref_Location> tmp_obj = std::make_shared<Gps_Ref_Location>(supl_client_acquisition_.gps_ref_loc);
agnss_ref_location_ = supl_client_acquisition_.gps_ref_loc;
std::shared_ptr<Agnss_Ref_Location> tmp_obj = std::make_shared<Agnss_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 data (Acquisition Assistance)" << std::endl;
std::shared_ptr<Gps_Ref_Time> tmp_obj = std::make_shared<Gps_Ref_Time>(supl_client_acquisition_.gps_time);
agnss_ref_time_ = supl_client_acquisition_.gps_time;
std::shared_ptr<Agnss_Ref_Time> tmp_obj = std::make_shared<Agnss_Ref_Time>(supl_client_acquisition_.gps_time);
flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
}
}
@ -645,6 +647,25 @@ void ControlThread::assist_GNSS()
std::cout << "GNSS assistance data loaded from local XML file(s)." << std::endl;
}
}
// If we have enough AGNSS data, make use of it
if (agnss_ref_location_.valid == true) // and agnss_ref_time_.valid == true and we have AGNSS data
{
// Set the receiver in Standby mode
flowgraph_->apply_action(0, 10);
// Get the list of visible satellites
arma::vec ref_LLH = arma::zeros(1, 3);
ref_LLH(0) = agnss_ref_location_.lat;
ref_LLH(1) = agnss_ref_location_.lon;
time_t ref_rx_utc_time = 0;
std::vector<std::pair<int, Gnss_Satellite>> visible_sats = get_visible_sats(ref_rx_utc_time, ref_LLH);
// Set the receiver in Standby mode
flowgraph_->apply_action(0, 10);
// Give priority to visible satellites in the search list
flowgraph_->priorize_satellites(visible_sats);
// Warm Start
flowgraph_->apply_action(0, 13);
}
}
@ -670,6 +691,31 @@ void ControlThread::init()
supl_lac = 0;
supl_ci = 0;
msqid = -1;
agnss_ref_location_ = Agnss_Ref_Location();
agnss_ref_time_ = Agnss_Ref_Time();
std::string empty_string = "";
std::string ref_location_str = configuration_->property("GNSS-SDR.AGNSS_ref_location", empty_string);
std::string ref_time_str = configuration_->property("GNSS-SDR.AGNSS_ref_utc_time", empty_string);
if (ref_location_str.compare(empty_string) != 0)
{
// fill agnss_ref_location_
agnss_ref_location_.lat = 0.0; // fill
agnss_ref_location_.lon = 0.0; // fill
agnss_ref_location_.valid = true;
}
if (ref_time_str.compare(empty_string) == 0)
{
// Make and educated guess with local system time? Implies timezones, etc.
}
else
{
// fill agnss_ref_time_
agnss_ref_time_.d_TOW = 0.0; // fill
agnss_ref_time_.d_Week = 0; // fill
agnss_ref_time_.d_tv_sec = 0; // fill
agnss_ref_time_.valid = true;
}
}
@ -744,7 +790,7 @@ void ControlThread::apply_action(unsigned int what)
visible_satellites = get_visible_sats(cmd_interface_.get_utc_time(), cmd_interface_.get_LLH());
//reorder the satellite queue to acquire first those visible satellites
flowgraph_->priorize_satellites(visible_satellites);
//start again the satellite acquisitions (done in chained applyaction to flowgraph)
//start again the satellite acquisitions (done in chained apply_action to flowgraph)
break;
case 13:
LOG(INFO) << "Receiver action WARMSTART";
@ -754,11 +800,11 @@ void ControlThread::apply_action(unsigned int what)
//load the ephemeris and the almanac from XML files (receiver assistance)
read_assistance_from_XML();
//call here the function that computes the set of visible satellites and its elevation
//for the date and time specified by the warmstart command and the assisted position
//for the date and time specified by the warm start command and the assisted position
get_visible_sats(cmd_interface_.get_utc_time(), cmd_interface_.get_LLH());
//reorder the satellite queue to acquire first those visible satellites
flowgraph_->priorize_satellites(visible_satellites);
//start again the satellite acquisitions (done in chained applyaction to flowgraph)
//start again the satellite acquisitions (done in chained apply_action to flowgraph)
break;
default:
LOG(INFO) << "Unrecognized action.";

View File

@ -41,6 +41,8 @@
#include "tcp_cmd_interface.h"
#include "gnss_flowgraph.h"
#include "configuration_interface.h"
#include "agnss_ref_location.h"
#include "agnss_ref_time.h"
#include <boost/thread.hpp>
#include <gnuradio/msg_queue.h>
#include <memory>
@ -189,6 +191,9 @@ private:
const std::string glo_utc_default_xml_filename = "./glo_utc_model.xml";
const std::string gal_almanac_default_xml_filename = "./gal_almanac.xml";
const std::string gps_almanac_default_xml_filename = "./gps_almanac.xml";
Agnss_Ref_Location agnss_ref_location_;
Agnss_Ref_Time agnss_ref_time_;
};
#endif /*GNSS_SDR_CONTROL_THREAD_H_*/

View File

@ -25,8 +25,8 @@ set(SYSTEM_PARAMETERS_SOURCES
gps_almanac.cc
gps_utc_model.cc
gps_acq_assist.cc
gps_ref_time.cc
gps_ref_location.cc
agnss_ref_time.cc
agnss_ref_location.cc
galileo_utc_model.cc
galileo_ephemeris.cc
galileo_almanac.cc
@ -55,8 +55,8 @@ set(SYSTEM_PARAMETERS_HEADERS
gps_almanac.h
gps_utc_model.h
gps_acq_assist.h
gps_ref_time.h
gps_ref_location.h
agnss_ref_time.h
agnss_ref_location.h
galileo_utc_model.h
galileo_ephemeris.h
galileo_almanac.h

View File

@ -1,6 +1,6 @@
/*!
* \file gps_ref_location.cc
* \brief Interface of a GPS REFERENCE LOCATION storage
* \file agnss_ref_location.cc
* \brief Interface of an Assisted GNSS REFERENCE LOCATION storage
*
* \author Javier Arribas, 2013. jarribas(at)cttc.es
*
@ -29,9 +29,9 @@
* -------------------------------------------------------------------------
*/
#include "gps_ref_location.h"
#include "agnss_ref_location.h"
Gps_Ref_Location::Gps_Ref_Location()
Agnss_Ref_Location::Agnss_Ref_Location()
{
valid = false;
lat = 0.0;

View File

@ -1,6 +1,6 @@
/*!
* \file gps_ref_location.h
* \brief Interface of a GPS REFERENCE LOCATION storage
* \file agnss_ref_location.h
* \brief Interface of an Assisted GNSS REFERENCE LOCATION storage
* \author Javier Arribas, 2013. jarribas(at)cttc.es
*
* -------------------------------------------------------------------------
@ -29,18 +29,18 @@
*/
#ifndef GNSS_SDR_GPS_REF_LOCATION_H_
#define GNSS_SDR_GPS_REF_LOCATION_H_
#ifndef GNSS_SDR_AGNSS_REF_LOCATION_H_
#define GNSS_SDR_AGNSS_REF_LOCATION_H_
#include <boost/assign.hpp>
#include <boost/serialization/nvp.hpp>
/*!
* \brief Interface of a GPS REFERENCE LOCATION storage
* \brief Interface of an Assisted GNSS REFERENCE LOCATION storage
*
*/
class Gps_Ref_Location
class Agnss_Ref_Location
{
public:
bool valid;
@ -50,7 +50,7 @@ public:
/*!
* Default constructor
*/
Gps_Ref_Location();
Agnss_Ref_Location();
template <class Archive>

View File

@ -1,6 +1,6 @@
/*!
* \file gps_ref_time.cc
* \brief Interface of a GPS REFERENCE TIME storage
* \file agnss_ref_time.cc
* \brief Interface of an Assisted GNSS REFERENCE TIME storage
*
* \author Javier Arribas, 2013. jarribas(at)cttc.es
*
@ -29,9 +29,9 @@
* -------------------------------------------------------------------------
*/
#include "gps_ref_time.h"
#include "agnss_ref_time.h"
Gps_Ref_Time::Gps_Ref_Time()
Agnss_Ref_Time::Agnss_Ref_Time()
{
valid = false;
d_TOW = 0.0;

View File

@ -1,6 +1,6 @@
/*!
* \file gps_ref_time.h
* \brief Interface of a GPS REFERENCE TIME storage
* \file agnss_ref_time.h
* \brief Interface of an Assisted GNSS REFERENCE TIME storage
* \author Javier Arribas, 2013. jarribas(at)cttc.es
*
* -------------------------------------------------------------------------
@ -29,18 +29,18 @@
*/
#ifndef GNSS_SDR_GPS_REF_TIME_H_
#define GNSS_SDR_GPS_REF_TIME_H_
#ifndef GNSS_SDR_AGNSS_REF_TIME_H_
#define GNSS_SDR_AGNSS_REF_TIME_H_
#include <boost/assign.hpp>
#include <boost/serialization/nvp.hpp>
/*!
* \brief Interface of a GPS REFERENCE TIME storage
* \brief Interface of an Assisted GNSS REFERENCE TIME storage
*
*/
class Gps_Ref_Time
class Agnss_Ref_Time
{
public:
bool valid;
@ -51,7 +51,7 @@ public:
/*!
* Default constructor
*/
Gps_Ref_Time();
Agnss_Ref_Time();
template <class Archive>

View File

@ -29,6 +29,8 @@
* -------------------------------------------------------------------------
*/
#include "agnss_ref_location.h"
#include "agnss_ref_time.h"
#include "concurrent_queue.h"
#include "concurrent_map.h"
#include "gps_navigation_message.h"
@ -36,8 +38,6 @@
#include "gps_cnav_ephemeris.h"
#include "gps_cnav_iono.h"
#include "gps_acq_assist.h"
#include "gps_ref_location.h"
#include "gps_ref_time.h"
#include "galileo_navigation_message.h"
#include <boost/thread.hpp>
#include <boost/filesystem.hpp>