1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-14 20:20:35 +00:00

Merge branch 'next' into smart_acq_resampler

This commit is contained in:
Carles Fernandez 2018-12-04 00:05:04 +01:00
commit b2659aa076
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
240 changed files with 1692 additions and 1956 deletions

View File

@ -877,11 +877,9 @@ bool rtklib_pvt_cc::save_gnss_synchro_map_xml(const std::string& file_name)
}
return true;
}
else
{
LOG(WARNING) << "Failed to save gnss_synchro, map is empty";
return false;
}
LOG(WARNING) << "Failed to save gnss_synchro, map is empty";
return false;
}
@ -925,10 +923,8 @@ bool rtklib_pvt_cc::get_latest_PVT(double* longitude_deg,
return true;
}
else
{
return false;
}
return false;
}
@ -1021,7 +1017,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
if (gnss_observables_map.empty() == false)
{
double current_RX_time = gnss_observables_map.begin()->second.RX_time;
uint32_t current_RX_time_ms = static_cast<uint32_t>(current_RX_time * 1000.0);
auto current_RX_time_ms = static_cast<uint32_t>(current_RX_time * 1000.0);
if (current_RX_time_ms % d_output_rate_ms == 0)
{
flag_compute_pvt_output = true;

View File

@ -80,8 +80,7 @@ else()
)
endif()
target_link_libraries(
pvt_lib
target_link_libraries(pvt_lib
rtklib_lib
gnss_sdr_flags
gnss_sp_libs

View File

@ -145,23 +145,19 @@ bool GeoJSON_Printer::set_headers(const std::string& filename, bool time_tag_nam
// Writing the header
geojson_file << "{" << std::endl;
geojson_file << " \"type\": \"Feature\"," << std::endl;
geojson_file << R"( "type": "Feature",)" << std::endl;
geojson_file << " \"properties\": {" << std::endl;
geojson_file << " \"name\": \"Locations generated by GNSS-SDR\" " << std::endl;
geojson_file << R"( "name": "Locations generated by GNSS-SDR" )" << std::endl;
geojson_file << " }," << std::endl;
geojson_file << " \"geometry\": {" << std::endl;
geojson_file << " \"type\": \"MultiPoint\"," << std::endl;
geojson_file << R"( "type": "MultiPoint",)" << std::endl;
geojson_file << " \"coordinates\": [" << std::endl;
return true;
}
else
{
std::cout << "File " << filename_ << " cannot be saved. Wrong permissions?" << std::endl;
return false;
}
std::cout << "File " << filename_ << " cannot be saved. Wrong permissions?" << std::endl;
return false;
}
@ -200,10 +196,7 @@ bool GeoJSON_Printer::print_position(const std::shared_ptr<Pvt_Solution>& positi
}
return true;
}
else
{
return false;
}
return false;
}
@ -222,11 +215,7 @@ bool GeoJSON_Printer::close_file()
{
if (remove(filename_.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
}
return true;
}
else
{
return false;
}
return false;
}

View File

@ -136,8 +136,8 @@ bool Gpx_Printer::set_headers(const std::string& filename, bool time_tag_name)
// Set iostream numeric format and precision
gpx_file.setf(gpx_file.std::ofstream::fixed, gpx_file.std::ofstream::floatfield);
gpx_file << std::setprecision(14);
gpx_file << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl
<< "<gpx version=\"1.1\" creator=\"GNSS-SDR\"" << std::endl
gpx_file << R"(<?xml version="1.0" encoding="UTF-8"?>)" << std::endl
<< R"(<gpx version="1.1" creator="GNSS-SDR")" << std::endl
<< indent << "xsi:schemaLocation=\"http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://www.garmin.com/xmlschemas/GpxExtensions/v3 http://www.garmin.com/xmlschemas/GpxExtensionsv3.xsd http://www.garmin.com/xmlschemas/TrackPointExtension/v2 http://www.garmin.com/xmlschemas/TrackPointExtensionv2.xsd\"" << std::endl
<< indent << "xmlns=\"http://www.topografix.com/GPX/1/1\"" << std::endl
<< indent << "xmlns:gpxx=\"http://www.garmin.com/xmlschemas/GpxExtensions/v3\"" << std::endl
@ -149,11 +149,8 @@ bool Gpx_Printer::set_headers(const std::string& filename, bool time_tag_name)
<< indent << indent << "<trkseg>" << std::endl;
return true;
}
else
{
std::cout << "File " << gpx_filename << " cannot be saved. Wrong permissions?" << std::endl;
return false;
}
std::cout << "File " << gpx_filename << " cannot be saved. Wrong permissions?" << std::endl;
return false;
}
@ -201,10 +198,7 @@ bool Gpx_Printer::print_position(const std::shared_ptr<rtklib_solver>& position,
<< "</gpxtpx:TrackPointExtension></extensions></trkpt>" << std::endl;
return true;
}
else
{
return false;
}
return false;
}
@ -218,10 +212,7 @@ bool Gpx_Printer::close_file()
gpx_file.close();
return true;
}
else
{
return false;
}
return false;
}

View File

@ -34,6 +34,7 @@
#include "GPS_L1_CA.h"
#include "GPS_L2C.h"
#include <boost/date_time/posix_time/posix_time.hpp>
#include <utility>
#include <glog/logging.h>
@ -43,7 +44,7 @@ hybrid_ls_pvt::hybrid_ls_pvt(int nchannels, std::string dump_filename, bool flag
{
// init empty ephemeris for all the available GNSS channels
d_nchannels = nchannels;
d_dump_filename = dump_filename;
d_dump_filename = std::move(dump_filename);
d_flag_dump_enabled = flag_dump_to_file;
d_galileo_current_time = 0;
count_valid_position = 0;

View File

@ -149,8 +149,8 @@ bool Kml_Printer::set_headers(const std::string& filename, bool time_tag_name)
tmp_file.setf(tmp_file.std::ofstream::fixed, tmp_file.std::ofstream::floatfield);
tmp_file << std::setprecision(14);
kml_file << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl
<< "<kml xmlns=\"http://www.opengis.net/kml/2.2\" xmlns:gx=\"http://www.google.com/kml/ext/2.2\">" << std::endl
kml_file << R"(<?xml version="1.0" encoding="UTF-8"?>)" << std::endl
<< R"(<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2">)" << std::endl
<< indent << "<Document>" << std::endl
<< indent << indent << "<name>GNSS Track</name>" << std::endl
<< indent << indent << "<description><![CDATA[" << std::endl
@ -206,11 +206,8 @@ bool Kml_Printer::set_headers(const std::string& filename, bool time_tag_name)
return true;
}
else
{
std::cout << "File " << kml_filename << " cannot be saved. Wrong permissions?" << std::endl;
return false;
}
std::cout << "File " << kml_filename << " cannot be saved. Wrong permissions?" << std::endl;
return false;
}
@ -282,10 +279,7 @@ bool Kml_Printer::print_position(const std::shared_ptr<rtklib_solver>& position,
return true;
}
else
{
return false;
}
return false;
}
@ -319,10 +313,7 @@ bool Kml_Printer::close_file()
return true;
}
else
{
return false;
}
return false;
}

View File

