1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-28 09:54:51 +00:00

Mara Branzanti GSoC commit: Galileo observables block skeleton. Not usable yet!

git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@418 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
Javier Arribas 2013-09-09 14:32:48 +00:00
parent cd6b1c0ec5
commit 5fddaae79d
7 changed files with 499 additions and 2 deletions

View File

@ -16,7 +16,10 @@
# along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
#
set(OBS_ADAPTER_SOURCES gps_l1_ca_observables.cc)
set(OBS_ADAPTER_SOURCES
gps_l1_ca_observables.cc
galileo_e1_observables.cc
)
include_directories(
$(CMAKE_CURRENT_SOURCE_DIR)

View File

@ -0,0 +1,102 @@
/*!
* \file galileo_e1_observables.cc
* \brief Implementation of an adapter of a Galileo E1 observables block
* to a ObservablesInterface
* \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 "galileo_e1_observables.h"
#include "configuration_interface.h"
#include "galileo_e1_observables_cc.h"
#include <glog/log_severity.h>
#include <glog/logging.h>
using google::LogMessage;
GalileoE1Observables::GalileoE1Observables(ConfigurationInterface* configuration,
std::string role,
unsigned int in_streams,
unsigned int out_streams,
boost::shared_ptr<gr::msg_queue> queue) :
role_(role),
in_streams_(in_streams),
out_streams_(out_streams),
queue_(queue)
{
int output_rate_ms;
output_rate_ms = configuration->property(role + ".output_rate_ms", 500);
std::string default_dump_filename = "./observables.dat";
DLOG(INFO) << "role " << role;
bool flag_averaging;
flag_averaging = configuration->property(role + ".flag_averaging", false);
dump_ = configuration->property(role + ".dump", false);
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename);
fs_in_ = configuration->property("GNSS-SDR.internal_fs_hz", 2048000);
observables_ = galileo_e1_make_observables_cc(in_streams_, queue_, dump_, dump_filename_, output_rate_ms, flag_averaging);
observables_->set_fs_in(fs_in_);
DLOG(INFO) << "pseudorange(" << observables_->unique_id() << ")";
}
GalileoE1Observables::~GalileoE1Observables()
{}
void GalileoE1Observables::connect(gr::top_block_sptr top_block)
{
// Nothing to connect internally
DLOG(INFO) << "nothing to connect internally";
}
void GalileoE1Observables::disconnect(gr::top_block_sptr top_block)
{
// Nothing to disconnect
}
gr::basic_block_sptr GalileoE1Observables::get_left_block()
{
return observables_;
}
gr::basic_block_sptr GalileoE1Observables::get_right_block()
{
return observables_;
}

View File

@ -0,0 +1,90 @@
/*!
* \file galileo_e1_observables.h
* \brief Implementation of an adapter of a Galileo E1 observables block
* to a ObservablesInterface
* \author Mara Branzanti 2013. mara.branzanti(at)gmail.com
* \author Javier Arribas 2013. 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_E1_OBSERVABLES_H_
#define GNSS_SDR_GALILEO_E1_OBSERVABLES_H_
#include "observables_interface.h"
#include "galileo_e1_observables_cc.h"
#include <gnuradio/msg_queue.h>
class ConfigurationInterface;
/*!
* \brief This class implements an ObservablesInterface for Galileo E1
*/
class GalileoE1Observables : public ObservablesInterface
{
public:
GalileoE1Observables(ConfigurationInterface* configuration,
std::string role,
unsigned int in_streams,
unsigned int out_streams,
boost::shared_ptr<gr::msg_queue> queue);
virtual ~GalileoE1Observables();
std::string role()
{
return role_;
}
std::string implementation()
{
return "Galileo_E1B_Observables";
}
void connect(gr::top_block_sptr top_block);
void disconnect(gr::top_block_sptr top_block);
gr::basic_block_sptr get_left_block();
gr::basic_block_sptr get_right_block();
void reset()
{
return;
}
//! All blocks must have an item_size() function implementation
size_t item_size()
{
return sizeof(gr_complex);
}
private:
galileo_e1_observables_cc_sptr observables_;
bool dump_;
unsigned int fs_in_;
std::string dump_filename_;
std::string role_;
unsigned int in_streams_;
unsigned int out_streams_;
boost::shared_ptr<gr::msg_queue> queue_;
};
#endif

View File

@ -16,7 +16,10 @@
# along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
#
set(OBS_GR_BLOCKS_SOURCES gps_l1_ca_observables_cc.cc )
set(OBS_GR_BLOCKS_SOURCES
gps_l1_ca_observables_cc.cc
galileo_e1_observables_cc.cc
)
include_directories(
$(CMAKE_CURRENT_SOURCE_DIR)

View File

@ -0,0 +1,205 @@
/*!
* \file gps_l1_ca_observables_cc.cc
* \brief Implementation of the pseudorange computation block for GPS L1 C/A
* \author Mara Branzanti 2013. mara.branzanti(at)gmail.com
* \author Javier Arribas 2013. 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 "galileo_e1_observables_cc.h"
#include <iostream>
#include <sstream>
#include <vector>
#include <map>
#include <algorithm>
#include <bitset>
#include <cmath>
#include "control_message_factory.h"
#include <gnuradio/io_signature.h>
#include <glog/log_severity.h>
#include <glog/logging.h>
#include "gnss_synchro.h"
using google::LogMessage;
galileo_e1_observables_cc_sptr
galileo_e1_make_observables_cc(unsigned int nchannels, boost::shared_ptr<gr::msg_queue> queue, bool dump, std::string dump_filename, int output_rate_ms, bool flag_averaging)
{
return galileo_e1_observables_cc_sptr(new galileo_e1_observables_cc(nchannels, queue, dump, dump_filename, output_rate_ms, flag_averaging));
}
galileo_e1_observables_cc::galileo_e1_observables_cc(unsigned int nchannels, boost::shared_ptr<gr::msg_queue> queue, bool dump, std::string dump_filename, int output_rate_ms, bool flag_averaging) :
gr::block("galileo_e1_observables_cc", gr::io_signature::make(nchannels, nchannels, sizeof(Gnss_Synchro)),
gr::io_signature::make(nchannels, nchannels, sizeof(Gnss_Synchro)))
{
// initialize internal vars
d_queue = queue;
d_dump = dump;
d_nchannels = nchannels;
d_output_rate_ms = output_rate_ms;
d_dump_filename = dump_filename;
d_flag_averaging = flag_averaging;
// ############# ENABLE DATA FILE LOG #################
if (d_dump == true)
{
if (d_dump_file.is_open() == false)
{
try
{
d_dump_file.exceptions (std::ifstream::failbit | std::ifstream::badbit );
d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary);
std::cout << "Observables dump enabled Log file: " << d_dump_filename.c_str() << std::endl;
}
catch (std::ifstream::failure e)
{
std::cout << "Exception opening observables dump file " << e.what() << std::endl;
}
}
}
}
galileo_e1_observables_cc::~galileo_e1_observables_cc()
{
d_dump_file.close();
}
//
bool galileo_e1_observables_cc::pairCompare_gnss_synchro_Prn_delay_ms( std::pair<int,Gnss_Synchro> a, std::pair<int,Gnss_Synchro> b)
{
return (a.second.Prn_timestamp_ms) < (b.second.Prn_timestamp_ms);
}
bool galileo_e1_observables_cc::pairCompare_gnss_synchro_d_TOW_at_current_symbol( std::pair<int,Gnss_Synchro> a, std::pair<int,Gnss_Synchro> b)
{
return (a.second.d_TOW_at_current_symbol) < (b.second.d_TOW_at_current_symbol);
}
int galileo_e1_observables_cc::general_work (int noutput_items, gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
{
// Gnss_Synchro **in = (Gnss_Synchro **) &input_items[0]; //Get the input pointer
// Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0]; //Get the output pointer
//
// Gnss_Synchro current_gnss_synchro[d_nchannels];
// std::map<int,Gnss_Synchro> current_gnss_synchro_map;
// std::map<int,Gnss_Synchro>::iterator gnss_synchro_iter;
//
// d_sample_counter++; //count for the processed samples
// /*
// * 1. Read the GNSS SYNCHRO objects from available channels
// */
// for (unsigned int i=0; i<d_nchannels ; i++)
// {
// //Copy the telemetry decoder data to local copy
// current_gnss_synchro[i] = in[i][0];
// /*
// * 1.2 Assume no valid pseudoranges
// */
// current_gnss_synchro[i].Flag_valid_pseudorange = false;
// current_gnss_synchro[i].Pseudorange_m = 0.0;
// if (current_gnss_synchro[i].Flag_valid_word) //if this channel have valid word
// {
// //record the word structure in a map for pseudorange computation
// current_gnss_synchro_map.insert(std::pair<int, Gnss_Synchro>(current_gnss_synchro[i].Channel_ID, current_gnss_synchro[i]));
// }
// }
// /*
// * 2. Compute RAW pseudoranges using COMMON RECEPTION TIME algorithm. Use only the valid channels (channels that are tracking a satellite)
// */
// if(current_gnss_synchro_map.size() > 0)
// {
// /*
// * 2.1 Use CURRENT set of measurements and find the nearest satellite
// * common RX time algorithm
// */
// //;
// // what is the most recent symbol TOW in the current set? -> this will be the reference symbol
// gnss_synchro_iter = max_element(current_gnss_synchro_map.begin(), current_gnss_synchro_map.end(), pairCompare_gnss_synchro_d_TOW_at_current_symbol);
// double d_TOW_reference = gnss_synchro_iter->second.d_TOW_at_current_symbol;
// double d_ref_PRN_rx_time_ms = gnss_synchro_iter->second.Prn_timestamp_ms;
// //int reference_channel= gnss_synchro_iter->second.Channel_ID;
//
// // Now compute RX time differences due to the PRN alignement in the correlators
// double traveltime_ms;
// double pseudorange_m;
// double delta_rx_time_ms;
// for(gnss_synchro_iter = current_gnss_synchro_map.begin(); gnss_synchro_iter != current_gnss_synchro_map.end(); gnss_synchro_iter++)
// {
// // compute the required symbol history shift in order to match the reference symbol
// delta_rx_time_ms = gnss_synchro_iter->second.Prn_timestamp_ms-d_ref_PRN_rx_time_ms;
// //std::cout<<"delta_rx_time_ms="<<delta_rx_time_ms<<std::endl;
// //compute the pseudorange
// traveltime_ms = (d_TOW_reference-gnss_synchro_iter->second.d_TOW_at_current_symbol)*1000.0 + delta_rx_time_ms + GPS_STARTOFFSET_ms;
// pseudorange_m = traveltime_ms * GPS_C_m_ms; // [m]
// // update the pseudorange object
// current_gnss_synchro[gnss_synchro_iter->second.Channel_ID] = gnss_synchro_iter->second;
// current_gnss_synchro[gnss_synchro_iter->second.Channel_ID].Pseudorange_m = pseudorange_m;
// current_gnss_synchro[gnss_synchro_iter->second.Channel_ID].Flag_valid_pseudorange = true;
// current_gnss_synchro[gnss_synchro_iter->second.Channel_ID].d_TOW_at_current_symbol = round(d_TOW_reference*1000)/1000 + GPS_STARTOFFSET_ms/1000.0;
// }
// }
//
//
// if(d_dump == true)
// {
// // MULTIPLEXED FILE RECORDING - Record results to file
// try
// {
// double tmp_double;
// for (unsigned int i=0; i<d_nchannels ; i++)
// {
// tmp_double = current_gnss_synchro[i].d_TOW_at_current_symbol;
// d_dump_file.write((char*)&tmp_double, sizeof(double));
// tmp_double = current_gnss_synchro[i].Prn_timestamp_ms;
// d_dump_file.write((char*)&tmp_double, sizeof(double));
// tmp_double = current_gnss_synchro[i].Pseudorange_m;
// d_dump_file.write((char*)&tmp_double, sizeof(double));
// tmp_double = 0;
// d_dump_file.write((char*)&tmp_double, sizeof(double));
// tmp_double = current_gnss_synchro[i].PRN;
// d_dump_file.write((char*)&tmp_double, sizeof(double));
// }
// }
// catch (std::ifstream::failure e)
// {
// std::cout << "Exception writing observables dump file " << e.what() << std::endl;
// }
// }
//
consume_each(1); //one by one
// for (unsigned int i=0; i<d_nchannels ; i++)
// {
// *out[i] = current_gnss_synchro[i];
// }
return 1; //Output the observables
}

View File

@ -0,0 +1,86 @@
/*!
* \file gps_l1_ca_observables_cc.h
* \brief Interface of the pseudorange computation block for GPS L1 C/A
* \author Mara Branzanti 2013. mara.branzanti(at)gmail.com
* \author Javier Arribas 2013. 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_E1_OBSERVABLES_CC_H
#define GNSS_SDR_GALILEO_E1_OBSERVABLES_CC_H
#include <fstream>
#include <gnuradio/block.h>
#include <gnuradio/msg_queue.h>
#include <queue>
#include <boost/thread/mutex.hpp>
#include <boost/thread/thread.hpp>
#include "concurrent_queue.h"
//#include "gps_navigation_message.h" //to removed
#include "galileo_navigation_message.h"
#include "rinex_printer.h"
//#include "GPS_L1_CA.h" //to remove
#include "gnss_synchro.h"
class galileo_e1_observables_cc;
typedef boost::shared_ptr<galileo_e1_observables_cc> galileo_e1_observables_cc_sptr;
galileo_e1_observables_cc_sptr
galileo_e1_make_observables_cc(unsigned int n_channels, boost::shared_ptr<gr::msg_queue> queue, bool dump, std::string dump_filename, int output_rate_ms, bool flag_averaging);
/*!
* \brief This class implements a block that computes Galielo observables
*/
class galileo_e1_observables_cc : public gr::block
{
public:
~galileo_e1_observables_cc ();
void set_fs_in(unsigned long int fs_in) {d_fs_in = fs_in;};
int general_work (int noutput_items, gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
private:
friend galileo_e1_observables_cc_sptr
galileo_e1_make_observables_cc(unsigned int nchannels, boost::shared_ptr<gr::msg_queue> queue, bool dump, std::string dump_filename, int output_rate_ms, bool flag_averaging);
galileo_e1_observables_cc(unsigned int nchannels, boost::shared_ptr<gr::msg_queue> queue, bool dump, std::string dump_filename, int output_rate_ms, bool flag_averaging);
bool pairCompare_gnss_synchro_Prn_delay_ms( std::pair<int,Gnss_Synchro> a, std::pair<int,Gnss_Synchro> b);
bool pairCompare_gnss_synchro_d_TOW_at_current_symbol( std::pair<int,Gnss_Synchro> a, std::pair<int,Gnss_Synchro> b);
// class private vars
boost::shared_ptr<gr::msg_queue> d_queue;
bool d_dump;
bool d_flag_averaging;
long int d_sample_counter;
unsigned int d_nchannels;
unsigned long int d_fs_in;
int d_output_rate_ms;
std::string d_dump_filename;
std::ofstream d_dump_file;
};
#endif

View File

@ -70,6 +70,7 @@
#include "gps_l1_ca_telemetry_decoder.h"
#include "galileo_e1b_telemetry_decoder.h"
#include "gps_l1_ca_observables.h"
#include "galileo_e1_observables.h"
#include "gps_l1_ca_pvt.h"
#if GN3S_DRIVER
@ -148,6 +149,7 @@ GNSSBlockInterface* GNSSBlockFactory::GetObservables(
ConfigurationInterface *configuration, boost::shared_ptr<gr::msg_queue> queue)
{
std::string default_implementation = "GPS_L1_CA_Observables";
std::string implementation = configuration->property(
"Observables.implementation", default_implementation);
DLOG(INFO) << "Getting Observables with implementation "
@ -422,6 +424,12 @@ GNSSBlockInterface* GNSSBlockFactory::GetBlock(
out_streams, queue);
}
else if (implementation.compare("Galileo_E1B_Observables") == 0)
{
block = new GalileoE1Observables(configuration, role, in_streams,
out_streams, queue);
}
// PVT -------------------------------------------------------------------------
else if (implementation.compare("GPS_L1_CA_PVT") == 0)
{