1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-03-20 18:37:01 +00:00

Commit from GSoC Mara branzanti (27 August)

- Galileo Ephemeris collector thread

git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@410 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
Javier Arribas 2013-08-27 14:32:44 +00:00
parent 545f50fa47
commit 5b7027206b
6 changed files with 113 additions and 24 deletions

View File

@ -292,6 +292,8 @@ int galileo_e1b_telemetry_decoder_cc::general_work (int noutput_items, gr_vector
//decode_page.split_page(page_String, flag_even_word_arrived); //decode_page.split_page(page_String, flag_even_word_arrived);
flag_even_word_arrived=0; flag_even_word_arrived=0;
//std::cout << "page odd" << page_String << std::endl; //std::cout << "page odd" << page_String << std::endl;
DLOG(INFO) << "mara prova print page odd" << page_String;
//std::cout<<"Page type ="<< page_part_bits[1]<<std::endl; //std::cout<<"Page type ="<< page_part_bits[1]<<std::endl;
} }
else else
@ -300,6 +302,7 @@ int galileo_e1b_telemetry_decoder_cc::general_work (int noutput_items, gr_vector
d_nav.split_page(page_String.c_str(), flag_even_word_arrived); d_nav.split_page(page_String.c_str(), flag_even_word_arrived);
flag_even_word_arrived=1; flag_even_word_arrived=1;
//std::cout << "page even" << std::endl << page_String << std::endl; //std::cout << "page even" << std::endl << page_String << std::endl;
DLOG(INFO) << "Page type =" << page_part_bits[1];
//std::cout<<"Page type ="<< page_part_bits[1]<<std::endl; //std::cout<<"Page type ="<< page_part_bits[1]<<std::endl;
} }

View File

