mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-13 19:50:34 +00:00
Adding an improved receiver time reporting system
This commit is contained in:
parent
5581b2f888
commit
c3c3266fad
@ -22,6 +22,7 @@ set(GNSS_SPLIBS_SOURCES
|
||||
gps_l2c_signal.cc
|
||||
galileo_e1_signal_processing.cc
|
||||
gnss_sdr_valve.cc
|
||||
gnss_sdr_sample_counter.cc
|
||||
gnss_signal_processing.cc
|
||||
gps_sdr_signal_processing.cc
|
||||
pass_through.cc
|
||||
|
71
src/algorithms/libs/gnss_sdr_sample_counter.cc
Normal file
71
src/algorithms/libs/gnss_sdr_sample_counter.cc
Normal file
@ -0,0 +1,71 @@
|
||||
/*!
|
||||
* \file gnss_sdr_sample_counter.cc
|
||||
* \brief Simple block to report the current receiver time based on the output of the tracking or telemetry blocks
|
||||
* \author Javier Arribas 2017. jarribas(at)cttc.es
|
||||
*
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2015 (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 "gnss_sdr_sample_counter.h"
|
||||
#include "gnss_synchro.h"
|
||||
#include <gnuradio/io_signature.h>
|
||||
|
||||
gnss_sdr_sample_counter::gnss_sdr_sample_counter () : gr::sync_block("sample_counter",
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
|
||||
gr::io_signature::make(0,0,0))
|
||||
{
|
||||
this->message_port_register_out(pmt::mp("sample_counter"));
|
||||
last_T_rx_s=0;
|
||||
report_interval_s=1;//default reporting 1 second
|
||||
flag_enable_send_msg=false; //enable it for reporting time with asynchronous message
|
||||
}
|
||||
|
||||
|
||||
gnss_sdr_sample_counter_sptr gnss_sdr_make_sample_counter ()
|
||||
{
|
||||
gnss_sdr_sample_counter_sptr sample_counter_(new gnss_sdr_sample_counter());
|
||||
return sample_counter_;
|
||||
}
|
||||
|
||||
|
||||
int gnss_sdr_sample_counter::work (int noutput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items)
|
||||
{
|
||||
const Gnss_Synchro *in = (const Gnss_Synchro *) input_items[0]; // input
|
||||
|
||||
double current_T_rx_s=in[noutput_items-1].Tracking_sample_counter/(double)in[noutput_items-1].fs;
|
||||
if ((current_T_rx_s-last_T_rx_s)>report_interval_s)
|
||||
{
|
||||
std::cout<<"Current receiver time: "<<floor(current_T_rx_s)<<" [s]"<<std::endl;
|
||||
if(flag_enable_send_msg==true)
|
||||
{
|
||||
this->message_port_pub(pmt::mp("receiver_time"), pmt::from_double(current_T_rx_s));
|
||||
}
|
||||
last_T_rx_s=current_T_rx_s;
|
||||
}
|
||||
return noutput_items;
|
||||
}
|
58
src/algorithms/libs/gnss_sdr_sample_counter.h
Normal file
58
src/algorithms/libs/gnss_sdr_sample_counter.h
Normal file
@ -0,0 +1,58 @@
|
||||
/*!
|
||||
* \file gnss_sdr_sample_counter.h
|
||||
* \brief Simple block to report the current receiver time based on the output of the tracking or telemetry blocks
|
||||
* \author Javier Arribas 2017. jarribas(at)cttc.es
|
||||
*
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2015 (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_sample_counter_H_
|
||||
#define GNSS_SDR_sample_counter_H_
|
||||
|
||||
#include <gnuradio/sync_block.h>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
|
||||
class gnss_sdr_sample_counter;
|
||||
|
||||
typedef boost::shared_ptr<gnss_sdr_sample_counter> gnss_sdr_sample_counter_sptr;
|
||||
|
||||
gnss_sdr_sample_counter_sptr gnss_sdr_make_sample_counter ();
|
||||
|
||||
class gnss_sdr_sample_counter : public gr::sync_block
|
||||
{
|
||||
friend gnss_sdr_sample_counter_sptr gnss_sdr_make_sample_counter();
|
||||
gnss_sdr_sample_counter ();
|
||||
double last_T_rx_s;
|
||||
double report_interval_s;
|
||||
bool flag_enable_send_msg;
|
||||
|
||||
public:
|
||||
int work(int noutput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items);
|
||||
};
|
||||
|
||||
#endif /*GNSS_SDR_sample_counter_H_*/
|
@ -48,6 +48,7 @@
|
||||
#include "channel_interface.h"
|
||||
#include "gnss_block_factory.h"
|
||||
|
||||
|
||||
#define GNSS_SDR_ARRAY_SIGNAL_CONDITIONER_CHANNELS 8
|
||||
|
||||
using google::LogMessage;
|
||||
@ -312,6 +313,13 @@ void GNSSFlowgraph::connect()
|
||||
{
|
||||
LOG(INFO) << "Channel " << i << " connected to observables in standby mode";
|
||||
}
|
||||
//connect the sample counter to the channel 0
|
||||
if (i==0)
|
||||
{
|
||||
ch_out_sample_counter=gnss_sdr_make_sample_counter();
|
||||
top_block_->connect(channels_.at(i)->get_right_block(),0,ch_out_sample_counter,0);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include <gnuradio/msg_queue.h>
|
||||
#include "GPS_L1_CA.h"
|
||||
#include "gnss_signal.h"
|
||||
#include "gnss_sdr_sample_counter.h"
|
||||
|
||||
class GNSSBlockInterface;
|
||||
class ChannelInterface;
|
||||
@ -136,6 +137,7 @@ private:
|
||||
std::shared_ptr<GNSSBlockInterface> pvt_;
|
||||
|
||||
std::vector<std::shared_ptr<ChannelInterface>> channels_;
|
||||
gnss_sdr_sample_counter_sptr ch_out_sample_counter;
|
||||
gr::top_block_sptr top_block_;
|
||||
boost::shared_ptr<gr::msg_queue> queue_;
|
||||
std::list<Gnss_Signal> available_GNSS_signals_;
|
||||
|
Loading…
Reference in New Issue
Block a user