@ -248,9 +248,9 @@ char Nmea_Printer::checkSum(std::string sentence)
{
char check = 0;
// iterate over the string, XOR each byte with the total sum:
for (unsigned int c = 0; c < sentence.length(); c++)
for (char c : sentence)
{
check = char(check ^ sentence.at(c));
check = char(check ^ c);
}
// return the result
return check;

View File

@ -254,7 +254,7 @@ void Rinex_Printer::lengthCheck(const std::string& line)
}
std::string Rinex_Printer::createFilename(std::string type)
std::string Rinex_Printer::createFilename(const std::string& type)
{
const std::string stationName = "GSDR"; // 4-character station name designator
boost::gregorian::date today = boost::gregorian::day_clock::local_day();
@ -2878,7 +2878,7 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map<int32_t, Gps
line += std::string(1, ' ');
line += Rinex_Printer::doub2for(static_cast<double>(gps_ephemeris_iter->second.i_code_on_L2), 18, 2);
line += std::string(1, ' ');
double GPS_week_continuous_number = static_cast<double>(gps_ephemeris_iter->second.i_GPS_week + 1024); // valid until April 7, 2019 (check http://www.colorado.edu/geography/gcraft/notes/gps/gpseow.htm)
auto GPS_week_continuous_number = static_cast<double>(gps_ephemeris_iter->second.i_GPS_week + 1024); // valid until April 7, 2019 (check http://www.colorado.edu/geography/gcraft/notes/gps/gpseow.htm)
line += Rinex_Printer::doub2for(GPS_week_continuous_number, 18, 2);
line += std::string(1, ' ');
line += Rinex_Printer::doub2for(static_cast<double>(gps_ephemeris_iter->second.i_code_on_L2), 18, 2);
@ -3082,7 +3082,7 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map<int32_t, Gps
double my_zero = 0.0;
line += Rinex_Printer::doub2for(my_zero, 18, 2);
line += std::string(1, ' ');
double GPS_week_continuous_number = static_cast<double>(gps_ephemeris_iter->second.i_GPS_week + 1024); // valid until April 7, 2019 (check http://www.colorado.edu/geography/gcraft/notes/gps/gpseow.htm)
auto GPS_week_continuous_number = static_cast<double>(gps_ephemeris_iter->second.i_GPS_week + 1024); // valid until April 7, 2019 (check http://www.colorado.edu/geography/gcraft/notes/gps/gpseow.htm)
line += Rinex_Printer::doub2for(GPS_week_continuous_number, 18, 2);
line += std::string(1, ' ');
line += Rinex_Printer::doub2for(my_zero, 18, 2);
@ -3227,7 +3227,7 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map<int32_t, Gal
int32_t data_source_INAV = Rinex_Printer::toInt(iNAVE1B, 10);
line += Rinex_Printer::doub2for(static_cast<double>(data_source_INAV), 18, 2);
line += std::string(1, ' ');
double GST_week = static_cast<double>(galileo_ephemeris_iter->second.WN_5);
auto GST_week = static_cast<double>(galileo_ephemeris_iter->second.WN_5);
double num_GST_rollovers = floor((GST_week + 1024.0) / 4096.0);
double Galileo_week_continuous_number = GST_week + 1024.0 + num_GST_rollovers * 4096.0;
line += Rinex_Printer::doub2for(Galileo_week_continuous_number, 18, 2);
@ -3529,7 +3529,7 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map<int32_t, Gal
}
void Rinex_Printer::rinex_obs_header(std::fstream& out, const Glonass_Gnav_Ephemeris& eph, const double d_TOW_first_observation, const std::string glonass_bands)
void Rinex_Printer::rinex_obs_header(std::fstream& out, const Glonass_Gnav_Ephemeris& eph, const double d_TOW_first_observation, const std::string& glonass_bands)
{
if (eph.d_m)
{
@ -3859,7 +3859,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Glonass_Gnav_Ephem
}
void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps_eph, const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const double d_TOW_first_observation, const std::string glonass_bands)
void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps_eph, const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const double d_TOW_first_observation, const std::string& glonass_bands)
{
if (glonass_gnav_eph.d_m)
{
@ -4212,7 +4212,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps
}
void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris& gps_eph, const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const double d_TOW_first_observation, const std::string glonass_bands)
void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris& gps_eph, const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const double d_TOW_first_observation, const std::string& glonass_bands)
{
if (glonass_gnav_eph.d_m)
{
@ -4529,7 +4529,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris
}
void Rinex_Printer::rinex_obs_header(std::fstream& out, const Galileo_Ephemeris& galileo_eph, const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const double d_TOW_first_observation, const std::string galileo_bands, const std::string glonass_bands)
void Rinex_Printer::rinex_obs_header(std::fstream& out, const Galileo_Ephemeris& galileo_eph, const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const double d_TOW_first_observation, const std::string& galileo_bands, const std::string& glonass_bands)
{
if (glonass_gnav_eph.d_m)
{
@ -5107,7 +5107,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& eph
}
void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris& eph, const double d_TOW_first_observation, const std::string gps_bands)
void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris& eph, const double d_TOW_first_observation, const std::string& gps_bands)
{
std::string line;
@ -5352,7 +5352,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris
}
void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& eph, const Gps_CNAV_Ephemeris& eph_cnav, const double d_TOW_first_observation, const std::string gps_bands)
void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& eph, const Gps_CNAV_Ephemeris& eph_cnav, const double d_TOW_first_observation, const std::string& gps_bands)
{
if (eph_cnav.d_i_0)
{
@ -5624,7 +5624,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& eph
}
void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps_eph, const Gps_CNAV_Ephemeris& eph_cnav, const Galileo_Ephemeris& galileo_eph, const double d_TOW_first_observation, const std::string gps_bands, const std::string galileo_bands)
void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps_eph, const Gps_CNAV_Ephemeris& eph_cnav, const Galileo_Ephemeris& galileo_eph, const double d_TOW_first_observation, const std::string& gps_bands, const std::string& galileo_bands)
{
std::string line;
version = 3;
@ -5972,7 +5972,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps
}
void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris& eph_cnav, const Galileo_Ephemeris& galileo_eph, const double d_TOW_first_observation, const std::string gps_bands, const std::string galileo_bands)
void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris& eph_cnav, const Galileo_Ephemeris& galileo_eph, const double d_TOW_first_observation, const std::string& gps_bands, const std::string& galileo_bands)
{
std::string line;
version = 3;
@ -6290,7 +6290,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris
}
void Rinex_Printer::rinex_obs_header(std::fstream& out, const Galileo_Ephemeris& eph, const double d_TOW_first_observation, const std::string bands)
void Rinex_Printer::rinex_obs_header(std::fstream& out, const Galileo_Ephemeris& eph, const double d_TOW_first_observation, const std::string& bands)
{
std::string line;
version = 3;
@ -6551,7 +6551,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Galileo_Ephemeris&
}
void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps_eph, const Galileo_Ephemeris& galileo_eph, const double d_TOW_first_observation, const std::string galileo_bands)
void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps_eph, const Galileo_Ephemeris& galileo_eph, const double d_TOW_first_observation, const std::string& galileo_bands)
{
if (galileo_eph.e_1)
{
@ -7050,7 +7050,7 @@ void Rinex_Printer::update_obs_header(std::fstream& out, const Galileo_Utc_Model
}
void Rinex_Printer::log_rinex_obs(std::fstream& out, const Glonass_Gnav_Ephemeris& eph, const double obs_time, const std::map<int32_t, Gnss_Synchro>& observables, const std::string glonass_band)
void Rinex_Printer::log_rinex_obs(std::fstream& out, const Glonass_Gnav_Ephemeris& eph, const double obs_time, const std::map<int32_t, Gnss_Synchro>& observables, const std::string& glonass_band)
{
// RINEX observations timestamps are GPS timestamps.
std::string line;
@ -7558,7 +7558,7 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep
lineObs += std::to_string(static_cast<int32_t>(*it));
}
ret = total_glo_map.equal_range(*it);
for (std::multimap<uint32_t, Gnss_Synchro>::iterator iter = ret.first; iter != ret.second; ++iter)
for (auto iter = ret.first; iter != ret.second; ++iter)
{
/// \todo Need to account for pseudorange correction for glonass
//double leap_seconds = Rinex_Printer::get_leap_second(glonass_gnav_eph, gps_obs_time);
@ -7798,7 +7798,7 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& g
lineObs += std::to_string(static_cast<int32_t>(*it));
ret = total_glo_map.equal_range(*it);
for (std::multimap<uint32_t, Gnss_Synchro>::iterator iter = ret.first; iter != ret.second; ++iter)
for (auto iter = ret.first; iter != ret.second; ++iter)
{
/// \todo Need to account for pseudorange correction for glonass
//double leap_seconds = Rinex_Printer::get_leap_second(glonass_gnav_eph, gps_obs_time);
@ -8035,7 +8035,7 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& ga
if (static_cast<int32_t>(*it) < 10) lineObs += std::string(1, '0');
lineObs += std::to_string(static_cast<int32_t>(*it));
ret = total_glo_map.equal_range(*it);
for (std::multimap<uint32_t, Gnss_Synchro>::iterator iter = ret.first; iter != ret.second; ++iter)
for (auto iter = ret.first; iter != ret.second; ++iter)
{
lineObs += Rinex_Printer::rightJustify(asString(iter->second.Pseudorange_m, 3), 14);
@ -8616,7 +8616,7 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& eph, c
if (static_cast<int32_t>(*it) < 10) lineObs += std::string(1, '0');
lineObs += std::to_string(static_cast<int32_t>(*it));
ret = total_mmap.equal_range(*it);
for (std::multimap<uint32_t, Gnss_Synchro>::iterator iter = ret.first; iter != ret.second; ++iter)
for (auto iter = ret.first; iter != ret.second; ++iter)
{
lineObs += Rinex_Printer::rightJustify(asString(iter->second.Pseudorange_m, 3), 14);
@ -8669,7 +8669,7 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& eph, c
}
void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables, const std::string galileo_bands)
void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables, const std::string& galileo_bands)
{
// RINEX observations timestamps are Galileo timestamps.
// See http://gage14.upc.es/gLAB/HTML/Observation_Rinex_v3.01.html
@ -8856,7 +8856,7 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& ep
if (static_cast<int32_t>(*it) < 10) lineObs += std::string(1, '0');
lineObs += std::to_string(static_cast<int32_t>(*it));
ret = total_map.equal_range(*it);
for (std::multimap<uint32_t, Gnss_Synchro>::iterator iter = ret.first; iter != ret.second; ++iter)
for (auto iter = ret.first; iter != ret.second; ++iter)
{
lineObs += Rinex_Printer::rightJustify(asString(iter->second.Pseudorange_m, 3), 14);
@ -9110,7 +9110,7 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep
if (static_cast<int32_t>(*it) < 10) lineObs += std::string(1, '0');
lineObs += std::to_string(static_cast<int32_t>(*it));
ret = total_gal_map.equal_range(*it);
for (std::multimap<uint32_t, Gnss_Synchro>::iterator iter = ret.first; iter != ret.second; ++iter)
for (auto iter = ret.first; iter != ret.second; ++iter)
{
lineObs += Rinex_Printer::rightJustify(asString(iter->second.Pseudorange_m, 3), 14);
@ -9339,7 +9339,7 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& e
if (static_cast<int32_t>(*it) < 10) lineObs += std::string(1, '0');
lineObs += std::to_string(static_cast<int32_t>(*it));
ret = total_gps_map.equal_range(*it);
for (std::multimap<uint32_t, Gnss_Synchro>::iterator iter = ret.first; iter != ret.second; ++iter)
for (auto iter = ret.first; iter != ret.second; ++iter)
{
lineObs += Rinex_Printer::rightJustify(asString(iter->second.Pseudorange_m, 3), 14);
@ -9398,7 +9398,7 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& e
if (static_cast<int32_t>(*it) < 10) lineObs += std::string(1, '0');
lineObs += std::to_string(static_cast<int32_t>(*it));
ret = total_gal_map.equal_range(*it);
for (std::multimap<uint32_t, Gnss_Synchro>::iterator iter = ret.first; iter != ret.second; ++iter)
for (auto iter = ret.first; iter != ret.second; ++iter)
{
lineObs += Rinex_Printer::rightJustify(asString(iter->second.Pseudorange_m, 3), 14);
@ -9648,7 +9648,7 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep
if (static_cast<int32_t>(*it) < 10) lineObs += std::string(1, '0');
lineObs += std::to_string(static_cast<int32_t>(*it));
ret = total_gps_map.equal_range(*it);
for (std::multimap<uint32_t, Gnss_Synchro>::iterator iter = ret.first; iter != ret.second; ++iter)
for (auto iter = ret.first; iter != ret.second; ++iter)
{
lineObs += Rinex_Printer::rightJustify(asString(iter->second.Pseudorange_m, 3), 14);
@ -9707,7 +9707,7 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep
if (static_cast<int32_t>(*it) < 10) lineObs += std::string(1, '0');
lineObs += std::to_string(static_cast<int32_t>(*it));
ret = total_gal_map.equal_range(*it);
for (std::multimap<uint32_t, Gnss_Synchro>::iterator iter = ret.first; iter != ret.second; ++iter)
for (auto iter = ret.first; iter != ret.second; ++iter)
{
lineObs += Rinex_Printer::rightJustify(asString(iter->second.Pseudorange_m, 3), 14);

View File

@ -146,52 +146,52 @@ public:
/*!
* \brief Generates the GPS L2 Observation data header
*/
void rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris& eph, const double d_TOW_first_observation, const std::string gps_bands = "2S");
void rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris& eph, const double d_TOW_first_observation, const std::string& gps_bands = "2S");
/*!
* \brief Generates the dual frequency GPS L1 & L2/L5 Observation data header
*/
void rinex_obs_header(std::fstream& out, const Gps_Ephemeris& eph, const Gps_CNAV_Ephemeris& eph_cnav, const double d_TOW_first_observation, const std::string gps_bands = "1C 2S");
void rinex_obs_header(std::fstream& out, const Gps_Ephemeris& eph, const Gps_CNAV_Ephemeris& eph_cnav, const double d_TOW_first_observation, const std::string& gps_bands = "1C 2S");
/*!
* \brief Generates the Galileo Observation data header. Example: bands("1B"), bands("1B 5X"), bands("5X"), ... Default: "1B".
*/
void rinex_obs_header(std::fstream& out, const Galileo_Ephemeris& eph, const double d_TOW_first_observation, const std::string bands = "1B");
void rinex_obs_header(std::fstream& out, const Galileo_Ephemeris& eph, const double d_TOW_first_observation, const std::string& bands = "1B");
/*!
* \brief Generates the Mixed (GPS/Galileo) Observation data header. Example: galileo_bands("1B"), galileo_bands("1B 5X"), galileo_bands("5X"), ... Default: "1B".
*/
void rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps_eph, const Galileo_Ephemeris& galileo_eph, const double d_TOW_first_observation, const std::string galileo_bands = "1B");
void rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps_eph, const Galileo_Ephemeris& galileo_eph, const double d_TOW_first_observation, const std::string& galileo_bands = "1B");
/*!
* \brief Generates the Mixed (GPS/Galileo) Observation data header. Example: galileo_bands("1B"), galileo_bands("1B 5X"), galileo_bands("5X"), ... Default: "1B".
*/
void rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps_eph, const Gps_CNAV_Ephemeris& eph_cnav, const Galileo_Ephemeris& galileo_eph, const double d_TOW_first_observation, const std::string gps_bands = "1C 2S", const std::string galileo_bands = "1B");
void rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps_eph, const Gps_CNAV_Ephemeris& eph_cnav, const Galileo_Ephemeris& galileo_eph, const double d_TOW_first_observation, const std::string& gps_bands = "1C 2S", const std::string& galileo_bands = "1B");
/*!
* \brief Generates the Mixed (GPS/Galileo) Observation data header. Example: galileo_bands("1B"), galileo_bands("1B 5X"), galileo_bands("5X"), ... Default: "1B".
*/
void rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris& eph_cnav, const Galileo_Ephemeris& galileo_eph, const double d_TOW_first_observation, const std::string gps_bands = "2S", const std::string galileo_bands = "1B");
void rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris& eph_cnav, const Galileo_Ephemeris& galileo_eph, const double d_TOW_first_observation, const std::string& gps_bands = "2S", const std::string& galileo_bands = "1B");
/*!
* \brief Generates the GLONASS GNAV Observation data header. Example: bands("1C"), bands("1C 2C"), bands("2C"), ... Default: "1C".
*/
void rinex_obs_header(std::fstream& out, const Glonass_Gnav_Ephemeris& eph, const double d_TOW_first_observation, const std::string bands = "1G");
void rinex_obs_header(std::fstream& out, const Glonass_Gnav_Ephemeris& eph, const double d_TOW_first_observation, const std::string& bands = "1G");
/*!
* \brief Generates the Mixed (GPS L1 C/A /GLONASS) Observation data header. Example: galileo_bands("1C"), galileo_bands("1B 5X"), galileo_bands("5X"), ... Default: "1B".
*/
void rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps_eph, const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const double d_TOW_first_observation, const std::string glo_bands = "1C");
void rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps_eph, const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const double d_TOW_first_observation, const std::string& glo_bands = "1C");
/*!
* \brief Generates the Mixed (Galileo/GLONASS) Observation data header. Example: galileo_bands("1C"), galileo_bands("1B 5X"), galileo_bands("5X"), ... Default: "1B".
*/
void rinex_obs_header(std::fstream& out, const Galileo_Ephemeris& galileo_eph, const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const double d_TOW_first_observation, const std::string galileo_bands = "1B", const std::string glo_bands = "1C");
void rinex_obs_header(std::fstream& out, const Galileo_Ephemeris& galileo_eph, const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const double d_TOW_first_observation, const std::string& galileo_bands = "1B", const std::string& glo_bands = "1C");
/*!
* \brief Generates the Mixed (GPS L2C/GLONASS) Observation data header. Example: galileo_bands("1G")... Default: "1G".
*/
void rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris& gps_cnav_eph, const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const double d_TOW_first_observation, const std::string glo_bands = "1G");
void rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris& gps_cnav_eph, const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const double d_TOW_first_observation, const std::string& glo_bands = "1G");
/*!
* \brief Generates the SBAS raw data header
@ -297,7 +297,7 @@ public:
/*!
* \brief Writes Galileo observables into the RINEX file. Example: galileo_bands("1B"), galileo_bands("1B 5X"), galileo_bands("5X"), ... Default: "1B".
*/
void log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables, const std::string galileo_bands = "1B");
void log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables, const std::string& galileo_bands = "1B");
/*!
* \brief Writes Mixed GPS / Galileo observables into the RINEX file
@ -317,7 +317,7 @@ public:
/*!
* \brief Writes GLONASS GNAV observables into the RINEX file. Example: glonass_bands("1C"), galileo_bands("1B 5X"), galileo_bands("5X"), ... Default: "1B".
*/
void log_rinex_obs(std::fstream& out, const Glonass_Gnav_Ephemeris& eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables, const std::string glonass_bands = "1C");
void log_rinex_obs(std::fstream& out, const Glonass_Gnav_Ephemeris& eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables, const std::string& glonass_bands = "1C");
/*!
* \brief Writes Mixed GPS L1 C/A - GLONASS observables into the RINEX file
@ -406,7 +406,7 @@ private:
* "RINEX_FILE_TYPE_SBAS" - SBAS broadcast data file.
* "RINEX_FILE_TYPE_CLK" - Clock file.
*/
std::string createFilename(std::string type);
std::string createFilename(const std::string& type);
/*
* Generates the data for the PGM / RUN BY / DATE line

View File

@ -38,6 +38,7 @@
#include <boost/filesystem/path_traits.hpp> // for filesystem
#include <glog/logging.h>
#include <iomanip>
#include <utility>
#include <fcntl.h> // for O_RDWR
#include <termios.h> // for tcgetattr
@ -45,7 +46,7 @@
using google::LogMessage;
Rtcm_Printer::Rtcm_Printer(std::string filename, bool flag_rtcm_file_dump, bool flag_rtcm_server, bool flag_rtcm_tty_port, uint16_t rtcm_tcp_port, uint16_t rtcm_station_id, std::string rtcm_dump_devname, bool time_tag_name, const std::string& base_path)
Rtcm_Printer::Rtcm_Printer(const std::string& filename, bool flag_rtcm_file_dump, bool flag_rtcm_server, bool flag_rtcm_tty_port, uint16_t rtcm_tcp_port, uint16_t rtcm_station_id, const std::string& rtcm_dump_devname, bool time_tag_name, const std::string& base_path)
{
boost::posix_time::ptime pt = boost::posix_time::second_clock::local_time();
tm timeinfo = boost::posix_time::to_tm(pt);
@ -141,7 +142,7 @@ Rtcm_Printer::Rtcm_Printer(std::string filename, bool flag_rtcm_file_dump, bool
}
}
rtcm_devname = rtcm_dump_devname;
rtcm_devname = std::move(rtcm_dump_devname);
if (flag_rtcm_tty_port == true)
{
rtcm_dev_descriptor = init_serial(rtcm_devname.c_str());
@ -337,7 +338,7 @@ bool Rtcm_Printer::Print_Rtcm_MSM(uint32_t msm_number, const Gps_Ephemeris& gps_
}
int Rtcm_Printer::init_serial(std::string serial_device)
int Rtcm_Printer::init_serial(const std::string& serial_device)
{
/*
* Opens the serial device and sets the default baud rate for a RTCM transmission (9600,8,N,1)

View File

@ -48,7 +48,7 @@ public:
/*!
* \brief Default constructor.
*/
Rtcm_Printer(std::string filename, bool flag_rtcm_file_dump, bool flag_rtcm_server, bool flag_rtcm_tty_port, uint16_t rtcm_tcp_port, uint16_t rtcm_station_id, std::string rtcm_dump_filename, bool time_tag_name = true, const std::string& base_path = ".");
Rtcm_Printer(const std::string& filename, bool flag_rtcm_file_dump, bool flag_rtcm_server, bool flag_rtcm_tty_port, uint16_t rtcm_tcp_port, uint16_t rtcm_station_id, const std::string& rtcm_dump_filename, bool time_tag_name = true, const std::string& base_path = ".");
/*!
* \brief Default destructor.
@ -149,7 +149,7 @@ private:
uint16_t port;
uint16_t station_id;
int32_t rtcm_dev_descriptor; // RTCM serial device descriptor (i.e. COM port)
int32_t init_serial(std::string serial_device); //serial port control
int32_t init_serial(const std::string& serial_device); //serial port control
void close_serial();
std::shared_ptr<Rtcm> rtcm;
bool Print_Message(const std::string& message);

View File

@ -60,6 +60,8 @@
#include <matio.h>
#include <glog/logging.h>
#include <utility>
using google::LogMessage;
@ -67,18 +69,18 @@ rtklib_solver::rtklib_solver(int nchannels, std::string dump_filename, bool flag
{
// init empty ephemeris for all the available GNSS channels
d_nchannels = nchannels;
d_dump_filename = dump_filename;
d_dump_filename = std::move(dump_filename);
d_flag_dump_enabled = flag_dump_to_file;
d_flag_dump_mat_enabled = flag_dump_to_mat;
count_valid_position = 0;
this->set_averaging_flag(false);
rtk_ = rtk;
for (unsigned int i = 0; i < 4; i++) dop_[i] = 0.0;
for (double & i : dop_) i = 0.0;
pvt_sol = {{0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, '0', '0', '0', 0, 0, 0};
ssat_t ssat0 = {0, 0, {0.0}, {0.0}, {0.0}, {'0'}, {'0'}, {'0'}, {'0'}, {'0'}, {}, {}, {}, {}, 0.0, 0.0, 0.0, 0.0, {{{0, 0}}, {{0, 0}}}, {{}, {}}};
for (unsigned int i = 0; i < MAXSAT; i++)
for (auto & i : pvt_ssat)
{
pvt_ssat[i] = ssat0;
i = ssat0;
}
// ############# ENABLE DATA FILE LOG #################
if (d_flag_dump_enabled == true)
@ -137,34 +139,34 @@ bool rtklib_solver::save_matfile()
return false;
}
uint32_t *TOW_at_current_symbol_ms = new uint32_t[num_epoch];
uint32_t *week = new uint32_t[num_epoch];
double *RX_time = new double[num_epoch];
double *user_clk_offset = new double[num_epoch];
double *pos_x = new double[num_epoch];
double *pos_y = new double[num_epoch];
double *pos_z = new double[num_epoch];
double *vel_x = new double[num_epoch];
double *vel_y = new double[num_epoch];
double *vel_z = new double[num_epoch];
double *cov_xx = new double[num_epoch];
double *cov_yy = new double[num_epoch];
double *cov_zz = new double[num_epoch];
double *cov_xy = new double[num_epoch];
double *cov_yz = new double[num_epoch];
double *cov_zx = new double[num_epoch];
double *latitude = new double[num_epoch];
double *longitude = new double[num_epoch];
double *height = new double[num_epoch];
uint8_t *valid_sats = new uint8_t[num_epoch];
uint8_t *solution_status = new uint8_t[num_epoch];
uint8_t *solution_type = new uint8_t[num_epoch];
float *AR_ratio_factor = new float[num_epoch];
float *AR_ratio_threshold = new float[num_epoch];
double *gdop = new double[num_epoch];
double *pdop = new double[num_epoch];
double *hdop = new double[num_epoch];
double *vdop = new double[num_epoch];
auto *TOW_at_current_symbol_ms = new uint32_t[num_epoch];
auto *week = new uint32_t[num_epoch];
auto *RX_time = new double[num_epoch];
auto *user_clk_offset = new double[num_epoch];
auto *pos_x = new double[num_epoch];
auto *pos_y = new double[num_epoch];
auto *pos_z = new double[num_epoch];
auto *vel_x = new double[num_epoch];
auto *vel_y = new double[num_epoch];
auto *vel_z = new double[num_epoch];
auto *cov_xx = new double[num_epoch];
auto *cov_yy = new double[num_epoch];
auto *cov_zz = new double[num_epoch];
auto *cov_xy = new double[num_epoch];
auto *cov_yz = new double[num_epoch];
auto *cov_zx = new double[num_epoch];
auto *latitude = new double[num_epoch];
auto *longitude = new double[num_epoch];
auto *height = new double[num_epoch];
auto *valid_sats = new uint8_t[num_epoch];
auto *solution_status = new uint8_t[num_epoch];
auto *solution_type = new uint8_t[num_epoch];
auto *AR_ratio_factor = new float[num_epoch];
auto *AR_ratio_threshold = new float[num_epoch];
auto *gdop = new double[num_epoch];
auto *pdop = new double[num_epoch];
auto *hdop = new double[num_epoch];
auto *vdop = new double[num_epoch];
try
{
@ -548,7 +550,7 @@ bool rtklib_solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
// convert ephemeris from GNSS-SDR class to RTKLIB structure
eph_data[valid_obs] = eph_to_rtklib(galileo_ephemeris_iter->second);
// convert observation from GNSS-SDR class to RTKLIB structure
unsigned char default_code_ = static_cast<unsigned char>(CODE_NONE);
auto default_code_ = static_cast<unsigned char>(CODE_NONE);
obsd_t newobs = {{0, 0}, '0', '0', {}, {},
{default_code_, default_code_, default_code_},
{}, {0.0, 0.0, 0.0}, {}};
@ -624,7 +626,7 @@ bool rtklib_solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
// convert ephemeris from GNSS-SDR class to RTKLIB structure
eph_data[valid_obs] = eph_to_rtklib(gps_cnav_ephemeris_iter->second);
// convert observation from GNSS-SDR class to RTKLIB structure
unsigned char default_code_ = static_cast<unsigned char>(CODE_NONE);
auto default_code_ = static_cast<unsigned char>(CODE_NONE);
obsd_t newobs = {{0, 0}, '0', '0', {}, {},
{default_code_, default_code_, default_code_},
{}, {0.0, 0.0, 0.0}, {}};
@ -671,7 +673,7 @@ bool rtklib_solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
// convert ephemeris from GNSS-SDR class to RTKLIB structure
eph_data[valid_obs] = eph_to_rtklib(gps_cnav_ephemeris_iter->second);
// convert observation from GNSS-SDR class to RTKLIB structure
unsigned char default_code_ = static_cast<unsigned char>(CODE_NONE);
auto default_code_ = static_cast<unsigned char>(CODE_NONE);
obsd_t newobs = {{0, 0}, '0', '0', {}, {},
{default_code_, default_code_, default_code_},
{}, {0.0, 0.0, 0.0}, {}};
@ -775,11 +777,11 @@ bool rtklib_solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
nav_data.n = valid_obs;
nav_data.ng = glo_valid_obs;
for (int i = 0; i < MAXSAT; i++)
for (auto & i : nav_data.lam)
{
nav_data.lam[i][0] = SPEED_OF_LIGHT / FREQ1; // L1/E1
nav_data.lam[i][1] = SPEED_OF_LIGHT / FREQ2; // L2
nav_data.lam[i][2] = SPEED_OF_LIGHT / FREQ5; // L5/E5
i[0] = SPEED_OF_LIGHT / FREQ1; // L1/E1
i[1] = SPEED_OF_LIGHT / FREQ2; // L2
i[2] = SPEED_OF_LIGHT / FREQ5; // L5/E5
}
result = rtkpos(&rtk_, obs_data, valid_obs + glo_valid_obs, &nav_data);
@ -809,12 +811,12 @@ bool rtklib_solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
std::vector<double> azel;
azel.reserve(used_sats * 2);
unsigned int index_aux = 0;
for (unsigned int i = 0; i < MAXSAT; i++)
for (auto & i : rtk_.ssat)
{
if (rtk_.ssat[i].vs == 1)
if (i.vs == 1)
{
azel[2 * index_aux] = rtk_.ssat[i].azel[0];
azel[2 * index_aux + 1] = rtk_.ssat[i].azel[1];
azel[2 * index_aux] = i.azel[0];
azel[2 * index_aux + 1] = i.azel[1];
index_aux++;
}
}

View File

@ -203,10 +203,7 @@ signed int GalileoE1Pcps8msAmbiguousAcquisition::mag()
{
return acquisition_cc_->mag();
}
else
{
return 0;
}
return 0;
}
@ -224,7 +221,7 @@ void GalileoE1Pcps8msAmbiguousAcquisition::set_local_code()
bool cboc = configuration_->property(
"Acquisition" + std::to_string(channel_) + ".cboc", false);
std::complex<float>* code = new std::complex<float>[code_length_];
auto* code = new std::complex<float>[code_length_];
galileo_e1_code_gen_complex_sampled(code, gnss_synchro_->Signal,
cboc, gnss_synchro_->PRN, fs_in_, 0, false);
@ -263,9 +260,9 @@ float GalileoE1Pcps8msAmbiguousAcquisition::calculate_threshold(float pfa)
unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent);
double lambda = double(vector_length_);
auto lambda = double(vector_length_);
boost::math::exponential_distribution<double> mydist(lambda);
float threshold = static_cast<float>(quantile(mydist, val));
auto threshold = static_cast<float>(quantile(mydist, val));
return threshold;
}

View File

@ -126,7 +126,7 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
code_ = new gr_complex[vector_length_];
if (item_type_.compare("cshort") == 0)
if (item_type_ == "cshort")
{
item_size_ = sizeof(lv_16sc_t);
}
@ -142,7 +142,7 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
acquisition_ = pcps_make_acquisition(acq_parameters);
DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")";
if (item_type_.compare("cbyte") == 0)
if (item_type_ == "cbyte")
{
cbyte_to_float_x2_ = make_complex_byte_to_float_x2();
float_to_complex_ = gr::blocks::float_to_complex::make();
@ -244,7 +244,7 @@ void GalileoE1PcpsAmbiguousAcquisition::set_local_code()
bool cboc = configuration_->property(
"Acquisition" + std::to_string(channel_) + ".cboc", false);
std::complex<float>* code = new std::complex<float>[code_length_];
auto* code = new std::complex<float>[code_length_];
if (acquire_pilot_ == true)
{
@ -311,9 +311,9 @@ float GalileoE1PcpsAmbiguousAcquisition::calculate_threshold(float pfa)
unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent);
double lambda = double(vector_length_);
auto lambda = double(vector_length_);
boost::math::exponential_distribution<double> mydist(lambda);
float threshold = static_cast<float>(quantile(mydist, val));
auto threshold = static_cast<float>(quantile(mydist, val));
return threshold;
}
@ -373,7 +373,7 @@ gr::basic_block_sptr GalileoE1PcpsAmbiguousAcquisition::get_left_block()
{
return acquisition_;
}
else if (item_type_ == "cshort")
if (item_type_ == "cshort")
{
return acquisition_;
}

View File

@ -206,10 +206,7 @@ signed int GalileoE1PcpsCccwsrAmbiguousAcquisition::mag()
{
return acquisition_cc_->mag();
}
else
{
return 0;
}
return 0;
}

View File

@ -237,10 +237,7 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::mag()
{
return acquisition_cc_->mag();
}
else
{
return 0;
}
return 0;
}
@ -258,7 +255,7 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisition::set_local_code()
bool cboc = configuration_->property(
"Acquisition" + std::to_string(channel_) + ".cboc", false);
std::complex<float>* code = new std::complex<float>[code_length_];
auto* code = new std::complex<float>[code_length_];
galileo_e1_code_gen_complex_sampled(code, gnss_synchro_->Signal,
cboc, gnss_synchro_->PRN, fs_in_, 0, false);
@ -311,7 +308,7 @@ float GalileoE1PcpsQuickSyncAmbiguousAcquisition::calculate_threshold(float pfa)
double val = pow(1.0 - pfa, exponent);
double lambda = static_cast<double>(code_length_) / static_cast<double>(folding_factor_);
boost::math::exponential_distribution<double> mydist(lambda);
float threshold = static_cast<float>(quantile(mydist, val));
auto threshold = static_cast<float>(quantile(mydist, val));
return threshold;
}

View File

@ -207,10 +207,7 @@ signed int GalileoE1PcpsTongAmbiguousAcquisition::mag()
{
return acquisition_cc_->mag();
}
else
{
return 0;
}
return 0;
}
@ -228,7 +225,7 @@ void GalileoE1PcpsTongAmbiguousAcquisition::set_local_code()
bool cboc = configuration_->property(
"Acquisition" + std::to_string(channel_) + ".cboc", false);
std::complex<float>* code = new std::complex<float>[code_length_];
auto* code = new std::complex<float>[code_length_];
galileo_e1_code_gen_complex_sampled(code, gnss_synchro_->Signal,
cboc, gnss_synchro_->PRN, fs_in_, 0, false);
@ -273,9 +270,9 @@ float GalileoE1PcpsTongAmbiguousAcquisition::calculate_threshold(float pfa)
unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent);
double lambda = double(vector_length_);
auto lambda = double(vector_length_);
boost::math::exponential_distribution<double> mydist(lambda);
float threshold = static_cast<float>(quantile(mydist, val));
auto threshold = static_cast<float>(quantile(mydist, val));
return threshold;
}

View File

@ -213,10 +213,7 @@ signed int GalileoE5aNoncoherentIQAcquisitionCaf::mag()
{
return acquisition_cc_->mag();
}
else
{
return 0;
}
return 0;
}
@ -231,8 +228,8 @@ void GalileoE5aNoncoherentIQAcquisitionCaf::set_local_code()
{
if (item_type_ == "gr_complex")
{
std::complex<float>* codeI = new std::complex<float>[code_length_];
std::complex<float>* codeQ = new std::complex<float>[code_length_];
auto* codeI = new std::complex<float>[code_length_];
auto* codeQ = new std::complex<float>[code_length_];
if (gnss_synchro_->Signal[0] == '5' && gnss_synchro_->Signal[1] == 'X')
{
@ -305,9 +302,9 @@ float GalileoE5aNoncoherentIQAcquisitionCaf::calculate_threshold(float pfa)
unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent);
double lambda = double(vector_length_);
auto lambda = double(vector_length_);
boost::math::exponential_distribution<double> mydist(lambda);
float threshold = static_cast<float>(quantile(mydist, val));
auto threshold = static_cast<float>(quantile(mydist, val));
return threshold;
}

View File

@ -208,7 +208,7 @@ void GalileoE5aPcpsAcquisition::init()
void GalileoE5aPcpsAcquisition::set_local_code()
{
gr_complex* code = new gr_complex[code_length_];
auto* code = new gr_complex[code_length_];
char signal_[3];
if (acq_iq_)
@ -253,9 +253,9 @@ float GalileoE5aPcpsAcquisition::calculate_threshold(float pfa)
unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent);
double lambda = double(vector_length_);
auto lambda = double(vector_length_);
boost::math::exponential_distribution<double> mydist(lambda);
float threshold = static_cast<float>(quantile(mydist, val));
auto threshold = static_cast<float>(quantile(mydist, val));
return threshold;
}

View File

@ -213,7 +213,7 @@ void GlonassL1CaPcpsAcquisition::init()
void GlonassL1CaPcpsAcquisition::set_local_code()
{
std::complex<float>* code = new std::complex<float>[code_length_];
auto* code = new std::complex<float>[code_length_];
glonass_l1_ca_code_gen_complex_sampled(code, /* gnss_synchro_->PRN,*/ fs_in_, 0);
@ -257,9 +257,9 @@ float GlonassL1CaPcpsAcquisition::calculate_threshold(float pfa)
unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent);
double lambda = static_cast<double>(vector_length_);
auto lambda = static_cast<double>(vector_length_);
boost::math::exponential_distribution<double> mydist(lambda);
float threshold = static_cast<float>(quantile(mydist, val));
auto threshold = static_cast<float>(quantile(mydist, val));
return threshold;
}
@ -319,7 +319,7 @@ gr::basic_block_sptr GlonassL1CaPcpsAcquisition::get_left_block()
{
return acquisition_;
}
else if (item_type_ == "cshort")
if (item_type_ == "cshort")
{
return acquisition_;
}

