1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-07-16 16:44:21 +00:00

Merge branch 'next' of https://github.com/gnss-sdr/gnss-sdr into next

This commit is contained in:
Carles Fernandez 2018-04-14 11:22:58 +02:00
commit 5d22a5d680
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
16 changed files with 490 additions and 485 deletions

View File

@ -335,84 +335,6 @@ void pcps_acquisition::send_negative_acquisition()
}
int pcps_acquisition::general_work(int noutput_items __attribute__((unused)),
gr_vector_int& ninput_items, gr_vector_const_void_star& input_items,
gr_vector_void_star& output_items __attribute__((unused)))
{
/*
* By J.Arribas, L.Esteve and M.Molina
* Acquisition strategy (Kay Borre book + CFAR threshold):
* 1. Compute the input signal power estimation
* 2. Doppler serial search loop
* 3. Perform the FFT-based circular convolution (parallel time search)
* 4. Record the maximum peak and the associated synchronization parameters
* 5. Compute the test statistics and compare to the threshold
* 6. Declare positive or negative acquisition using a message port
*/
gr::thread::scoped_lock lk(d_setlock);
if (!d_active or d_worker_active)
{
d_sample_counter += d_fft_size * ninput_items[0];
consume_each(ninput_items[0]);
if (d_step_two)
{
d_doppler_center_step_two = static_cast<float>(d_gnss_synchro->Acq_doppler_hz);
update_grid_doppler_wipeoffs_step2();
d_state = 0;
d_active = true;
}
return 0;
}
switch (d_state)
{
case 0:
{
//restart acquisition variables
d_gnss_synchro->Acq_delay_samples = 0.0;
d_gnss_synchro->Acq_doppler_hz = 0.0;
d_gnss_synchro->Acq_samplestamp_samples = 0;
d_well_count = 0;
d_mag = 0.0;
d_input_power = 0.0;
d_test_statistics = 0.0;
d_state = 1;
d_sample_counter += d_fft_size * ninput_items[0]; // sample counter
consume_each(ninput_items[0]);
break;
}
case 1:
{
// Copy the data to the core and let it know that new data is available
if (d_cshort)
{
memcpy(d_data_buffer_sc, input_items[0], d_fft_size * sizeof(lv_16sc_t));
}
else
{
memcpy(d_data_buffer, input_items[0], d_fft_size * sizeof(gr_complex));
}
if (acq_parameters.blocking)
{
lk.unlock();
acquisition_core(d_sample_counter);
}
else
{
gr::thread::thread d_worker(&pcps_acquisition::acquisition_core, this, d_sample_counter);
d_worker_active = true;
}
d_sample_counter += d_fft_size;
consume_each(1);
break;
}
}
return 0;
}
void pcps_acquisition::acquisition_core(unsigned long int samp_count)
{
gr::thread::scoped_lock lk(d_setlock);
@ -686,3 +608,81 @@ void pcps_acquisition::acquisition_core(unsigned long int samp_count)
}
d_worker_active = false;
}
int pcps_acquisition::general_work(int noutput_items __attribute__((unused)),
gr_vector_int& ninput_items, gr_vector_const_void_star& input_items,
gr_vector_void_star& output_items __attribute__((unused)))
{
/*
* By J.Arribas, L.Esteve and M.Molina
* Acquisition strategy (Kay Borre book + CFAR threshold):
* 1. Compute the input signal power estimation
* 2. Doppler serial search loop
* 3. Perform the FFT-based circular convolution (parallel time search)
* 4. Record the maximum peak and the associated synchronization parameters
* 5. Compute the test statistics and compare to the threshold
* 6. Declare positive or negative acquisition using a message port
*/
gr::thread::scoped_lock lk(d_setlock);
if (!d_active or d_worker_active)
{
d_sample_counter += d_fft_size * ninput_items[0];
consume_each(ninput_items[0]);
if (d_step_two)
{
d_doppler_center_step_two = static_cast<float>(d_gnss_synchro->Acq_doppler_hz);
update_grid_doppler_wipeoffs_step2();
d_state = 0;
d_active = true;
}
return 0;
}
switch (d_state)
{
case 0:
{
//restart acquisition variables
d_gnss_synchro->Acq_delay_samples = 0.0;
d_gnss_synchro->Acq_doppler_hz = 0.0;
d_gnss_synchro->Acq_samplestamp_samples = 0;
d_well_count = 0;
d_mag = 0.0;
d_input_power = 0.0;
d_test_statistics = 0.0;
d_state = 1;
d_sample_counter += d_fft_size * ninput_items[0]; // sample counter
consume_each(ninput_items[0]);
break;
}
case 1:
{
// Copy the data to the core and let it know that new data is available
if (d_cshort)
{
memcpy(d_data_buffer_sc, input_items[0], d_fft_size * sizeof(lv_16sc_t));
}
else
{
memcpy(d_data_buffer, input_items[0], d_fft_size * sizeof(gr_complex));
}
if (acq_parameters.blocking)
{
lk.unlock();
acquisition_core(d_sample_counter);
}
else
{
gr::thread::thread d_worker(&pcps_acquisition::acquisition_core, this, d_sample_counter);
d_worker_active = true;
}
d_sample_counter += d_fft_size;
consume_each(1);
break;
}
}
return 0;
}

