mirror of
				https://github.com/gnss-sdr/gnss-sdr
				synced 2025-10-29 22:42:59 +00:00 
			
		
		
		
	Galileo navigation queues ready and some code cleaning and doxigen documentation
git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@403 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
		| @@ -229,8 +229,8 @@ int galileo_e1b_telemetry_decoder_cc::general_work (int noutput_items, gr_vector | ||||
|                     if (abs(preamble_diff - GALILEO_INAV_PREAMBLE_PERIOD_SYMBOLS) < 1) | ||||
|                         { | ||||
|  | ||||
|                     		std::cout<<"d_sample_counter="<<d_sample_counter<<std::endl; | ||||
|                     		std::cout<<"corr_value="<<corr_value<<std::endl; | ||||
|                     		//std::cout<<"d_sample_counter="<<d_sample_counter<<std::endl; | ||||
|                     		//std::cout<<"corr_value="<<corr_value<<std::endl; | ||||
|                     		// NEW Galileo page part is received | ||||
|                     	    // 0. fetch the symbols into an array | ||||
|                     	    int frame_length=GALILEO_INAV_PAGE_PART_SYMBOLS-d_symbols_per_preamble; | ||||
| @@ -268,43 +268,57 @@ int galileo_e1b_telemetry_decoder_cc::general_work (int noutput_items, gr_vector | ||||
|  | ||||
|                      	    std::string page_String; | ||||
|  | ||||
|                       	    //std::cout<<"frame_bits=["; | ||||
|                      	    for(int i=0; i < (frame_length/2); i++) | ||||
|                      	    { | ||||
|                      	    	if (page_part_bits[i]>0) | ||||
|                      	    	{ | ||||
|                      	    		page_String.push_back('1'); | ||||
|                     	    		//std::cout<<",1"; | ||||
|                      	    	}else{ | ||||
|                      	    		page_String.push_back('0'); | ||||
|                     	    		//std::cout<<",0"; | ||||
|                      	    	} | ||||
|  | ||||
|                      	    	//sprintf(&page_String[i], "%d", page_part_bits[i]); // this produces a memory core dumped... | ||||
|                      	    } | ||||
|                     	    //std::cout<<"]"<<std::endl; | ||||
|  | ||||
|                      	    Galileo_Navigation_Message decode_page; | ||||
|  | ||||
|                      	    std::cout<<"page_string="<<page_String<<std::endl; //correctly transformed to char | ||||
|  | ||||
|                      	    // Galileo_Navigation_Message d_nav; // Now is a class member object, to store the intermediate results from call to call | ||||
|                      	    //std::cout<<"page_string="<<page_String<<std::endl; //correctly transformed to char | ||||
|  | ||||
|              	             if (page_part_bits[0]==1) | ||||
|                               { | ||||
|                              	 std::cout<<"Page Odd"<<std::endl; | ||||
|                              	 decode_page.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=0; | ||||
|                              	 std::cout<<"Page type ="<< page_part_bits[1]<<std::endl; | ||||
|                                } | ||||
|                               else | ||||
|                               { | ||||
|                              	 std::cout<<"Page Even"<<std::endl; | ||||
|                              	 decode_page.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; | ||||
|                              	 std::cout<<"Page type ="<< page_part_bits[1]<<std::endl; | ||||
|                               } | ||||
|  | ||||
|              	            // 4. Push the new navigation data to the queues | ||||
|                       	    //ToDo: Decide if we have an updated ephemeris for the current satellite, | ||||
|              	            //      fill the ephemeris class and push the object to the concurrent queue | ||||
|              	            //      Do the same for the | ||||
|              	            // sample from Gps 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 | ||||
| 								d_ephemeris_queue->push(ephemeris); | ||||
| 							} | ||||
| 							if (d_nav.have_new_iono()==true) | ||||
| 							{ | ||||
| 								Galileo_Iono iono=d_nav.get_iono(); //notice that the read operation will clear the valid flag | ||||
| 								d_iono_queue->push(iono); | ||||
| 							} | ||||
| 							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 | ||||
| 								d_utc_model_queue->push(utc_model); | ||||
| 							} | ||||
|  | ||||
|                             d_flag_preamble = true; | ||||
|                             d_preamble_index = d_sample_counter;  //record the preamble sample stamp (t_P) | ||||
| @@ -339,23 +353,15 @@ int galileo_e1b_telemetry_decoder_cc::general_work (int noutput_items, gr_vector | ||||
|     //1. Copy the current tracking output | ||||
|     current_synchro_data = in[0][0]; | ||||
|     //2. Add the telemetry decoder information | ||||
|     //if (this->d_flag_preamble==true and d_GPS_FSM.d_nav.d_TOW>0) //update TOW at the preamble instant (todo: check for valid d_TOW) | ||||
|     if (this->d_flag_preamble==true) //update TOW at the preamble instant (todo: check for valid d_TOW) | ||||
|         { | ||||
|             //d_TOW_at_Preamble = d_GPS_FSM.d_nav.d_TOW + GPS_SUBFRAME_SECONDS; //we decoded the current TOW when the last word of the subframe arrive, so, we have a lag of ONE SUBFRAME | ||||
|             //d_TOW_at_current_symbol = d_TOW_at_Preamble + GALILEO_INAV_PREAMBLE_LENGTH_BITS/Galileo_E1_B_SYMBOL_RATE_BPS; | ||||
|             Prn_timestamp_at_preamble_ms = in[0][0].Tracking_timestamp_secs * 1000.0; | ||||
|             ///if (flag_TOW_set==false) | ||||
|                 //{ | ||||
|                 //    flag_TOW_set = true; | ||||
|                 //} | ||||
|         } | ||||
|     else | ||||
|         { | ||||
|             //d_TOW_at_current_symbol = d_TOW_at_current_symbol + Galileo_E1_CODE_PERIOD; | ||||
|         } | ||||
|  | ||||
|  | ||||
|     current_synchro_data.d_TOW = d_TOW_at_Preamble; | ||||
|     current_synchro_data.d_TOW_at_current_symbol = d_TOW_at_current_symbol; | ||||
|     current_synchro_data.Flag_valid_word = (d_flag_frame_sync == true and d_flag_parity == true and flag_TOW_set==true); | ||||
| @@ -391,7 +397,6 @@ void galileo_e1b_telemetry_decoder_cc::set_satellite(Gnss_Satellite satellite) | ||||
| { | ||||
|     d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); | ||||
|     DLOG(INFO) << "Setting decoder Finite State Machine to satellite "  << d_satellite; | ||||
|     //d_GPS_FSM.i_satellite_PRN = d_satellite.get_PRN(); | ||||
|     DLOG(INFO) << "Navigation Satellite set to " << d_satellite; | ||||
| } | ||||
|  | ||||
| @@ -399,7 +404,6 @@ void galileo_e1b_telemetry_decoder_cc::set_satellite(Gnss_Satellite satellite) | ||||
| void galileo_e1b_telemetry_decoder_cc::set_channel(int channel) | ||||
| { | ||||
|     d_channel = channel; | ||||
|     //d_GPS_FSM.i_channel_ID = channel; | ||||
|     DLOG(INFO) << "Navigation channel set to " << channel; | ||||
|     // ############# ENABLE DATA FILE LOG ################# | ||||
|     if (d_dump == true) | ||||
| @@ -425,19 +429,19 @@ void galileo_e1b_telemetry_decoder_cc::set_channel(int channel) | ||||
|  | ||||
| void galileo_e1b_telemetry_decoder_cc::set_ephemeris_queue(concurrent_queue<Galileo_Ephemeris> *ephemeris_queue) | ||||
| { | ||||
| 	//d_Galileo_INAV_FSM.d_ephemeris_queue = ephemeris_queue; | ||||
| 	d_ephemeris_queue = ephemeris_queue; | ||||
| } | ||||
| void galileo_e1b_telemetry_decoder_cc::set_iono_queue(concurrent_queue<Galileo_Iono> *iono_queue) | ||||
| { | ||||
| 	//d_Galileo_INAV_FSM.d_iono_queue = iono_queue; | ||||
| 	d_iono_queue = iono_queue; | ||||
| } | ||||
| void galileo_e1b_telemetry_decoder_cc::set_almanac_queue(concurrent_queue<Galileo_Almanac> *almanac_queue) | ||||
| { | ||||
| 	//d_Galileo_INAV_FSM.d_almanac_queue = almanac_queue; | ||||
| 	d_almanac_queue = almanac_queue; | ||||
| } | ||||
| void galileo_e1b_telemetry_decoder_cc::set_utc_model_queue(concurrent_queue<Galileo_Utc_Model> *utc_model_queue) | ||||
| { | ||||
| 	//d_Galileo_INAV_FSM.d_utc_model_queue = utc_model_queue; | ||||
| 	d_utc_model_queue = utc_model_queue; | ||||
| } | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -43,15 +43,20 @@ | ||||
| #include "gnuradio/trellis/permutation.h" | ||||
| #include "gnuradio/fec/viterbi.h" | ||||
|  | ||||
| //#include <gnuradio/gr_sync_block.h> | ||||
| #include "gnss_satellite.h" | ||||
| //#include "galileo_inav_fsm.h" | ||||
| #include "galileo_navigation_message.h" | ||||
| #include "galileo_ephemeris.h" | ||||
| #include "galileo_almanac.h" | ||||
| #include "galileo_iono.h" | ||||
| #include "galileo_utc_model.h" | ||||
|  | ||||
| // Galileo Navigation Message structures | ||||
| #include "galileo_ephemeris.h" | ||||
| #include "galileo_iono.h" | ||||
| #include "galileo_almanac.h" | ||||
| #include "galileo_utc_model.h" | ||||
|  | ||||
|  | ||||
| class galileo_e1b_telemetry_decoder_cc; | ||||
|  | ||||
| typedef boost::shared_ptr<galileo_e1b_telemetry_decoder_cc> galileo_e1b_telemetry_decoder_cc_sptr; | ||||
| @@ -110,13 +115,18 @@ private: | ||||
|  | ||||
|     long d_fs_in; | ||||
|  | ||||
|  | ||||
|     //gr::trellis::interleaver d_interleaver; | ||||
|  | ||||
|     // navigation message vars | ||||
|     Galileo_Navigation_Message d_nav; | ||||
|  | ||||
|     //GalileoINAVFsm d_Galileo_INAV_FSM; | ||||
|     //ToDo: Update the Galileo_Ephemeris,Galileo_Iono,Galileo_Utc_Model, and Galileo_Almanac classes to store the Galileo parameters | ||||
|     // 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; | ||||
|     unsigned int d_vector_length; | ||||
|   | ||||
| @@ -1,298 +0,0 @@ | ||||
| /*! | ||||
|  * \file gps_l1_ca_subframe_fsm.cc | ||||
|  * \brief  Implementation of a GPS NAV message word-to-subframe decoder state machine | ||||
|  * \author Javier Arribas, 2011. jarribas(at)cttc.es | ||||
|  * | ||||
|  * ------------------------------------------------------------------------- | ||||
|  * | ||||
|  * Copyright (C) 2010-2012  (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/>. | ||||
|  * | ||||
|  * ------------------------------------------------------------------------- | ||||
|  */ | ||||
|  | ||||
| #include "gps_l1_ca_subframe_fsm.h" | ||||
|  | ||||
|  | ||||
| //************ GPS WORD TO SUBFRAME DECODER STATE MACHINE ********** | ||||
|  | ||||
| struct Ev_gps_word_valid : sc::event<Ev_gps_word_valid> {}; | ||||
| struct Ev_gps_word_invalid : sc::event<Ev_gps_word_invalid>{}; | ||||
| struct Ev_gps_word_preamble : sc::event<Ev_gps_word_preamble>{}; | ||||
|  | ||||
|  | ||||
| struct gps_subframe_fsm_S0: public sc::state<gps_subframe_fsm_S0, GpsL1CaSubframeFsm> | ||||
| { | ||||
| public: | ||||
|     // sc::transition(event,next_status) | ||||
|     typedef sc::transition< Ev_gps_word_preamble, gps_subframe_fsm_S1 > reactions; | ||||
|     gps_subframe_fsm_S0(my_context ctx): my_base( ctx ) | ||||
|     { | ||||
|         //std::cout<<"Enter S0 "<<std::endl; | ||||
|     } | ||||
| }; | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| struct gps_subframe_fsm_S1: public sc::state<gps_subframe_fsm_S1, GpsL1CaSubframeFsm> | ||||
| { | ||||
| public: | ||||
|     typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >, | ||||
|             sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S2 > > reactions; | ||||
|  | ||||
|     gps_subframe_fsm_S1(my_context ctx): my_base( ctx ) | ||||
|     { | ||||
|         //std::cout<<"Enter S1 "<<std::endl; | ||||
|     } | ||||
| }; | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| struct gps_subframe_fsm_S2: public sc::state<gps_subframe_fsm_S2, GpsL1CaSubframeFsm> | ||||
| { | ||||
| public: | ||||
|     typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >, | ||||
|             sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S3 > > reactions; | ||||
|  | ||||
|     gps_subframe_fsm_S2(my_context ctx): my_base( ctx ) | ||||
|     { | ||||
|         //std::cout<<"Enter S2 "<<std::endl; | ||||
|         context< GpsL1CaSubframeFsm >().gps_word_to_subframe(0); | ||||
|     } | ||||
| }; | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| struct gps_subframe_fsm_S3: public sc::state<gps_subframe_fsm_S3, GpsL1CaSubframeFsm> | ||||
| { | ||||
| public: | ||||
|     typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >, | ||||
|             sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S4 > > reactions; | ||||
|  | ||||
|     gps_subframe_fsm_S3(my_context ctx): my_base( ctx ) | ||||
|     { | ||||
|         //std::cout<<"Enter S3 "<<std::endl; | ||||
|         context< GpsL1CaSubframeFsm >().gps_word_to_subframe(1); | ||||
|     } | ||||
| }; | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| struct gps_subframe_fsm_S4: public sc::state<gps_subframe_fsm_S4, GpsL1CaSubframeFsm> | ||||
| { | ||||
| public: | ||||
|     typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >, | ||||
|             sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S5 > > reactions; | ||||
|  | ||||
|     gps_subframe_fsm_S4(my_context ctx): my_base( ctx ) | ||||
|     { | ||||
|         //std::cout<<"Enter S4 "<<std::endl; | ||||
|         context< GpsL1CaSubframeFsm >().gps_word_to_subframe(2); | ||||
|     } | ||||
| }; | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| struct gps_subframe_fsm_S5: public sc::state<gps_subframe_fsm_S5, GpsL1CaSubframeFsm> | ||||
| { | ||||
| public: | ||||
|     typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >, | ||||
|             sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S6 > > reactions; | ||||
|  | ||||
|     gps_subframe_fsm_S5(my_context ctx): my_base( ctx ) | ||||
|     { | ||||
|         //std::cout<<"Enter S5 "<<std::endl; | ||||
|         context< GpsL1CaSubframeFsm >().gps_word_to_subframe(3); | ||||
|     } | ||||
| }; | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| struct gps_subframe_fsm_S6: public sc::state<gps_subframe_fsm_S6, GpsL1CaSubframeFsm> | ||||
| { | ||||
| public: | ||||
|     typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >, | ||||
|             sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S7 > > reactions; | ||||
|  | ||||
|     gps_subframe_fsm_S6(my_context ctx): my_base( ctx ) | ||||
|     { | ||||
|         //std::cout<<"Enter S6 "<<std::endl; | ||||
|         context< GpsL1CaSubframeFsm >().gps_word_to_subframe(4); | ||||
|     } | ||||
| }; | ||||
|  | ||||
|  | ||||
|  | ||||
| struct gps_subframe_fsm_S7: public sc::state<gps_subframe_fsm_S7, GpsL1CaSubframeFsm> | ||||
| { | ||||
| public: | ||||
|     typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >, | ||||
|             sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S8 > > reactions; | ||||
|  | ||||
|     gps_subframe_fsm_S7(my_context ctx): my_base( ctx ) | ||||
|     { | ||||
|         //std::cout<<"Enter S7 "<<std::endl; | ||||
|         context< GpsL1CaSubframeFsm >().gps_word_to_subframe(5); | ||||
|     } | ||||
| }; | ||||
|  | ||||
|  | ||||
|  | ||||
| struct gps_subframe_fsm_S8: public sc::state<gps_subframe_fsm_S8, GpsL1CaSubframeFsm> | ||||
| { | ||||
| public: | ||||
|     typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >, | ||||
|             sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S9 > > reactions; | ||||
|  | ||||
|     gps_subframe_fsm_S8(my_context ctx): my_base( ctx ) | ||||
|     { | ||||
|         //std::cout<<"Enter S8 "<<std::endl; | ||||
|         context< GpsL1CaSubframeFsm >().gps_word_to_subframe(6); | ||||
|     } | ||||
| }; | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| struct gps_subframe_fsm_S9: public sc::state<gps_subframe_fsm_S9, GpsL1CaSubframeFsm> | ||||
| { | ||||
| public: | ||||
|     typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >, | ||||
|             sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S10 > > reactions; | ||||
|  | ||||
|     gps_subframe_fsm_S9(my_context ctx): my_base( ctx ) | ||||
|     { | ||||
|         //std::cout<<"Enter S9 "<<std::endl; | ||||
|         context< GpsL1CaSubframeFsm >().gps_word_to_subframe(7); | ||||
|     } | ||||
| }; | ||||
|  | ||||
|  | ||||
|  | ||||
| struct gps_subframe_fsm_S10: public sc::state<gps_subframe_fsm_S10, GpsL1CaSubframeFsm> | ||||
| { | ||||
| public: | ||||
|     typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >, | ||||
|             sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S11 > > reactions; | ||||
|  | ||||
|     gps_subframe_fsm_S10(my_context ctx): my_base( ctx ) | ||||
|     { | ||||
|         //std::cout<<"Enter S10 "<<std::endl; | ||||
|         context< GpsL1CaSubframeFsm >().gps_word_to_subframe(8); | ||||
|     } | ||||
| }; | ||||
|  | ||||
|  | ||||
|  | ||||
| struct gps_subframe_fsm_S11: public sc::state<gps_subframe_fsm_S11, GpsL1CaSubframeFsm> | ||||
| { | ||||
| public: | ||||
|     typedef sc::transition< Ev_gps_word_preamble, gps_subframe_fsm_S1 > reactions; | ||||
|  | ||||
|     gps_subframe_fsm_S11(my_context ctx): my_base( ctx ) | ||||
|     { | ||||
|         //std::cout<<"Completed GPS Subframe!"<<std::endl; | ||||
|         context< GpsL1CaSubframeFsm >().gps_word_to_subframe(9); | ||||
|         context< GpsL1CaSubframeFsm >().gps_subframe_to_nav_msg(); //decode the subframe | ||||
|         // DECODE SUBFRAME | ||||
|         //std::cout<<"Enter S11"<<std::endl; | ||||
|     } | ||||
| }; | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| GpsL1CaSubframeFsm::GpsL1CaSubframeFsm() | ||||
| { | ||||
|   d_nav.reset(); | ||||
|   initiate(); //start the FSM | ||||
| } | ||||
|  | ||||
| void GpsL1CaSubframeFsm::gps_word_to_subframe(int position) | ||||
| { | ||||
|   // insert the word in the correct position of the subframe | ||||
|   std::memcpy(&d_subframe[position*GPS_WORD_LENGTH], &d_GPS_frame_4bytes, sizeof(char)*GPS_WORD_LENGTH); | ||||
| } | ||||
|  | ||||
| void GpsL1CaSubframeFsm::gps_subframe_to_nav_msg() | ||||
| { | ||||
|     int subframe_ID; | ||||
|     // NEW GPS SUBFRAME HAS ARRIVED! | ||||
|     subframe_ID = d_nav.subframe_decoder(this->d_subframe); //decode the subframe | ||||
|     std::cout << "NAVIGATION FSM: received subframe " << subframe_ID << " for satellite " << Gnss_Satellite(std::string("GPS"), i_satellite_PRN) << std::endl; | ||||
|     d_nav.i_satellite_PRN = i_satellite_PRN; | ||||
|     d_nav.i_channel_ID = i_channel_ID; | ||||
|     d_nav.d_subframe_timestamp_ms = this->d_preamble_time_ms; | ||||
|  | ||||
|     switch (subframe_ID) | ||||
|     { | ||||
|     case 3: //we have a new set of ephemeris data for the current SV | ||||
|     	if (d_nav.satellite_validation()==true) | ||||
|     	{ | ||||
|     		// get ephemeris object for this SV (mandatory) | ||||
|     		Gps_Ephemeris ephemeris=d_nav.get_ephemeris(); | ||||
|     		d_ephemeris_queue->push(ephemeris); | ||||
|     	} | ||||
|     	break; | ||||
|     case 4: // Possible IONOSPHERE and UTC model update (page 18) | ||||
|     	if (d_nav.flag_iono_valid==true) | ||||
|     	{ | ||||
|     		Gps_Iono iono=d_nav.get_iono(); //notice that the read operation will clear the valid flag | ||||
|     		d_iono_queue->push(iono); | ||||
|     	} | ||||
|     	if (d_nav.flag_utc_model_valid==true) | ||||
|     	{ | ||||
|     		Gps_Utc_Model utc_model=d_nav.get_utc_model(); //notice that the read operation will clear the valid flag | ||||
|     		d_utc_model_queue->push(utc_model); | ||||
|     	} | ||||
|     	break; | ||||
|     case 5: | ||||
| 		// get almanac (if available) | ||||
| 		//TODO: implement almanac reader in navigation_message | ||||
|     	break; | ||||
|     default: | ||||
|     	break; | ||||
|     } | ||||
| } | ||||
|  | ||||
| void GpsL1CaSubframeFsm::Event_gps_word_valid() | ||||
| { | ||||
|   this->process_event(Ev_gps_word_valid()); | ||||
| } | ||||
|  | ||||
| void GpsL1CaSubframeFsm::Event_gps_word_invalid() | ||||
| { | ||||
|   this->process_event(Ev_gps_word_invalid()); | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| void GpsL1CaSubframeFsm::Event_gps_word_preamble() | ||||
| { | ||||
|   this->process_event(Ev_gps_word_preamble()); | ||||
| } | ||||
|  | ||||
| @@ -1,112 +0,0 @@ | ||||
| /*! | ||||
|  * \file gps_l1_ca_subframe_fsm.h | ||||
|  * \brief  Interface of a Galileo NAV message word-to-subframe decoder state machine | ||||
|  * \author Javier Arribas, 2011. jarribas(at)cttc.es | ||||
|  * | ||||
|  * ------------------------------------------------------------------------- | ||||
|  * | ||||
|  * Copyright (C) 2010-2012  (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_GALILEO_INAV_FSM_H_ | ||||
| #define GNSS_SDR_GALILEO_INAV_FSM_H_ | ||||
|  | ||||
| #include <boost/statechart/state_machine.hpp> | ||||
| #include <boost/statechart/simple_state.hpp> | ||||
| #include <boost/statechart/state.hpp> | ||||
| #include <boost/statechart/transition.hpp> | ||||
| #include <boost/statechart/custom_reaction.hpp> | ||||
| #include <boost/mpl/list.hpp> | ||||
| #include <queue> | ||||
| #include <boost/thread/mutex.hpp> | ||||
| #include <boost/thread/thread.hpp> | ||||
| #include "concurrent_queue.h" | ||||
| #include <iostream> | ||||
| #include <cstring> | ||||
|  | ||||
| #include "galileo_navigation_message.h" | ||||
| #include "galileo_ephemeris.h" | ||||
| #include "galileo_almanac.h" | ||||
| #include "galileo_iono.h" | ||||
| #include "galileo_utc_model.h" | ||||
|  | ||||
| namespace sc = boost::statechart; | ||||
| namespace mpl = boost::mpl; | ||||
|  | ||||
| struct gps_subframe_fsm_S0; | ||||
| struct gps_subframe_fsm_S1; | ||||
| struct gps_subframe_fsm_S2; | ||||
| struct gps_subframe_fsm_S3; | ||||
| struct gps_subframe_fsm_S4; | ||||
| struct gps_subframe_fsm_S5; | ||||
| struct gps_subframe_fsm_S6; | ||||
| struct gps_subframe_fsm_S7; | ||||
| struct gps_subframe_fsm_S8; | ||||
| struct gps_subframe_fsm_S9; | ||||
| struct gps_subframe_fsm_S10; | ||||
| struct gps_subframe_fsm_S11; | ||||
|  | ||||
| class GalileoINAVFsm : public sc::state_machine< GalileoINAVFsm, gps_subframe_fsm_S0 > | ||||
| { | ||||
| public: | ||||
|   // channel and satellite info | ||||
|   int i_channel_ID; | ||||
|   unsigned int i_satellite_PRN; | ||||
|  | ||||
|   // 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; | ||||
|  | ||||
|   // navigation message class | ||||
|   Gps_Navigation_Message d_nav; | ||||
|  | ||||
|   // GPS SV and System parameters | ||||
|   Galileo_Ephemeris ephemeris; | ||||
|   Galileo_Almanac almanac; | ||||
|   Galileo_Utc_Model utc_model; | ||||
|   Galileo_Iono iono; | ||||
|  | ||||
|  | ||||
|   char d_subframe[GPS_SUBFRAME_LENGTH]; | ||||
|   char d_GPS_frame_4bytes[GPS_WORD_LENGTH]; | ||||
|  | ||||
|   double d_preamble_time_ms; | ||||
|  | ||||
|   void gps_word_to_subframe(int position); | ||||
|   void gps_subframe_to_nav_msg(); | ||||
|  | ||||
|   //FSM EVENTS | ||||
|   void Event_gps_word_valid(); | ||||
|   void Event_gps_word_invalid(); | ||||
|   void Event_gps_word_preamble(); | ||||
|  | ||||
|   GalileoINAVFsm(); | ||||
| }; | ||||
|  | ||||
| #endif | ||||
| @@ -506,6 +506,61 @@ void Galileo_Navigation_Message::split_page(const char *page, int flag_even_word | ||||
| } | ||||
|  | ||||
|  | ||||
| bool Galileo_Navigation_Message::have_new_ephemeris() | ||||
| { | ||||
| 	//ToDo: Check if whe have a new ephemeris data set stored in the galileo navigation class | ||||
| 	return false; | ||||
| } | ||||
|  | ||||
| bool Galileo_Navigation_Message::have_new_iono() | ||||
| { | ||||
| 	//ToDo: Check if whe have a new iono data set stored in the galileo navigation class | ||||
| 	return false; | ||||
| } | ||||
| bool Galileo_Navigation_Message::have_new_utc_model() | ||||
| { | ||||
| 	//ToDo: Check if whe have a new utc data set stored in the galileo navigation class | ||||
| 	return false; | ||||
| } | ||||
| bool Galileo_Navigation_Message::have_new_almanac() | ||||
| { | ||||
| 	//ToDo: Check if whe have a new almanac data set stored in the galileo navigation class | ||||
| 	return false; | ||||
| } | ||||
|  | ||||
| Galileo_Ephemeris Galileo_Navigation_Message::get_ephemeris() | ||||
| { | ||||
|  | ||||
| 	Galileo_Ephemeris ephemeris; | ||||
| 	//ToDo:: fill the object | ||||
| 	return ephemeris; | ||||
| } | ||||
|  | ||||
|  | ||||
| Galileo_Iono Galileo_Navigation_Message::get_iono() | ||||
| { | ||||
| 	Galileo_Iono iono; | ||||
| 	//ToDo:: fill the object | ||||
| 	return iono; | ||||
| } | ||||
|  | ||||
|  | ||||
| Galileo_Utc_Model Galileo_Navigation_Message::get_utc_model() | ||||
| { | ||||
| 	Galileo_Utc_Model utc_model; | ||||
| 	//ToDo:: fill the object | ||||
| 	return utc_model; | ||||
| } | ||||
|  | ||||
|  | ||||
| Galileo_Almanac Galileo_Navigation_Message::get_almanac() | ||||
| { | ||||
| 	Galileo_Almanac almanac; | ||||
| 	//ToDo:: fill the object | ||||
| 	return almanac; | ||||
| } | ||||
|  | ||||
|  | ||||
| int Galileo_Navigation_Message::page_jk_decoder(char *data_jk) | ||||
| { | ||||
| 	std::cout << "--------------------------------------------------------------------------" << endl; | ||||
|   | ||||
| @@ -43,6 +43,12 @@ | ||||
| #include <cmath> | ||||
| #include <utility> | ||||
|  | ||||
| // Galileo Navigation Message structures | ||||
| #include "galileo_ephemeris.h" | ||||
| #include "galileo_iono.h" | ||||
| #include "galileo_almanac.h" | ||||
| #include "galileo_utc_model.h" | ||||
|  | ||||
| #include "Galileo_E1.h" | ||||
|  | ||||
|  | ||||
| @@ -205,15 +211,61 @@ public: | ||||
| 			double TOW_0; | ||||
|  | ||||
|  | ||||
| 	/* | ||||
| 	 * \brief Takes in input a page (Odd or Even) of 120 bit, split it according ICD 4.3.2.3 and join Data_k with Data_j | ||||
| 	 */ | ||||
| 	void split_page(const char *page, int flag_even_word); | ||||
| 	/* | ||||
| 	 * \brief Takes in input Data_jk (128 bit) and split it in ephemeris parameters according ICD 4.3.5 | ||||
| 	 */ | ||||
| 	int page_jk_decoder(char *data_jk); | ||||
|  | ||||
| 	void split_page(const char *page, int flag_even_word); 			/* Takes in input a page (Odd or Even) of 120 bit, split it according ICD 4.3.2.3 and join Data_k with Data_j*/ | ||||
|  | ||||
| 	int page_jk_decoder(char *data_jk);		/* Takes in input Data_jk (128 bit) and split it in ephemeris parameters according ICD 4.3.5*/ | ||||
| 	/* | ||||
| 	 * \brief Write doxigen function description here | ||||
| 	 */ | ||||
|  | ||||
| 	void reset(); | ||||
|  | ||||
| 	/* | ||||
| 	 * \brief Returns true if new Ephemeris has arrived. The flag is set to false when the function is executed | ||||
| 	 */ | ||||
| 	bool have_new_ephemeris(); | ||||
| 	/* | ||||
| 	 * \brief Returns true if new Iono model has arrived. The flag is set to false when the function is executed | ||||
| 	 */ | ||||
| 	bool have_new_iono(); | ||||
| 	/* | ||||
| 	 * \brief Returns true if new UTC model has arrived. The flag is set to false when the function is executed | ||||
| 	 */ | ||||
| 	bool have_new_utc_model(); | ||||
|  | ||||
| 	/* | ||||
| 	 * \brief Returns true if new UTC model has arrived. The flag is set to false when the function is executed | ||||
| 	 */ | ||||
| 	bool have_new_almanac(); | ||||
|  | ||||
|  | ||||
| 	/* | ||||
| 	 * \brief Returns a Galileo_Ephemeris object filled with the latest navigation data received | ||||
| 	 */ | ||||
| 	Galileo_Ephemeris get_ephemeris(); | ||||
|  | ||||
| 	/* | ||||
| 	 * \brief Returns a Galileo_Iono object filled with the latest navigation data received | ||||
| 	 */ | ||||
| 	Galileo_Iono get_iono(); | ||||
|  | ||||
| 	/* | ||||
| 	 * \brief Returns a Galileo_Utc_Model object filled with the latest navigation data received | ||||
| 	 */ | ||||
| 	Galileo_Utc_Model get_utc_model(); | ||||
|  | ||||
| 	/* | ||||
| 	 * \brief Returns a Galileo_Almanac object filled with the latest navigation data received | ||||
| 	 */ | ||||
| 	Galileo_Almanac get_almanac(); | ||||
|  | ||||
| 	/* Default constructor */ | ||||
|  | ||||
| 	Galileo_Navigation_Message(); | ||||
| }; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Javier Arribas
					Javier Arribas