View File

@ -212,7 +212,7 @@ void GlonassL2CaPcpsAcquisition::init()
void GlonassL2CaPcpsAcquisition::set_local_code()
{
std::complex<float>* code = new std::complex<float>[code_length_];
auto* code = new std::complex<float>[code_length_];
glonass_l2_ca_code_gen_complex_sampled(code, /* gnss_synchro_->PRN,*/ fs_in_, 0);
@ -256,9 +256,9 @@ float GlonassL2CaPcpsAcquisition::calculate_threshold(float pfa)
unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent);
double lambda = static_cast<double>(vector_length_);
auto lambda = static_cast<double>(vector_length_);
boost::math::exponential_distribution<double> mydist(lambda);
float threshold = static_cast<float>(quantile(mydist, val));
auto threshold = static_cast<float>(quantile(mydist, val));
return threshold;
}
@ -318,7 +318,7 @@ gr::basic_block_sptr GlonassL2CaPcpsAcquisition::get_left_block()
{
return acquisition_;
}
else if (item_type_ == "cshort")
if (item_type_ == "cshort")
{
return acquisition_;
}

View File

@ -234,7 +234,7 @@ void GpsL1CaPcpsAcquisition::init()
void GpsL1CaPcpsAcquisition::set_local_code()
{
std::complex<float>* code = new std::complex<float>[code_length_];
auto* code = new std::complex<float>[code_length_];
if (acq_parameters_.use_automatic_resampler)
{
@ -279,9 +279,9 @@ float GpsL1CaPcpsAcquisition::calculate_threshold(float pfa)
unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent);
double lambda = double(vector_length_);
auto lambda = double(vector_length_);
boost::math::exponential_distribution<double> mydist(lambda);
float threshold = static_cast<float>(quantile(mydist, val));
auto threshold = static_cast<float>(quantile(mydist, val));
return threshold;
}
@ -341,7 +341,7 @@ gr::basic_block_sptr GpsL1CaPcpsAcquisition::get_left_block()
{
return acquisition_;
}
else if (item_type_ == "cshort")
if (item_type_ == "cshort")
{
return acquisition_;
}

View File

@ -68,7 +68,7 @@ GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition(
code_length_ = round(fs_in_ / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS));
/*Calculate the folding factor value based on the calculations*/
unsigned int temp = static_cast<unsigned int>(ceil(sqrt(log2(code_length_))));
auto temp = static_cast<unsigned int>(ceil(sqrt(log2(code_length_))));
folding_factor_ = configuration_->property(role + ".folding_factor", temp);
if (sampled_ms_ % folding_factor_ != 0)
@ -231,10 +231,7 @@ signed int GpsL1CaPcpsQuickSyncAcquisition::mag()
{
return acquisition_cc_->mag();
}
else
{
return 0;
}
return 0;
}
@ -249,7 +246,7 @@ void GpsL1CaPcpsQuickSyncAcquisition::set_local_code()
{
if (item_type_ == "gr_complex")
{
std::complex<float>* code = new std::complex<float>[code_length_]();
auto* code = new std::complex<float>[code_length_]();
gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0);
@ -299,7 +296,7 @@ float GpsL1CaPcpsQuickSyncAcquisition::calculate_threshold(float pfa)
double val = pow(1.0 - pfa, exponent);
double lambda = static_cast<double>(code_length_) / static_cast<double>(folding_factor_);
boost::math::exponential_distribution<double> mydist(lambda);
float threshold = static_cast<float>(quantile(mydist, val));
auto threshold = static_cast<float>(quantile(mydist, val));
return threshold;
}

View File

@ -193,10 +193,7 @@ signed int GpsL1CaPcpsTongAcquisition::mag()
{
return acquisition_cc_->mag();
}
else
{
return 0;
}
return 0;
}
@ -210,7 +207,7 @@ void GpsL1CaPcpsTongAcquisition::set_local_code()
{
if (item_type_ == "gr_complex")
{
std::complex<float>* code = new std::complex<float>[code_length_];
auto* code = new std::complex<float>[code_length_];
gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0);
@ -259,9 +256,9 @@ float GpsL1CaPcpsTongAcquisition::calculate_threshold(float pfa)
unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent);
double lambda = double(vector_length_);
auto lambda = double(vector_length_);
boost::math::exponential_distribution<double> mydist(lambda);
float threshold = static_cast<float>(quantile(mydist, val));
auto threshold = static_cast<float>(quantile(mydist, val));
return threshold;
}

View File

@ -221,7 +221,7 @@ void GpsL2MPcpsAcquisition::init()
void GpsL2MPcpsAcquisition::set_local_code()
{
std::complex<float>* code = new std::complex<float>[code_length_];
auto* code = new std::complex<float>[code_length_];
gps_l2c_m_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_);
@ -259,9 +259,9 @@ float GpsL2MPcpsAcquisition::calculate_threshold(float pfa)
unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1.0 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent);
double lambda = double(vector_length_);
auto lambda = double(vector_length_);
boost::math::exponential_distribution<double> mydist(lambda);
float threshold = static_cast<float>(quantile(mydist, val));
auto threshold = static_cast<float>(quantile(mydist, val));
return threshold;
}
@ -321,7 +321,7 @@ gr::basic_block_sptr GpsL2MPcpsAcquisition::get_left_block()
{
return acquisition_;
}
else if (item_type_ == "cshort")
if (item_type_ == "cshort")
{
return acquisition_;
}

View File

@ -209,7 +209,7 @@ void GpsL5iPcpsAcquisition::init()
void GpsL5iPcpsAcquisition::set_local_code()
{
std::complex<float>* code = new std::complex<float>[code_length_];
auto* code = new std::complex<float>[code_length_];
gps_l5i_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_);
@ -247,9 +247,9 @@ float GpsL5iPcpsAcquisition::calculate_threshold(float pfa)
unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1.0 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent);
double lambda = double(vector_length_);
auto lambda = double(vector_length_);
boost::math::exponential_distribution<double> mydist(lambda);
float threshold = static_cast<float>(quantile(mydist, val));
auto threshold = static_cast<float>(quantile(mydist, val));
return threshold;
}
@ -309,7 +309,7 @@ gr::basic_block_sptr GpsL5iPcpsAcquisition::get_left_block()
{
return acquisition_;
}
else if (item_type_ == "cshort")
if (item_type_ == "cshort")
{
return acquisition_;
}

View File