View File

@ -62,6 +62,7 @@ endif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# Enable C++17 support in GCC >= 8.0.0
# Enable C++14 support in 8.0.0 > GCC >= 6.1.1
# Fallback to C++11 when using GCC < 6.1.1
if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32)
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.1.1")
set(MY_CXX_FLAGS "${MY_CXX_FLAGS} -std=c++11")
@ -75,8 +76,8 @@ if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32)
set(MY_CXX_FLAGS "${MY_CXX_FLAGS} -Wall -Wextra") #Add warning flags: For "-Wall" see http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
endif(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32)
# Enable C++17 support in Clang >= 6.0.0 or AppleClang >= 900
# Enable C++14 support in 6.0.0 > Clang >= 3.5.0 or 900 > AppleClang >= 600
# Enable C++17 support in Clang >= 6.0.0
# Enable C++14 support in 6.0.0 > Clang >= 3.5.0 or AppleClang >= 600
# Fallback to C++11 if older version
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
@ -84,11 +85,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if(CLANG_VERSION VERSION_LESS "600")
set(MY_CXX_FLAGS "${MY_CXX_FLAGS} -std=c++11")
else(CLANG_VERSION VERSION_LESS "600")
if(CLANG_VERSION VERSION_LESS "900")
set(MY_CXX_FLAGS "${MY_CXX_FLAGS} -std=c++14")
else(CLANG_VERSION VERSION_LESS "900")
set(MY_CXX_FLAGS "${MY_CXX_FLAGS} -std=c++17")
endif(CLANG_VERSION VERSION_LESS "900")
set(MY_CXX_FLAGS "${MY_CXX_FLAGS} -std=c++14")
endif(CLANG_VERSION VERSION_LESS "600")
else(CMAKE_SYSTEM_NAME MATCHES "Darwin")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.5.0")

View File

@ -64,7 +64,7 @@ hybrid_observables_cc::hybrid_observables_cc(unsigned int nchannels_in,
T_rx_s = 0.0;
T_rx_step_s = 0.001; // 1 ms
max_delta = 1.5; // 1.5 s
d_latency = 0.175; // 175 ms
d_latency = 0.3; // 300 ms
valid_channels.resize(d_nchannels, false);
d_num_valid_channels = 0;
d_gnss_synchro_history = new Gnss_circular_deque<Gnss_Synchro>(static_cast<unsigned int>(max_delta * 1000.0), d_nchannels);

View File

@ -158,41 +158,6 @@ rtl_tcp_signal_source_c::~rtl_tcp_signal_source_c()
}
int rtl_tcp_signal_source_c::work(int noutput_items,
gr_vector_const_void_star & /*input_items*/,
gr_vector_void_star &output_items)
{
gr_complex *out = reinterpret_cast<gr_complex *>(output_items[0]);
int i = 0;
if (io_service_.stopped())
{
return -1;
}
{
boost::mutex::scoped_lock lock(mutex_);
not_empty_.wait(lock, boost::bind(&rtl_tcp_signal_source_c::not_empty,
this));
for (; i < noutput_items && unread_ > 1; i++)
{
float re = buffer_[--unread_];
float im = buffer_[--unread_];
if (flip_iq_)
{
out[i] = gr_complex(im, re);
}
else
{
out[i] = gr_complex(re, im);
}
}
}
not_full_.notify_one();
return i == 0 ? -1 : i;
}
void rtl_tcp_signal_source_c::set_frequency(int frequency)
{
boost::system::error_code ec =
@ -359,3 +324,38 @@ void rtl_tcp_signal_source_c::handle_read(const boost::system::error_code &ec,
this, _1, _2));
}
}
int rtl_tcp_signal_source_c::work(int noutput_items,
gr_vector_const_void_star & /*input_items*/,
gr_vector_void_star &output_items)
{
gr_complex *out = reinterpret_cast<gr_complex *>(output_items[0]);
int i = 0;
if (io_service_.stopped())
{
return -1;
}
{
boost::mutex::scoped_lock lock(mutex_);
not_empty_.wait(lock, boost::bind(&rtl_tcp_signal_source_c::not_empty,
this));
for (; i < noutput_items && unread_ > 1; i++)
{
float re = buffer_[--unread_];
float im = buffer_[--unread_];
if (flip_iq_)
{
out[i] = gr_complex(im, re);
}
else
{
out[i] = gr_complex(re, im);
}
}
}
not_full_.notify_one();
return i == 0 ? -1 : i;
}

View File