@ -38,6 +38,12 @@
#include "gps_iono.h" #include "gps_iono.h"
#include "gps_utc_model.h" #include "gps_utc_model.h"
#include "gps_almanac.h" #include "gps_almanac.h"
#include "galileo_ephemeris.h"
#include "galileo_iono.h"
#include "galileo_utc_model.h"
#include "galileo_almanac.h"
#include "concurrent_queue.h" #include "concurrent_queue.h"
#include "concurrent_map.h" #include "concurrent_map.h"
#include <unistd.h> #include <unistd.h>
@ -63,6 +69,19 @@ extern concurrent_queue<Gps_Utc_Model> global_gps_utc_model_queue;
extern concurrent_queue<Gps_Almanac> global_gps_almanac_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_Acq_Assist> global_gps_acq_assist_queue;
extern concurrent_map<Galileo_Ephemeris> global_galileo_ephemeris_map;
extern concurrent_map<Galileo_Iono> global_galileo_iono_map;
extern concurrent_map<Galileo_Utc_Model> global_galileo_utc_model_map;
extern concurrent_map<Galileo_Almanac> global_galileo_almanac_map;
//extern concurrent_map<Galileo_Acq_Assist> global_gps_acq_assist_map;
extern concurrent_queue<Galileo_Ephemeris> global_galileo_ephemeris_queue;
extern concurrent_queue<Galileo_Iono> global_galileo_iono_queue;
extern concurrent_queue<Galileo_Utc_Model> global_galileo_utc_model_queue;
extern concurrent_queue<Galileo_Almanac> global_galileo_almanac_queue;
//extern concurrent_queue<Galileo_Acq_Assist> global_gps_acq_assist_queue;
using google::LogMessage; using google::LogMessage;
DEFINE_string(config_file, "../conf/gnss-sdr.conf", DEFINE_string(config_file, "../conf/gnss-sdr.conf",
@ -141,6 +160,8 @@ void ControlThread::run()
gps_utc_model_data_collector_thread_ =boost::thread(&ControlThread::gps_utc_model_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_acq_assist_data_collector_thread_=boost::thread(&ControlThread::gps_acq_assist_data_collector,this);
galileo_ephemeris_data_collector_thread_ =boost::thread(&ControlThread::galileo_ephemeris_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_)
{ {
@ -150,10 +171,17 @@ 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();
// Join GPS threads
gps_ephemeris_data_collector_thread_.timed_join(boost::posix_time::seconds(1)); gps_ephemeris_data_collector_thread_.timed_join(boost::posix_time::seconds(1));
gps_iono_data_collector_thread_.timed_join(boost::posix_time::seconds(1)); 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_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_acq_assist_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));
//Join keyboard threads
keyboard_thread_.timed_join(boost::posix_time::seconds(1)); keyboard_thread_.timed_join(boost::posix_time::seconds(1));
LOG_AT_LEVEL(INFO) << "Flowgraph stopped"; LOG_AT_LEVEL(INFO) << "Flowgraph stopped";
@ -451,6 +479,51 @@ void ControlThread::gps_ephemeris_data_collector()
} }
} }
void ControlThread::galileo_ephemeris_data_collector()
{
// ############ 1.bis READ EPHEMERIS/UTC_MODE/IONO QUEUE ####################
Galileo_Ephemeris galileo_eph;
Galileo_Ephemeris galileo_eph_old;
while(stop_==false)
{
global_galileo_ephemeris_queue.wait_and_pop(galileo_eph);
// DEBUG MESSAGE
std::cout << "Ephemeris record has arrived from SAT ID "
<< galileo_eph.SV_ID_PRN_4 << std::endl;
// insert new ephemeris record to the global ephemeris map
if (global_galileo_ephemeris_map.read(galileo_eph.SV_ID_PRN_4,galileo_eph_old))
{
// Check the EPHEMERIS timestamp. If it is newer, then update the ephemeris
if (galileo_eph.WN_5 > galileo_eph_old.WN_5)
{
std::cout << "Ephemeris record updated -- GALILEO Week Number ="<<galileo_eph.WN_5<<std::endl;
global_galileo_ephemeris_map.write(galileo_eph.SV_ID_PRN_4,galileo_eph);
}else{
if (galileo_eph.TOW_5 > galileo_eph_old.TOW_5)
{
std::cout << "Ephemeris record updated -- GALILEO TOW ="<<galileo_eph.TOW_5<<std::endl;
global_galileo_ephemeris_map.write(galileo_eph.SV_ID_PRN_4,galileo_eph);
std::cout << "Ephemeris tow OLD: " << galileo_eph_old.TOW_5<<std::endl;
std::cout << "Ephemeris satellite: " << galileo_eph.SV_ID_PRN_4<<std::endl;
}else{
std::cout<<"Not updating the existing ephemeris"<<std::endl;
}
}
//
}else{
// insert new ephemeris record
std::cout << "New Ephemeris record inserted with TOW="<<galileo_eph.TOW_5<<" and GALILEO Week Number="<< galileo_eph.WN_5 << std::endl;
global_galileo_ephemeris_map.write(galileo_eph.SV_ID_PRN_4, galileo_eph);
}
}
}
void ControlThread::gps_iono_data_collector() void ControlThread::gps_iono_data_collector()
{ {

View File

@ -159,6 +159,13 @@ private:
*/ */
void gps_acq_assist_data_collector(); void gps_acq_assist_data_collector();
/*
* \brief Blocking function that reads the Galileo ephemeris queue and updates the shared ephemeris map, accessible from the PVT block
*/
void galileo_ephemeris_data_collector();
void apply_action(unsigned int what); void apply_action(unsigned int what);
GNSSFlowgraph *flowgraph_; GNSSFlowgraph *flowgraph_;
ConfigurationInterface *configuration_; ConfigurationInterface *configuration_;
@ -174,6 +181,9 @@ private:
boost::thread gps_iono_data_collector_thread_; boost::thread gps_iono_data_collector_thread_;
boost::thread gps_utc_model_data_collector_thread_; boost::thread gps_utc_model_data_collector_thread_;
boost::thread gps_acq_assist_data_collector_thread_; boost::thread gps_acq_assist_data_collector_thread_;
boost::thread galileo_ephemeris_data_collector_thread_;
void keyboard_listener(); void keyboard_listener();
}; };

View File