@ -42,6 +42,7 @@
#include <volk/volk.h>
#include <volk_gnsssdr/volk_gnsssdr.h>
#include <sstream>
#include <utility>
using google::LogMessage;
@ -59,7 +60,7 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc_sptr galileo_e5a_noncoherentIQ_make
{
return galileo_e5a_noncoherentIQ_acquisition_caf_cc_sptr(
new galileo_e5a_noncoherentIQ_acquisition_caf_cc(sampled_ms, max_dwells, doppler_max, fs_in, samples_per_ms,
samples_per_code, bit_transition_flag, dump, dump_filename, both_signal_components_, CAF_window_hz_, Zero_padding_));
samples_per_code, bit_transition_flag, dump, std::move(dump_filename), both_signal_components_, CAF_window_hz_, Zero_padding_));
}
@ -152,7 +153,7 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc::galileo_e5a_noncoherentIQ_acquisit
// For dumping samples into a file
d_dump = dump;
d_dump_filename = dump_filename;
d_dump_filename = std::move(dump_filename);
d_doppler_resolution = 0;
d_threshold = 0;
@ -393,7 +394,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
}
case 1:
{
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]); //Get the input samples pointer
const auto *in = reinterpret_cast<const gr_complex *>(input_items[0]); //Get the input samples pointer
unsigned int buff_increment;
if ((ninput_items[0] + d_buffer_count) <= d_fft_size)
{
@ -417,7 +418,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
case 2:
{
// Fill last part of the buffer and reset counter
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]); //Get the input samples pointer
const auto *in = reinterpret_cast<const gr_complex *>(input_items[0]); //Get the input samples pointer
if (d_buffer_count < d_fft_size)
{
memcpy(&d_inbuffer[d_buffer_count], in, sizeof(gr_complex) * (d_fft_size - d_buffer_count));
@ -674,7 +675,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
if (d_CAF_window_hz > 0)
{
int CAF_bins_half;
float *accum = static_cast<float *>(volk_gnsssdr_malloc(sizeof(float), volk_gnsssdr_get_alignment()));
auto *accum = static_cast<float *>(volk_gnsssdr_malloc(sizeof(float), volk_gnsssdr_get_alignment()));
CAF_bins_half = d_CAF_window_hz / (2 * d_doppler_step);
float weighting_factor;
weighting_factor = 0.5 / static_cast<float>(CAF_bins_half);

View File

@ -31,6 +31,7 @@
#include "galileo_pcps_8ms_acquisition_cc.h"
#include <sstream>
#include <utility>
#include <glog/logging.h>
#include <gnuradio/io_signature.h>
#include <volk/volk.h>
@ -47,7 +48,7 @@ galileo_pcps_8ms_acquisition_cc_sptr galileo_pcps_8ms_make_acquisition_cc(
{
return galileo_pcps_8ms_acquisition_cc_sptr(
new galileo_pcps_8ms_acquisition_cc(sampled_ms, max_dwells, doppler_max, fs_in, samples_per_ms,
samples_per_code, dump, dump_filename));
samples_per_code, dump, std::move(dump_filename)));
}
galileo_pcps_8ms_acquisition_cc::galileo_pcps_8ms_acquisition_cc(
@ -87,7 +88,7 @@ galileo_pcps_8ms_acquisition_cc::galileo_pcps_8ms_acquisition_cc(
// For dumping samples into a file
d_dump = dump;
d_dump_filename = dump_filename;
d_dump_filename = std::move(dump_filename);
d_doppler_resolution = 0;
d_threshold = 0;
@ -246,7 +247,7 @@ int galileo_pcps_8ms_acquisition_cc::general_work(int noutput_items,
float magt = 0.0;
float magt_A = 0.0;
float magt_B = 0.0;
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]); //Get the input samples pointer
const auto *in = reinterpret_cast<const gr_complex *>(input_items[0]); //Get the input samples pointer
float fft_normalization_factor = static_cast<float>(d_fft_size) * static_cast<float>(d_fft_size);
d_input_power = 0.0;
d_mag = 0.0;

View File

@ -158,10 +158,10 @@ pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) : gr::block("pcps_acqu
{
std::string dump_path;
// Get path
if (d_dump_filename.find_last_of("/") != std::string::npos)
if (d_dump_filename.find_last_of('/') != std::string::npos)
{
std::string dump_filename_ = d_dump_filename.substr(d_dump_filename.find_last_of("/") + 1);
dump_path = d_dump_filename.substr(0, d_dump_filename.find_last_of("/"));
std::string dump_filename_ = d_dump_filename.substr(d_dump_filename.find_last_of('/') + 1);
dump_path = d_dump_filename.substr(0, d_dump_filename.find_last_of('/'));
d_dump_filename = dump_filename_;
}
else
@ -173,9 +173,9 @@ pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) : gr::block("pcps_acqu
d_dump_filename = "acquisition";
}
// remove extension if any
if (d_dump_filename.substr(1).find_last_of(".") != std::string::npos)
if (d_dump_filename.substr(1).find_last_of('.') != std::string::npos)
{
d_dump_filename = d_dump_filename.substr(0, d_dump_filename.find_last_of("."));
d_dump_filename = d_dump_filename.substr(0, d_dump_filename.find_last_of('.'));
}
d_dump_filename = dump_path + boost::filesystem::path::preferred_separator + d_dump_filename;
// create directory
@ -268,7 +268,7 @@ bool pcps_acquisition::is_fdma()
LOG(INFO) << "Trying to acquire SV PRN " << d_gnss_synchro->PRN << " with freq " << d_old_freq << " in Glonass Channel " << GLONASS_PRN.at(d_gnss_synchro->PRN) << std::endl;
return true;
}
else if (strcmp(d_gnss_synchro->Signal, "2G") == 0)
if (strcmp(d_gnss_synchro->Signal, "2G") == 0)
{
d_old_freq += DFRQ2_GLO * GLONASS_PRN.at(d_gnss_synchro->PRN);
LOG(INFO) << "Trying to acquire SV PRN " << d_gnss_synchro->PRN << " with freq " << d_old_freq << " in Glonass Channel " << GLONASS_PRN.at(d_gnss_synchro->PRN) << std::endl;
@ -480,7 +480,7 @@ void pcps_acquisition::dump_results(int32_t effective_fft_size)
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar);
float aux = static_cast<float>(d_gnss_synchro->Acq_doppler_hz);
auto aux = static_cast<float>(d_gnss_synchro->Acq_doppler_hz);
matvar = Mat_VarCreate("acq_doppler_hz", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims, &aux, 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar);
@ -963,7 +963,7 @@ int pcps_acquisition::general_work(int noutput_items __attribute__((unused)),
uint32_t buff_increment;
if (d_cshort)
{
const lv_16sc_t* in = reinterpret_cast<const lv_16sc_t*>(input_items[0]); // Get the input samples pointer
const auto* in = reinterpret_cast<const lv_16sc_t*>(input_items[0]); // Get the input samples pointer
if ((ninput_items[0] + d_buffer_count) <= d_consumed_samples)
{
buff_increment = ninput_items[0];
@ -976,7 +976,7 @@ int pcps_acquisition::general_work(int noutput_items __attribute__((unused)),
}
else
{
const gr_complex* in = reinterpret_cast<const gr_complex*>(input_items[0]); // Get the input samples pointer
const auto* in = reinterpret_cast<const gr_complex*>(input_items[0]); // Get the input samples pointer
if ((ninput_items[0] + d_buffer_count) <= d_consumed_samples)
{
buff_increment = ninput_items[0];

View File

@ -91,10 +91,10 @@ pcps_acquisition_fine_doppler_cc::pcps_acquisition_fine_doppler_cc(const Acq_Con
{
std::string dump_path;
// Get path
if (d_dump_filename.find_last_of("/") != std::string::npos)
if (d_dump_filename.find_last_of('/') != std::string::npos)
{
std::string dump_filename_ = d_dump_filename.substr(d_dump_filename.find_last_of("/") + 1);
dump_path = d_dump_filename.substr(0, d_dump_filename.find_last_of("/"));
std::string dump_filename_ = d_dump_filename.substr(d_dump_filename.find_last_of('/') + 1);
dump_path = d_dump_filename.substr(0, d_dump_filename.find_last_of('/'));
d_dump_filename = dump_filename_;
}
else
@ -106,9 +106,9 @@ pcps_acquisition_fine_doppler_cc::pcps_acquisition_fine_doppler_cc(const Acq_Con
d_dump_filename = "acquisition";
}
// remove extension if any
if (d_dump_filename.substr(1).find_last_of(".") != std::string::npos)
if (d_dump_filename.substr(1).find_last_of('.') != std::string::npos)
{
d_dump_filename = d_dump_filename.substr(0, d_dump_filename.find_last_of("."));
d_dump_filename = d_dump_filename.substr(0, d_dump_filename.find_last_of('.'));
}
d_dump_filename = dump_path + boost::filesystem::path::preferred_separator + d_dump_filename;
// create directory
@ -337,7 +337,7 @@ double pcps_acquisition_fine_doppler_cc::compute_CAF()
float pcps_acquisition_fine_doppler_cc::estimate_input_power(gr_vector_const_void_star &input_items)
{
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]); //Get the input samples pointer
const auto *in = reinterpret_cast<const gr_complex *>(input_items[0]); //Get the input samples pointer
// Compute the input signal power estimation
float power = 0;
volk_32fc_magnitude_squared_32f(d_magnitude, in, d_fft_size);
@ -350,7 +350,7 @@ float pcps_acquisition_fine_doppler_cc::estimate_input_power(gr_vector_const_voi
int pcps_acquisition_fine_doppler_cc::compute_and_accumulate_grid(gr_vector_const_void_star &input_items)
{
// initialize acquisition algorithm
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]); //Get the input samples pointer
const auto *in = reinterpret_cast<const gr_complex *>(input_items[0]); //Get the input samples pointer
DLOG(INFO) << "Channel: " << d_channel
<< " , doing acquisition of satellite: " << d_gnss_synchro->System << " " << d_gnss_synchro->PRN
@ -359,7 +359,7 @@ int pcps_acquisition_fine_doppler_cc::compute_and_accumulate_grid(gr_vector_cons
<< ", doppler_step: " << d_doppler_step;
// 2- Doppler frequency search loop
float *p_tmp_vector = static_cast<float *>(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment()));
auto *p_tmp_vector = static_cast<float *>(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment()));
for (int doppler_index = 0; doppler_index < d_num_doppler_points; doppler_index++)
{
@ -405,12 +405,12 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler()
int signal_samples = prn_replicas * d_fft_size;
//int fft_size_extended = nextPowerOf2(signal_samples * zero_padding_factor);
int fft_size_extended = signal_samples * zero_padding_factor;
gr::fft::fft_complex *fft_operator = new gr::fft::fft_complex(fft_size_extended, true);
auto *fft_operator = new gr::fft::fft_complex(fft_size_extended, true);
//zero padding the entire vector
std::fill_n(fft_operator->get_inbuf(), fft_size_extended, gr_complex(0.0, 0.0));
//1. generate local code aligned with the acquisition code phase estimation
gr_complex *code_replica = static_cast<gr_complex *>(volk_gnsssdr_malloc(signal_samples * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
auto *code_replica = static_cast<gr_complex *>(volk_gnsssdr_malloc(signal_samples * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
gps_l1_ca_code_gen_complex_sampled(code_replica, d_gnss_synchro->PRN, d_fs_in, 0);
@ -433,7 +433,7 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler()
fft_operator->execute();
// 4. Compute the magnitude and find the maximum
float *p_tmp_vector = static_cast<float *>(volk_gnsssdr_malloc(fft_size_extended * sizeof(float), volk_gnsssdr_get_alignment()));
auto *p_tmp_vector = static_cast<float *>(volk_gnsssdr_malloc(fft_size_extended * sizeof(float), volk_gnsssdr_get_alignment()));
volk_32fc_magnitude_squared_32f(p_tmp_vector, fft_operator->get_outbuf(), fft_size_extended);
@ -442,7 +442,7 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler()
//case even
int counter = 0;
float *fftFreqBins = new float[fft_size_extended];
auto *fftFreqBins = new float[fft_size_extended];
std::fill_n(fftFreqBins, fft_size_extended, 0.0);
@ -699,7 +699,7 @@ void pcps_acquisition_fine_doppler_cc::dump_results(int effective_fft_size)
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar);
float aux = static_cast<float>(d_gnss_synchro->Acq_doppler_hz);
auto aux = static_cast<float>(d_gnss_synchro->Acq_doppler_hz);
matvar = Mat_VarCreate("acq_doppler_hz", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims, &aux, 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar);

View File

@ -32,6 +32,7 @@
#include "pcps_assisted_acquisition_cc.h"
#include <sstream>
#include <utility>
#include <glog/logging.h>
#include <gnuradio/io_signature.h>
#include <volk/volk.h>
@ -52,7 +53,7 @@ pcps_assisted_acquisition_cc_sptr pcps_make_assisted_acquisition_cc(
{
return pcps_assisted_acquisition_cc_sptr(
new pcps_assisted_acquisition_cc(max_dwells, sampled_ms, doppler_max, doppler_min,
fs_in, samples_per_ms, dump, dump_filename));
fs_in, samples_per_ms, dump, std::move(dump_filename)));
}
@ -89,7 +90,7 @@ pcps_assisted_acquisition_cc::pcps_assisted_acquisition_cc(
// For dumping samples into a file
d_dump = dump;
d_dump_filename = dump_filename;
d_dump_filename = std::move(dump_filename);
d_doppler_resolution = 0;
d_threshold = 0;
@ -301,9 +302,9 @@ double pcps_assisted_acquisition_cc::search_maximum()
float pcps_assisted_acquisition_cc::estimate_input_power(gr_vector_const_void_star &input_items)
{
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]); //Get the input samples pointer
const auto *in = reinterpret_cast<const gr_complex *>(input_items[0]); //Get the input samples pointer
// 1- Compute the input signal power estimation
float *p_tmp_vector = static_cast<float *>(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment()));
auto *p_tmp_vector = static_cast<float *>(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment()));
volk_32fc_magnitude_squared_32f(p_tmp_vector, in, d_fft_size);
@ -318,7 +319,7 @@ float pcps_assisted_acquisition_cc::estimate_input_power(gr_vector_const_void_st
int pcps_assisted_acquisition_cc::compute_and_accumulate_grid(gr_vector_const_void_star &input_items)
{
// initialize acquisition algorithm
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]); //Get the input samples pointer
const auto *in = reinterpret_cast<const gr_complex *>(input_items[0]); //Get the input samples pointer
DLOG(INFO) << "Channel: " << d_channel
<< " , doing acquisition of satellite: " << d_gnss_synchro->System << " "
@ -328,7 +329,7 @@ int pcps_assisted_acquisition_cc::compute_and_accumulate_grid(gr_vector_const_vo
<< ", doppler_step: " << d_doppler_step;
// 2- Doppler frequency search loop
float *p_tmp_vector = static_cast<float *>(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment()));
auto *p_tmp_vector = static_cast<float *>(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment()));
for (int doppler_index = 0; doppler_index < d_num_doppler_points; doppler_index++)
{

View File

@ -36,6 +36,7 @@
#include "pcps_cccwsr_acquisition_cc.h"
#include <sstream>
#include <utility>
#include <glog/logging.h>
#include <gnuradio/io_signature.h>
#include <volk/volk.h>
@ -54,7 +55,7 @@ pcps_cccwsr_acquisition_cc_sptr pcps_cccwsr_make_acquisition_cc(
{
return pcps_cccwsr_acquisition_cc_sptr(
new pcps_cccwsr_acquisition_cc(sampled_ms, max_dwells, doppler_max, fs_in,
samples_per_ms, samples_per_code, dump, dump_filename));
samples_per_ms, samples_per_code, dump, std::move(dump_filename)));
}
pcps_cccwsr_acquisition_cc::pcps_cccwsr_acquisition_cc(
@ -98,7 +99,7 @@ pcps_cccwsr_acquisition_cc::pcps_cccwsr_acquisition_cc(
// For dumping samples into a file
d_dump = dump;
d_dump_filename = dump_filename;
d_dump_filename = std::move(dump_filename);
d_doppler_resolution = 0;
d_threshold = 0;
@ -261,7 +262,7 @@ int pcps_cccwsr_acquisition_cc::general_work(int noutput_items,
float magt = 0.0;
float magt_plus = 0.0;
float magt_minus = 0.0;
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]); //Get the input samples pointer
const auto *in = reinterpret_cast<const gr_complex *>(input_items[0]); //Get the input samples pointer
float fft_normalization_factor = static_cast<float>(d_fft_size) * static_cast<float>(d_fft_size);
d_sample_counter += static_cast<uint64_t>(d_fft_size); // sample counter

View File

@ -37,6 +37,7 @@
#include <volk_gnsssdr/volk_gnsssdr.h>
#include <cmath>
#include <sstream>
#include <utility>
using google::LogMessage;
@ -57,7 +58,7 @@ pcps_quicksync_acquisition_cc_sptr pcps_quicksync_make_acquisition_cc(
fs_in, samples_per_ms,
samples_per_code,
bit_transition_flag,
dump, dump_filename));
dump, std::move(dump_filename)));
}
@ -110,7 +111,7 @@ pcps_quicksync_acquisition_cc::pcps_quicksync_acquisition_cc(
// For dumping samples into a file
d_dump = dump;
d_dump_filename = dump_filename;
d_dump_filename = std::move(dump_filename);
d_corr_acumulator = nullptr;
d_signal_folded = nullptr;
@ -304,18 +305,18 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
int doppler;
uint32_t indext = 0;
float magt = 0.0;
const gr_complex* in = reinterpret_cast<const gr_complex*>(input_items[0]); //Get the input samples pointer
const auto* in = reinterpret_cast<const gr_complex*>(input_items[0]); //Get the input samples pointer
gr_complex* in_temp = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_samples_per_code * d_folding_factor * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
gr_complex* in_temp_folded = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
auto* in_temp = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_samples_per_code * d_folding_factor * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
auto* in_temp_folded = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
/*Create a signal to store a signal of size 1ms, to perform correlation
in time. No folding on this data is required*/
gr_complex* in_1code = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_samples_per_code * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
auto* in_1code = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_samples_per_code * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
/*Stores the values of the correlation output between the local code
and the signal with doppler shift corrected */
gr_complex* corr_output = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_samples_per_code * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
auto* corr_output = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_samples_per_code * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
/*Stores a copy of the folded version of the signal.This is used for
the FFT operations in future steps of execution*/

View File

@ -56,6 +56,7 @@
#include <volk/volk.h>
#include <volk_gnsssdr/volk_gnsssdr.h>
#include <sstream>
#include <utility>
using google::LogMessage;
@ -68,7 +69,7 @@ pcps_tong_acquisition_cc_sptr pcps_tong_make_acquisition_cc(
{
return pcps_tong_acquisition_cc_sptr(
new pcps_tong_acquisition_cc(sampled_ms, doppler_max, fs_in, samples_per_ms, samples_per_code,
tong_init_val, tong_max_val, tong_max_dwells, dump, dump_filename));
tong_init_val, tong_max_val, tong_max_dwells, dump, std::move(dump_filename)));
}
pcps_tong_acquisition_cc::pcps_tong_acquisition_cc(
@ -111,7 +112,7 @@ pcps_tong_acquisition_cc::pcps_tong_acquisition_cc(
// For dumping samples into a file
d_dump = dump;
d_dump_filename = dump_filename;
d_dump_filename = std::move(dump_filename);
d_doppler_resolution = 0;
d_threshold = 0;
@ -282,7 +283,7 @@ int pcps_tong_acquisition_cc::general_work(int noutput_items,
int doppler;
uint32_t indext = 0;
float magt = 0.0;
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]); //Get the input samples pointer
const auto *in = reinterpret_cast<const gr_complex *>(input_items[0]); //Get the input samples pointer
float fft_normalization_factor = static_cast<float>(d_fft_size) * static_cast<float>(d_fft_size);
d_input_power = 0.0;
d_mag = 0.0;

View File

@ -81,13 +81,10 @@ bool ChannelFsm::Event_start_acquisition()
{
return false;
}
else
{
d_state = 1;
start_acquisition();
DLOG(INFO) << "CH = " << channel_ << ". Ev start acquisition";
return true;
}
d_state = 1;
start_acquisition();
DLOG(INFO) << "CH = " << channel_ << ". Ev start acquisition";
return true;
}
@ -98,13 +95,10 @@ bool ChannelFsm::Event_valid_acquisition()
{
return false;
}
else
{
d_state = 2;
start_tracking();
DLOG(INFO) << "CH = " << channel_ << ". Ev valid acquisition";
return true;
}
d_state = 2;
start_tracking();
DLOG(INFO) << "CH = " << channel_ << ". Ev valid acquisition";
return true;
}
@ -115,13 +109,10 @@ bool ChannelFsm::Event_failed_acquisition_repeat()
{
return false;
}
else
{
d_state = 1;
start_acquisition();
DLOG(INFO) << "CH = " << channel_ << ". Ev failed acquisition repeat";
return true;
}
d_state = 1;
start_acquisition();
DLOG(INFO) << "CH = " << channel_ << ". Ev failed acquisition repeat";
return true;
}
@ -132,13 +123,10 @@ bool ChannelFsm::Event_failed_acquisition_no_repeat()
{
return false;
}
else
{
d_state = 3;
request_satellite();
DLOG(INFO) << "CH = " << channel_ << ". Ev failed acquisition no repeat";
return true;
}
d_state = 3;
request_satellite();
DLOG(INFO) << "CH = " << channel_ << ". Ev failed acquisition no repeat";
return true;
}
@ -149,13 +137,10 @@ bool ChannelFsm::Event_failed_tracking_standby()
{
return false;
}
else
{
d_state = 0U;
notify_stop_tracking();
DLOG(INFO) << "CH = " << channel_ << ". Ev failed tracking standby";
return true;
}
d_state = 0U;
notify_stop_tracking();
DLOG(INFO) << "CH = " << channel_ << ". Ev failed tracking standby";
return true;
}

View File