@ -57,6 +57,21 @@ unpack_spir_gss6450_samples::~unpack_spir_gss6450_samples()
}
int unpack_spir_gss6450_samples::compute_two_complement(unsigned long data)
{
int res = 0;
if (static_cast<int>(data) < two_compl_thres)
{
res = static_cast<int>(data);
}
else
{
res = static_cast<int>(data) - adc_bits_two_pow;
}
return res;
}
int unpack_spir_gss6450_samples::work(int noutput_items,
gr_vector_const_void_star& input_items, gr_vector_void_star& output_items)
{
@ -86,17 +101,3 @@ int unpack_spir_gss6450_samples::work(int noutput_items,
}
return noutput_items;
}
int unpack_spir_gss6450_samples::compute_two_complement(unsigned long data)
{
int res = 0;
if (static_cast<int>(data) < two_compl_thres)
{
res = static_cast<int>(data);
}
else
{
res = static_cast<int>(data) - adc_bits_two_pow;
}
return res;
}

View File

@ -272,6 +272,41 @@ void galileo_e1b_telemetry_decoder_cc::decode_word(double *page_part_symbols, in
}
void galileo_e1b_telemetry_decoder_cc::set_satellite(const Gnss_Satellite &satellite)
{
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
DLOG(INFO) << "Setting decoder Finite State Machine to satellite " << d_satellite;
DLOG(INFO) << "Navigation Satellite set to " << d_satellite;
}
void galileo_e1b_telemetry_decoder_cc::set_channel(int channel)
{
d_channel = channel;
LOG(INFO) << "Navigation channel set to " << channel;
// ############# ENABLE DATA FILE LOG #################
if (d_dump == true)
{
if (d_dump_file.is_open() == false)
{
try
{
d_dump_filename = "telemetry";
d_dump_filename.append(boost::lexical_cast<std::string>(d_channel));
d_dump_filename.append(".dat");
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);
LOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str();
}
catch (const std::ifstream::failure &e)
{
LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what();
}
}
}
}
int galileo_e1b_telemetry_decoder_cc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
{
@ -467,38 +502,3 @@ int galileo_e1b_telemetry_decoder_cc::general_work(int noutput_items __attribute
//std::cout<<"GPS L1 TLM output on CH="<<this->d_channel << " SAMPLE STAMP="<<d_sample_counter/d_decimation_output_factor<<std::endl;
return 1;
}
void galileo_e1b_telemetry_decoder_cc::set_satellite(const Gnss_Satellite &satellite)
{
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
DLOG(INFO) << "Setting decoder Finite State Machine to satellite " << d_satellite;
DLOG(INFO) << "Navigation Satellite set to " << d_satellite;
}
void galileo_e1b_telemetry_decoder_cc::set_channel(int channel)
{
d_channel = channel;
LOG(INFO) << "Navigation channel set to " << channel;
// ############# ENABLE DATA FILE LOG #################
if (d_dump == true)
{
if (d_dump_file.is_open() == false)
{
try
{
d_dump_filename = "telemetry";
d_dump_filename.append(boost::lexical_cast<std::string>(d_channel));
d_dump_filename.append(".dat");
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);
LOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str();
}
catch (const std::ifstream::failure &e)
{
LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what();
}
}
}
}

View File

@ -245,6 +245,41 @@ galileo_e5a_telemetry_decoder_cc::~galileo_e5a_telemetry_decoder_cc()
}
void galileo_e5a_telemetry_decoder_cc::set_satellite(const Gnss_Satellite &satellite)
{
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
DLOG(INFO) << "Setting decoder Finite State Machine to satellite " << d_satellite;
DLOG(INFO) << "Navigation Satellite set to " << d_satellite;
}
void galileo_e5a_telemetry_decoder_cc::set_channel(int channel)
{
d_channel = channel;
LOG(INFO) << "Navigation channel set to " << channel;
// ############# ENABLE DATA FILE LOG #################
if (d_dump == true)
{
if (d_dump_file.is_open() == false)
{
try
{
d_dump_filename = "telemetry";
d_dump_filename.append(boost::lexical_cast<std::string>(d_channel));
d_dump_filename.append(".dat");
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);
LOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str();
}
catch (const std::ifstream::failure &e)
{
LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what();
}
}
}
}
int galileo_e5a_telemetry_decoder_cc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
{
@ -491,38 +526,3 @@ int galileo_e5a_telemetry_decoder_cc::general_work(int noutput_items __attribute
return 0;
}
}
void galileo_e5a_telemetry_decoder_cc::set_satellite(const Gnss_Satellite &satellite)
{
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
DLOG(INFO) << "Setting decoder Finite State Machine to satellite " << d_satellite;
DLOG(INFO) << "Navigation Satellite set to " << d_satellite;
}
void galileo_e5a_telemetry_decoder_cc::set_channel(int channel)
{
d_channel = channel;
LOG(INFO) << "Navigation channel set to " << channel;
// ############# ENABLE DATA FILE LOG #################
if (d_dump == true)
{
if (d_dump_file.is_open() == false)
{
try
{
d_dump_filename = "telemetry";
d_dump_filename.append(boost::lexical_cast<std::string>(d_channel));
d_dump_filename.append(".dat");
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);
LOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str();
}
catch (const std::ifstream::failure &e)
{
LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what();
}
}
}
}

