2013-07-05 17:00:48 +00:00
|
|
|
/*!
|
|
|
|
* \file main.cc
|
|
|
|
* \brief Main file of the Front-end calibration program.
|
|
|
|
* \author Javier Arribas, 2013. jarribas(at)cttc.es
|
|
|
|
*
|
|
|
|
*
|
2020-07-28 14:57:15 +00:00
|
|
|
* -----------------------------------------------------------------------------
|
2013-07-05 17:00:48 +00:00
|
|
|
*
|
2020-12-30 12:35:06 +00:00
|
|
|
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
2013-07-05 17:00:48 +00:00
|
|
|
* This file is part of GNSS-SDR.
|
|
|
|
*
|
2020-12-30 12:35:06 +00:00
|
|
|
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
|
2020-02-08 00:20:02 +00:00
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2013-07-05 17:00:48 +00:00
|
|
|
*
|
2020-07-28 14:57:15 +00:00
|
|
|
* -----------------------------------------------------------------------------
|
2013-07-05 17:00:48 +00:00
|
|
|
*/
|
2020-12-30 12:35:06 +00:00
|
|
|
|
2013-07-05 17:00:48 +00:00
|
|
|
#ifndef FRONT_END_CAL_VERSION
|
|
|
|
#define FRONT_END_CAL_VERSION "0.0.1"
|
|
|
|
#endif
|
|
|
|
|
2019-03-06 12:49:14 +00:00
|
|
|
#include "GPS_L1_CA.h" // for GPS_L1_CA_COD...
|
2013-07-05 17:00:48 +00:00
|
|
|
#include "concurrent_map.h"
|
2017-04-20 14:10:12 +00:00
|
|
|
#include "concurrent_queue.h"
|
2019-03-06 12:49:14 +00:00
|
|
|
#include "configuration_interface.h" // for Configuration...
|
2013-07-05 17:00:48 +00:00
|
|
|
#include "file_configuration.h"
|
2018-12-09 21:00:09 +00:00
|
|
|
#include "front_end_cal.h"
|
|
|
|
#include "gnss_block_factory.h"
|
2019-03-06 12:49:14 +00:00
|
|
|
#include "gnss_block_interface.h" // for GNSSBlockInte...
|
2021-01-16 13:37:19 +00:00
|
|
|
#include "gnss_sdr_filesystem.h"
|
2018-12-09 21:00:09 +00:00
|
|
|
#include "gnss_sdr_flags.h"
|
2013-07-05 17:00:48 +00:00
|
|
|
#include "gnss_synchro.h"
|
2019-03-06 12:49:14 +00:00
|
|
|
#include "gps_acq_assist.h" // for Gps_Acq_Assist
|
2013-07-05 17:00:48 +00:00
|
|
|
#include "gps_almanac.h"
|
2018-12-09 21:00:09 +00:00
|
|
|
#include "gps_ephemeris.h"
|
|
|
|
#include "gps_iono.h"
|
|
|
|
#include "gps_l1_ca_pcps_acquisition_fine_doppler.h"
|
2013-07-05 17:00:48 +00:00
|
|
|
#include "gps_utc_model.h"
|
2019-03-06 12:49:14 +00:00
|
|
|
#include <boost/any.hpp> // for bad_any_cast
|
|
|
|
#include <boost/exception/exception.hpp>
|
2018-02-26 20:37:53 +00:00
|
|
|
#include <boost/lexical_cast.hpp>
|
2019-03-06 12:49:14 +00:00
|
|
|
#include <gflags/gflags.h>
|
2018-02-26 20:37:53 +00:00
|
|
|
#include <glog/logging.h>
|
2019-03-06 12:49:14 +00:00
|
|
|
#include <gnuradio/block.h> // for block
|
2018-12-09 21:00:09 +00:00
|
|
|
#include <gnuradio/blocks/file_sink.h>
|
|
|
|
#include <gnuradio/blocks/file_source.h>
|
|
|
|
#include <gnuradio/blocks/head.h>
|
2018-02-26 20:37:53 +00:00
|
|
|
#include <gnuradio/blocks/null_sink.h>
|
|
|
|
#include <gnuradio/blocks/skiphead.h>
|
2019-07-17 13:56:30 +00:00
|
|
|
#include <gnuradio/gr_complex.h> // for gr_complex
|
|
|
|
#include <gnuradio/io_signature.h> // for io_signature
|
2019-03-06 12:49:14 +00:00
|
|
|
#include <gnuradio/runtime_types.h> // for block_sptr
|
2018-12-09 21:00:09 +00:00
|
|
|
#include <gnuradio/top_block.h>
|
2019-03-06 12:49:14 +00:00
|
|
|
#include <pmt/pmt.h> // for pmt_t, to_long
|
|
|
|
#include <pmt/pmt_sugar.h> // for mp
|
2018-02-26 20:37:53 +00:00
|
|
|
#include <chrono>
|
2019-03-06 12:49:14 +00:00
|
|
|
#include <cmath> // for round
|
2018-08-10 18:34:03 +00:00
|
|
|
#include <cstdint>
|
2018-12-09 21:00:09 +00:00
|
|
|
#include <cstdlib>
|
2018-03-03 01:03:39 +00:00
|
|
|
#include <ctime> // for ctime
|
2018-02-26 20:37:53 +00:00
|
|
|
#include <exception>
|
2019-03-06 12:49:14 +00:00
|
|
|
#include <iostream>
|
|
|
|
#include <map>
|
2018-02-26 20:37:53 +00:00
|
|
|
#include <memory>
|
2019-03-06 12:49:14 +00:00
|
|
|
#include <stdexcept> // for logic_error
|
|
|
|
#include <string>
|
2019-02-24 23:02:53 +00:00
|
|
|
#include <thread>
|
2018-12-03 18:01:47 +00:00
|
|
|
#include <utility>
|
2018-02-26 20:37:53 +00:00
|
|
|
#include <vector>
|
2014-03-16 19:58:29 +00:00
|
|
|
|
2020-04-25 19:41:04 +00:00
|
|
|
#if HAS_GENERIC_LAMBDA
|
|
|
|
#else
|
2020-06-06 21:41:38 +00:00
|
|
|
#include <boost/bind/bind.hpp>
|
2020-04-25 19:41:04 +00:00
|
|
|
#endif
|
|
|
|
|
2020-08-13 18:54:22 +00:00
|
|
|
#if GFLAGS_OLD_NAMESPACE
|
|
|
|
namespace gflags
|
|
|
|
{
|
|
|
|
using namespace google;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-07-05 17:00:48 +00:00
|
|
|
DECLARE_string(log_dir);
|
|
|
|
|
2019-02-22 09:47:24 +00:00
|
|
|
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;
|
2020-07-13 08:54:47 +00:00
|
|
|
Concurrent_Queue<Gps_Acq_Assist> global_gps_acq_assist_queue;
|
2013-07-05 17:00:48 +00:00
|
|
|
|
|
|
|
bool stop;
|
2019-02-22 09:47:24 +00:00
|
|
|
Concurrent_Queue<int> channel_internal_queue;
|
2013-07-05 17:00:48 +00:00
|
|
|
std::vector<Gnss_Synchro> gnss_sync_vector;
|
2020-06-18 09:49:28 +00:00
|
|
|
Gnss_Synchro gnss_synchro{};
|
2016-04-26 14:11:42 +00:00
|
|
|
|
|
|
|
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
|
|
|
|
class FrontEndCal_msg_rx;
|
|
|
|
|
2020-11-03 19:51:57 +00:00
|
|
|
using FrontEndCal_msg_rx_sptr = gnss_shared_ptr<FrontEndCal_msg_rx>;
|
2016-04-26 14:11:42 +00:00
|
|
|
|
|
|
|
FrontEndCal_msg_rx_sptr FrontEndCal_msg_rx_make();
|
|
|
|
|
2016-04-26 16:54:32 +00:00
|
|
|
|
2016-04-26 14:11:42 +00:00
|
|
|
class FrontEndCal_msg_rx : public gr::block
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
friend FrontEndCal_msg_rx_sptr FrontEndCal_msg_rx_make();
|
2020-08-03 06:13:21 +00:00
|
|
|
void msg_handler_channel_events(const pmt::pmt_t& msg);
|
2016-04-26 14:11:42 +00:00
|
|
|
FrontEndCal_msg_rx();
|
|
|
|
|
|
|
|
public:
|
|
|
|
int rx_message;
|
|
|
|
};
|
|
|
|
|
2016-04-26 16:54:32 +00:00
|
|
|
|
2016-04-26 14:11:42 +00:00
|
|
|
FrontEndCal_msg_rx_sptr FrontEndCal_msg_rx_make()
|
|
|
|
{
|
|
|
|
return FrontEndCal_msg_rx_sptr(new FrontEndCal_msg_rx());
|
|
|
|
}
|
|
|
|
|
2016-04-26 16:54:32 +00:00
|
|
|
|
2020-08-03 06:13:21 +00:00
|
|
|
void FrontEndCal_msg_rx::msg_handler_channel_events(const pmt::pmt_t& msg)
|
2016-04-26 14:11:42 +00:00
|
|
|
{
|
2016-04-26 16:54:32 +00:00
|
|
|
try
|
2018-03-03 01:03:39 +00:00
|
|
|
{
|
2019-09-13 06:56:37 +00:00
|
|
|
int64_t message = pmt::to_long(msg);
|
2016-04-26 16:54:32 +00:00
|
|
|
rx_message = message;
|
|
|
|
channel_internal_queue.push(rx_message);
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
2020-08-03 06:13:21 +00:00
|
|
|
catch (const boost::bad_any_cast& e)
|
2018-03-03 01:03:39 +00:00
|
|
|
{
|
2016-04-26 14:11:42 +00:00
|
|
|
LOG(WARNING) << "msg_handler_telemetry Bad any cast!\n";
|
|
|
|
rx_message = 0;
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
2016-04-26 14:11:42 +00:00
|
|
|
}
|
|
|
|
|
2016-04-26 16:54:32 +00:00
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
FrontEndCal_msg_rx::FrontEndCal_msg_rx() : gr::block("FrontEndCal_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
|
2016-04-26 14:11:42 +00:00
|
|
|
{
|
|
|
|
this->message_port_register_in(pmt::mp("events"));
|
2020-04-25 19:41:04 +00:00
|
|
|
this->set_msg_handler(pmt::mp("events"),
|
|
|
|
#if HAS_GENERIC_LAMBDA
|
2020-08-03 06:13:21 +00:00
|
|
|
[this](auto&& PH1) { msg_handler_channel_events(PH1); });
|
2020-04-25 19:41:04 +00:00
|
|
|
#else
|
2020-06-12 22:32:40 +00:00
|
|
|
#if USE_BOOST_BIND_PLACEHOLDERS
|
2020-08-03 06:13:21 +00:00
|
|
|
boost::bind(&FrontEndCal_msg_rx::msg_handler_channel_events, this, boost::placeholders::_1));
|
2020-05-18 20:50:34 +00:00
|
|
|
#else
|
2020-08-03 06:13:21 +00:00
|
|
|
boost::bind(&FrontEndCal_msg_rx::msg_handler_channel_events, this, _1));
|
2020-05-18 20:50:34 +00:00
|
|
|
#endif
|
2020-04-25 19:41:04 +00:00
|
|
|
#endif
|
2016-04-26 16:54:32 +00:00
|
|
|
rx_message = 0;
|
2016-04-26 14:11:42 +00:00
|
|
|
}
|
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
|
2013-07-05 17:00:48 +00:00
|
|
|
void wait_message()
|
|
|
|
{
|
|
|
|
while (!stop)
|
|
|
|
{
|
2013-08-02 16:00:12 +00:00
|
|
|
int message;
|
|
|
|
channel_internal_queue.wait_and_pop(message);
|
2020-07-07 16:53:50 +00:00
|
|
|
// std::cout<<"Acq message rx="<<message<< '\n';
|
2013-08-02 16:00:12 +00:00
|
|
|
switch (message)
|
2018-03-03 01:03:39 +00:00
|
|
|
{
|
|
|
|
case 1: // Positive acq
|
2020-06-18 09:49:28 +00:00
|
|
|
gnss_sync_vector.push_back(gnss_synchro);
|
2019-08-18 23:29:04 +00:00
|
|
|
// acquisition->reset();
|
2018-03-03 01:03:39 +00:00
|
|
|
break;
|
|
|
|
case 2: // negative acq
|
2019-08-18 23:29:04 +00:00
|
|
|
// acquisition->reset();
|
2018-03-03 01:03:39 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
stop = true;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2013-07-05 17:00:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-26 16:54:32 +00:00
|
|
|
|
2018-12-03 18:01:47 +00:00
|
|
|
bool front_end_capture(const std::shared_ptr<ConfigurationInterface>& configuration)
|
2013-07-05 17:00:48 +00:00
|
|
|
{
|
|
|
|
gr::top_block_sptr top_block;
|
|
|
|
GNSSBlockFactory block_factory;
|
2019-07-17 13:56:30 +00:00
|
|
|
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue;
|
2013-07-05 17:00:48 +00:00
|
|
|
|
2019-07-17 13:56:30 +00:00
|
|
|
queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
|
2013-07-05 17:00:48 +00:00
|
|
|
top_block = gr::make_top_block("Acquisition test");
|
|
|
|
|
2014-04-11 20:13:41 +00:00
|
|
|
std::shared_ptr<GNSSBlockInterface> source;
|
2015-05-30 11:23:23 +00:00
|
|
|
try
|
2018-03-03 01:03:39 +00:00
|
|
|
{
|
2020-06-18 09:49:28 +00:00
|
|
|
source = block_factory.GetSignalSource(configuration.get(), queue.get());
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
|
|
|
catch (const boost::exception_ptr& e)
|
|
|
|
{
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << "Exception caught in creating source " << e << '\n';
|
2018-12-11 11:08:54 +00:00
|
|
|
return false;
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
2013-07-05 17:00:48 +00:00
|
|
|
|
2015-05-30 11:23:23 +00:00
|
|
|
std::shared_ptr<GNSSBlockInterface> conditioner;
|
|
|
|
try
|
2018-03-03 01:03:39 +00:00
|
|
|
{
|
2020-06-18 09:49:28 +00:00
|
|
|
conditioner = block_factory.GetSignalConditioner(configuration.get());
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
|
|
|
catch (const boost::exception_ptr& e)
|
|
|
|
{
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << "Exception caught in creating signal conditioner " << e << '\n';
|
2018-12-11 11:08:54 +00:00
|
|
|
return false;
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
2013-07-05 17:00:48 +00:00
|
|
|
gr::block_sptr sink;
|
|
|
|
sink = gr::blocks::file_sink::make(sizeof(gr_complex), "tmp_capture.dat");
|
|
|
|
|
2019-09-13 06:56:37 +00:00
|
|
|
// -- Find number of samples per spreading code ---
|
2018-08-10 18:34:03 +00:00
|
|
|
int64_t fs_in_ = configuration->property("GNSS-SDR.internal_fs_sps", 2048000);
|
2019-08-31 09:37:29 +00:00
|
|
|
int samples_per_code = round(fs_in_ / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS));
|
2013-08-02 16:00:12 +00:00
|
|
|
int nsamples = samples_per_code * 50;
|
2013-07-05 17:00:48 +00:00
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
int skip_samples = fs_in_ * 5; // skip 5 seconds
|
2013-07-05 17:00:48 +00:00
|
|
|
|
|
|
|
gr::block_sptr head = gr::blocks::head::make(sizeof(gr_complex), nsamples);
|
|
|
|
|
|
|
|
gr::block_sptr skiphead = gr::blocks::skiphead::make(sizeof(gr_complex), skip_samples);
|
|
|
|
|
2013-08-02 16:00:12 +00:00
|
|
|
try
|
2018-03-03 01:03:39 +00:00
|
|
|
{
|
2013-08-02 16:00:12 +00:00
|
|
|
source->connect(top_block);
|
|
|
|
conditioner->connect(top_block);
|
|
|
|
top_block->connect(source->get_right_block(), 0, conditioner->get_left_block(), 0);
|
|
|
|
top_block->connect(conditioner->get_right_block(), 0, skiphead, 0);
|
|
|
|
top_block->connect(skiphead, 0, head, 0);
|
|
|
|
top_block->connect(head, 0, sink, 0);
|
|
|
|
top_block->run();
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << "Failure connecting the GNU Radio blocks " << e.what() << '\n';
|
2013-08-02 16:00:12 +00:00
|
|
|
return false;
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
2013-07-05 17:00:48 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-08-02 16:00:12 +00:00
|
|
|
|
2018-08-10 18:34:03 +00:00
|
|
|
static time_t utc_time(int week, int64_t tow)
|
2018-03-03 01:03:39 +00:00
|
|
|
{
|
2013-08-02 16:00:12 +00:00
|
|
|
time_t t;
|
2013-07-30 10:53:45 +00:00
|
|
|
|
2013-08-02 16:00:12 +00:00
|
|
|
/* Jan 5/6 midnight 1980 - beginning of GPS time as Unix time */
|
|
|
|
t = 315964801;
|
2013-07-30 10:53:45 +00:00
|
|
|
|
2013-08-02 16:00:12 +00:00
|
|
|
/* soon week will wrap again, uh oh... */
|
|
|
|
/* TS 44.031: GPSTOW, range 0-604799.92, resolution 0.08 sec, 23-bit presentation */
|
2013-08-23 08:56:24 +00:00
|
|
|
/* The factor 0.08 was applied in the ephemeris SUPL class */
|
|
|
|
/* here the tow is in [s] */
|
|
|
|
t += (1024 + week) * 604800 + tow;
|
2013-07-30 10:53:45 +00:00
|
|
|
|
2013-08-02 16:00:12 +00:00
|
|
|
return t;
|
2013-07-30 10:53:45 +00:00
|
|
|
}
|
|
|
|
|
2013-08-02 16:00:12 +00:00
|
|
|
|
2013-07-05 17:00:48 +00:00
|
|
|
int main(int argc, char** argv)
|
|
|
|
{
|
|
|
|
const std::string intro_help(
|
2018-03-03 01:03:39 +00:00
|
|
|
std::string("\n RTL-SDR E4000 RF front-end center frequency and sampling rate calibration tool that uses GPS signals\n") +
|
2019-07-26 10:38:20 +00:00
|
|
|
"Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors)\n" +
|
2018-03-03 01:03:39 +00:00
|
|
|
"This program comes with ABSOLUTELY NO WARRANTY;\n" +
|
|
|
|
"See COPYING file to see a copy of the General Public License\n \n");
|
2013-07-05 17:00:48 +00:00
|
|
|
|
2020-08-13 18:54:22 +00:00
|
|
|
gflags::SetUsageMessage(intro_help);
|
2013-07-05 17:00:48 +00:00
|
|
|
google::SetVersionString(FRONT_END_CAL_VERSION);
|
2020-08-13 18:54:22 +00:00
|
|
|
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
2013-07-05 17:00:48 +00:00
|
|
|
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << "Initializing... Please wait.\n";
|
2013-07-05 17:00:48 +00:00
|
|
|
|
|
|
|
google::InitGoogleLogging(argv[0]);
|
|
|
|
if (FLAGS_log_dir.empty())
|
|
|
|
{
|
2013-08-02 16:00:12 +00:00
|
|
|
std::cout << "Logging will be done at "
|
2018-03-03 01:03:39 +00:00
|
|
|
<< "/tmp"
|
2020-07-07 16:53:50 +00:00
|
|
|
<< '\n'
|
2018-03-03 01:03:39 +00:00
|
|
|
<< "Use front-end-cal --log_dir=/path/to/log to change that."
|
2020-07-07 16:53:50 +00:00
|
|
|
<< '\n';
|
2013-07-05 17:00:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-06-10 19:41:13 +00:00
|
|
|
const fs::path p(FLAGS_log_dir);
|
|
|
|
if (!fs::exists(p))
|
2013-07-05 17:00:48 +00:00
|
|
|
{
|
|
|
|
std::cout << "The path "
|
2013-08-02 16:00:12 +00:00
|
|
|
<< FLAGS_log_dir
|
|
|
|
<< " does not exist, attempting to create it"
|
2020-07-07 16:53:50 +00:00
|
|
|
<< '\n';
|
2019-06-10 19:41:13 +00:00
|
|
|
fs::create_directory(p);
|
2013-07-05 17:00:48 +00:00
|
|
|
}
|
|
|
|
std::cout << "Logging with be done at "
|
2020-07-07 16:53:50 +00:00
|
|
|
<< FLAGS_log_dir << '\n';
|
2013-07-05 17:00:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// 0. Instantiate the FrontEnd Calibration class
|
|
|
|
FrontEndCal front_end_cal;
|
|
|
|
|
|
|
|
// 1. Load configuration parameters from config file
|
2014-04-03 21:59:14 +00:00
|
|
|
std::shared_ptr<ConfigurationInterface> configuration = std::make_shared<FileConfiguration>(FLAGS_config_file);
|
2013-07-05 17:00:48 +00:00
|
|
|
front_end_cal.set_configuration(configuration);
|
|
|
|
|
2013-07-30 10:53:45 +00:00
|
|
|
// 2. Get SUPL information from server: Ephemeris record, assistance info and TOW
|
2018-05-26 07:33:57 +00:00
|
|
|
try
|
2013-08-02 16:00:12 +00:00
|
|
|
{
|
2018-05-26 07:33:57 +00:00
|
|
|
if (front_end_cal.get_ephemeris() == true)
|
|
|
|
{
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << "SUPL data received OK!\n";
|
2018-05-26 07:33:57 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << "Failure connecting to SUPL server\n";
|
2018-05-26 07:33:57 +00:00
|
|
|
}
|
2013-08-02 16:00:12 +00:00
|
|
|
}
|
2018-05-26 07:33:57 +00:00
|
|
|
catch (const boost::exception& e)
|
2013-08-02 16:00:12 +00:00
|
|
|
{
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << "Failure connecting to SUPL server\n";
|
2013-08-02 16:00:12 +00:00
|
|
|
}
|
2013-07-30 10:53:45 +00:00
|
|
|
|
|
|
|
// 3. Capture some front-end samples to hard disk
|
2015-06-01 10:17:06 +00:00
|
|
|
try
|
2018-03-03 01:03:39 +00:00
|
|
|
{
|
2015-06-01 10:17:06 +00:00
|
|
|
if (front_end_capture(configuration))
|
|
|
|
{
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << "Front-end RAW samples captured\n";
|
2015-06-01 10:17:06 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << "Failure capturing front-end samples\n";
|
2015-06-01 10:17:06 +00:00
|
|
|
}
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
|
|
|
catch (const boost::bad_lexical_cast& e)
|
|
|
|
{
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << "Exception caught while capturing samples (bad lexical cast)\n";
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
|
|
|
catch (const boost::io::too_few_args& e)
|
|
|
|
{
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << "Exception caught while capturing samples (too few args)\n";
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
|
|
|
catch (...)
|
|
|
|
{
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << "Unexpected exception\n";
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
2013-07-05 17:00:48 +00:00
|
|
|
|
2013-07-30 10:53:45 +00:00
|
|
|
// 4. Setup GNU Radio flowgraph (file_source -> Acquisition_10m)
|
2013-07-05 17:00:48 +00:00
|
|
|
gr::top_block_sptr top_block;
|
|
|
|
top_block = gr::make_top_block("Acquisition test");
|
|
|
|
|
|
|
|
// Satellite signal definition
|
2020-06-18 09:49:28 +00:00
|
|
|
gnss_synchro = Gnss_Synchro();
|
|
|
|
gnss_synchro.Channel_ID = 0;
|
|
|
|
gnss_synchro.System = 'G';
|
2013-07-05 17:00:48 +00:00
|
|
|
std::string signal = "1C";
|
2020-06-18 09:49:28 +00:00
|
|
|
signal.copy(gnss_synchro.Signal, 2, 0);
|
|
|
|
gnss_synchro.PRN = 1;
|
2013-07-05 17:00:48 +00:00
|
|
|
|
2018-08-10 18:34:03 +00:00
|
|
|
int64_t fs_in_ = configuration->property("GNSS-SDR.internal_fs_sps", 2048000);
|
2018-07-04 14:56:47 +00:00
|
|
|
configuration->set_property("Acquisition.max_dwells", "10");
|
2013-07-05 17:00:48 +00:00
|
|
|
|
2020-06-18 09:49:28 +00:00
|
|
|
auto acquisition = std::make_shared<GpsL1CaPcpsAcquisitionFineDoppler>(configuration.get(), "Acquisition", 1, 1);
|
2013-07-05 17:00:48 +00:00
|
|
|
|
|
|
|
acquisition->set_channel(1);
|
2020-06-18 09:49:28 +00:00
|
|
|
acquisition->set_gnss_synchro(&gnss_synchro);
|
2018-07-04 14:56:47 +00:00
|
|
|
acquisition->set_threshold(configuration->property("Acquisition.threshold", 2.0));
|
2013-07-05 17:00:48 +00:00
|
|
|
acquisition->set_doppler_max(configuration->property("Acquisition.doppler_max", 10000));
|
|
|
|
acquisition->set_doppler_step(configuration->property("Acquisition.doppler_step", 250));
|
|
|
|
|
|
|
|
gr::block_sptr source;
|
|
|
|
source = gr::blocks::file_source::make(sizeof(gr_complex), "tmp_capture.dat");
|
2020-04-02 21:59:35 +00:00
|
|
|
#if GNURADIO_USES_STD_POINTERS
|
2020-04-02 11:23:20 +00:00
|
|
|
std::shared_ptr<FrontEndCal_msg_rx> msg_rx;
|
2020-04-02 21:59:35 +00:00
|
|
|
#else
|
|
|
|
boost::shared_ptr<FrontEndCal_msg_rx> msg_rx;
|
|
|
|
#endif
|
2017-06-07 18:34:33 +00:00
|
|
|
try
|
2018-03-03 01:03:39 +00:00
|
|
|
{
|
2017-06-07 18:41:56 +00:00
|
|
|
msg_rx = FrontEndCal_msg_rx_make();
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << "Failure connecting the message port system: " << e.what() << '\n';
|
2018-03-03 01:03:39 +00:00
|
|
|
exit(0);
|
|
|
|
}
|
2016-04-26 14:11:42 +00:00
|
|
|
|
2013-08-02 16:00:12 +00:00
|
|
|
try
|
2018-03-03 01:03:39 +00:00
|
|
|
{
|
2013-08-02 16:00:12 +00:00
|
|
|
acquisition->connect(top_block);
|
|
|
|
top_block->connect(source, 0, acquisition->get_left_block(), 0);
|
2018-03-03 01:03:39 +00:00
|
|
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
|
|
|
}
|
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << "Failure connecting the GNU Radio blocks: " << e.what() << '\n';
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
2013-07-05 17:00:48 +00:00
|
|
|
|
2013-07-30 10:53:45 +00:00
|
|
|
// 5. Run the flowgraph
|
|
|
|
// Get visible GPS satellites (positive acquisitions with Doppler measurements)
|
|
|
|
// Compute Doppler estimations
|
2013-07-05 17:00:48 +00:00
|
|
|
|
2019-08-18 23:29:04 +00:00
|
|
|
// todo: Fix the front-end cal to support new channel internal message system (no more external queues)
|
2018-03-03 01:03:39 +00:00
|
|
|
std::map<int, double> doppler_measurements_map;
|
|
|
|
std::map<int, double> cn0_measurements_map;
|
2013-07-05 17:00:48 +00:00
|
|
|
|
2019-02-24 23:02:53 +00:00
|
|
|
std::thread ch_thread;
|
2015-06-01 16:50:13 +00:00
|
|
|
|
2013-07-05 17:00:48 +00:00
|
|
|
// record startup time
|
2019-08-12 22:19:31 +00:00
|
|
|
std::chrono::time_point<std::chrono::system_clock> start;
|
|
|
|
std::chrono::time_point<std::chrono::system_clock> end;
|
2018-12-08 17:49:31 +00:00
|
|
|
std::chrono::duration<double> elapsed_seconds{};
|
2017-08-11 03:18:38 +00:00
|
|
|
start = std::chrono::system_clock::now();
|
2013-07-05 17:00:48 +00:00
|
|
|
|
2013-08-02 16:00:12 +00:00
|
|
|
bool start_msg = true;
|
2013-07-05 17:00:48 +00:00
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
for (unsigned int PRN = 1; PRN < 33; PRN++)
|
2013-07-05 17:00:48 +00:00
|
|
|
{
|
2020-06-18 09:49:28 +00:00
|
|
|
gnss_synchro.PRN = PRN;
|
|
|
|
acquisition->set_gnss_synchro(&gnss_synchro);
|
2013-08-02 16:00:12 +00:00
|
|
|
acquisition->init();
|
2017-12-06 12:06:05 +00:00
|
|
|
acquisition->set_local_code();
|
2013-08-02 16:00:12 +00:00
|
|
|
acquisition->reset();
|
|
|
|
stop = false;
|
2015-06-01 16:50:13 +00:00
|
|
|
try
|
2018-03-03 01:03:39 +00:00
|
|
|
{
|
2019-02-24 23:02:53 +00:00
|
|
|
ch_thread = std::thread(wait_message);
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
2019-02-24 23:02:53 +00:00
|
|
|
catch (const std::exception& e)
|
2018-03-03 01:03:39 +00:00
|
|
|
{
|
2016-04-26 16:47:36 +00:00
|
|
|
LOG(INFO) << "Exception caught (thread resource error)";
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
2013-08-02 16:00:12 +00:00
|
|
|
top_block->run();
|
|
|
|
if (start_msg == true)
|
|
|
|
{
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << "Searching for GPS Satellites in L1 band...\n";
|
2013-08-02 16:00:12 +00:00
|
|
|
std::cout << "[";
|
|
|
|
start_msg = false;
|
|
|
|
}
|
2018-12-11 11:25:38 +00:00
|
|
|
if (!gnss_sync_vector.empty())
|
2013-08-02 16:00:12 +00:00
|
|
|
{
|
|
|
|
std::cout << " " << PRN << " ";
|
|
|
|
double doppler_measurement_hz = 0;
|
2018-12-08 17:49:31 +00:00
|
|
|
for (auto& it : gnss_sync_vector)
|
2013-08-02 16:00:12 +00:00
|
|
|
{
|
2018-12-03 17:03:25 +00:00
|
|
|
doppler_measurement_hz += it.Acq_doppler_hz;
|
2013-08-02 16:00:12 +00:00
|
|
|
}
|
2018-03-03 01:03:39 +00:00
|
|
|
doppler_measurement_hz = doppler_measurement_hz / gnss_sync_vector.size();
|
|
|
|
doppler_measurements_map.insert(std::pair<int, double>(PRN, doppler_measurement_hz));
|
2013-08-02 16:00:12 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
std::cout << " . ";
|
|
|
|
}
|
2018-05-22 20:09:28 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
channel_internal_queue.push(3);
|
|
|
|
}
|
|
|
|
catch (const boost::exception& e)
|
|
|
|
{
|
2018-08-11 18:51:59 +00:00
|
|
|
LOG(INFO) << "Exception caught while pushing to the internal queue.";
|
2018-05-22 20:09:28 +00:00
|
|
|
}
|
2015-05-30 11:23:23 +00:00
|
|
|
try
|
2018-03-03 01:03:39 +00:00
|
|
|
{
|
2015-05-30 11:23:23 +00:00
|
|
|
ch_thread.join();
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
2019-02-24 23:02:53 +00:00
|
|
|
catch (const std::exception& e)
|
2018-03-03 01:03:39 +00:00
|
|
|
{
|
2015-06-01 10:17:06 +00:00
|
|
|
LOG(INFO) << "Exception caught while joining threads.";
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
2013-08-02 16:00:12 +00:00
|
|
|
gnss_sync_vector.clear();
|
2020-04-02 22:41:51 +00:00
|
|
|
#if GNURADIO_USES_STD_POINTERS
|
|
|
|
std::dynamic_pointer_cast<gr::blocks::file_source>(source)->seek(0, 0);
|
|
|
|
#else
|
2013-08-02 16:00:12 +00:00
|
|
|
boost::dynamic_pointer_cast<gr::blocks::file_source>(source)->seek(0, 0);
|
2020-04-02 22:41:51 +00:00
|
|
|
#endif
|
2013-08-02 16:00:12 +00:00
|
|
|
std::cout.flush();
|
2013-07-05 17:00:48 +00:00
|
|
|
}
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << "]\n";
|
2013-07-05 17:00:48 +00:00
|
|
|
|
|
|
|
// report the elapsed time
|
2017-08-11 03:18:38 +00:00
|
|
|
end = std::chrono::system_clock::now();
|
|
|
|
elapsed_seconds = end - start;
|
2013-07-05 17:00:48 +00:00
|
|
|
std::cout << "Total signal acquisition run time "
|
2017-08-11 03:18:38 +00:00
|
|
|
<< elapsed_seconds.count()
|
2020-07-07 16:53:50 +00:00
|
|
|
<< " [seconds]\n";
|
2013-07-05 17:00:48 +00:00
|
|
|
|
2018-05-21 22:29:33 +00:00
|
|
|
// 6. find TOW from SUPL assistance
|
2013-08-02 16:00:12 +00:00
|
|
|
double current_TOW = 0;
|
2018-05-21 22:29:33 +00:00
|
|
|
try
|
2013-08-02 16:00:12 +00:00
|
|
|
{
|
2018-05-21 22:29:33 +00:00
|
|
|
if (global_gps_ephemeris_map.size() > 0)
|
2018-05-21 19:21:28 +00:00
|
|
|
{
|
2018-05-21 22:29:33 +00:00
|
|
|
std::map<int, Gps_Ephemeris> Eph_map;
|
2018-05-21 19:21:28 +00:00
|
|
|
Eph_map = global_gps_ephemeris_map.get_map_copy();
|
2018-05-21 22:29:33 +00:00
|
|
|
current_TOW = Eph_map.begin()->second.d_TOW;
|
|
|
|
|
2018-08-11 18:50:06 +00:00
|
|
|
time_t t = utc_time(Eph_map.begin()->second.i_GPS_week, static_cast<int64_t>(current_TOW));
|
2018-05-21 22:29:33 +00:00
|
|
|
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << "Reference Time:\n";
|
|
|
|
std::cout << " GPS Week: " << Eph_map.begin()->second.i_GPS_week << '\n';
|
|
|
|
std::cout << " GPS TOW: " << static_cast<int64_t>(current_TOW) << " " << static_cast<int64_t>(current_TOW) * 0.08 << '\n';
|
|
|
|
std::cout << " ~ UTC: " << ctime(&t) << '\n';
|
|
|
|
std::cout << "Current TOW obtained from SUPL assistance = " << current_TOW << '\n';
|
2018-05-21 19:21:28 +00:00
|
|
|
}
|
2018-05-21 22:29:33 +00:00
|
|
|
else
|
2018-05-21 19:21:28 +00:00
|
|
|
{
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << "Unable to get Ephemeris SUPL assistance. TOW is unknown!\n";
|
2020-08-13 18:54:22 +00:00
|
|
|
gflags::ShutDownCommandLineFlags();
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << "GNSS-SDR Front-end calibration program ended.\n";
|
2018-05-21 19:21:28 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2013-08-02 16:00:12 +00:00
|
|
|
}
|
2018-05-21 22:29:33 +00:00
|
|
|
catch (const boost::exception& e)
|
2013-08-02 16:00:12 +00:00
|
|
|
{
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << "Exception in getting Global ephemeris map\n";
|
2020-08-13 18:54:22 +00:00
|
|
|
gflags::ShutDownCommandLineFlags();
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << "GNSS-SDR Front-end calibration program ended.\n";
|
2013-08-02 16:00:12 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2013-07-05 17:00:48 +00:00
|
|
|
|
2018-05-21 22:29:33 +00:00
|
|
|
// Get user position from config file (or from SUPL using GSM Cell ID)
|
2013-07-05 17:00:48 +00:00
|
|
|
double lat_deg = configuration->property("GNSS-SDR.init_latitude_deg", 41.0);
|
|
|
|
double lon_deg = configuration->property("GNSS-SDR.init_longitude_deg", 2.0);
|
|
|
|
double altitude_m = configuration->property("GNSS-SDR.init_altitude_m", 100);
|
|
|
|
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << "Reference location (defined in config file):\n";
|
2013-07-30 10:53:45 +00:00
|
|
|
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << "Latitude=" << lat_deg << " [º]\n";
|
|
|
|
std::cout << "Longitude=" << lon_deg << " [º]\n";
|
|
|
|
std::cout << "Altitude=" << altitude_m << " [m]\n";
|
2013-07-30 10:53:45 +00:00
|
|
|
|
2018-12-11 11:25:38 +00:00
|
|
|
if (doppler_measurements_map.empty())
|
2013-08-02 16:00:12 +00:00
|
|
|
{
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << "Sorry, no GPS satellites detected in the front-end capture, please check the antenna setup...\n";
|
2020-08-13 18:54:22 +00:00
|
|
|
gflags::ShutDownCommandLineFlags();
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << "GNSS-SDR Front-end calibration program ended.\n";
|
2013-08-02 16:00:12 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2013-07-30 10:53:45 +00:00
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
std::map<int, double> f_if_estimation_Hz_map;
|
|
|
|
std::map<int, double> f_fs_estimation_Hz_map;
|
|
|
|
std::map<int, double> f_ppm_estimation_Hz_map;
|
2013-07-05 17:00:48 +00:00
|
|
|
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << std::setiosflags(std::ios::fixed) << std::setprecision(2) << "Doppler analysis results:\n";
|
2013-07-08 16:17:57 +00:00
|
|
|
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << "SV ID Measured [Hz] Predicted [Hz]\n";
|
2013-07-08 16:17:57 +00:00
|
|
|
|
2018-12-08 17:49:31 +00:00
|
|
|
for (auto& it : doppler_measurements_map)
|
2013-08-02 16:00:12 +00:00
|
|
|
{
|
|
|
|
try
|
2018-03-03 01:03:39 +00:00
|
|
|
{
|
2013-08-02 16:00:12 +00:00
|
|
|
double doppler_estimated_hz;
|
2018-12-03 17:03:25 +00:00
|
|
|
doppler_estimated_hz = front_end_cal.estimate_doppler_from_eph(it.first, current_TOW, lat_deg, lon_deg, altitude_m);
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << " " << it.first << " " << it.second << " " << doppler_estimated_hz << '\n';
|
2013-08-02 16:00:12 +00:00
|
|
|
// 7. Compute front-end IF and sampling frequency estimation
|
|
|
|
// Compare with the measurements and compute clock drift using FE model
|
2019-08-12 22:19:31 +00:00
|
|
|
double estimated_fs_Hz;
|
|
|
|
double estimated_f_if_Hz;
|
|
|
|
double f_osc_err_ppm;
|
2018-12-03 17:03:25 +00:00
|
|
|
front_end_cal.GPS_L1_front_end_model_E4000(doppler_estimated_hz, it.second, fs_in_, &estimated_fs_Hz, &estimated_f_if_Hz, &f_osc_err_ppm);
|
2018-03-03 01:03:39 +00:00
|
|
|
|
2018-12-03 17:03:25 +00:00
|
|
|
f_if_estimation_Hz_map.insert(std::pair<int, double>(it.first, estimated_f_if_Hz));
|
|
|
|
f_fs_estimation_Hz_map.insert(std::pair<int, double>(it.first, estimated_fs_Hz));
|
|
|
|
f_ppm_estimation_Hz_map.insert(std::pair<int, double>(it.first, f_osc_err_ppm));
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
|
|
|
catch (const std::logic_error& e)
|
|
|
|
{
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << "Logic error caught: " << e.what() << '\n';
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
|
|
|
catch (const boost::lock_error& e)
|
|
|
|
{
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << "Exception caught while reading ephemeris\n";
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
2019-07-30 10:51:36 +00:00
|
|
|
catch (const std::exception& ex)
|
2018-03-03 01:03:39 +00:00
|
|
|
{
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << " " << it.first << " " << it.second << " (Eph not found)\n";
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
2013-08-02 16:00:12 +00:00
|
|
|
}
|
2013-07-05 17:00:48 +00:00
|
|
|
|
|
|
|
// FINAL FE estimations
|
2013-08-02 16:00:12 +00:00
|
|
|
double mean_f_if_Hz = 0;
|
|
|
|
double mean_fs_Hz = 0;
|
|
|
|
double mean_osc_err_ppm = 0;
|
|
|
|
int n_elements = f_if_estimation_Hz_map.size();
|
2013-07-05 17:00:48 +00:00
|
|
|
|
2018-12-08 17:49:31 +00:00
|
|
|
for (auto& it : f_if_estimation_Hz_map)
|
2013-08-02 16:00:12 +00:00
|
|
|
{
|
2018-12-03 17:03:25 +00:00
|
|
|
mean_f_if_Hz += it.second;
|
|
|
|
mean_fs_Hz += f_fs_estimation_Hz_map.find(it.first)->second;
|
|
|
|
mean_osc_err_ppm += f_ppm_estimation_Hz_map.find(it.first)->second;
|
2013-08-02 16:00:12 +00:00
|
|
|
}
|
2013-07-05 17:00:48 +00:00
|
|
|
|
2013-08-02 16:00:12 +00:00
|
|
|
mean_f_if_Hz /= n_elements;
|
|
|
|
mean_fs_Hz /= n_elements;
|
|
|
|
mean_osc_err_ppm /= n_elements;
|
2013-07-05 17:00:48 +00:00
|
|
|
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << std::setiosflags(std::ios::fixed) << std::setprecision(2) << "Parameters estimation for Elonics E4000 Front-End:\n";
|
2013-08-01 14:01:07 +00:00
|
|
|
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << "Sampling frequency =" << mean_fs_Hz << " [Hz]\n";
|
|
|
|
std::cout << "IF bias present in baseband=" << mean_f_if_Hz << " [Hz]\n";
|
|
|
|
std::cout << "Reference oscillator error =" << mean_osc_err_ppm << " [ppm]\n";
|
2013-08-01 14:01:07 +00:00
|
|
|
|
2013-08-02 16:00:12 +00:00
|
|
|
std::cout << std::setiosflags(std::ios::fixed) << std::setprecision(2)
|
2020-07-07 16:53:50 +00:00
|
|
|
<< "Corrected Doppler vs. Predicted\n";
|
|
|
|
std::cout << "SV ID Corrected [Hz] Predicted [Hz]\n";
|
2013-08-01 14:01:07 +00:00
|
|
|
|
2018-12-08 17:49:31 +00:00
|
|
|
for (auto& it : doppler_measurements_map)
|
2013-08-02 16:00:12 +00:00
|
|
|
{
|
|
|
|
try
|
2018-03-03 01:03:39 +00:00
|
|
|
{
|
2013-08-02 16:00:12 +00:00
|
|
|
double doppler_estimated_hz;
|
2018-12-03 17:03:25 +00:00
|
|
|
doppler_estimated_hz = front_end_cal.estimate_doppler_from_eph(it.first, current_TOW, lat_deg, lon_deg, altitude_m);
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << " " << it.first << " " << it.second - mean_f_if_Hz << " " << doppler_estimated_hz << '\n';
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
|
|
|
catch (const std::logic_error& e)
|
|
|
|
{
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << "Logic error caught: " << e.what() << '\n';
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
|
|
|
catch (const boost::lock_error& e)
|
|
|
|
{
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << "Exception caught while reading ephemeris\n";
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
2019-07-30 18:03:02 +00:00
|
|
|
catch (const std::exception& ex)
|
2018-03-03 01:03:39 +00:00
|
|
|
{
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << " " << it.first << " " << it.second - mean_f_if_Hz << " (Eph not found)\n";
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
2013-08-02 16:00:12 +00:00
|
|
|
}
|
2013-08-01 14:01:07 +00:00
|
|
|
|
2020-08-13 18:54:22 +00:00
|
|
|
gflags::ShutDownCommandLineFlags();
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << "GNSS-SDR Front-end calibration program ended.\n";
|
2013-07-05 17:00:48 +00:00
|
|
|
}
|