@ -32,6 +32,8 @@
#include "array_signal_conditioner.h"
#include <glog/logging.h>
#include <utility>
using google::LogMessage;
@ -41,11 +43,11 @@ ArraySignalConditioner::ArraySignalConditioner(ConfigurationInterface *configura
std::shared_ptr<GNSSBlockInterface> in_filt,
std::shared_ptr<GNSSBlockInterface> res,
std::string role,
std::string implementation) : data_type_adapt_(data_type_adapt),
in_filt_(in_filt),
res_(res),
role_(role),
implementation_(implementation)
std::string implementation) : data_type_adapt_(std::move(data_type_adapt)),
in_filt_(std::move(in_filt)),
res_(std::move(res)),
role_(std::move(role)),
implementation_(std::move(implementation))
{
connected_ = false;
if (configuration)

View File

@ -32,6 +32,8 @@
#include "signal_conditioner.h"
#include <glog/logging.h>
#include <utility>
using google::LogMessage;
@ -41,11 +43,11 @@ SignalConditioner::SignalConditioner(ConfigurationInterface *configuration,
std::shared_ptr<GNSSBlockInterface> in_filt,
std::shared_ptr<GNSSBlockInterface> res,
std::string role,
std::string implementation) : data_type_adapt_(data_type_adapt),
in_filt_(in_filt),
res_(res),
role_(role),
implementation_(implementation)
std::string implementation) : data_type_adapt_(std::move(data_type_adapt)),
in_filt_(std::move(in_filt)),
res_(std::move(res)),
role_(std::move(role)),
implementation_(std::move(implementation))
{
connected_ = false;
if (configuration)

View File

@ -32,11 +32,13 @@
#include "configuration_interface.h"
#include <glog/logging.h>
#include <utility>
using google::LogMessage;
ByteToShort::ByteToShort(ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams) : config_(configuration), role_(role), in_streams_(in_streams), out_streams_(out_streams)
unsigned int in_streams, unsigned int out_streams) : config_(configuration), role_(std::move(role)), in_streams_(in_streams), out_streams_(out_streams)
{
std::string default_input_item_type = "byte";
std::string default_output_item_type = "short";

View File

@ -36,7 +36,7 @@
using google::LogMessage;
IbyteToCbyte::IbyteToCbyte(ConfigurationInterface* configuration, std::string role,
IbyteToCbyte::IbyteToCbyte(ConfigurationInterface* configuration, const std::string& role,
unsigned int in_streams, unsigned int out_streams) : config_(configuration), role_(role), in_streams_(in_streams), out_streams_(out_streams)
{
std::string default_input_item_type = "byte";
@ -144,8 +144,5 @@ gr::basic_block_sptr IbyteToCbyte::get_right_block()
{
return conjugate_ic_;
}
else
{
return ibyte_to_cbyte_;
}
return ibyte_to_cbyte_;
}

View File

@ -48,7 +48,7 @@ class IbyteToCbyte : public GNSSBlockInterface
{
public:
IbyteToCbyte(ConfigurationInterface* configuration,
std::string role, unsigned int in_streams,
const std::string& role, unsigned int in_streams,
unsigned int out_streams);
virtual ~IbyteToCbyte();

View File

@ -34,7 +34,7 @@
using google::LogMessage;
IbyteToComplex::IbyteToComplex(ConfigurationInterface* configuration, std::string role,
IbyteToComplex::IbyteToComplex(ConfigurationInterface* configuration, const std::string& role,
unsigned int in_streams, unsigned int out_streams) : config_(configuration), role_(role), in_streams_(in_streams), out_streams_(out_streams)
{
std::string default_input_item_type = "byte";
@ -142,8 +142,5 @@ gr::basic_block_sptr IbyteToComplex::get_right_block()
{
return conjugate_cc_;
}
else
{
return gr_interleaved_char_to_complex_;
}
return gr_interleaved_char_to_complex_;
}

View File

@ -48,7 +48,7 @@ class IbyteToComplex : public GNSSBlockInterface
{
public:
IbyteToComplex(ConfigurationInterface* configuration,
std::string role, unsigned int in_streams,
const std::string& role, unsigned int in_streams,
unsigned int out_streams);
virtual ~IbyteToComplex();

View File

@ -37,7 +37,7 @@
using google::LogMessage;
IbyteToCshort::IbyteToCshort(ConfigurationInterface* configuration, std::string role,
IbyteToCshort::IbyteToCshort(ConfigurationInterface* configuration, const std::string& role,
unsigned int in_streams, unsigned int out_streams) : config_(configuration), role_(role), in_streams_(in_streams), out_streams_(out_streams)
{
std::string default_input_item_type = "byte";
@ -141,8 +141,5 @@ gr::basic_block_sptr IbyteToCshort::get_right_block()
{
return conjugate_sc_;
}
else
{
return interleaved_byte_to_complex_short_;
}
return interleaved_byte_to_complex_short_;
}

View File

@ -48,7 +48,7 @@ class IbyteToCshort : public GNSSBlockInterface
{
public:
IbyteToCshort(ConfigurationInterface* configuration,
std::string role, unsigned int in_streams,
const std::string& role, unsigned int in_streams,
unsigned int out_streams);
virtual ~IbyteToCshort();

View File

@ -34,7 +34,7 @@
using google::LogMessage;
IshortToComplex::IshortToComplex(ConfigurationInterface* configuration, std::string role,
IshortToComplex::IshortToComplex(ConfigurationInterface* configuration, const std::string& role,
unsigned int in_streams, unsigned int out_streams) : config_(configuration), role_(role), in_streams_(in_streams), out_streams_(out_streams)
{
std::string default_input_item_type = "short";
@ -142,8 +142,5 @@ gr::basic_block_sptr IshortToComplex::get_right_block()
{
return conjugate_cc_;
}
else
{
return gr_interleaved_short_to_complex_;
}
return gr_interleaved_short_to_complex_;
}

View File

@ -47,7 +47,7 @@ class IshortToComplex : public GNSSBlockInterface
{
public:
IshortToComplex(ConfigurationInterface* configuration,
std::string role, unsigned int in_streams,
const std::string& role, unsigned int in_streams,
unsigned int out_streams);
virtual ~IshortToComplex();

View File

@ -36,7 +36,7 @@
using google::LogMessage;
IshortToCshort::IshortToCshort(ConfigurationInterface* configuration, std::string role,
IshortToCshort::IshortToCshort(ConfigurationInterface* configuration, const std::string& role,
unsigned int in_streams, unsigned int out_streams) : config_(configuration), role_(role), in_streams_(in_streams), out_streams_(out_streams)
{
std::string default_input_item_type = "short";
@ -144,8 +144,5 @@ gr::basic_block_sptr IshortToCshort::get_right_block()
{
return conjugate_sc_;
}
else
{
return interleaved_short_to_complex_short_;
}
return interleaved_short_to_complex_short_;
}

View File

@ -48,7 +48,7 @@ class IshortToCshort : public GNSSBlockInterface
{
public:
IshortToCshort(ConfigurationInterface* configuration,
std::string role, unsigned int in_streams,
const std::string& role, unsigned int in_streams,
unsigned int out_streams);
virtual ~IshortToCshort();

View File

@ -54,8 +54,8 @@ int interleaved_byte_to_complex_byte::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const int8_t *in = reinterpret_cast<const int8_t *>(input_items[0]);
lv_8sc_t *out = reinterpret_cast<lv_8sc_t *>(output_items[0]);
const auto *in = reinterpret_cast<const int8_t *>(input_items[0]);
auto *out = reinterpret_cast<lv_8sc_t *>(output_items[0]);
// This could be put into a Volk kernel
int8_t real_part;
int8_t imag_part;

View File

@ -54,8 +54,8 @@ int interleaved_byte_to_complex_short::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const int8_t *in = reinterpret_cast<const int8_t *>(input_items[0]);
lv_16sc_t *out = reinterpret_cast<lv_16sc_t *>(output_items[0]);
const auto *in = reinterpret_cast<const int8_t *>(input_items[0]);
auto *out = reinterpret_cast<lv_16sc_t *>(output_items[0]);
// This could be put into a Volk kernel
int8_t real_part;
int8_t imag_part;

View File

@ -54,8 +54,8 @@ int interleaved_short_to_complex_short::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const int16_t *in = reinterpret_cast<const int16_t *>(input_items[0]);
lv_16sc_t *out = reinterpret_cast<lv_16sc_t *>(output_items[0]);
const auto *in = reinterpret_cast<const int16_t *>(input_items[0]);
auto *out = reinterpret_cast<lv_16sc_t *>(output_items[0]);
// This could be put into a Volk kernel
int16_t real_part;
int16_t imag_part;

View File

@ -38,7 +38,7 @@
using google::LogMessage;
BeamformerFilter::BeamformerFilter(
ConfigurationInterface* configuration, std::string role,
ConfigurationInterface* configuration, const std::string& role,
unsigned int in_stream, unsigned int out_stream) : role_(role), in_stream_(in_stream), out_stream_(out_stream)
{
std::string default_item_type = "gr_complex";
@ -48,7 +48,7 @@ BeamformerFilter::BeamformerFilter(
DLOG(INFO) << "dump_ is " << dump_;
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file);
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
item_size_ = sizeof(gr_complex);
beamformer_ = make_beamformer();

View File

@ -46,7 +46,7 @@ class BeamformerFilter : public GNSSBlockInterface
{
public:
BeamformerFilter(ConfigurationInterface* configuration,
std::string role, unsigned int in_stream,
const std::string& role, unsigned int in_stream,
unsigned int out_stream);
virtual ~BeamformerFilter();

View File

@ -31,7 +31,7 @@
#include "fir_filter.h"
#include "configuration_interface.h"
#include <boost/lexical_cast.hpp>
#include <utility>
#include <gnuradio/filter/pm_remez.h>
#include <glog/logging.h>
#include <volk/volk.h>
@ -40,11 +40,11 @@
using google::LogMessage;
FirFilter::FirFilter(ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams) : config_(configuration), role_(role), in_streams_(in_streams), out_streams_(out_streams)
unsigned int in_streams, unsigned int out_streams) : config_(configuration), role_(std::move(role)), in_streams_(in_streams), out_streams_(out_streams)
{
size_t item_size;
(*this).init();
if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("gr_complex") == 0) && (output_item_type_.compare("gr_complex") == 0))
if ((taps_item_type_ == "float") && (input_item_type_ == "gr_complex") && (output_item_type_ == "gr_complex"))
{
item_size = sizeof(gr_complex);
fir_filter_ccf_ = gr::filter::fir_filter_ccf::make(1, taps_);
@ -55,7 +55,7 @@ FirFilter::FirFilter(ConfigurationInterface* configuration, std::string role,
file_sink_ = gr::blocks::file_sink::make(item_size, dump_filename_.c_str());
}
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cshort") == 0) && (output_item_type_.compare("cshort") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "cshort") && (output_item_type_ == "cshort"))
{
item_size = sizeof(lv_16sc_t);
cshort_to_float_x2_ = make_cshort_to_float_x2();
@ -72,7 +72,7 @@ FirFilter::FirFilter(ConfigurationInterface* configuration, std::string role,
file_sink_ = gr::blocks::file_sink::make(item_size, dump_filename_.c_str());
}
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cshort") == 0) && (output_item_type_.compare("gr_complex") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "cshort") && (output_item_type_ == "gr_complex"))
{
item_size = sizeof(gr_complex);
cshort_to_float_x2_ = make_cshort_to_float_x2();
@ -88,7 +88,7 @@ FirFilter::FirFilter(ConfigurationInterface* configuration, std::string role,
}
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cbyte") == 0) && (output_item_type_.compare("gr_complex") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "cbyte") && (output_item_type_ == "gr_complex"))
{
item_size = sizeof(gr_complex);
cbyte_to_float_x2_ = make_complex_byte_to_float_x2();
@ -106,7 +106,7 @@ FirFilter::FirFilter(ConfigurationInterface* configuration, std::string role,
file_sink_ = gr::blocks::file_sink::make(item_size, dump_filename_.c_str());
}
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cbyte") == 0) && (output_item_type_.compare("cbyte") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "cbyte") && (output_item_type_ == "cbyte"))
{
item_size = sizeof(lv_8sc_t);
cbyte_to_float_x2_ = make_complex_byte_to_float_x2();
@ -147,7 +147,7 @@ FirFilter::~FirFilter() = default;
void FirFilter::connect(gr::top_block_sptr top_block)
{
if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("gr_complex") == 0) && (output_item_type_.compare("gr_complex") == 0))
if ((taps_item_type_ == "float") && (input_item_type_ == "gr_complex") && (output_item_type_ == "gr_complex"))
{
if (dump_)
{
@ -158,7 +158,7 @@ void FirFilter::connect(gr::top_block_sptr top_block)
DLOG(INFO) << "Nothing to connect internally";
}
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cshort") == 0) && (output_item_type_.compare("cshort") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "cshort") && (output_item_type_ == "cshort"))
{
top_block->connect(cshort_to_float_x2_, 0, fir_filter_fff_1_, 0);
top_block->connect(cshort_to_float_x2_, 1, fir_filter_fff_2_, 0);
@ -171,7 +171,7 @@ void FirFilter::connect(gr::top_block_sptr top_block)
top_block->connect(short_x2_to_cshort_, 0, file_sink_, 0);
}
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cbyte") == 0) && (output_item_type_.compare("gr_complex") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "cbyte") && (output_item_type_ == "gr_complex"))
{
top_block->connect(cbyte_to_float_x2_, 0, fir_filter_fff_1_, 0);
top_block->connect(cbyte_to_float_x2_, 1, fir_filter_fff_2_, 0);
@ -182,7 +182,7 @@ void FirFilter::connect(gr::top_block_sptr top_block)
top_block->connect(float_to_complex_, 0, file_sink_, 0);
}
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cbyte") == 0) && (output_item_type_.compare("cbyte") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "cbyte") && (output_item_type_ == "cbyte"))
{
top_block->connect(cbyte_to_float_x2_, 0, fir_filter_fff_1_, 0);
top_block->connect(cbyte_to_float_x2_, 1, fir_filter_fff_2_, 0);
@ -195,7 +195,7 @@ void FirFilter::connect(gr::top_block_sptr top_block)
top_block->connect(char_x2_cbyte_, 0, file_sink_, 0);
}
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cshort") == 0) && (output_item_type_.compare("gr_complex") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "cshort") && (output_item_type_ == "gr_complex"))
{
top_block->connect(cshort_to_float_x2_, 0, fir_filter_fff_1_, 0);
top_block->connect(cshort_to_float_x2_, 1, fir_filter_fff_2_, 0);
@ -215,14 +215,14 @@ void FirFilter::connect(gr::top_block_sptr top_block)
void FirFilter::disconnect(gr::top_block_sptr top_block)
{
if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("gr_complex") == 0) && (output_item_type_.compare("gr_complex") == 0))
if ((taps_item_type_ == "float") && (input_item_type_ == "gr_complex") && (output_item_type_ == "gr_complex"))
{
if (dump_)
{
top_block->disconnect(fir_filter_ccf_, 0, file_sink_, 0);
}
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cbyte") == 0) && (output_item_type_.compare("gr_complex") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "cbyte") && (output_item_type_ == "gr_complex"))
{
top_block->disconnect(fir_filter_fff_2_, 0, float_to_complex_, 1);
top_block->disconnect(fir_filter_fff_1_, 0, float_to_complex_, 0);
@ -233,7 +233,7 @@ void FirFilter::disconnect(gr::top_block_sptr top_block)
top_block->disconnect(float_to_complex_, 0, file_sink_, 0);
}
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cshort") == 0) && (output_item_type_.compare("cshort") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "cshort") && (output_item_type_ == "cshort"))
{
top_block->disconnect(cshort_to_float_x2_, 0, fir_filter_fff_1_, 0);
top_block->disconnect(cshort_to_float_x2_, 1, fir_filter_fff_2_, 0);
@ -246,7 +246,7 @@ void FirFilter::disconnect(gr::top_block_sptr top_block)
top_block->disconnect(short_x2_to_cshort_, 0, file_sink_, 0);
}
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cbyte") == 0) && (output_item_type_.compare("cbyte") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "cbyte") && (output_item_type_ == "cbyte"))
{
top_block->disconnect(float_to_char_2_, 0, char_x2_cbyte_, 1);
top_block->disconnect(float_to_char_1_, 0, char_x2_cbyte_, 0);
@ -259,7 +259,7 @@ void FirFilter::disconnect(gr::top_block_sptr top_block)
top_block->disconnect(char_x2_cbyte_, 0, file_sink_, 0);
}
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cshort") == 0) && (output_item_type_.compare("gr_complex") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "cshort") && (output_item_type_ == "gr_complex"))
{
top_block->disconnect(cshort_to_float_x2_, 0, fir_filter_fff_1_, 0);
top_block->disconnect(cshort_to_float_x2_, 1, fir_filter_fff_2_, 0);
@ -279,23 +279,23 @@ void FirFilter::disconnect(gr::top_block_sptr top_block)
gr::basic_block_sptr FirFilter::get_left_block()
{
if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("gr_complex") == 0) && (output_item_type_.compare("gr_complex") == 0))
if ((taps_item_type_ == "float") && (input_item_type_ == "gr_complex") && (output_item_type_ == "gr_complex"))
{
return fir_filter_ccf_;
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cshort") == 0) && (output_item_type_.compare("cshort") == 0))
if ((taps_item_type_ == "float") && (input_item_type_ == "cshort") && (output_item_type_ == "cshort"))
{
return cshort_to_float_x2_;
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cbyte") == 0) && (output_item_type_.compare("gr_complex") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "cbyte") && (output_item_type_ == "gr_complex"))
{
return cbyte_to_float_x2_;
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cbyte") == 0) && (output_item_type_.compare("cbyte") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "cbyte") && (output_item_type_ == "cbyte"))
{
return cbyte_to_float_x2_;
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cshort") == 0) && (output_item_type_.compare("gr_complex") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "cshort") && (output_item_type_ == "gr_complex"))
{
return cshort_to_float_x2_;
}
@ -309,23 +309,23 @@ gr::basic_block_sptr FirFilter::get_left_block()
gr::basic_block_sptr FirFilter::get_right_block()
{
if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("gr_complex") == 0) && (output_item_type_.compare("gr_complex") == 0))
if ((taps_item_type_ == "float") && (input_item_type_ == "gr_complex") && (output_item_type_ == "gr_complex"))
{
return fir_filter_ccf_;
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cshort") == 0) && (output_item_type_.compare("cshort") == 0))
if ((taps_item_type_ == "float") && (input_item_type_ == "cshort") && (output_item_type_ == "cshort"))
{
return short_x2_to_cshort_;
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cbyte") == 0) && (output_item_type_.compare("gr_complex") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "cbyte") && (output_item_type_ == "gr_complex"))
{
return float_to_complex_;
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cbyte") == 0) && (output_item_type_.compare("cbyte") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "cbyte") && (output_item_type_ == "cbyte"))
{
return char_x2_cbyte_;
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cshort") == 0) && (output_item_type_.compare("gr_complex") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "cshort") && (output_item_type_ == "gr_complex"))
{
return float_to_complex_;
}
@ -368,23 +368,23 @@ void FirFilter::init()
double option_value;
for (unsigned int i = 0; i < number_of_bands; i++)
{
option = ".band" + boost::lexical_cast<std::string>(i + 1) + "_begin";
option = ".band" + std::to_string(i + 1) + "_begin";
option_value = config_->property(role_ + option, default_bands[i]);
bands.push_back(option_value);
option = ".band" + boost::lexical_cast<std::string>(i + 1) + "_end";
option = ".band" + std::to_string(i + 1) + "_end";
option_value = config_->property(role_ + option, default_bands[i]);
bands.push_back(option_value);
option = ".ampl" + boost::lexical_cast<std::string>(i + 1) + "_begin";
option = ".ampl" + std::to_string(i + 1) + "_begin";
option_value = config_->property(role_ + option, default_bands[i]);
ampl.push_back(option_value);
option = ".ampl" + boost::lexical_cast<std::string>(i + 1) + "_end";
option = ".ampl" + std::to_string(i + 1) + "_end";
option_value = config_->property(role_ + option, default_bands[i]);
ampl.push_back(option_value);
option = ".band" + boost::lexical_cast<std::string>(i + 1) + "_error";
option = ".band" + std::to_string(i + 1) + "_error";
option_value = config_->property(role_ + option, default_bands[i]);
error_w.push_back(option_value);
}
@ -398,8 +398,8 @@ void FirFilter::init()
// those bands, and the weight given to the error in those bands.
std::vector<double> taps_d = gr::filter::pm_remez(number_of_taps - 1, bands, ampl, error_w, filter_type, grid_density);
taps_.reserve(taps_d.size());
for (std::vector<double>::iterator it = taps_d.begin(); it != taps_d.end(); it++)
for (double& it : taps_d)
{
taps_.push_back(float(*it));
taps_.push_back(float(it));
}
}

View File

@ -31,7 +31,7 @@
#include "freq_xlating_fir_filter.h"
#include "configuration_interface.h"
#include <boost/lexical_cast.hpp>
#include <utility>
#include <gnuradio/blocks/file_sink.h>
#include <gnuradio/filter/pm_remez.h>
#include <gnuradio/filter/firdes.h>
@ -41,7 +41,7 @@
using google::LogMessage;
FreqXlatingFirFilter::FreqXlatingFirFilter(ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams) : config_(configuration), role_(role), in_streams_(in_streams), out_streams_(out_streams)
unsigned int in_streams, unsigned int out_streams) : config_(configuration), role_(std::move(role)), in_streams_(in_streams), out_streams_(out_streams)
{
std::string default_input_item_type = "gr_complex";
std::string default_output_item_type = "gr_complex";
@ -72,7 +72,7 @@ FreqXlatingFirFilter::FreqXlatingFirFilter(ConfigurationInterface* configuration
std::string filter_type = config_->property(role_ + ".filter_type", default_filter_type);
decimation_factor_ = config_->property(role_ + ".decimation_factor", default_decimation_factor);
if (filter_type.compare("lowpass") != 0)
if (filter_type != "lowpass")
{
std::vector<double> taps_d;
std::vector<double> bands;
@ -83,23 +83,23 @@ FreqXlatingFirFilter::FreqXlatingFirFilter(ConfigurationInterface* configuration
for (unsigned int i = 0; i < number_of_bands; i++)
{
option = ".band" + boost::lexical_cast<std::string>(i + 1) + "_begin";
option = ".band" + std::to_string(i + 1) + "_begin";
option_value = config_->property(role_ + option, default_bands[i]);
bands.push_back(option_value);
option = ".band" + boost::lexical_cast<std::string>(i + 1) + "_end";
option = ".band" + std::to_string(i + 1) + "_end";
option_value = config_->property(role_ + option, default_bands[i]);
bands.push_back(option_value);
option = ".ampl" + boost::lexical_cast<std::string>(i + 1) + "_begin";
option = ".ampl" + std::to_string(i + 1) + "_begin";
option_value = config_->property(role_ + option, default_bands[i]);
ampl.push_back(option_value);
option = ".ampl" + boost::lexical_cast<std::string>(i + 1) + "_end";
option = ".ampl" + std::to_string(i + 1) + "_end";
option_value = config_->property(role_ + option, default_bands[i]);
ampl.push_back(option_value);
option = ".band" + boost::lexical_cast<std::string>(i + 1) + "_error";
option = ".band" + std::to_string(i + 1) + "_error";
option_value = config_->property(role_ + option, default_bands[i]);
error_w.push_back(option_value);
}
@ -107,9 +107,9 @@ FreqXlatingFirFilter::FreqXlatingFirFilter(ConfigurationInterface* configuration
int grid_density = config_->property(role_ + ".grid_density", default_grid_density);
taps_d = gr::filter::pm_remez(number_of_taps - 1, bands, ampl, error_w, filter_type, grid_density);
taps_.reserve(taps_d.size());
for (std::vector<double>::iterator it = taps_d.begin(); it != taps_d.end(); it++)
for (double& it : taps_d)
{
taps_.push_back(static_cast<float>(*it));
taps_.push_back(static_cast<float>(it));
}
}
else
@ -123,28 +123,28 @@ FreqXlatingFirFilter::FreqXlatingFirFilter(ConfigurationInterface* configuration
size_t item_size;
if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("gr_complex") == 0) && (output_item_type_.compare("gr_complex") == 0))
if ((taps_item_type_ == "float") && (input_item_type_ == "gr_complex") && (output_item_type_ == "gr_complex"))
{
item_size = sizeof(gr_complex); //output
input_size_ = sizeof(gr_complex); //input
freq_xlating_fir_filter_ccf_ = gr::filter::freq_xlating_fir_filter_ccf::make(decimation_factor_, taps_, intermediate_freq_, sampling_freq_);
DLOG(INFO) << "input_filter(" << freq_xlating_fir_filter_ccf_->unique_id() << ")";
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("float") == 0) && (output_item_type_.compare("gr_complex") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "float") && (output_item_type_ == "gr_complex"))
{
item_size = sizeof(gr_complex);
input_size_ = sizeof(float); //input
freq_xlating_fir_filter_fcf_ = gr::filter::freq_xlating_fir_filter_fcf::make(decimation_factor_, taps_, intermediate_freq_, sampling_freq_);
DLOG(INFO) << "input_filter(" << freq_xlating_fir_filter_fcf_->unique_id() << ")";
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("short") == 0) && (output_item_type_.compare("gr_complex") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "gr_complex"))
{
item_size = sizeof(gr_complex);
input_size_ = sizeof(int16_t); //input
freq_xlating_fir_filter_scf_ = gr::filter::freq_xlating_fir_filter_scf::make(decimation_factor_, taps_, intermediate_freq_, sampling_freq_);
DLOG(INFO) << "input_filter(" << freq_xlating_fir_filter_scf_->unique_id() << ")";
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("short") == 0) && (output_item_type_.compare("cshort") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "cshort"))
{
item_size = sizeof(lv_16sc_t);
input_size_ = sizeof(int16_t); //input
@ -155,7 +155,7 @@ FreqXlatingFirFilter::FreqXlatingFirFilter(ConfigurationInterface* configuration
float_to_short_2_ = gr::blocks::float_to_short::make();
short_x2_to_cshort_ = make_short_x2_to_cshort();
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("byte") == 0) && (output_item_type_.compare("gr_complex") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "byte") && (output_item_type_ == "gr_complex"))
{
item_size = sizeof(gr_complex);
input_size_ = sizeof(int8_t); //input
@ -163,7 +163,7 @@ FreqXlatingFirFilter::FreqXlatingFirFilter(ConfigurationInterface* configuration
freq_xlating_fir_filter_scf_ = gr::filter::freq_xlating_fir_filter_scf::make(decimation_factor_, taps_, intermediate_freq_, sampling_freq_);
DLOG(INFO) << "input_filter(" << freq_xlating_fir_filter_scf_->unique_id() << ")";
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("byte") == 0) && (output_item_type_.compare("cbyte") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "byte") && (output_item_type_ == "cbyte"))
{
item_size = sizeof(lv_8sc_t);
input_size_ = sizeof(int8_t); //input
@ -201,28 +201,28 @@ FreqXlatingFirFilter::~FreqXlatingFirFilter() = default;
void FreqXlatingFirFilter::connect(gr::top_block_sptr top_block)
{
if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("gr_complex") == 0) && (output_item_type_.compare("gr_complex") == 0))
if ((taps_item_type_ == "float") && (input_item_type_ == "gr_complex") && (output_item_type_ == "gr_complex"))
{
if (dump_)
{
top_block->connect(freq_xlating_fir_filter_ccf_, 0, file_sink_, 0);
}
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("float") == 0) && (output_item_type_.compare("gr_complex") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "float") && (output_item_type_ == "gr_complex"))
{
if (dump_)
{
top_block->connect(freq_xlating_fir_filter_fcf_, 0, file_sink_, 0);
}
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("short") == 0) && (output_item_type_.compare("gr_complex") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "gr_complex"))
{
if (dump_)
{
top_block->connect(freq_xlating_fir_filter_scf_, 0, file_sink_, 0);
}
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("short") == 0) && (output_item_type_.compare("cshort") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "cshort"))
{
top_block->connect(freq_xlating_fir_filter_scf_, 0, complex_to_float_, 0);
top_block->connect(complex_to_float_, 0, float_to_short_1_, 0);
@ -234,7 +234,7 @@ void FreqXlatingFirFilter::connect(gr::top_block_sptr top_block)
top_block->connect(short_x2_to_cshort_, 0, file_sink_, 0);
}
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("byte") == 0) && (output_item_type_.compare("gr_complex") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "byte") && (output_item_type_ == "gr_complex"))
{
top_block->connect(gr_char_to_short_, 0, freq_xlating_fir_filter_scf_, 0);
if (dump_)
@ -242,7 +242,7 @@ void FreqXlatingFirFilter::connect(gr::top_block_sptr top_block)
top_block->connect(freq_xlating_fir_filter_scf_, 0, file_sink_, 0);
}
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("byte") == 0) && (output_item_type_.compare("cbyte") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "byte") && (output_item_type_ == "cbyte"))
{
top_block->connect(gr_char_to_short_, 0, freq_xlating_fir_filter_scf_, 0);
top_block->connect(freq_xlating_fir_filter_scf_, 0, complex_to_complex_byte_, 0);
@ -260,28 +260,28 @@ void FreqXlatingFirFilter::connect(gr::top_block_sptr top_block)
void FreqXlatingFirFilter::disconnect(gr::top_block_sptr top_block)
{
if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("gr_complex") == 0) && (output_item_type_.compare("gr_complex") == 0))
if ((taps_item_type_ == "float") && (input_item_type_ == "gr_complex") && (output_item_type_ == "gr_complex"))
{
if (dump_)
{
top_block->disconnect(freq_xlating_fir_filter_ccf_, 0, file_sink_, 0);
}
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("float") == 0) && (output_item_type_.compare("gr_complex") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "float") && (output_item_type_ == "gr_complex"))
{
if (dump_)
{
top_block->disconnect(freq_xlating_fir_filter_fcf_, 0, file_sink_, 0);
}
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("short") == 0) && (output_item_type_.compare("gr_complex") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "gr_complex"))
{
if (dump_)
{
top_block->disconnect(freq_xlating_fir_filter_scf_, 0, file_sink_, 0);
}
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("short") == 0) && (output_item_type_.compare("cshort") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "cshort"))
{
top_block->disconnect(freq_xlating_fir_filter_scf_, 0, complex_to_float_, 0);
top_block->disconnect(complex_to_float_, 0, float_to_short_1_, 0);
@ -293,7 +293,7 @@ void FreqXlatingFirFilter::disconnect(gr::top_block_sptr top_block)
top_block->disconnect(short_x2_to_cshort_, 0, file_sink_, 0);
}
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("byte") == 0) && (output_item_type_.compare("gr_complex") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "byte") && (output_item_type_ == "gr_complex"))
{
top_block->disconnect(gr_char_to_short_, 0, freq_xlating_fir_filter_scf_, 0);
if (dump_)
@ -301,7 +301,7 @@ void FreqXlatingFirFilter::disconnect(gr::top_block_sptr top_block)
top_block->disconnect(freq_xlating_fir_filter_scf_, 0, file_sink_, 0);
}
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("byte") == 0) && (output_item_type_.compare("cbyte") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "byte") && (output_item_type_ == "cbyte"))
{
top_block->disconnect(gr_char_to_short_, 0, freq_xlating_fir_filter_scf_, 0);
top_block->disconnect(freq_xlating_fir_filter_scf_, 0, complex_to_complex_byte_, 0);
@ -319,27 +319,27 @@ void FreqXlatingFirFilter::disconnect(gr::top_block_sptr top_block)
gr::basic_block_sptr FreqXlatingFirFilter::get_left_block()
{
if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("gr_complex") == 0) && (output_item_type_.compare("gr_complex") == 0))
if ((taps_item_type_ == "float") && (input_item_type_ == "gr_complex") && (output_item_type_ == "gr_complex"))
{
return freq_xlating_fir_filter_ccf_;
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("float") == 0) && (output_item_type_.compare("gr_complex") == 0))
if ((taps_item_type_ == "float") && (input_item_type_ == "float") && (output_item_type_ == "gr_complex"))
{
return freq_xlating_fir_filter_fcf_;
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("short") == 0) && (output_item_type_.compare("gr_complex") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "gr_complex"))
{
return freq_xlating_fir_filter_scf_;
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("short") == 0) && (output_item_type_.compare("cshort") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "cshort"))
{
return freq_xlating_fir_filter_scf_;
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("byte") == 0) && (output_item_type_.compare("gr_complex") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "byte") && (output_item_type_ == "gr_complex"))
{
return gr_char_to_short_;
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("byte") == 0) && (output_item_type_.compare("cbyte") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "byte") && (output_item_type_ == "cbyte"))
{
return gr_char_to_short_;
}
@ -353,27 +353,27 @@ gr::basic_block_sptr FreqXlatingFirFilter::get_left_block()
gr::basic_block_sptr FreqXlatingFirFilter::get_right_block()
{
if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("gr_complex") == 0) && (output_item_type_.compare("gr_complex") == 0))
if ((taps_item_type_ == "float") && (input_item_type_ == "gr_complex") && (output_item_type_ == "gr_complex"))
{
return freq_xlating_fir_filter_ccf_;
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("float") == 0) && (output_item_type_.compare("gr_complex") == 0))
if ((taps_item_type_ == "float") && (input_item_type_ == "float") && (output_item_type_ == "gr_complex"))
{
return freq_xlating_fir_filter_fcf_;
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("short") == 0) && (output_item_type_.compare("gr_complex") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "gr_complex"))
{
return freq_xlating_fir_filter_scf_;
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("short") == 0) && (output_item_type_.compare("cshort") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "cshort"))
{
return short_x2_to_cshort_;
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("byte") == 0) && (output_item_type_.compare("gr_complex") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "byte") && (output_item_type_ == "gr_complex"))
{
return freq_xlating_fir_filter_scf_;
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("byte") == 0) && (output_item_type_.compare("cbyte") == 0))
else if ((taps_item_type_ == "float") && (input_item_type_ == "byte") && (output_item_type_ == "cbyte"))
{
return complex_to_complex_byte_;
}