@ -35,32 +35,33 @@
Galileo_Ephemeris::Galileo_Ephemeris() Galileo_Ephemeris::Galileo_Ephemeris()
{ {
double M0_1 = 0; // Mean anomaly at reference time [semi-circles] SV_ID_PRN_4 = 0;
double delta_n_3 = 0; // Mean motion difference from computed value [semi-circles/sec] M0_1 = 0; // Mean anomaly at reference time [semi-circles]
double e_1 = 0; // Eccentricity delta_n_3 = 0; // Mean motion difference from computed value [semi-circles/sec]
double A_1 = 0; // Square root of the semi-major axis [metres^1/2] e_1 = 0; // Eccentricity
double OMEGA_0_2 = 0; // Longitude of ascending node of orbital plane at weekly epoch [semi-circles] A_1 = 0; // Square root of the semi-major axis [metres^1/2]
double i_0_2 = 0; // Inclination angle at reference time [semi-circles] OMEGA_0_2 = 0; // Longitude of ascending node of orbital plane at weekly epoch [semi-circles]
double omega_2 = 0; // Argument of perigee [semi-circles] i_0_2 = 0; // Inclination angle at reference time [semi-circles]
double OMEGA_dot_3 = 0; // Rate of right ascension [semi-circles/sec] omega_2 = 0; // Argument of perigee [semi-circles]
double iDot_2 = 0; // Rate of inclination angle [semi-circles/sec] OMEGA_dot_3 = 0; // Rate of right ascension [semi-circles/sec]
double C_uc_3 = 0; // Amplitude of the cosine harmonic correction term to the argument of latitude [radians] iDot_2 = 0; // Rate of inclination angle [semi-circles/sec]
double C_us_3 = 0; // Amplitude of the sine harmonic correction term to the argument of latitude [radians] C_uc_3 = 0; // Amplitude of the cosine harmonic correction term to the argument of latitude [radians]
double C_rc_3 = 0; // Amplitude of the cosine harmonic correction term to the orbit radius [meters] C_us_3 = 0; // Amplitude of the sine harmonic correction term to the argument of latitude [radians]
double C_rs_3 = 0; // Amplitude of the sine harmonic correction term to the orbit radius [meters] C_rc_3 = 0; // Amplitude of the cosine harmonic correction term to the orbit radius [meters]
double C_ic_4 = 0; // Amplitude of the cosine harmonic correction term to the angle of inclination [radians] C_rs_3 = 0; // Amplitude of the sine harmonic correction term to the orbit radius [meters]
double C_is_4 = 0; // Amplitude of the sine harmonic correction term to the angle of inclination [radians] C_ic_4 = 0; // Amplitude of the cosine harmonic correction term to the angle of inclination [radians]
double t0e_1 = 0; // Ephemeris reference time [s] C_is_4 = 0; // Amplitude of the sine harmonic correction term to the angle of inclination [radians]
t0e_1 = 0; // Ephemeris reference time [s]
/*Clock correction parameters*/ /*Clock correction parameters*/
double t0c_4 = 0; //Clock correction data reference Time of Week [sec] t0c_4 = 0; //Clock correction data reference Time of Week [sec]
double af0_4 = 0; //SV clock bias correction coefficient [s] af0_4 = 0; //SV clock bias correction coefficient [s]
double af1_4 = 0; //SV clock drift correction coefficient [s/s] af1_4 = 0; //SV clock drift correction coefficient [s/s]
double af2_4 = 0; //SV clock drift rate correction coefficient [s/s^2] af2_4 = 0; //SV clock drift rate correction coefficient [s/s^2]
/*GST*/ /*GST*/
double WN_5 = 0; WN_5 = 0;
double TOW_5 = 0; TOW_5 = 0;
} }

View File

@ -52,6 +52,7 @@ public:
/*Galileo ephemeris are 16 parameters and here are reported following the ICD order, paragraph 5.1.1. /*Galileo ephemeris are 16 parameters and here are reported following the ICD order, paragraph 5.1.1.
The number in the name after underscore (_1, _2, _3 and so on) refers to the page were we can find that parameter */ The number in the name after underscore (_1, _2, _3 and so on) refers to the page were we can find that parameter */
int SV_ID_PRN_4;
double M0_1; // Mean anomaly at reference time [semi-circles] double M0_1; // Mean anomaly at reference time [semi-circles]
double delta_n_3; // Mean motion difference from computed value [semi-circles/sec] double delta_n_3; // Mean motion difference from computed value [semi-circles/sec]
double e_1; // Eccentricity double e_1; // Eccentricity

View File

@ -553,6 +553,7 @@ Galileo_Ephemeris Galileo_Navigation_Message::get_ephemeris()
{ {
Galileo_Ephemeris ephemeris; Galileo_Ephemeris ephemeris;
ephemeris.SV_ID_PRN_4 = SV_ID_PRN_4;
ephemeris.M0_1 = M0_1; // Mean anomaly at reference time [semi-circles] ephemeris.M0_1 = M0_1; // Mean anomaly at reference time [semi-circles]
ephemeris.delta_n_3 = delta_n_3; // Mean motion difference from computed value [semi-circles/sec] ephemeris.delta_n_3 = delta_n_3; // Mean motion difference from computed value [semi-circles/sec]
ephemeris.e_1 = e_1; // Eccentricity ephemeris.e_1 = e_1; // Eccentricity