View File

@ -221,6 +221,41 @@ void glonass_l1_ca_telemetry_decoder_cc::decode_string(double *frame_symbols, in
}
void glonass_l1_ca_telemetry_decoder_cc::set_satellite(const Gnss_Satellite &satellite)
{
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
DLOG(INFO) << "Setting decoder Finite State Machine to satellite " << d_satellite;
DLOG(INFO) << "Navigation Satellite set to " << d_satellite;
}
void glonass_l1_ca_telemetry_decoder_cc::set_channel(int channel)
{
d_channel = channel;
LOG(INFO) << "Navigation channel set to " << channel;
// ############# ENABLE DATA FILE LOG #################
if (d_dump == true)
{
if (d_dump_file.is_open() == false)
{
try
{
d_dump_filename = "telemetry";
d_dump_filename.append(boost::lexical_cast<std::string>(d_channel));
d_dump_filename.append(".dat");
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);
LOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str();
}
catch (const std::ifstream::failure &e)
{
LOG(WARNING) << "channel " << d_channel << ": exception opening Glonass TLM dump file. " << e.what();
}
}
}
}
int glonass_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
{
@ -408,38 +443,3 @@ int glonass_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu
return 1;
}
void glonass_l1_ca_telemetry_decoder_cc::set_satellite(const Gnss_Satellite &satellite)
{
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
DLOG(INFO) << "Setting decoder Finite State Machine to satellite " << d_satellite;
DLOG(INFO) << "Navigation Satellite set to " << d_satellite;
}
void glonass_l1_ca_telemetry_decoder_cc::set_channel(int channel)
{
d_channel = channel;
LOG(INFO) << "Navigation channel set to " << channel;
// ############# ENABLE DATA FILE LOG #################
if (d_dump == true)
{
if (d_dump_file.is_open() == false)
{
try
{
d_dump_filename = "telemetry";
d_dump_filename.append(boost::lexical_cast<std::string>(d_channel));
d_dump_filename.append(".dat");
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);
LOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str();
}
catch (const std::ifstream::failure &e)
{
LOG(WARNING) << "channel " << d_channel << ": exception opening Glonass TLM dump file. " << e.what();
}
}
}
}

View File

@ -220,6 +220,41 @@ void glonass_l2_ca_telemetry_decoder_cc::decode_string(double *frame_symbols, in
}
void glonass_l2_ca_telemetry_decoder_cc::set_satellite(const Gnss_Satellite &satellite)
{
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
DLOG(INFO) << "Setting decoder Finite State Machine to satellite " << d_satellite;
DLOG(INFO) << "Navigation Satellite set to " << d_satellite;
}
void glonass_l2_ca_telemetry_decoder_cc::set_channel(int channel)
{
d_channel = channel;
LOG(INFO) << "Navigation channel set to " << channel;
// ############# ENABLE DATA FILE LOG #################
if (d_dump == true)
{
if (d_dump_file.is_open() == false)
{
try
{
d_dump_filename = "telemetry";
d_dump_filename.append(boost::lexical_cast<std::string>(d_channel));
d_dump_filename.append(".dat");
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);
LOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str();
}
catch (const std::ifstream::failure &e)
{
LOG(WARNING) << "channel " << d_channel << ": exception opening Glonass TLM dump file. " << e.what();
}
}
}
}
int glonass_l2_ca_telemetry_decoder_cc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
{
@ -407,38 +442,3 @@ int glonass_l2_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu
return 1;
}
void glonass_l2_ca_telemetry_decoder_cc::set_satellite(const Gnss_Satellite &satellite)
{
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
DLOG(INFO) << "Setting decoder Finite State Machine to satellite " << d_satellite;
DLOG(INFO) << "Navigation Satellite set to " << d_satellite;
}
void glonass_l2_ca_telemetry_decoder_cc::set_channel(int channel)
{
d_channel = channel;
LOG(INFO) << "Navigation channel set to " << channel;
// ############# ENABLE DATA FILE LOG #################
if (d_dump == true)
{
if (d_dump_file.is_open() == false)
{
try
{
d_dump_filename = "telemetry";
d_dump_filename.append(boost::lexical_cast<std::string>(d_channel));
d_dump_filename.append(".dat");
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);
LOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str();
}
catch (const std::ifstream::failure &e)
{
LOG(WARNING) << "channel " << d_channel << ": exception opening Glonass TLM dump file. " << e.what();
}
}
}
}

View File