View File

@ -38,7 +38,7 @@
using google::LogMessage;
NotchFilter::NotchFilter(ConfigurationInterface* configuration, std::string role,
NotchFilter::NotchFilter(ConfigurationInterface* configuration, const std::string& role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
{
size_t item_size_;
@ -63,7 +63,7 @@ NotchFilter::NotchFilter(ConfigurationInterface* configuration, std::string role
length_ = configuration->property(role + ".length", default_length_);
n_segments_est = configuration->property(role + ".segments_est", default_n_segments_est);
n_segments_reset = configuration->property(role + ".segments_reset", default_n_segments_reset);
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
item_size_ = sizeof(gr_complex);
notch_filter_ = make_notch_filter(pfa, p_c_factor, length_, n_segments_est, n_segments_reset);

View File

@ -45,7 +45,7 @@ class NotchFilter : public GNSSBlockInterface
{
public:
NotchFilter(ConfigurationInterface* configuration,
std::string role, unsigned int in_streams,
const std::string& role, unsigned int in_streams,
unsigned int out_streams);
virtual ~NotchFilter();

View File

@ -38,7 +38,7 @@
using google::LogMessage;
NotchFilterLite::NotchFilterLite(ConfigurationInterface* configuration, std::string role,
NotchFilterLite::NotchFilterLite(ConfigurationInterface* configuration, const std::string& role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
{
size_t item_size_;
@ -70,7 +70,7 @@ NotchFilterLite::NotchFilterLite(ConfigurationInterface* configuration, std::str
n_segments_reset = configuration->property(role + ".segments_reset", default_n_segments_reset);
int n_segments_coeff = static_cast<int>((samp_freq / coeff_rate) / static_cast<float>(length_));
n_segments_coeff = std::max(1, n_segments_coeff);
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
item_size_ = sizeof(gr_complex);
notch_filter_lite_ = make_notch_filter_lite(p_c_factor, pfa, length_, n_segments_est, n_segments_reset, n_segments_coeff);

View File

@ -45,7 +45,7 @@ class NotchFilterLite : public GNSSBlockInterface
{
public:
NotchFilterLite(ConfigurationInterface* configuration,
std::string role, unsigned int in_streams,
const std::string& role, unsigned int in_streams,
unsigned int out_streams);
virtual ~NotchFilterLite();

View File

@ -33,13 +33,14 @@
#include <boost/lexical_cast.hpp>
#include <glog/logging.h>
#include <gnuradio/filter/firdes.h>
#include <utility>
#include <vector>
#include <cmath>
using google::LogMessage;
PulseBlankingFilter::PulseBlankingFilter(ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams) : config_(configuration), role_(role), in_streams_(in_streams), out_streams_(out_streams)
unsigned int in_streams, unsigned int out_streams) : config_(configuration), role_(std::move(role)), in_streams_(in_streams), out_streams_(out_streams)
{
size_t item_size;
xlat_ = false;
@ -61,7 +62,7 @@ PulseBlankingFilter::PulseBlankingFilter(ConfigurationInterface* configuration,
int n_segments_est = config_->property(role_ + ".segments_est", default_n_segments_est);
int default_n_segments_reset = 5000000;
int n_segments_reset = config_->property(role_ + ".segments_reset", default_n_segments_reset);
if (input_item_type_.compare("gr_complex") == 0)
if (input_item_type_ == "gr_complex")
{
item_size = sizeof(gr_complex); //output
input_size_ = sizeof(gr_complex); //input
@ -110,7 +111,7 @@ PulseBlankingFilter::~PulseBlankingFilter() = default;
void PulseBlankingFilter::connect(gr::top_block_sptr top_block)
{
if (input_item_type_.compare("gr_complex") == 0)
if (input_item_type_ == "gr_complex")
{
if (dump_)
{
@ -131,7 +132,7 @@ void PulseBlankingFilter::connect(gr::top_block_sptr top_block)
void PulseBlankingFilter::disconnect(gr::top_block_sptr top_block)
{
if (input_item_type_.compare("gr_complex") == 0)
if (input_item_type_ == "gr_complex")
{
if (dump_)
{
@ -151,34 +152,28 @@ void PulseBlankingFilter::disconnect(gr::top_block_sptr top_block)
gr::basic_block_sptr PulseBlankingFilter::get_left_block()
{
if (input_item_type_.compare("gr_complex") == 0)
if (input_item_type_ == "gr_complex")
{
if (xlat_)
{
return freq_xlating_;
}
else
{
return pulse_blanking_cc_;
}
return pulse_blanking_cc_;
}
else
{
return nullptr;
LOG(ERROR) << " Unknown input filter input/output item type conversion";
return nullptr;
}
}
gr::basic_block_sptr PulseBlankingFilter::get_right_block()
{
if (input_item_type_.compare("gr_complex") == 0)
if (input_item_type_ == "gr_complex")
{
return pulse_blanking_cc_;
}
else
{
return nullptr;
LOG(ERROR) << " Unknown input filter input/output item type conversion";
}
LOG(ERROR) << " Unknown input filter input/output item type conversion";
return nullptr;
}

View File

@ -69,7 +69,7 @@ beamformer::~beamformer()
int beamformer::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]);
auto *out = reinterpret_cast<gr_complex *>(output_items[0]);
// channel output buffers
// gr_complex *ch1 = (gr_complex *) input_items[0];
// gr_complex *ch2 = (gr_complex *) input_items[1];

View File

@ -86,9 +86,9 @@ Notch::~Notch()
void Notch::forecast(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items_required)
{
for (uint32_t aux = 0; aux < ninput_items_required.size(); aux++)
for (int & aux : ninput_items_required)
{
ninput_items_required[aux] = length_;
aux = length_;
}
}
@ -100,8 +100,8 @@ int Notch::general_work(int noutput_items, gr_vector_int &ninput_items __attribu
float sig2dB = 0.0;
float sig2lin = 0.0;
lv_32fc_t dot_prod_;
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]);
gr_complex *out = reinterpret_cast<gr_complex *>(output_items[0]);
const auto *in = reinterpret_cast<const gr_complex *>(input_items[0]);
auto *out = reinterpret_cast<gr_complex *>(output_items[0]);
in++;
while ((index_out + length_) < noutput_items)
{

View File

@ -89,9 +89,9 @@ NotchLite::~NotchLite()
void NotchLite::forecast(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items_required)
{
for (uint32_t aux = 0; aux < ninput_items_required.size(); aux++)
for (int & aux : ninput_items_required)
{
ninput_items_required[aux] = length_;
aux = length_;
}
}
@ -103,8 +103,8 @@ int NotchLite::general_work(int noutput_items, gr_vector_int &ninput_items __att
float sig2dB = 0.0;
float sig2lin = 0.0;
lv_32fc_t dot_prod_;
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]);
gr_complex *out = reinterpret_cast<gr_complex *>(output_items[0]);
const auto *in = reinterpret_cast<const gr_complex *>(input_items[0]);
auto *out = reinterpret_cast<gr_complex *>(output_items[0]);
in++;
while ((index_out + length_) < noutput_items)
{

View File

@ -79,9 +79,9 @@ pulse_blanking_cc::~pulse_blanking_cc()
void pulse_blanking_cc::forecast(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items_required)
{
for (uint32_t aux = 0; aux < ninput_items_required.size(); aux++)
for (int & aux : ninput_items_required)
{
ninput_items_required[aux] = length_;
aux = length_;
}
}
@ -89,9 +89,9 @@ void pulse_blanking_cc::forecast(int noutput_items __attribute__((unused)), gr_v
int pulse_blanking_cc::general_work(int noutput_items, gr_vector_int &ninput_items __attribute__((unused)),
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
{
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]);
gr_complex *out = reinterpret_cast<gr_complex *>(output_items[0]);
float *magnitude = static_cast<float *>(volk_malloc(noutput_items * sizeof(float), volk_get_alignment()));
const auto *in = reinterpret_cast<const gr_complex *>(input_items[0]);
auto *out = reinterpret_cast<gr_complex *>(output_items[0]);
auto *magnitude = static_cast<float *>(volk_malloc(noutput_items * sizeof(float), volk_get_alignment()));
volk_32fc_magnitude_squared_32f(magnitude, in, noutput_items);
int32_t sample_index = 0;
float segment_energy;

View File

@ -53,9 +53,9 @@ int byte_x2_to_complex_byte::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const int8_t *in0 = reinterpret_cast<const int8_t *>(input_items[0]);
const int8_t *in1 = reinterpret_cast<const int8_t *>(input_items[1]);
lv_8sc_t *out = reinterpret_cast<lv_8sc_t *>(output_items[0]);
const auto *in0 = reinterpret_cast<const int8_t *>(input_items[0]);
const auto *in1 = reinterpret_cast<const int8_t *>(input_items[1]);
auto *out = reinterpret_cast<lv_8sc_t *>(output_items[0]);
// This could be put into a volk kernel
int8_t real_part;
int8_t imag_part;

View File

@ -53,9 +53,9 @@ int complex_byte_to_float_x2::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const lv_8sc_t *in = reinterpret_cast<const lv_8sc_t *>(input_items[0]);
float *out0 = reinterpret_cast<float *>(output_items[0]);
float *out1 = reinterpret_cast<float *>(output_items[1]);
const auto *in = reinterpret_cast<const lv_8sc_t *>(input_items[0]);
auto *out0 = reinterpret_cast<float *>(output_items[0]);
auto *out1 = reinterpret_cast<float *>(output_items[1]);
const float scalar = 1;
volk_8ic_s32f_deinterleave_32f_x2(out0, out1, in, scalar, noutput_items);
return noutput_items;

View File

@ -53,8 +53,8 @@ int complex_float_to_complex_byte::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]);
lv_8sc_t *out = reinterpret_cast<lv_8sc_t *>(output_items[0]);
const auto *in = reinterpret_cast<const gr_complex *>(input_items[0]);
auto *out = reinterpret_cast<lv_8sc_t *>(output_items[0]);
volk_gnsssdr_32fc_convert_8ic(out, in, noutput_items);
return noutput_items;
}

View File

@ -52,8 +52,8 @@ int conjugate_cc::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]);
gr_complex *out = reinterpret_cast<gr_complex *>(output_items[0]);
const auto *in = reinterpret_cast<const gr_complex *>(input_items[0]);
auto *out = reinterpret_cast<gr_complex *>(output_items[0]);
volk_32fc_conjugate_32fc(out, in, noutput_items);
return noutput_items;
}

View File

@ -52,8 +52,8 @@ int conjugate_ic::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const lv_8sc_t *in = reinterpret_cast<const lv_8sc_t *>(input_items[0]);
lv_8sc_t *out = reinterpret_cast<lv_8sc_t *>(output_items[0]);
const auto *in = reinterpret_cast<const lv_8sc_t *>(input_items[0]);
auto *out = reinterpret_cast<lv_8sc_t *>(output_items[0]);
volk_gnsssdr_8ic_conjugate_8ic(out, in, noutput_items);
return noutput_items;
}

View File

@ -52,8 +52,8 @@ int conjugate_sc::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const lv_16sc_t *in = reinterpret_cast<const lv_16sc_t *>(input_items[0]);
lv_16sc_t *out = reinterpret_cast<lv_16sc_t *>(output_items[0]);
const auto *in = reinterpret_cast<const lv_16sc_t *>(input_items[0]);
auto *out = reinterpret_cast<lv_16sc_t *>(output_items[0]);
volk_gnsssdr_16ic_conjugate_16ic(out, in, noutput_items);
return noutput_items;
}

View File

@ -53,9 +53,9 @@ int cshort_to_float_x2::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const lv_16sc_t *in = reinterpret_cast<const lv_16sc_t *>(input_items[0]);
float *out0 = reinterpret_cast<float *>(output_items[0]);
float *out1 = reinterpret_cast<float *>(output_items[1]);
const auto *in = reinterpret_cast<const lv_16sc_t *>(input_items[0]);
auto *out0 = reinterpret_cast<float *>(output_items[0]);
auto *out1 = reinterpret_cast<float *>(output_items[1]);
const float scalar = 1;
volk_16ic_s32f_deinterleave_32f_x2(out0, out1, in, scalar, noutput_items);
return noutput_items;

View File

@ -51,17 +51,17 @@ void galileo_e1_code_gen_int(int* _dest, char _Signal[3], int32_t _prn)
if (_galileo_signal.rfind("1B") != std::string::npos && _galileo_signal.length() >= 2)
{
for (size_t i = 0; i < Galileo_E1_B_PRIMARY_CODE[prn].length(); i++)
for (char i : Galileo_E1_B_PRIMARY_CODE[prn])
{
hex_to_binary_converter(&_dest[index], Galileo_E1_B_PRIMARY_CODE[prn].at(i));
hex_to_binary_converter(&_dest[index], i);
index += 4;
}
}
else if (_galileo_signal.rfind("1C") != std::string::npos && _galileo_signal.length() >= 2)
{
for (size_t i = 0; i < Galileo_E1_C_PRIMARY_CODE[prn].length(); i++)
for (char i : Galileo_E1_C_PRIMARY_CODE[prn])
{
hex_to_binary_converter(&_dest[index], Galileo_E1_C_PRIMARY_CODE[prn].at(i));
hex_to_binary_converter(&_dest[index], i);
index += 4;
}
}
@ -71,7 +71,7 @@ void galileo_e1_code_gen_int(int* _dest, char _Signal[3], int32_t _prn)
void galileo_e1_sinboc_11_gen_int(int* _dest, int* _prn, uint32_t _length_out)
{
const uint32_t _length_in = Galileo_E1_B_CODE_LENGTH_CHIPS;
uint32_t _period = static_cast<uint32_t>(_length_out / _length_in);
auto _period = static_cast<uint32_t>(_length_out / _length_in);
for (uint32_t i = 0; i < _length_in; i++)
{
for (uint32_t j = 0; j < (_period / 2); j++)
@ -89,7 +89,7 @@ void galileo_e1_sinboc_11_gen_int(int* _dest, int* _prn, uint32_t _length_out)
void galileo_e1_sinboc_61_gen_int(int* _dest, int* _prn, uint32_t _length_out)
{
const uint32_t _length_in = Galileo_E1_B_CODE_LENGTH_CHIPS;
uint32_t _period = static_cast<uint32_t>(_length_out / _length_in);
auto _period = static_cast<uint32_t>(_length_out / _length_in);
for (uint32_t i = 0; i < _length_in; i++)
{
@ -108,7 +108,7 @@ void galileo_e1_sinboc_61_gen_int(int* _dest, int* _prn, uint32_t _length_out)
void galileo_e1_code_gen_sinboc11_float(float* _dest, char _Signal[3], uint32_t _prn)
{
std::string _galileo_signal = _Signal;
const uint32_t _codeLength = static_cast<uint32_t>(Galileo_E1_B_CODE_LENGTH_CHIPS);
const auto _codeLength = static_cast<uint32_t>(Galileo_E1_B_CODE_LENGTH_CHIPS);
int32_t primary_code_E1_chips[4092]; // _codeLength not accepted by Clang
galileo_e1_code_gen_int(primary_code_E1_chips, _Signal, _prn); //generate Galileo E1 code, 1 sample per chip
for (uint32_t i = 0; i < _codeLength; i++)
@ -159,8 +159,8 @@ void galileo_e1_code_gen_float_sampled(float* _dest, char _Signal[3],
std::string _galileo_signal = _Signal;
uint32_t _samplesPerCode;
const int32_t _codeFreqBasis = Galileo_E1_CODE_CHIP_RATE_HZ; // Hz
uint32_t _codeLength = static_cast<uint32_t>(Galileo_E1_B_CODE_LENGTH_CHIPS);
int32_t* primary_code_E1_chips = static_cast<int32_t*>(volk_gnsssdr_malloc(static_cast<uint32_t>(Galileo_E1_B_CODE_LENGTH_CHIPS) * sizeof(int32_t), volk_gnsssdr_get_alignment()));
auto _codeLength = static_cast<uint32_t>(Galileo_E1_B_CODE_LENGTH_CHIPS);
auto* primary_code_E1_chips = static_cast<int32_t*>(volk_gnsssdr_malloc(static_cast<uint32_t>(Galileo_E1_B_CODE_LENGTH_CHIPS) * sizeof(int32_t), volk_gnsssdr_get_alignment()));
_samplesPerCode = static_cast<uint32_t>(static_cast<double>(_fs) / (static_cast<double>(_codeFreqBasis) / static_cast<double>(_codeLength)));
const int32_t _samplesPerChip = (_cboc == true) ? 12 : 2;
@ -180,7 +180,7 @@ void galileo_e1_code_gen_float_sampled(float* _dest, char _Signal[3],
}
else
{
int32_t* _signal_E1_int = static_cast<int32_t*>(volk_gnsssdr_malloc(_codeLength * sizeof(int32_t), volk_gnsssdr_get_alignment()));
auto* _signal_E1_int = static_cast<int32_t*>(volk_gnsssdr_malloc(_codeLength * sizeof(int32_t), volk_gnsssdr_get_alignment()));
galileo_e1_sinboc_11_gen_int(_signal_E1_int, primary_code_E1_chips, _codeLength); // generate sinboc(1,1) 2 samples per chip
for (uint32_t ii = 0; ii < _codeLength; ++ii)
@ -192,7 +192,7 @@ void galileo_e1_code_gen_float_sampled(float* _dest, char _Signal[3],
if (_fs != _samplesPerChip * _codeFreqBasis)
{
float* _resampled_signal = new float[_samplesPerCode];
auto* _resampled_signal = new float[_samplesPerCode];
resampler(_signal_E1, _resampled_signal, _samplesPerChip * _codeFreqBasis, _fs,
_codeLength, _samplesPerCode); // resamples code to fs
@ -203,7 +203,7 @@ void galileo_e1_code_gen_float_sampled(float* _dest, char _Signal[3],
if (_galileo_signal.rfind("1C") != std::string::npos && _galileo_signal.length() >= 2 && _secondary_flag)
{
float* _signal_E1C_secondary = new float[static_cast<int32_t>(Galileo_E1_C_SECONDARY_CODE_LENGTH) * _samplesPerCode];
auto* _signal_E1C_secondary = new float[static_cast<int32_t>(Galileo_E1_C_SECONDARY_CODE_LENGTH) * _samplesPerCode];
for (uint32_t i = 0; i < static_cast<uint32_t>(Galileo_E1_C_SECONDARY_CODE_LENGTH); i++)
{
@ -235,7 +235,7 @@ void galileo_e1_code_gen_complex_sampled(std::complex<float>* _dest, char _Signa
{
std::string _galileo_signal = _Signal;
const int32_t _codeFreqBasis = Galileo_E1_CODE_CHIP_RATE_HZ; // Hz
uint32_t _samplesPerCode = static_cast<uint32_t>(static_cast<double>(_fs) /
auto _samplesPerCode = static_cast<uint32_t>(static_cast<double>(_fs) /
(static_cast<double>(_codeFreqBasis) / static_cast<double>(Galileo_E1_B_CODE_LENGTH_CHIPS)));
if (_galileo_signal.rfind("1C") != std::string::npos && _galileo_signal.length() >= 2 && _secondary_flag)
@ -243,7 +243,7 @@ void galileo_e1_code_gen_complex_sampled(std::complex<float>* _dest, char _Signa
_samplesPerCode *= static_cast<int32_t>(Galileo_E1_C_SECONDARY_CODE_LENGTH);
}
float* real_code = static_cast<float*>(volk_gnsssdr_malloc(_samplesPerCode * sizeof(float), volk_gnsssdr_get_alignment()));
auto* real_code = static_cast<float*>(volk_gnsssdr_malloc(_samplesPerCode * sizeof(float), volk_gnsssdr_get_alignment()));
galileo_e1_code_gen_float_sampled(real_code, _Signal, _cboc, _prn, _fs, _chip_shift, _secondary_flag);

View File

@ -108,7 +108,7 @@ void galileo_e5_a_code_gen_complex_sampled(std::complex<float>* _dest, char _Sig
const uint32_t _codeLength = Galileo_E5a_CODE_LENGTH_CHIPS;
const int32_t _codeFreqBasis = Galileo_E5a_CODE_CHIP_RATE_HZ;
std::complex<float>* _code = new std::complex<float>[_codeLength]();
auto* _code = new std::complex<float>[_codeLength]();
galileo_e5_a_code_gen_complex_primary(_code, _prn, _Signal);

View File

@ -79,9 +79,7 @@ bool gnss_sdr_create_directory(const std::string& foldername)
}
return true;
}
else
{
os_test_file.close();
return false;
}
os_test_file.close();
return false;
}

View File

@ -71,7 +71,7 @@ int gnss_sdr_sample_counter::work(int noutput_items __attribute__((unused)),
gr_vector_const_void_star &input_items __attribute__((unused)),
gr_vector_void_star &output_items)
{
Gnss_Synchro *out = reinterpret_cast<Gnss_Synchro *>(output_items[0]);
auto *out = reinterpret_cast<Gnss_Synchro *>(output_items[0]);
out[0] = Gnss_Synchro();
out[0].Flag_valid_symbol_output = false;
out[0].Flag_valid_word = false;

View File

@ -37,6 +37,7 @@
#include <gnuradio/io_signature.h>
#include <algorithm> // for min
#include <cstring> // for memcpy
#include <utility>
gnss_sdr_valve::gnss_sdr_valve(size_t sizeof_stream_item,
unsigned long long nitems,
@ -46,7 +47,7 @@ gnss_sdr_valve::gnss_sdr_valve(size_t sizeof_stream_item,
gr::io_signature::make(1, 1, sizeof_stream_item)),
d_nitems(nitems),
d_ncopied_items(0),
d_queue(queue),
d_queue(std::move(queue)),
d_stop_flowgraph(stop_flowgraph)
{
d_open_valve = false;
@ -55,14 +56,14 @@ gnss_sdr_valve::gnss_sdr_valve(size_t sizeof_stream_item,
boost::shared_ptr<gr::block> gnss_sdr_make_valve(size_t sizeof_stream_item, unsigned long long nitems, gr::msg_queue::sptr queue, bool stop_flowgraph)
{
boost::shared_ptr<gnss_sdr_valve> valve_(new gnss_sdr_valve(sizeof_stream_item, nitems, queue, stop_flowgraph));
boost::shared_ptr<gnss_sdr_valve> valve_(new gnss_sdr_valve(sizeof_stream_item, nitems, std::move(queue), stop_flowgraph));
return valve_;
}
boost::shared_ptr<gr::block> gnss_sdr_make_valve(size_t sizeof_stream_item, unsigned long long nitems, gr::msg_queue::sptr queue)
{
boost::shared_ptr<gnss_sdr_valve> valve_(new gnss_sdr_valve(sizeof_stream_item, nitems, queue, true));
boost::shared_ptr<gnss_sdr_valve> valve_(new gnss_sdr_valve(sizeof_stream_item, nitems, std::move(queue), true));
return valve_;
}
@ -81,7 +82,7 @@ int gnss_sdr_valve::work(int noutput_items,
{
if (d_ncopied_items >= d_nitems)
{
ControlMessageFactory *cmf = new ControlMessageFactory();
auto *cmf = new ControlMessageFactory();
d_queue->handle(cmf->GetQueueMessage(200, 0));
LOG(INFO) << "Stopping receiver, " << d_ncopied_items << " samples processed";
delete cmf;
@ -89,11 +90,8 @@ int gnss_sdr_valve::work(int noutput_items,
{
return -1; // Done!
}
else
{
usleep(1000000);
return 0; // do not produce or consume
}
usleep(1000000);
return 0; // do not produce or consume
}
unsigned long long n = std::min(d_nitems - d_ncopied_items, static_cast<long long unsigned int>(noutput_items));
if (n == 0) return 0;
@ -101,9 +99,7 @@ int gnss_sdr_valve::work(int noutput_items,
d_ncopied_items += n;
return n;
}
else
{
memcpy(output_items[0], input_items[0], noutput_items * input_signature()->sizeof_stream_item(0));
return noutput_items;
}
memcpy(output_items[0], input_items[0], noutput_items * input_signature()->sizeof_stream_item(0));
return noutput_items;
}

View File

@ -55,7 +55,7 @@ void gps_l2c_m_code(int32_t* _dest, uint32_t _prn)
void gps_l2c_m_code_gen_complex(std::complex<float>* _dest, uint32_t _prn)
{
int32_t* _code = new int32_t[GPS_L2_M_CODE_LENGTH_CHIPS];
auto* _code = new int32_t[GPS_L2_M_CODE_LENGTH_CHIPS];
if (_prn > 0 and _prn < 51)
{
@ -73,7 +73,7 @@ void gps_l2c_m_code_gen_complex(std::complex<float>* _dest, uint32_t _prn)
void gps_l2c_m_code_gen_float(float* _dest, uint32_t _prn)
{
int32_t* _code = new int32_t[GPS_L2_M_CODE_LENGTH_CHIPS];
auto* _code = new int32_t[GPS_L2_M_CODE_LENGTH_CHIPS];
if (_prn > 0 and _prn < 51)
{
@ -94,7 +94,7 @@ void gps_l2c_m_code_gen_float(float* _dest, uint32_t _prn)
*/
void gps_l2c_m_code_gen_complex_sampled(std::complex<float>* _dest, uint32_t _prn, int32_t _fs)
{
int32_t* _code = new int32_t[GPS_L2_M_CODE_LENGTH_CHIPS];
auto* _code = new int32_t[GPS_L2_M_CODE_LENGTH_CHIPS];
if (_prn > 0 and _prn < 51)
{
gps_l2c_m_code(_code, _prn);

View File

@ -44,12 +44,9 @@ std::deque<bool> l5i_xa_shift(std::deque<bool> xa)
{
return std::deque<bool>{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
}
else
{
std::deque<bool> out(xa.begin(), xa.end() - 1);
out.push_front(xa[12] xor xa[11] xor xa[9] xor xa[8]);
return out;
}
std::deque<bool> out(xa.begin(), xa.end() - 1);
out.push_front(xa[12] xor xa[11] xor xa[9] xor xa[8]);
return out;
}
@ -59,12 +56,9 @@ std::deque<bool> l5q_xa_shift(std::deque<bool> xa)
{
return std::deque<bool>{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
}
else
{
std::deque<bool> out(xa.begin(), xa.end() - 1);
out.push_front(xa[12] xor xa[11] xor xa[9] xor xa[8]);
return out;
}
std::deque<bool> out(xa.begin(), xa.end() - 1);
out.push_front(xa[12] xor xa[11] xor xa[9] xor xa[8]);
return out;
}
@ -182,7 +176,7 @@ void make_l5q(int32_t* _dest, int32_t prn)
void gps_l5i_code_gen_complex(std::complex<float>* _dest, uint32_t _prn)
{
int32_t* _code = new int32_t[GPS_L5i_CODE_LENGTH_CHIPS];
auto* _code = new int32_t[GPS_L5i_CODE_LENGTH_CHIPS];
if (_prn > 0 and _prn < 51)
{
@ -200,7 +194,7 @@ void gps_l5i_code_gen_complex(std::complex<float>* _dest, uint32_t _prn)
void gps_l5i_code_gen_float(float* _dest, uint32_t _prn)
{
int32_t* _code = new int32_t[GPS_L5i_CODE_LENGTH_CHIPS];
auto* _code = new int32_t[GPS_L5i_CODE_LENGTH_CHIPS];
if (_prn > 0 and _prn < 51)
{
@ -221,7 +215,7 @@ void gps_l5i_code_gen_float(float* _dest, uint32_t _prn)
*/
void gps_l5i_code_gen_complex_sampled(std::complex<float>* _dest, uint32_t _prn, int32_t _fs)
{
int32_t* _code = new int32_t[GPS_L5i_CODE_LENGTH_CHIPS];
auto* _code = new int32_t[GPS_L5i_CODE_LENGTH_CHIPS];
if (_prn > 0 and _prn < 51)
{
make_l5i(_code, _prn - 1);
@ -267,7 +261,7 @@ void gps_l5i_code_gen_complex_sampled(std::complex<float>* _dest, uint32_t _prn,
void gps_l5q_code_gen_complex(std::complex<float>* _dest, uint32_t _prn)
{
int32_t* _code = new int32_t[GPS_L5q_CODE_LENGTH_CHIPS];
auto* _code = new int32_t[GPS_L5q_CODE_LENGTH_CHIPS];
if (_prn > 0 and _prn < 51)
{
@ -285,7 +279,7 @@ void gps_l5q_code_gen_complex(std::complex<float>* _dest, uint32_t _prn)
void gps_l5q_code_gen_float(float* _dest, uint32_t _prn)
{
int32_t* _code = new int32_t[GPS_L5q_CODE_LENGTH_CHIPS];
auto* _code = new int32_t[GPS_L5q_CODE_LENGTH_CHIPS];
if (_prn > 0 and _prn < 51)
{
@ -306,7 +300,7 @@ void gps_l5q_code_gen_float(float* _dest, uint32_t _prn)
*/
void gps_l5q_code_gen_complex_sampled(std::complex<float>* _dest, uint32_t _prn, int32_t _fs)
{
int32_t* _code = new int32_t[GPS_L5q_CODE_LENGTH_CHIPS];
auto* _code = new int32_t[GPS_L5q_CODE_LENGTH_CHIPS];
if (_prn > 0 and _prn < 51)
{
make_l5q(_code, _prn - 1);

View File

@ -38,7 +38,7 @@
using google::LogMessage;
Pass_Through::Pass_Through(ConfigurationInterface* configuration, std::string role,
Pass_Through::Pass_Through(ConfigurationInterface* configuration, const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
in_streams_(in_streams),
@ -47,7 +47,7 @@ Pass_Through::Pass_Through(ConfigurationInterface* configuration, std::string ro
std::string default_item_type = "gr_complex";
std::string input_type = configuration->property(role + ".input_item_type", default_item_type);
std::string output_type = configuration->property(role + ".output_item_type", default_item_type);
if (input_type.compare(output_type) != 0)
if (input_type != output_type)
{
LOG(WARNING) << "input_item_type and output_item_type are different in a Pass_Through implementation! Taking "
<< input_type
@ -57,11 +57,11 @@ Pass_Through::Pass_Through(ConfigurationInterface* configuration, std::string ro
item_type_ = configuration->property(role + ".item_type", input_type);
inverted_spectrum = configuration->property(role + ".inverted_spectrum", false);
if (item_type_.compare("float") == 0)
if (item_type_ == "float")
{
item_size_ = sizeof(float);
}
else if (item_type_.compare("gr_complex") == 0)
else if (item_type_ == "gr_complex")
{
item_size_ = sizeof(gr_complex);
if (inverted_spectrum)
@ -69,15 +69,15 @@ Pass_Through::Pass_Through(ConfigurationInterface* configuration, std::string ro
conjugate_cc_ = make_conjugate_cc();
}
}
else if (item_type_.compare("short") == 0)
else if (item_type_ == "short")
{
item_size_ = sizeof(int16_t);
}
else if (item_type_.compare("ishort") == 0)
else if (item_type_ == "ishort")
{
item_size_ = sizeof(int16_t);
}
else if (item_type_.compare("cshort") == 0)
else if (item_type_ == "cshort")
{
item_size_ = sizeof(lv_16sc_t);
if (inverted_spectrum)
@ -85,15 +85,15 @@ Pass_Through::Pass_Through(ConfigurationInterface* configuration, std::string ro
conjugate_sc_ = make_conjugate_sc();
}
}
else if (item_type_.compare("byte") == 0)
else if (item_type_ == "byte")
{
item_size_ = sizeof(int8_t);
}
else if (item_type_.compare("ibyte") == 0)
else if (item_type_ == "ibyte")
{
item_size_ = sizeof(int8_t);
}
else if (item_type_.compare("cbyte") == 0)
else if (item_type_ == "cbyte")
{
item_size_ = sizeof(lv_8sc_t);
if (inverted_spectrum)
@ -145,15 +145,15 @@ gr::basic_block_sptr Pass_Through::get_left_block()
{
if (inverted_spectrum)
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
return conjugate_cc_;
}
else if (item_type_.compare("cshort") == 0)
if (item_type_ == "cshort")
{
return conjugate_sc_;
}
else if (item_type_.compare("cbyte") == 0)
else if (item_type_ == "cbyte")
{
return conjugate_ic_;
}
@ -172,15 +172,15 @@ gr::basic_block_sptr Pass_Through::get_right_block()
{
if (inverted_spectrum)
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
return conjugate_cc_;
}
else if (item_type_.compare("cshort") == 0)
if (item_type_ == "cshort")
{
return conjugate_sc_;
}
else if (item_type_.compare("cbyte") == 0)
else if (item_type_ == "cbyte")
{
return conjugate_ic_;
}

View File

@ -51,7 +51,7 @@ class Pass_Through : public GNSSBlockInterface
{
public:
Pass_Through(ConfigurationInterface* configuration,
std::string role,
const std::string& role,
unsigned int in_stream,
unsigned int out_stream);

View File

@ -51,7 +51,7 @@ obsd_t insert_obs_to_rtklib(obsd_t& rtklib_obs, const Gnss_Synchro& gnss_synchro
double CN0_dB_Hz_est = gnss_synchro.CN0_dB_hz;
if (CN0_dB_Hz_est > 63.75) CN0_dB_Hz_est = 63.75;
if (CN0_dB_Hz_est < 0.0) CN0_dB_Hz_est = 0.0;
unsigned char CN0_dB_Hz = static_cast<unsigned char>(std::round(CN0_dB_Hz_est / 0.25));
auto CN0_dB_Hz = static_cast<unsigned char>(std::round(CN0_dB_Hz_est / 0.25));
rtklib_obs.SNR[band] = CN0_dB_Hz;
//Galileo is the third satellite system for RTKLIB, so, add the required offset to discriminate Galileo ephemeris
switch (gnss_synchro.System)

View File

@ -400,18 +400,17 @@ void readtec(const char *file, nav_t *nav, int opt)
trace(2, "ionex file open error %s\n", efiles[i]);
continue;
}
else
/* read ionex header */
if (readionexh(fp, lats, lons, hgts, &rb, &nexp, dcb, rms) <= 0.0)
{
/* read ionex header */
if (readionexh(fp, lats, lons, hgts, &rb, &nexp, dcb, rms) <= 0.0)
{
trace(2, "ionex file format error %s\n", efiles[i]);
fclose(fp);
continue;
}
/* read ionex body */
readionexb(fp, lats, lons, hgts, rb, nexp, nav);
trace(2, "ionex file format error %s\n", efiles[i]);
fclose(fp);
continue;
}
/* read ionex body */
readionexb(fp, lats, lons, hgts, rb, nexp, nav);
fclose(fp);
}
for (i = 0; i < MAXEXFILE; i++) free(efiles[i]);

View File

@ -197,13 +197,11 @@ int search(int n, int m, const double *L, const double *D,
{
if (k == n - 1)
break;
else
{
k++;
z[k] += step[k];
y = zb[k] - z[k];
step[k] = -step[k] - SGN_LAMBDA(step[k]);
}
k++;
z[k] += step[k];
y = zb[k] - z[k];
step[k] = -step[k] - SGN_LAMBDA(step[k]);
}
}
for (i = 0; i < m - 1; i++)

View File

@ -243,7 +243,7 @@ double prange(const obsd_t *obs, const nav_t *nav, const double *azel,
return 0.0;
}
else if (obs->code[i] != CODE_NONE and obs->code[j] == CODE_NONE)
if (obs->code[i] != CODE_NONE and obs->code[j] == CODE_NONE)
{
P1 += P1_C1; /* C1->P1 */
PC = P1 - P1_P2;

View File

@ -250,7 +250,7 @@ void readsp3b(FILE *fp, char type, int *sats __attribute__((unused)), int ns, do
/* compare precise ephemeris -------------------------------------------------*/
int cmppeph(const void *p1, const void *p2)
{
peph_t *q1 = (peph_t *)p1, *q2 = (peph_t *)p2;
auto *q1 = (peph_t *)p1, *q2 = (peph_t *)p2;
double tt = timediff(q1->time, q2->time);
return tt < -1e-9 ? -1 : (tt > 1e-9 ? 1 : q1->index - q2->index);
}
@ -556,7 +556,7 @@ int readfcbf(const char *file, nav_t *nav)
/* compare satellite fcb -----------------------------------------------------*/
int cmpfcb(const void *p1, const void *p2)
{
fcbd_t *q1 = (fcbd_t *)p1, *q2 = (fcbd_t *)p2;
auto *q1 = (fcbd_t *)p1, *q2 = (fcbd_t *)p2;
double tt = timediff(q1->ts, q2->ts);
return tt < -1e-3 ? -1 : (tt > 1e-3 ? 1 : 0);
}

View File

@ -194,8 +194,8 @@ int input_rtcm2(rtcm_t *rtcm, unsigned char data)
}
if (++rtcm->nbit < 30)
continue;
else
rtcm->nbit = 0;
rtcm->nbit = 0;
/* check parity */
if (!decode_word(rtcm->word, rtcm->buff + rtcm->nbyte))

View File

@ -1775,11 +1775,9 @@ unsigned int tickget(void)
{
return tp.tv_sec * 1000u + tp.tv_nsec / 1000000u;
}
else
{
gettimeofday(&tv, nullptr);
return tv.tv_sec * 1000u + tv.tv_usec / 1000u;
}
gettimeofday(&tv, nullptr);
return tv.tv_sec * 1000u + tv.tv_usec / 1000u;
#else
gettimeofday(&tv, NULL);
return tv.tv_sec * 1000u + tv.tv_usec / 1000u;
@ -2731,7 +2729,7 @@ int geterp(const erp_t *erp, gtime_t time, double *erpv)
/* compare ephemeris ---------------------------------------------------------*/
int cmpeph(const void *p1, const void *p2)
{
eph_t *q1 = (eph_t *)p1, *q2 = (eph_t *)p2;
auto *q1 = (eph_t *)p1, *q2 = (eph_t *)p2;
return q1->ttr.time != q2->ttr.time ? (int)(q1->ttr.time - q2->ttr.time) : (q1->toe.time != q2->toe.time ? (int)(q1->toe.time - q2->toe.time) : q1->sat - q2->sat);
}
@ -2776,7 +2774,7 @@ void uniqeph(nav_t *nav)
/* compare glonass ephemeris -------------------------------------------------*/
int cmpgeph(const void *p1, const void *p2)
{
geph_t *q1 = (geph_t *)p1, *q2 = (geph_t *)p2;
auto *q1 = (geph_t *)p1, *q2 = (geph_t *)p2;
return q1->tof.time != q2->tof.time ? (int)(q1->tof.time - q2->tof.time) : (q1->toe.time != q2->toe.time ? (int)(q1->toe.time - q2->toe.time) : q1->sat - q2->sat);
}
@ -2822,7 +2820,7 @@ void uniqgeph(nav_t *nav)
/* compare sbas ephemeris ----------------------------------------------------*/
int cmpseph(const void *p1, const void *p2)
{
seph_t *q1 = (seph_t *)p1, *q2 = (seph_t *)p2;
auto *q1 = (seph_t *)p1, *q2 = (seph_t *)p2;
return q1->tof.time != q2->tof.time ? (int)(q1->tof.time - q2->tof.time) : (q1->t0.time != q2->t0.time ? (int)(q1->t0.time - q2->t0.time) : q1->sat - q2->sat);
}
@ -2892,7 +2890,7 @@ void uniqnav(nav_t *nav)
/* compare observation data -------------------------------------------------*/
int cmpobs(const void *p1, const void *p2)
{
obsd_t *q1 = (obsd_t *)p1, *q2 = (obsd_t *)p2;
auto *q1 = (obsd_t *)p1, *q2 = (obsd_t *)p2;
double tt = timediff(q1->time, q2->time);
if (fabs(tt) > DTTOL) return tt < 0 ? -1 : 1;
if (q1->rcv != q2->rcv) return (int)q1->rcv - (int)q2->rcv;
@ -3175,7 +3173,7 @@ void freenav(nav_t *nav, int opt)
/* debug trace functions -----------------------------------------------------*/
//#ifdef TRACE
//
FILE *fp_trace = nullptr; /* file pointer of trace */
FILE *fp_trace = nullptr; /* file pointer of trace */
char file_trace[1024]; /* trace file */
static int level_trace = 0; /* level of trace */
unsigned int tick_trace = 0; /* tick time at traceopen (ms) */
@ -3635,7 +3633,7 @@ double satwavelen(int sat, int frq, const nav_t *nav)
{
if (frq == 0)
return SPEED_OF_LIGHT / FREQ1_BDS; /* B1 */
else if (frq == 1)
if (frq == 1)
return SPEED_OF_LIGHT / FREQ2_BDS; /* B2 */
else if (frq == 2)
return SPEED_OF_LIGHT / FREQ3_BDS; /* B3 */
@ -3644,7 +3642,7 @@ double satwavelen(int sat, int frq, const nav_t *nav)
{
if (frq == 0)
return SPEED_OF_LIGHT / FREQ1; /* L1/E1 */
else if (frq == 1)
if (frq == 1)
return SPEED_OF_LIGHT / FREQ2; /* L2 */
else if (frq == 2)
return SPEED_OF_LIGHT / FREQ5; /* L5/E5a */
@ -3886,7 +3884,7 @@ double interpc(const double coef[], double lat)
int i = (int)(lat / 15.0);
if (i < 1)
return coef[0];
else if (i > 4)
if (i > 4)
return coef[4];
return coef[i - 1] * (1.0 - lat / 15.0 + i) + coef[i] * (lat / 15.0 - i);
}
@ -3999,7 +3997,7 @@ double interpvar(double ang, const double *var)
int i = (int)a;
if (i < 0)
return var[0];
else if (i >= 18)
if (i >= 18)
return var[18];
return var[i] * (1.0 - a + i) + var[i + 1] * (a - i);
}
@ -4213,7 +4211,7 @@ int rtk_uncompress(const char *file, char *uncfile)
{
strcpy(uncfile, tmpfile);
uncfile[p - tmpfile] = '\0';
sprintf(cmd, "gzip -f -d -c \"%s\" > \"%s\"", tmpfile, uncfile);
sprintf(cmd, R"(gzip -f -d -c "%s" > "%s")", tmpfile, uncfile);
if (execcmd(cmd))
{
@ -4262,7 +4260,7 @@ int rtk_uncompress(const char *file, char *uncfile)
{
strcpy(uncfile, tmpfile);
uncfile[p - tmpfile + 3] = *(p + 3) == 'D' ? 'O' : 'o';
sprintf(cmd, "crx2rnx < \"%s\" > \"%s\"", tmpfile, uncfile);
sprintf(cmd, R"(crx2rnx < "%s" > "%s")", tmpfile, uncfile);
if (execcmd(cmd))
{

View File

@ -67,7 +67,7 @@ static int resamb_TCAR(rtk_t *rtk __attribute((unused)), const obsd_t *obs __att
/* global variables ----------------------------------------------------------*/
static int statlevel = 0; /* rtk status output level (0:off) */
static FILE *fp_stat = nullptr; /* rtk status file pointer */
static FILE *fp_stat = nullptr; /* rtk status file pointer */
static char file_stat[1024] = ""; /* rtk status file original path */
static gtime_t time_stat = {0, 0}; /* rtk status file time */
@ -1616,8 +1616,7 @@ int ddmat(rtk_t *rtk, double *D)
rtk->ssat[i - k].fix[f] = 2; /* fix */
break;
}
else
rtk->ssat[i - k].fix[f] = 1;
rtk->ssat[i - k].fix[f] = 1;
}
for (j = k; j < k + MAXSAT; j++)
{

View File

@ -446,7 +446,7 @@ void decodefile(rtksvr_t *svr, int index)
/* rtk server thread ---------------------------------------------------------*/
void *rtksvrthread(void *arg)
{
rtksvr_t *svr = (rtksvr_t *)arg;
auto *svr = (rtksvr_t *)arg;
obs_t obs;
obsd_t data[MAXOBS * 2];
double tt;

View File

@ -603,7 +603,7 @@ void readmsgs(const char *file, int sel, gtime_t ts, gtime_t te,
/* compare sbas messages -----------------------------------------------------*/
int cmpmsgs(const void *p1, const void *p2)
{
sbsmsg_t *q1 = (sbsmsg_t *)p1, *q2 = (sbsmsg_t *)p2;
auto *q1 = (sbsmsg_t *)p1, *q2 = (sbsmsg_t *)p2;
return q1->week != q2->week ? q1->week - q2->week : (q1->tow < q2->tow ? -1 : (q1->tow > q2->tow ? 1 : q1->prn - q2->prn));
}

View File

@ -79,7 +79,7 @@ const char *opt2sep(const solopt_t *opt)
{
if (!*opt->sep)
return " ";
else if (!strcmp(opt->sep, "\\t"))
if (!strcmp(opt->sep, "\\t"))
return "\t";
return opt->sep;
}
@ -343,7 +343,7 @@ int decode_nmea(char *buff, sol_t *sol)
{
return decode_nmearmc(val + 1, n - 1, sol);
}
else if (!strcmp(val[0], "$GPGGA"))
if (!strcmp(val[0], "$GPGGA"))
{
return decode_nmeagga(val + 1, n - 1, sol);
}
@ -815,7 +815,7 @@ int readsoldata(FILE *fp, gtime_t ts, gtime_t te, double tint, int qflag,
/* compare solution data -----------------------------------------------------*/
int cmpsol(const void *p1, const void *p2)
{
sol_t *q1 = (sol_t *)p1, *q2 = (sol_t *)p2;
auto *q1 = (sol_t *)p1, *q2 = (sol_t *)p2;
double tt = timediff(q1->time, q2->time);
return tt < -0.0 ? -1 : (tt > 0.0 ? 1 : 0);
}
@ -1023,7 +1023,7 @@ void freesolstatbuf(solstatbuf_t *solstatbuf)
/* compare solution status ---------------------------------------------------*/
int cmpsolstat(const void *p1, const void *p2)
{
solstat_t *q1 = (solstat_t *)p1, *q2 = (solstat_t *)p2;
auto *q1 = (solstat_t *)p1, *q2 = (solstat_t *)p2;
double tt = timediff(q1->time, q2->time);
return tt < -0.0 ? -1 : (tt > 0.0 ? 1 : 0);
}

View File

@ -1227,7 +1227,7 @@ int rspntrip_s(ntrip_t *ntrip, char *msg)
tracet(2, "rspntrip_s: response ok nb=%d\n", ntrip->nb);
return 1;
}
else if ((p = strstr((char *)ntrip->buff, NTRIP_RSP_ERROR)))
if ((p = strstr((char *)ntrip->buff, NTRIP_RSP_ERROR)))
{ /* error */
nb = ntrip->nb < MAXSTATMSG ? ntrip->nb : MAXSTATMSG;
// strncpy(msg, (char *)ntrip->buff, nb); This line triggers a warning. Replaced by;
@ -1534,7 +1534,7 @@ gtime_t nextdltime(const int *topts, int stat)
/* ftp thread ----------------------------------------------------------------*/
void *ftpthread(void *arg)
{
ftp_t *ftp = (ftp_t *)arg;
auto *ftp = (ftp_t *)arg;
FILE *fp;
gtime_t time;
char remote[1024], local[1024], tmpfile[1024], errfile[1024], *p;
@ -2362,7 +2362,7 @@ void strsendcmd(stream_t *str, const char *cmd)
}
if (*q == '\0')
break;
else
p = q + 1;
p = q + 1;
}
}

View File

@ -53,9 +53,9 @@ int short_x2_to_cshort::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const short *in0 = reinterpret_cast<const short *>(input_items[0]);
const short *in1 = reinterpret_cast<const short *>(input_items[1]);
lv_16sc_t *out = reinterpret_cast<lv_16sc_t *>(output_items[0]);
const auto *in0 = reinterpret_cast<const short *>(input_items[0]);
const auto *in1 = reinterpret_cast<const short *>(input_items[1]);
auto *out = reinterpret_cast<lv_16sc_t *>(output_items[0]);
// This could be put into a volk kernel
short real_part;
short imag_part;

View File

@ -38,7 +38,7 @@
using google::LogMessage;
HybridObservables::HybridObservables(ConfigurationInterface* configuration,
std::string role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
const std::string& role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
{
std::string default_dump_filename = "./observables.dat";
DLOG(INFO) << "role " << role;

View File

@ -47,7 +47,7 @@ class HybridObservables : public ObservablesInterface
{
public:
HybridObservables(ConfigurationInterface* configuration,
std::string role,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);

View File

@ -42,6 +42,7 @@
#include <cstdlib>
#include <iostream>
#include <limits>
#include <utility>
using google::LogMessage;
@ -49,7 +50,7 @@ using google::LogMessage;
hybrid_observables_cc_sptr hybrid_make_observables_cc(unsigned int nchannels_in, unsigned int nchannels_out, bool dump, bool dump_mat, std::string dump_filename)
{
return hybrid_observables_cc_sptr(new hybrid_observables_cc(nchannels_in, nchannels_out, dump, dump_mat, dump_filename));
return hybrid_observables_cc_sptr(new hybrid_observables_cc(nchannels_in, nchannels_out, dump, dump_mat, std::move(dump_filename)));
}
@ -63,7 +64,7 @@ hybrid_observables_cc::hybrid_observables_cc(uint32_t nchannels_in,
{
d_dump = dump;
d_dump_mat = dump_mat and d_dump;
d_dump_filename = dump_filename;
d_dump_filename = std::move(dump_filename);
d_nchannels_out = nchannels_out;
d_nchannels_in = nchannels_in;
T_rx_clock_step_samples = 0U;
@ -74,10 +75,10 @@ hybrid_observables_cc::hybrid_observables_cc(uint32_t nchannels_in,
{
std::string dump_path;
// Get path
if (d_dump_filename.find_last_of("/") != std::string::npos)
if (d_dump_filename.find_last_of('/') != std::string::npos)
{
std::string dump_filename_ = d_dump_filename.substr(d_dump_filename.find_last_of("/") + 1);
dump_path = d_dump_filename.substr(0, d_dump_filename.find_last_of("/"));
std::string dump_filename_ = d_dump_filename.substr(d_dump_filename.find_last_of('/') + 1);
dump_path = d_dump_filename.substr(0, d_dump_filename.find_last_of('/'));
d_dump_filename = dump_filename_;
}
else
@ -89,9 +90,9 @@ hybrid_observables_cc::hybrid_observables_cc(uint32_t nchannels_in,
d_dump_filename = "observables.dat";
}
// remove extension if any
if (d_dump_filename.substr(1).find_last_of(".") != std::string::npos)
if (d_dump_filename.substr(1).find_last_of('.') != std::string::npos)
{
d_dump_filename = d_dump_filename.substr(0, d_dump_filename.find_last_of("."));
d_dump_filename = d_dump_filename.substr(0, d_dump_filename.find_last_of('.'));
}
d_dump_filename.append(".dat");
d_dump_filename = dump_path + boost::filesystem::path::preferred_separator + d_dump_filename;
@ -175,13 +176,13 @@ int32_t hybrid_observables_cc::save_matfile()
{
return 1;
}
double **RX_time = new double *[d_nchannels_out];
double **TOW_at_current_symbol_s = new double *[d_nchannels_out];
double **Carrier_Doppler_hz = new double *[d_nchannels_out];
double **Carrier_phase_cycles = new double *[d_nchannels_out];
double **Pseudorange_m = new double *[d_nchannels_out];
double **PRN = new double *[d_nchannels_out];
double **Flag_valid_pseudorange = new double *[d_nchannels_out];
auto **RX_time = new double *[d_nchannels_out];
auto **TOW_at_current_symbol_s = new double *[d_nchannels_out];
auto **Carrier_Doppler_hz = new double *[d_nchannels_out];
auto **Carrier_phase_cycles = new double *[d_nchannels_out];
auto **Pseudorange_m = new double *[d_nchannels_out];
auto **PRN = new double *[d_nchannels_out];
auto **Flag_valid_pseudorange = new double *[d_nchannels_out];
for (uint32_t i = 0; i < d_nchannels_out; i++)
{
@ -238,13 +239,13 @@ int32_t hybrid_observables_cc::save_matfile()
return 1;
}
double *RX_time_aux = new double[d_nchannels_out * num_epoch];
double *TOW_at_current_symbol_s_aux = new double[d_nchannels_out * num_epoch];
double *Carrier_Doppler_hz_aux = new double[d_nchannels_out * num_epoch];
double *Carrier_phase_cycles_aux = new double[d_nchannels_out * num_epoch];
double *Pseudorange_m_aux = new double[d_nchannels_out * num_epoch];
double *PRN_aux = new double[d_nchannels_out * num_epoch];
double *Flag_valid_pseudorange_aux = new double[d_nchannels_out * num_epoch];
auto *RX_time_aux = new double[d_nchannels_out * num_epoch];
auto *TOW_at_current_symbol_s_aux = new double[d_nchannels_out * num_epoch];
auto *Carrier_Doppler_hz_aux = new double[d_nchannels_out * num_epoch];
auto *Carrier_phase_cycles_aux = new double[d_nchannels_out * num_epoch];
auto *Pseudorange_m_aux = new double[d_nchannels_out * num_epoch];
auto *PRN_aux = new double[d_nchannels_out * num_epoch];
auto *Flag_valid_pseudorange_aux = new double[d_nchannels_out * num_epoch];
uint32_t k = 0U;
for (int64_t j = 0; j < num_epoch; j++)
{
@ -408,10 +409,7 @@ bool hybrid_observables_cc::interp_trk_obs(Gnss_Synchro &interpolated_obs, const
// << " ,diff: " << old_abs_diff << " samples (" << static_cast<double>(old_abs_diff) / static_cast<double>(d_gnss_synchro_history->at(ch, nearest_element).fs) << " s)\n";
return true;
}
else
{
return false;
}
return false;
}
else
{
@ -503,8 +501,8 @@ int hybrid_observables_cc::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)
{
const Gnss_Synchro **in = reinterpret_cast<const Gnss_Synchro **>(&input_items[0]);
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]);
const auto **in = reinterpret_cast<const Gnss_Synchro **>(&input_items[0]);
auto **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]);
// Push receiver clock into history buffer (connected to the last of the input channels)
// The clock buffer gives time to the channels to compute the tracking observables
@ -615,8 +613,5 @@ int hybrid_observables_cc::general_work(int noutput_items __attribute__((unused)
}
return 1;
}
else
{
return 0;
}
return 0;
}

View File

@ -43,7 +43,7 @@
using google::LogMessage;
DirectResamplerConditioner::DirectResamplerConditioner(
ConfigurationInterface* configuration, std::string role,
ConfigurationInterface* configuration, const std::string& role,
unsigned int in_stream, unsigned int out_stream) : role_(role), in_stream_(in_stream), out_stream_(out_stream)
{
std::string default_item_type = "short";
@ -64,7 +64,7 @@ DirectResamplerConditioner::DirectResamplerConditioner(
DLOG(INFO) << "dump_ is " << dump_;
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file);
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
item_size_ = sizeof(gr_complex);
resampler_ = direct_resampler_make_conditioner_cc(sample_freq_in_, sample_freq_out_);
@ -73,7 +73,7 @@ DirectResamplerConditioner::DirectResamplerConditioner(
DLOG(INFO) << "Item size " << item_size_;
DLOG(INFO) << "resampler(" << resampler_->unique_id() << ")";
}
else if (item_type_.compare("cshort") == 0)
else if (item_type_ == "cshort")
{
item_size_ = sizeof(lv_16sc_t);
resampler_ = direct_resampler_make_conditioner_cs(sample_freq_in_, sample_freq_out_);
@ -82,7 +82,7 @@ DirectResamplerConditioner::DirectResamplerConditioner(
DLOG(INFO) << "Item size " << item_size_;
DLOG(INFO) << "resampler(" << resampler_->unique_id() << ")";
}
else if (item_type_.compare("cbyte") == 0)
else if (item_type_ == "cbyte")
{
item_size_ = sizeof(lv_8sc_t);
resampler_ = direct_resampler_make_conditioner_cb(sample_freq_in_, sample_freq_out_);

View File

@ -47,7 +47,7 @@ class DirectResamplerConditioner : public GNSSBlockInterface
{
public:
DirectResamplerConditioner(ConfigurationInterface* configuration,
std::string role, unsigned int in_stream,
const std::string& role, unsigned int in_stream,
unsigned int out_stream);
virtual ~DirectResamplerConditioner();

View File

@ -39,7 +39,7 @@
using google::LogMessage;
MmseResamplerConditioner::MmseResamplerConditioner(
ConfigurationInterface* configuration, std::string role,
ConfigurationInterface* configuration, const std::string& role,
unsigned int in_stream, unsigned int out_stream) : role_(role), in_stream_(in_stream), out_stream_(out_stream)
{
std::string default_item_type = "gr_complex";
@ -60,7 +60,7 @@ MmseResamplerConditioner::MmseResamplerConditioner(
DLOG(INFO) << "dump_ is " << dump_;
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file);
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
item_size_ = sizeof(gr_complex);

View File

@ -55,7 +55,7 @@ class MmseResamplerConditioner : public GNSSBlockInterface
{
public:
MmseResamplerConditioner(ConfigurationInterface* configuration,
std::string role, unsigned int in_stream,
const std::string& role, unsigned int in_stream,
unsigned int out_stream);
virtual ~MmseResamplerConditioner();

Some files were not shown because too many files have changed in this diff Show More