@ -152,6 +152,44 @@ bool gps_l1_ca_telemetry_decoder_cc::gps_word_parityCheck(unsigned int gpsword)
}
void gps_l1_ca_telemetry_decoder_cc::set_satellite(const 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;
}
void gps_l1_ca_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)
{
if (d_dump_file.is_open() == false)
{
try
{
d_dump_filename = "telemetry";
d_dump_filename.append(boost::lexical_cast<std::string>(d_channel));
d_dump_filename.append(".dat");
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);
LOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel
<< " Log file: " << d_dump_filename.c_str();
}
catch (const std::ifstream::failure &e)
{
LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what();
}
}
}
}
int gps_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
{
@ -411,41 +449,3 @@ int gps_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribute__
return 1;
}
void gps_l1_ca_telemetry_decoder_cc::set_satellite(const 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;
}
void gps_l1_ca_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)
{
if (d_dump_file.is_open() == false)
{
try
{
d_dump_filename = "telemetry";
d_dump_filename.append(boost::lexical_cast<std::string>(d_channel));
d_dump_filename.append(".dat");
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);
LOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel
<< " Log file: " << d_dump_filename.c_str();
}
catch (const std::ifstream::failure &e)
{
LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what();
}
}
}
}

View File

@ -90,6 +90,41 @@ gps_l2c_telemetry_decoder_cc::~gps_l2c_telemetry_decoder_cc()
}
void gps_l2c_telemetry_decoder_cc::set_satellite(const Gnss_Satellite &satellite)
{
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
DLOG(INFO) << "GPS L2C CNAV telemetry decoder in channel " << this->d_channel << " set to satellite " << d_satellite;
}
void gps_l2c_telemetry_decoder_cc::set_channel(int channel)
{
d_channel = channel;
LOG(INFO) << "GPS L2C CNAV channel set to " << channel;
// ############# ENABLE DATA FILE LOG #################
if (d_dump == true)
{
if (d_dump_file.is_open() == false)
{
try
{
d_dump_filename = "telemetry_L2CM_";
d_dump_filename.append(boost::lexical_cast<std::string>(d_channel));
d_dump_filename.append(".dat");
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);
LOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel
<< " Log file: " << d_dump_filename.c_str();
}
catch (const std::ifstream::failure &e)
{
LOG(WARNING) << "channel " << d_channel << " Exception opening Telemetry GPS L2 dump file " << e.what();
}
}
}
}
int gps_l2c_telemetry_decoder_cc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
{
@ -193,38 +228,3 @@ int gps_l2c_telemetry_decoder_cc::general_work(int noutput_items __attribute__((
out[0] = current_synchro_data;
return 1;
}
void gps_l2c_telemetry_decoder_cc::set_satellite(const Gnss_Satellite &satellite)
{
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
DLOG(INFO) << "GPS L2C CNAV telemetry decoder in channel " << this->d_channel << " set to satellite " << d_satellite;
}
void gps_l2c_telemetry_decoder_cc::set_channel(int channel)
{
d_channel = channel;
LOG(INFO) << "GPS L2C CNAV channel set to " << channel;
// ############# ENABLE DATA FILE LOG #################
if (d_dump == true)
{
if (d_dump_file.is_open() == false)
{
try
{
d_dump_filename = "telemetry_L2CM_";
d_dump_filename.append(boost::lexical_cast<std::string>(d_channel));
d_dump_filename.append(".dat");
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);
LOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel
<< " Log file: " << d_dump_filename.c_str();
}
catch (const std::ifstream::failure &e)
{
LOG(WARNING) << "channel " << d_channel << " Exception opening Telemetry GPS L2 dump file " << e.what();
}
}
}
}

View File

@ -100,6 +100,43 @@ gps_l5_telemetry_decoder_cc::~gps_l5_telemetry_decoder_cc()
}
void gps_l5_telemetry_decoder_cc::set_satellite(const Gnss_Satellite &satellite)
{
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
LOG(INFO) << "GPS L5 CNAV telemetry decoder in channel " << this->d_channel << " set to satellite " << d_satellite;
d_CNAV_Message.reset();
}
void gps_l5_telemetry_decoder_cc::set_channel(int channel)
{
d_channel = channel;
d_CNAV_Message.reset();
LOG(INFO) << "GPS L5 CNAV channel set to " << channel;
// ############# ENABLE DATA FILE LOG #################
if (d_dump == true)
{
if (d_dump_file.is_open() == false)
{
try
{
d_dump_filename = "telemetry_L5_";
d_dump_filename.append(boost::lexical_cast<std::string>(d_channel));
d_dump_filename.append(".dat");
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);
LOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel
<< " Log file: " << d_dump_filename.c_str();
}
catch (const std::ifstream::failure &e)
{
LOG(WARNING) << "channel " << d_channel << " Exception opening Telemetry GPS L5 dump file " << e.what();
}
}
}
}
int gps_l5_telemetry_decoder_cc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
{
@ -243,40 +280,3 @@ int gps_l5_telemetry_decoder_cc::general_work(int noutput_items __attribute__((u
out[0] = current_synchro_data;
return 1;
}
void gps_l5_telemetry_decoder_cc::set_satellite(const Gnss_Satellite &satellite)
{
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
LOG(INFO) << "GPS L5 CNAV telemetry decoder in channel " << this->d_channel << " set to satellite " << d_satellite;
d_CNAV_Message.reset();
}
void gps_l5_telemetry_decoder_cc::set_channel(int channel)
{
d_channel = channel;
d_CNAV_Message.reset();
LOG(INFO) << "GPS L5 CNAV channel set to " << channel;
// ############# ENABLE DATA FILE LOG #################
if (d_dump == true)
{
if (d_dump_file.is_open() == false)
{
try
{
d_dump_filename = "telemetry_L5_";
d_dump_filename.append(boost::lexical_cast<std::string>(d_channel));
d_dump_filename.append(".dat");
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);
LOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel
<< " Log file: " << d_dump_filename.c_str();
}
catch (const std::ifstream::failure &e)
{
LOG(WARNING) << "channel " << d_channel << " Exception opening Telemetry GPS L5 dump file " << e.what();
}
}
}
}

View File

@ -87,88 +87,6 @@ sbas_l1_telemetry_decoder_cc::~sbas_l1_telemetry_decoder_cc()
}
int sbas_l1_telemetry_decoder_cc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
{
VLOG(FLOW) << "general_work(): "
<< "noutput_items=" << noutput_items << "\toutput_items real size=" << output_items.size() << "\tninput_items size=" << ninput_items.size() << "\tinput_items real size=" << input_items.size() << "\tninput_items[0]=" << ninput_items[0];
// get pointers on in- and output gnss-synchro objects
Gnss_Synchro *out = reinterpret_cast<Gnss_Synchro *>(output_items[0]); // Get the output buffer pointer
const Gnss_Synchro *in = reinterpret_cast<const Gnss_Synchro *>(input_items[0]); // Get the input buffer pointer
Gnss_Synchro current_symbol; //structure to save the synchronization information and send the output object to the next block
//1. Copy the current tracking output
current_symbol = in[0];
// copy correlation samples into samples vector
d_sample_buf.push_back(current_symbol.Prompt_I); //add new symbol to the symbol queue
// store the time stamp of the first sample in the processed sample block
double sample_stamp = static_cast<double>(in[0].Tracking_sample_counter) / static_cast<double>(in[0].fs);
// decode only if enough samples in buffer
if (d_sample_buf.size() >= d_block_size)
{
// align correlation samples in pairs
// and obtain the symbols by summing the paired correlation samples
std::vector<double> symbols;
bool sample_alignment = d_sample_aligner.get_symbols(d_sample_buf, symbols);
// align symbols in pairs
// and obtain the bits by decoding the symbol pairs
std::vector<int> bits;
bool symbol_alignment = d_symbol_aligner_and_decoder.get_bits(symbols, bits);
// search for preambles
// and extract the corresponding message candidates
std::vector<msg_candiate_int_t> msg_candidates;
d_frame_detector.get_frame_candidates(bits, msg_candidates);
// verify checksum
// and return the valid messages
std::vector<msg_candiate_char_t> valid_msgs;
d_crc_verifier.get_valid_frames(msg_candidates, valid_msgs);
// compute message sample stamp
// and fill messages in SBAS raw message objects
//std::vector<Sbas_Raw_Msg> sbas_raw_msgs;
for (std::vector<msg_candiate_char_t>::const_iterator it = valid_msgs.cbegin();
it != valid_msgs.cend(); ++it)
{
int message_sample_offset =
(sample_alignment ? 0 : -1) + d_samples_per_symbol * (symbol_alignment ? -1 : 0) + d_samples_per_symbol * d_symbols_per_bit * it->first;
double message_sample_stamp = sample_stamp + static_cast<double>(message_sample_offset) / 1000.0;
VLOG(EVENT) << "message_sample_stamp=" << message_sample_stamp
<< " (sample_stamp=" << sample_stamp
<< " sample_alignment=" << sample_alignment
<< " symbol_alignment=" << symbol_alignment
<< " relative_preamble_start=" << it->first
<< " message_sample_offset=" << message_sample_offset
<< ")";
//Sbas_Raw_Msg sbas_raw_msg(message_sample_stamp, this->d_satellite.get_PRN(), it->second);
//sbas_raw_msgs.push_back(sbas_raw_msg);
}
// parse messages
// and send them to the SBAS raw message queue
//for(std::vector<Sbas_Raw_Msg>::iterator it = sbas_raw_msgs.begin(); it != sbas_raw_msgs.end(); it++)
// {
//std::cout << "SBAS message type " << it->get_msg_type() << " from PRN" << it->get_prn() << " received" << std::endl;
//sbas_telemetry_data.update(*it);
// }
// clear all processed samples in the input buffer
d_sample_buf.clear();
}
// UPDATE GNSS SYNCHRO DATA
// actually the SBAS telemetry decoder doesn't support ranging
current_symbol.Flag_valid_word = false; // indicate to observable block that this synchro object isn't valid for pseudorange computation
out[0] = current_symbol;
consume_each(1); // tell scheduler input items consumed
return 1; // tell scheduler output items produced
}
void sbas_l1_telemetry_decoder_cc::set_satellite(const Gnss_Satellite &satellite)
{
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
@ -184,7 +102,6 @@ void sbas_l1_telemetry_decoder_cc::set_channel(int channel)
// ### helper class for sample alignment ###
sbas_l1_telemetry_decoder_cc::sample_aligner::sample_aligner()
{
d_n_smpls_in_history = 3;
@ -403,12 +320,11 @@ void sbas_l1_telemetry_decoder_cc::frame_detector::get_frame_candidates(const st
// ### helper class for checking the CRC of the message candidates ###
void sbas_l1_telemetry_decoder_cc::crc_verifier::reset()
{
}
void sbas_l1_telemetry_decoder_cc::crc_verifier::get_valid_frames(const std::vector<msg_candiate_int_t> msg_candidates, std::vector<msg_candiate_char_t> &valid_msgs)
{
std::stringstream ss;
@ -500,3 +416,85 @@ void sbas_l1_telemetry_decoder_cc::crc_verifier::zerropad_front_and_convert_to_b
<< std::setfill('0') << std::hex << static_cast<unsigned int>(byte)
<< std::setfill(' ') << std::resetiosflags(std::ios::hex);
}
int sbas_l1_telemetry_decoder_cc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
{
VLOG(FLOW) << "general_work(): "
<< "noutput_items=" << noutput_items << "\toutput_items real size=" << output_items.size() << "\tninput_items size=" << ninput_items.size() << "\tinput_items real size=" << input_items.size() << "\tninput_items[0]=" << ninput_items[0];
// get pointers on in- and output gnss-synchro objects
Gnss_Synchro *out = reinterpret_cast<Gnss_Synchro *>(output_items[0]); // Get the output buffer pointer
const Gnss_Synchro *in = reinterpret_cast<const Gnss_Synchro *>(input_items[0]); // Get the input buffer pointer
Gnss_Synchro current_symbol; //structure to save the synchronization information and send the output object to the next block
//1. Copy the current tracking output
current_symbol = in[0];
// copy correlation samples into samples vector
d_sample_buf.push_back(current_symbol.Prompt_I); //add new symbol to the symbol queue
// store the time stamp of the first sample in the processed sample block
double sample_stamp = static_cast<double>(in[0].Tracking_sample_counter) / static_cast<double>(in[0].fs);
// decode only if enough samples in buffer
if (d_sample_buf.size() >= d_block_size)
{
// align correlation samples in pairs
// and obtain the symbols by summing the paired correlation samples
std::vector<double> symbols;
bool sample_alignment = d_sample_aligner.get_symbols(d_sample_buf, symbols);
// align symbols in pairs
// and obtain the bits by decoding the symbol pairs
std::vector<int> bits;
bool symbol_alignment = d_symbol_aligner_and_decoder.get_bits(symbols, bits);
// search for preambles
// and extract the corresponding message candidates
std::vector<msg_candiate_int_t> msg_candidates;
d_frame_detector.get_frame_candidates(bits, msg_candidates);
// verify checksum
// and return the valid messages
std::vector<msg_candiate_char_t> valid_msgs;
d_crc_verifier.get_valid_frames(msg_candidates, valid_msgs);
// compute message sample stamp
// and fill messages in SBAS raw message objects
//std::vector<Sbas_Raw_Msg> sbas_raw_msgs;
for (std::vector<msg_candiate_char_t>::const_iterator it = valid_msgs.cbegin();
it != valid_msgs.cend(); ++it)
{
int message_sample_offset =
(sample_alignment ? 0 : -1) + d_samples_per_symbol * (symbol_alignment ? -1 : 0) + d_samples_per_symbol * d_symbols_per_bit * it->first;
double message_sample_stamp = sample_stamp + static_cast<double>(message_sample_offset) / 1000.0;
VLOG(EVENT) << "message_sample_stamp=" << message_sample_stamp
<< " (sample_stamp=" << sample_stamp
<< " sample_alignment=" << sample_alignment
<< " symbol_alignment=" << symbol_alignment
<< " relative_preamble_start=" << it->first
<< " message_sample_offset=" << message_sample_offset
<< ")";
//Sbas_Raw_Msg sbas_raw_msg(message_sample_stamp, this->d_satellite.get_PRN(), it->second);
//sbas_raw_msgs.push_back(sbas_raw_msg);
}
// parse messages
// and send them to the SBAS raw message queue
//for(std::vector<Sbas_Raw_Msg>::iterator it = sbas_raw_msgs.begin(); it != sbas_raw_msgs.end(); it++)
// {
//std::cout << "SBAS message type " << it->get_msg_type() << " from PRN" << it->get_prn() << " received" << std::endl;
//sbas_telemetry_data.update(*it);
// }
// clear all processed samples in the input buffer
d_sample_buf.clear();
}
// UPDATE GNSS SYNCHRO DATA
// actually the SBAS telemetry decoder doesn't support ranging
current_symbol.Flag_valid_word = false; // indicate to observable block that this synchro object isn't valid for pseudorange computation
out[0] = current_symbol;
consume_each(1); // tell scheduler input items consumed
return 1; // tell scheduler output items produced
}

View File

@ -362,13 +362,15 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(dllpllconf_t conf_) : gr::block("dl
d_last_prompt = gr_complex(0.0, 0.0);
d_state = 0; // initial state: standby
signal_pretty_name["1C"] = "L1 C/A";
signal_pretty_name["1B"] = "E1";
signal_pretty_name["1G"] = "L1 C/A";
signal_pretty_name["2S"] = "L2C";
signal_pretty_name["2G"] = "L2 C/A";
signal_pretty_name["5X"] = "E5a";
signal_pretty_name["L5"] = "L5";
map_signal_pretty_name["1C"] = "L1 C/A";
map_signal_pretty_name["1B"] = "E1";
map_signal_pretty_name["1G"] = "L1 C/A";
map_signal_pretty_name["2S"] = "L2C";
map_signal_pretty_name["2G"] = "L2 C/A";
map_signal_pretty_name["5X"] = "E5a";
map_signal_pretty_name["L5"] = "L5";
signal_pretty_name = map_signal_pretty_name[signal_type];
}
@ -511,7 +513,7 @@ void dll_pll_veml_tracking::start_tracking()
d_code_loop_filter.set_pdi(static_cast<float>(d_code_period));
// DEBUG OUTPUT
std::cout << "Tracking of " << systemName << " " << signal_pretty_name[signal_type] << " signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN) << std::endl;
std::cout << "Tracking of " << systemName << " " << signal_pretty_name << " signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN) << std::endl;
LOG(INFO) << "Starting tracking of satellite " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN) << " on channel " << d_channel;
// enable tracking pull-in
@ -1263,7 +1265,7 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused)
next_state = acquire_secondary();
if (next_state)
{
std::cout << systemName << " " << signal_pretty_name[signal_type] << " secondary code locked in channel " << d_channel
std::cout << systemName << " " << signal_pretty_name << " secondary code locked in channel " << d_channel
<< " for satellite " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN) << std::endl;
}

View File

@ -119,7 +119,8 @@ private:
std::string systemName;
std::string signal_type;
std::string *d_secondary_code_string;
std::map<std::string, std::string> signal_pretty_name;
std::map<std::string, std::string> map_signal_pretty_name;
std::string signal_pretty_name;
//tracking state machine
int d_state;

View File

@ -277,8 +277,8 @@ int StaticPositionSystemTest::configure_receiver()
const float dll_bw_narrow_hz = 2.0;
const int extend_correlation_ms = 1;
const int display_rate_ms = 1000;
const int output_rate_ms = 1000;
const int display_rate_ms = 500;
const int output_rate_ms = 500;
config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(sampling_rate_internal));
@ -361,12 +361,11 @@ int StaticPositionSystemTest::configure_receiver()
config->set_property("Tracking_1C.pll_bw_narrow_hz", std::to_string(pll_bw_narrow_hz));
config->set_property("Tracking_1C.dll_bw_narrow_hz", std::to_string(dll_bw_narrow_hz));
config->set_property("Tracking_1C.extend_correlation_ms", std::to_string(extend_correlation_ms));
config->set_property("Tracking_1C.extend_correlation_symbols", std::to_string(extend_correlation_ms));
// Set Telemetry
config->set_property("TelemetryDecoder_1C.implementation", "GPS_L1_CA_Telemetry_Decoder");
config->set_property("TelemetryDecoder_1C.dump", "false");
config->set_property("TelemetryDecoder_1C.decimation_factor", std::to_string(decimation_factor));
// Set Observables
config->set_property("Observables.implementation", "Hybrid_Observables");
@ -454,6 +453,7 @@ int StaticPositionSystemTest::run_receiver()
void StaticPositionSystemTest::check_results()
{
std::fstream myfile(StaticPositionSystemTest::generated_kml_file, std::ios_base::in);
ASSERT_TRUE(myfile.is_open()) << "No valid kml file could be opened";
std::string line;
std::vector<double> pos_e;
@ -466,6 +466,7 @@ void StaticPositionSystemTest::check_results()
while (is_header)
{
std::getline(myfile, line);
ASSERT_FALSE(myfile.eof()) << "No valid kml file found.";
std::size_t found = line.find("<coordinates>");
if (found != std::string::npos) is_header = false;
}
@ -474,7 +475,11 @@ void StaticPositionSystemTest::check_results()
//read data
while (is_data)
{
std::getline(myfile, line);
if (!std::getline(myfile, line))
{
is_data = false;
break;
}
std::size_t found = line.find("</coordinates>");
if (found != std::string::npos)
is_data = false;
@ -504,6 +509,7 @@ void StaticPositionSystemTest::check_results()
}
}
myfile.close();
ASSERT_FALSE(pos_e.size() == 0) << "KML file is empty";
double sigma_E_2_precision = std::pow(compute_stdev_precision(pos_e), 2.0);
double sigma_N_2_precision = std::pow(compute_stdev_precision(pos_n), 2.0);