diff --git a/CMakeLists.txt b/CMakeLists.txt
index 05207272c..0b3d443cc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -97,9 +97,16 @@ option(ENABLE_SYSTEM_TESTING "Build system tests" OFF)
option(ENABLE_SYSTEM_TESTING_EXTRA "Download external tools and build extra system tests" OFF)
+option(ENABLE_GNSS_SIM_INSTALL "Enable the installation of gnss_sim on the fly" ON)
+
+if(NOT (ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA))
+ set(ENABLE_GNSS_SIM_INSTALL OFF)
+endif()
+
if(ENABLE_SYSTEM_TESTING_EXTRA)
set(ENABLE_SYSTEM_TESTING ON)
endif()
+
option(ENABLE_OWN_GPSTK "Force to download, build and link GPSTk for system tests, even if it is already installed" OFF)
option(ENABLE_INSTALL_TESTS "Install QA code system-wide" OFF)
@@ -2026,7 +2033,7 @@ if(DOXYGEN_FOUND)
else()
message(STATUS " Doxygen has not been found in your system.")
message(STATUS " You can get nice code documentation by using it!")
- message(STATUS " Get it from http://www.stack.nl/~dimitri/doxygen/index.html")
+ message(STATUS " Get it from http://www.doxygen.nl/download.html")
if(OS_IS_LINUX)
if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat")
message(STATUS " or simply by doing 'sudo yum install doxygen-latex'.")
@@ -2466,6 +2473,7 @@ add_feature_info(ENABLE_UNIT_TESTING_EXTRA ENABLE_UNIT_TESTING_EXTRA "Enables bu
add_feature_info(ENABLE_SYSTEM_TESTING ENABLE_SYSTEM_TESTING "Enables building of System Tests.")
add_feature_info(ENABLE_SYSTEM_TESTING_EXTRA ENABLE_SYSTEM_TESTING_EXTRA "Enables building of Extra System Tests and downloading of external tools.")
add_feature_info(ENABLE_OWN_GPSTK ENABLE_OWN_GPSTK "Forces the downloading and building of GPSTk for system tests.")
+add_feature_info(ENABLE_GNSS_SIM_INSTALL ENABLE_GNSS_SIM_INSTALL "Enables downloading and building of gnss-sim.")
add_feature_info(ENABLE_INSTALL_TESTS ENABLE_INSTALL_TESTS "Install test binaries when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME} install'.")
message(STATUS "")
diff --git a/cmake/Modules/FindGROSMOSDR.cmake b/cmake/Modules/FindGROSMOSDR.cmake
index 78fb58a31..ce2e655b5 100644
--- a/cmake/Modules/FindGROSMOSDR.cmake
+++ b/cmake/Modules/FindGROSMOSDR.cmake
@@ -100,7 +100,8 @@ include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GROSMOSDR DEFAULT_MSG GROSMOSDR_LIBRARIES GROSMOSDR_INCLUDE_DIR)
if(GROSMOSDR_PKG_VERSION)
- set(GROSMOSDR_VERSION ${GROSMOSDR_PKG_VERSION})
+ set(GROSMOSDR_VERSION_AUX ${GROSMOSDR_PKG_VERSION})
+ string(REGEX REPLACE "^v" "" GROSMOSDR_VERSION ${GROSMOSDR_VERSION_AUX})
endif()
set_package_properties(GROSMOSDR PROPERTIES
diff --git a/cmake/Modules/FindLIBOSMOSDR.cmake b/cmake/Modules/FindLIBOSMOSDR.cmake
deleted file mode 100644
index 7ecf41a61..000000000
--- a/cmake/Modules/FindLIBOSMOSDR.cmake
+++ /dev/null
@@ -1,98 +0,0 @@
-# Copyright (C) 2011-2018 (see AUTHORS file for a list of contributors)
-#
-# This file is part of GNSS-SDR.
-#
-# GNSS-SDR is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# GNSS-SDR is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNSS-SDR. If not, see .
-
-# Tries to find libosmosdr.
-#
-# Usage of this module as follows:
-#
-# find_package(LIBOSMOSDR)
-#
-#
-# Variables defined by this module:
-#
-# LIBOSMOSDR_FOUND System has libosmosdr libs/headers
-# LIBOSMOSDR_LIBRARIES The libosmosdr libraries
-# LIBOSMOSDR_INCLUDE_DIR The location of libosmosdr headers
-#
-# Provides the following imported target:
-# Osmosdr::osmosdr
-#
-
-set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE)
-include(FindPkgConfig)
-pkg_check_modules(LIBOSMOSDR_PKG libosmosdr)
-
-find_path(LIBOSMOSDR_INCLUDE_DIR NAMES osmosdr.h
- PATHS
- ${LIBOSMOSDR_PKG_INCLUDE_DIRS}
- /usr/include
- /usr/local/include
- ${LIBOSMOSDR_ROOT}/include
- $ENV{LIBOSMOSDR_ROOT}/include
- ${LIBOSMOSDR_PKG_INCLUDEDIR}
-)
-
-find_library(LIBOSMOSDR_LIBRARIES NAMES osmosdr
- PATHS
- ${LIBOSMOSDR_PKG_LIBRARY_DIRS}
- /usr/lib
- /usr/local/lib
- /usr/lib/x86_64-linux-gnu
- /usr/lib/i386-linux-gnu
- /usr/lib/arm-linux-gnueabihf
- /usr/lib/arm-linux-gnueabi
- /usr/lib/aarch64-linux-gnu
- /usr/lib/mipsel-linux-gnu
- /usr/lib/mips-linux-gnu
- /usr/lib/mips64el-linux-gnuabi64
- /usr/lib/powerpc-linux-gnu
- /usr/lib/powerpc64-linux-gnu
- /usr/lib/powerpc64le-linux-gnu
- /usr/lib/powerpc-linux-gnuspe
- /usr/lib/hppa-linux-gnu
- /usr/lib/s390x-linux-gnu
- /usr/lib/i386-gnu
- /usr/lib/hppa-linux-gnu
- /usr/lib/x86_64-kfreebsd-gnu
- /usr/lib/i386-kfreebsd-gnu
- /usr/lib/m68k-linux-gnu
- /usr/lib/sh4-linux-gnu
- /usr/lib/sparc64-linux-gnu
- /usr/lib/x86_64-linux-gnux32
- /usr/lib/alpha-linux-gnu
- /usr/lib64
- ${LIBOSMOSDR_ROOT}/lib
- $ENV{LIBOSMOSDR_ROOT}/lib
- ${LIBOSMOSDR_ROOT}/lib64
- $ENV{LIBOSMOSDR_ROOT}/lib64
- ${LIBOSMOSDR_PKG_LIBDIR}
-)
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(LIBOSMOSDR DEFAULT_MSG LIBOSMOSDR_INCLUDE_DIR LIBOSMOSDR_LIBRARIES)
-
-if(LIBOSMOSDR_FOUND AND NOT TARGET Osmosdr::osmosdr)
- add_library(Osmosdr::osmosdr SHARED IMPORTED)
- set_target_properties(Osmosdr::osmosdr PROPERTIES
- IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
- IMPORTED_LOCATION "${LIBOSMOSDR_LIBRARIES}"
- INTERFACE_INCLUDE_DIRECTORIES "${LIBOSMOSDR_INCLUDE_DIR}"
- INTERFACE_LINK_LIBRARIES "${LIBOSMOSDR_LIBRARIES}"
- )
-endif()
-
-mark_as_advanced(LIBOSMOSDR_INCLUDE_DIR LIBOSMOSDR_LIBRARIES)
diff --git a/cmake/Modules/FindOPENBLAS.cmake b/cmake/Modules/FindOPENBLAS.cmake
deleted file mode 100644
index 8ff70d65f..000000000
--- a/cmake/Modules/FindOPENBLAS.cmake
+++ /dev/null
@@ -1,49 +0,0 @@
-# Copyright (C) 2011-2018 (see AUTHORS file for a list of contributors)
-#
-# This file is part of GNSS-SDR.
-#
-# GNSS-SDR is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# GNSS-SDR is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNSS-SDR. If not, see .
-
-# - Try to find OpenBLAS library (not headers!)
-#
-# The following environment variable is optionally searched
-# OPENBLAS_HOME: Base directory where all OpenBlas components are found
-
-set(OPEN_BLAS_SEARCH_PATHS
- /lib
- /lib64/
- /usr/lib
- /usr/lib64
- /usr/local/lib
- /usr/local/lib64
- /opt/OpenBLAS/lib
- /opt/local/lib
- /usr/lib/openblas-base
- $ENV{OPENBLAS_HOME}/lib
- ${OPENBLAS_ROOT}/lib
- $ENV{OPENBLAS_ROOT}/lib
- ${OPENBLAS_ROOT}/lib64
- $ENV{OPENBLAS_ROOT}/lib64
-)
-
-find_library(OPENBLAS NAMES openblas PATHS ${OPEN_BLAS_SEARCH_PATHS})
-
-if(OPENBLAS)
- set(OPENBLAS_FOUND ON)
- message(STATUS "Found OpenBLAS")
-endif()
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(OPENBLAS DEFAULT_MSG OPENBLAS)
-mark_as_advanced(OPENBLAS)
diff --git a/cmake/Modules/TestForSSE.cmake b/cmake/Modules/TestForSSE.cmake
deleted file mode 100644
index 23b2d16a8..000000000
--- a/cmake/Modules/TestForSSE.cmake
+++ /dev/null
@@ -1,55 +0,0 @@
-# Copyright (C) 2011-2018 (see AUTHORS file for a list of contributors)
-#
-# This file is part of GNSS-SDR.
-#
-# GNSS-SDR is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# GNSS-SDR is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNSS-SDR. If not, see .
-
-
-###############################################################################
-# Test for availability of SSE
-#
-# - Anthony Arnold
-###############################################################################
-
-function(test_for_sse h_file result_var name)
- if(NOT DEFINED ${result_var})
- execute_process(COMMAND echo "#include <${h_file}>"
- COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} -c -x c++ -
- RESULT_VARIABLE COMPILE_RESULT
- OUTPUT_QUIET ERROR_QUIET)
- set(detected 0)
- if(COMPILE_RESULT EQUAL 0)
- message(STATUS "Detected ${name}")
- set(detected 1)
- endif()
- set(${result_var} ${detected} CACHE INTERNAL "${name} Available")
- endif()
-endfunction()
-
-message(STATUS "Testing for SIMD extensions")
-
-enable_language(C)
-
-test_for_sse("ammintrin.h" SSE4A_AVAILABLE "SSE4A")
-test_for_sse("nmmintrin.h" SSE4_2_AVAILABLE "SSE4.2")
-test_for_sse("smmintrin.h" SSE4_1_AVAILABLE "SSE4.1")
-test_for_sse("tmmintrin.h" SSSE3_AVAILABLE "SSSE3")
-test_for_sse("pmmintrin.h" SSE3_AVAILABLE "SSE3")
-test_for_sse("emmintrin.h" SSE2_AVAILABLE "SSE2")
-test_for_sse("xmmintrin.h" SSE_AVAILABLE "SSE1")
-test_for_sse("mmintrin.h" MMX_AVAILABLE "MMX")
-test_for_sse("wmmintrin.h" AES_AVAILABLE "AES")
-test_for_sse("immintrin.h" AVX_AVAILABLE "AVX")
-
-file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/-.o")
diff --git a/docs/changelog b/docs/changelog
index 3b8c0438e..97af773b1 100644
--- a/docs/changelog
+++ b/docs/changelog
@@ -56,6 +56,7 @@
### Improvements in Reliability
+- Included the Guidelines Support Library. General improvement of memory management, replacement of raw pointers by containers or smart pointers.
- Applied clang-tidy checks and fixes related to High Integrity C++: performance-move-const-arg, modernize-use-auto, modernize-use-equals-default, modernize-use-equals-delete, modernize-use-noexcept, modernize-use-nullptr, cert-dcl21-cpp, misc-new-delete-overloads, cert-dcl58-cpp, cert-err52-cpp, cert-err60-cpp.
diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h
index ade48e8b7..595cd2624 100644
--- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h
+++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h
@@ -77,6 +77,57 @@ rtklib_pvt_gs_sptr rtklib_make_pvt_gs(uint32_t nchannels,
*/
class rtklib_pvt_gs : public gr::sync_block
{
+public:
+ ~rtklib_pvt_gs(); //!< Default destructor
+
+ /*!
+ * \brief Get latest set of GPS ephemeris from PVT block
+ */
+ std::map get_gps_ephemeris_map() const;
+
+ /*!
+ * \brief Get latest set of GPS almanac from PVT block
+ */
+ std::map get_gps_almanac_map() const;
+
+ /*!
+ * \brief Get latest set of Galileo ephemeris from PVT block
+ */
+ std::map get_galileo_ephemeris_map() const;
+
+ /*!
+ * \brief Get latest set of Galileo almanac from PVT block
+ */
+ std::map get_galileo_almanac_map() const;
+
+ /*!
+ * \brief Get latest set of BeiDou DNAV ephemeris from PVT block
+ */
+ std::map get_beidou_dnav_ephemeris_map() const;
+
+ /*!
+ * \brief Get latest set of BeiDou DNAV almanac from PVT block
+ */
+ std::map get_beidou_dnav_almanac_map() const;
+
+ /*!
+ * \brief Clear all ephemeris information and the almanacs for GPS and Galileo
+ */
+ void clear_ephemeris();
+
+ /*!
+ * \brief Get the latest Position WGS84 [deg], Ground Velocity, Course over Ground, and UTC Time, if available
+ */
+ bool get_latest_PVT(double* longitude_deg,
+ double* latitude_deg,
+ double* height_m,
+ double* ground_speed_kmh,
+ double* course_over_ground_deg,
+ time_t* UTC_time) const;
+
+ int work(int noutput_items, gr_vector_const_void_star& input_items,
+ gr_vector_void_star& output_items); //!< PVT Signal Processing
+
private:
friend rtklib_pvt_gs_sptr rtklib_make_pvt_gs(uint32_t nchannels,
const Pvt_Conf& conf_,
@@ -169,57 +220,6 @@ private:
bool d_show_local_time_zone;
std::string d_local_time_str;
boost::posix_time::time_duration d_utc_diff_time;
-
-public:
- ~rtklib_pvt_gs(); //!< Default destructor
-
- /*!
- * \brief Get latest set of GPS ephemeris from PVT block
- */
- std::map get_gps_ephemeris_map() const;
-
- /*!
- * \brief Get latest set of GPS almanac from PVT block
- */
- std::map get_gps_almanac_map() const;
-
- /*!
- * \brief Get latest set of Galileo ephemeris from PVT block
- */
- std::map get_galileo_ephemeris_map() const;
-
- /*!
- * \brief Get latest set of Galileo almanac from PVT block
- */
- std::map get_galileo_almanac_map() const;
-
- /*!
- * \brief Get latest set of BeiDou DNAV ephemeris from PVT block
- */
- std::map get_beidou_dnav_ephemeris_map() const;
-
- /*!
- * \brief Get latest set of BeiDou DNAV almanac from PVT block
- */
- std::map get_beidou_dnav_almanac_map() const;
-
- /*!
- * \brief Clear all ephemeris information and the almanacs for GPS and Galileo
- */
- void clear_ephemeris();
-
- /*!
- * \brief Get the latest Position WGS84 [deg], Ground Velocity, Course over Ground, and UTC Time, if available
- */
- bool get_latest_PVT(double* longitude_deg,
- double* latitude_deg,
- double* height_m,
- double* ground_speed_kmh,
- double* course_over_ground_deg,
- time_t* UTC_time) const;
-
- int work(int noutput_items, gr_vector_const_void_star& input_items,
- gr_vector_void_star& output_items); //!< PVT Signal Processing
};
#endif
diff --git a/src/algorithms/PVT/libs/geojson_printer.h b/src/algorithms/PVT/libs/geojson_printer.h
index a74a9599d..8242fb634 100644
--- a/src/algorithms/PVT/libs/geojson_printer.h
+++ b/src/algorithms/PVT/libs/geojson_printer.h
@@ -47,18 +47,18 @@ class Pvt_Solution;
*/
class GeoJSON_Printer
{
-private:
- std::ofstream geojson_file;
- bool first_pos;
- std::string filename_;
- std::string geojson_base_path;
-
public:
GeoJSON_Printer(const std::string& base_path = ".");
~GeoJSON_Printer();
bool set_headers(const std::string& filename, bool time_tag_name = true);
bool print_position(const std::shared_ptr& position, bool print_average_values);
bool close_file();
+
+private:
+ std::ofstream geojson_file;
+ bool first_pos;
+ std::string filename_;
+ std::string geojson_base_path;
};
#endif
diff --git a/src/algorithms/PVT/libs/gpx_printer.h b/src/algorithms/PVT/libs/gpx_printer.h
index e78269f8c..a0906cb09 100644
--- a/src/algorithms/PVT/libs/gpx_printer.h
+++ b/src/algorithms/PVT/libs/gpx_printer.h
@@ -47,19 +47,19 @@ class Rtklib_Solver;
*/
class Gpx_Printer
{
-private:
- std::ofstream gpx_file;
- bool positions_printed;
- std::string gpx_filename;
- std::string indent;
- std::string gpx_base_path;
-
public:
Gpx_Printer(const std::string& base_path = ".");
~Gpx_Printer();
bool set_headers(const std::string& filename, bool time_tag_name = true);
bool print_position(const std::shared_ptr& position, bool print_average_values);
bool close_file();
+
+private:
+ std::ofstream gpx_file;
+ bool positions_printed;
+ std::string gpx_filename;
+ std::string indent;
+ std::string gpx_base_path;
};
#endif
diff --git a/src/algorithms/PVT/libs/hybrid_ls_pvt.h b/src/algorithms/PVT/libs/hybrid_ls_pvt.h
index 4409d4bba..a1ab64191 100644
--- a/src/algorithms/PVT/libs/hybrid_ls_pvt.h
+++ b/src/algorithms/PVT/libs/hybrid_ls_pvt.h
@@ -48,14 +48,6 @@
*/
class Hybrid_Ls_Pvt : public Ls_Pvt
{
-private:
- int count_valid_position;
- bool d_flag_dump_enabled;
- std::string d_dump_filename;
- std::ofstream d_dump_file;
- int d_nchannels; // Number of available channels for positioning
- double d_galileo_current_time;
-
public:
Hybrid_Ls_Pvt(int nchannels, std::string dump_filename, bool flag_dump_to_file);
~Hybrid_Ls_Pvt();
@@ -75,6 +67,14 @@ public:
Gps_CNAV_Iono gps_cnav_iono;
Gps_CNAV_Utc_Model gps_cnav_utc_model;
+
+private:
+ int count_valid_position;
+ bool d_flag_dump_enabled;
+ std::string d_dump_filename;
+ std::ofstream d_dump_file;
+ int d_nchannels; // Number of available channels for positioning
+ double d_galileo_current_time;
};
#endif
diff --git a/src/algorithms/PVT/libs/kml_printer.h b/src/algorithms/PVT/libs/kml_printer.h
index 6295242f6..71b27de43 100644
--- a/src/algorithms/PVT/libs/kml_printer.h
+++ b/src/algorithms/PVT/libs/kml_printer.h
@@ -46,6 +46,13 @@ class Rtklib_Solver;
*/
class Kml_Printer
{
+public:
+ Kml_Printer(const std::string& base_path = std::string("."));
+ ~Kml_Printer();
+ bool set_headers(const std::string& filename, bool time_tag_name = true);
+ bool print_position(const std::shared_ptr& position, bool print_average_values);
+ bool close_file();
+
private:
std::ofstream kml_file;
std::ofstream tmp_file;
@@ -55,13 +62,6 @@ private:
std::string tmp_file_str;
unsigned int point_id;
std::string indent;
-
-public:
- Kml_Printer(const std::string& base_path = std::string("."));
- ~Kml_Printer();
- bool set_headers(const std::string& filename, bool time_tag_name = true);
- bool print_position(const std::shared_ptr& position, bool print_average_values);
- bool close_file();
};
#endif
diff --git a/src/algorithms/PVT/libs/ls_pvt.h b/src/algorithms/PVT/libs/ls_pvt.h
index 78ad9deef..2e7226798 100644
--- a/src/algorithms/PVT/libs/ls_pvt.h
+++ b/src/algorithms/PVT/libs/ls_pvt.h
@@ -41,12 +41,6 @@
*/
class Ls_Pvt : public Pvt_Solution
{
-private:
- /*!
- * \brief Computes the Lorentz inner product between two vectors
- */
- double lorentz(const arma::vec& x, const arma::vec& y);
-
public:
Ls_Pvt();
@@ -59,6 +53,12 @@ public:
* \brief Computes the Weighted Least Squares position solution
*/
arma::vec leastSquarePos(const arma::mat& satpos, const arma::vec& obs, const arma::vec& w_vec);
+
+private:
+ /*!
+ * \brief Computes the Lorentz inner product between two vectors
+ */
+ double lorentz(const arma::vec& x, const arma::vec& y);
};
#endif
diff --git a/src/algorithms/PVT/libs/monitor_pvt_udp_sink.cc b/src/algorithms/PVT/libs/monitor_pvt_udp_sink.cc
index baa85692d..2796f13da 100644
--- a/src/algorithms/PVT/libs/monitor_pvt_udp_sink.cc
+++ b/src/algorithms/PVT/libs/monitor_pvt_udp_sink.cc
@@ -35,41 +35,13 @@
#include
-Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(std::vector addresses, const uint16_t& port, bool protobuf_enabled) : socket{io_context}
+Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(const std::vector& addresses, const uint16_t& port, bool protobuf_enabled) : socket{io_context}
{
for (const auto& address : addresses)
{
boost::asio::ip::udp::endpoint endpoint(boost::asio::ip::address::from_string(address, error), port);
endpoints.push_back(endpoint);
}
- monitor_pvt.TOW_at_current_symbol_ms = 0U;
- monitor_pvt.week = 0U;
- monitor_pvt.RX_time = 0.0;
- monitor_pvt.user_clk_offset = 0.0;
- monitor_pvt.pos_x = 0.0;
- monitor_pvt.pos_y = 0.0;
- monitor_pvt.pos_z = 0.0;
- monitor_pvt.vel_x = 0.0;
- monitor_pvt.vel_y = 0.0;
- monitor_pvt.vel_z = 0.0;
- monitor_pvt.cov_xx = 0.0;
- monitor_pvt.cov_yy = 0.0;
- monitor_pvt.cov_zz = 0.0;
- monitor_pvt.cov_xy = 0.0;
- monitor_pvt.cov_yz = 0.0;
- monitor_pvt.cov_zx = 0.0;
- monitor_pvt.latitude = 0.0;
- monitor_pvt.longitude = 0.0;
- monitor_pvt.height = 0.0;
- monitor_pvt.valid_sats = 0;
- monitor_pvt.solution_status = 0;
- monitor_pvt.solution_type = 0;
- monitor_pvt.AR_ratio_factor = 0.0;
- monitor_pvt.AR_ratio_threshold = 0.0;
- monitor_pvt.gdop = 0.0;
- monitor_pvt.pdop = 0.0;
- monitor_pvt.hdop = 0.0;
- monitor_pvt.vdop = 0.0;
use_protobuf = protobuf_enabled;
if (use_protobuf)
diff --git a/src/algorithms/PVT/libs/monitor_pvt_udp_sink.h b/src/algorithms/PVT/libs/monitor_pvt_udp_sink.h
index c8c363942..f1f9146f4 100644
--- a/src/algorithms/PVT/libs/monitor_pvt_udp_sink.h
+++ b/src/algorithms/PVT/libs/monitor_pvt_udp_sink.h
@@ -45,7 +45,7 @@ using b_io_context = boost::asio::io_service;
class Monitor_Pvt_Udp_Sink
{
public:
- Monitor_Pvt_Udp_Sink(std::vector addresses, const uint16_t &port, bool protobuf_enabled);
+ Monitor_Pvt_Udp_Sink(const std::vector& addresses, const uint16_t &port, bool protobuf_enabled);
bool write_monitor_pvt(const Monitor_Pvt &monitor_pvt);
private:
@@ -53,7 +53,7 @@ private:
boost::asio::ip::udp::socket socket;
boost::system::error_code error;
std::vector endpoints;
- Monitor_Pvt monitor_pvt;
+ Monitor_Pvt monitor_pvt{};
Serdes_Monitor_Pvt serdes;
bool use_protobuf;
};
diff --git a/src/algorithms/PVT/libs/nmea_printer.cc b/src/algorithms/PVT/libs/nmea_printer.cc
index c70deb403..913a23e39 100644
--- a/src/algorithms/PVT/libs/nmea_printer.cc
+++ b/src/algorithms/PVT/libs/nmea_printer.cc
@@ -283,7 +283,7 @@ bool Nmea_Printer::Print_Nmea_Line(const std::shared_ptr& pvt_dat
}
-char Nmea_Printer::checkSum(std::string sentence)
+char Nmea_Printer::checkSum(const std::string& sentence)
{
char check = 0;
// iterate over the string, XOR each byte with the total sum:
@@ -441,7 +441,7 @@ std::string Nmea_Printer::get_GPGSA()
// GSA-GNSS DOP and Active Satellites
std::stringstream sentence_str;
unsigned char buff[1024] = {0};
- outnmea_gsa(buff, &d_PVT_data->pvt_sol, d_PVT_data->pvt_ssat);
+ outnmea_gsa(buff, &d_PVT_data->pvt_sol, d_PVT_data->pvt_ssat.data());
sentence_str << buff;
return sentence_str.str();
}
@@ -454,7 +454,7 @@ std::string Nmea_Printer::get_GPGSV()
// Notice that NMEA 2.1 only supports 12 channels
std::stringstream sentence_str;
unsigned char buff[1024] = {0};
- outnmea_gsv(buff, &d_PVT_data->pvt_sol, d_PVT_data->pvt_ssat);
+ outnmea_gsv(buff, &d_PVT_data->pvt_sol, d_PVT_data->pvt_ssat.data());
sentence_str << buff;
return sentence_str.str();
}
diff --git a/src/algorithms/PVT/libs/nmea_printer.h b/src/algorithms/PVT/libs/nmea_printer.h
index f821ad94b..d9822c6c5 100644
--- a/src/algorithms/PVT/libs/nmea_printer.h
+++ b/src/algorithms/PVT/libs/nmea_printer.h
@@ -83,7 +83,7 @@ private:
std::string get_UTC_NMEA_time(boost::posix_time::ptime d_position_UTC_time);
std::string longitude_to_hm(double longitude);
std::string latitude_to_hm(double lat);
- char checkSum(std::string sentence);
+ char checkSum(const std::string& sentence);
bool print_avg_pos;
bool d_flag_nmea_output_file;
};
diff --git a/src/algorithms/PVT/libs/pvt_solution.h b/src/algorithms/PVT/libs/pvt_solution.h
index 7afd074d2..86b1d72f1 100644
--- a/src/algorithms/PVT/libs/pvt_solution.h
+++ b/src/algorithms/PVT/libs/pvt_solution.h
@@ -44,32 +44,6 @@
*/
class Pvt_Solution
{
-private:
- double d_rx_dt_s; // RX time offset [s]
-
- double d_latitude_d; // RX position Latitude WGS84 [deg]
- double d_longitude_d; // RX position Longitude WGS84 [deg]
- double d_height_m; // RX position height WGS84 [m]
- double d_speed_over_ground_m_s; // RX speed over ground [m/s]
- double d_course_over_ground_d; // RX course over ground [deg]
-
- double d_avg_latitude_d; // Averaged latitude in degrees
- double d_avg_longitude_d; // Averaged longitude in degrees
- double d_avg_height_m; // Averaged height [m]
-
- bool b_valid_position;
-
- std::deque d_hist_latitude_d;
- std::deque d_hist_longitude_d;
- std::deque d_hist_height_m;
-
- bool d_flag_averaging;
- int d_averaging_depth; // Length of averaging window
-
- arma::vec d_rx_pos;
- boost::posix_time::ptime d_position_UTC_time;
- int d_valid_observations;
-
public:
Pvt_Solution();
@@ -111,46 +85,73 @@ public:
arma::vec rotateSatellite(double traveltime, const arma::vec &X_sat);
/*!
- * \brief Conversion of Cartesian coordinates (X,Y,Z) to geographical
- * coordinates (d_latitude_d, d_longitude_d, d_height_m) on a selected reference ellipsoid.
- *
- * \param[in] X [m] Cartesian coordinate
- * \param[in] Y [m] Cartesian coordinate
- * \param[in] Z [m] Cartesian coordinate
- * \param[in] elipsoid_selection. Choices of Reference Ellipsoid for Geographical Coordinates:
- * 0 - International Ellipsoid 1924.
- * 1 - International Ellipsoid 1967.
- * 2 - World Geodetic System 1972.
- * 3 - Geodetic Reference System 1980.
- * 4 - World Geodetic System 1984.
- *
- */
+ * \brief Conversion of Cartesian coordinates (X,Y,Z) to geographical
+ * coordinates (d_latitude_d, d_longitude_d, d_height_m) on a selected reference ellipsoid.
+ *
+ * \param[in] X [m] Cartesian coordinate
+ * \param[in] Y [m] Cartesian coordinate
+ * \param[in] Z [m] Cartesian coordinate
+ * \param[in] elipsoid_selection. Choices of Reference Ellipsoid for Geographical Coordinates:
+ * 0 - International Ellipsoid 1924.
+ * 1 - International Ellipsoid 1967.
+ * 2 - World Geodetic System 1972.
+ * 3 - Geodetic Reference System 1980.
+ * 4 - World Geodetic System 1984.
+ *
+ */
int cart2geo(double X, double Y, double Z, int elipsoid_selection);
/*!
- * \brief Tropospheric correction
- *
- * \param[in] sinel - sin of elevation angle of satellite
- * \param[in] hsta_km - height of station in km
- * \param[in] p_mb - atmospheric pressure in mb at height hp_km
- * \param[in] t_kel - surface temperature in degrees Kelvin at height htkel_km
- * \param[in] hum - humidity in % at height hhum_km
- * \param[in] hp_km - height of pressure measurement in km
- * \param[in] htkel_km - height of temperature measurement in km
- * \param[in] hhum_km - height of humidity measurement in km
- *
- * \param[out] ddr_m - range correction (meters)
- *
- *
- * Reference:
- * Goad, C.C. & Goodman, L. (1974) A Modified Hopfield Tropospheric
- * Refraction Correction Model. Paper presented at the
- * American Geophysical Union Annual Fall Meeting, San
- * Francisco, December 12-17
- *
- * Translated to C++ by Carles Fernandez from a Matlab implementation by Kai Borre
- */
+ * \brief Tropospheric correction
+ *
+ * \param[in] sinel - sin of elevation angle of satellite
+ * \param[in] hsta_km - height of station in km
+ * \param[in] p_mb - atmospheric pressure in mb at height hp_km
+ * \param[in] t_kel - surface temperature in degrees Kelvin at height htkel_km
+ * \param[in] hum - humidity in % at height hhum_km
+ * \param[in] hp_km - height of pressure measurement in km
+ * \param[in] htkel_km - height of temperature measurement in km
+ * \param[in] hhum_km - height of humidity measurement in km
+ *
+ * \param[out] ddr_m - range correction (meters)
+ *
+ *
+ * Reference:
+ * Goad, C.C. & Goodman, L. (1974) A Modified Hopfield Tropospheric
+ * Refraction Correction Model. Paper presented at the
+ * American Geophysical Union Annual Fall Meeting, San
+ * Francisco, December 12-17
+ *
+ * Translated to C++ by Carles Fernandez from a Matlab implementation by Kai Borre
+ */
int tropo(double *ddr_m, double sinel, double hsta_km, double p_mb, double t_kel, double hum, double hp_km, double htkel_km, double hhum_km);
+
+private:
+ double d_rx_dt_s; // RX time offset [s]
+
+ double d_latitude_d; // RX position Latitude WGS84 [deg]
+ double d_longitude_d; // RX position Longitude WGS84 [deg]
+ double d_height_m; // RX position height WGS84 [m]
+ double d_speed_over_ground_m_s; // RX speed over ground [m/s]
+ double d_course_over_ground_d; // RX course over ground [deg]
+
+ double d_avg_latitude_d; // Averaged latitude in degrees
+ double d_avg_longitude_d; // Averaged longitude in degrees
+ double d_avg_height_m; // Averaged height [m]
+
+ bool b_valid_position;
+
+ std::deque d_hist_latitude_d;
+ std::deque d_hist_longitude_d;
+ std::deque d_hist_height_m;
+
+ bool d_flag_averaging;
+ int d_averaging_depth; // Length of averaging window
+
+ arma::vec d_rx_pos;
+ boost::posix_time::ptime d_position_UTC_time;
+ int d_valid_observations;
+
};
#endif
diff --git a/src/algorithms/PVT/libs/rtcm.cc b/src/algorithms/PVT/libs/rtcm.cc
index deb7a997b..0cad7ec65 100644
--- a/src/algorithms/PVT/libs/rtcm.cc
+++ b/src/algorithms/PVT/libs/rtcm.cc
@@ -140,7 +140,7 @@ bool Rtcm::is_server_running() const
std::string Rtcm::add_CRC(const std::string& message_without_crc) const
{
// ****** Computes Qualcomm CRC-24Q ******
- boost::crc_optimal<24, 0x1864CFBu, 0x0, 0x0, false, false> CRC_RTCM;
+ boost::crc_optimal<24, 0x1864CFBU, 0x0, 0x0, false, false> CRC_RTCM;
// 1) Converts the string to a vector of uint8_t:
boost::dynamic_bitset frame_bits(message_without_crc);
std::vector bytes;
@@ -159,7 +159,7 @@ std::string Rtcm::add_CRC(const std::string& message_without_crc) const
bool Rtcm::check_CRC(const std::string& message) const
{
- boost::crc_optimal<24, 0x1864CFBu, 0x0, 0x0, false, false> CRC_RTCM_CHECK;
+ boost::crc_optimal<24, 0x1864CFBU, 0x0, 0x0, false, false> CRC_RTCM_CHECK;
// Convert message to binary
std::string message_bin = Rtcm::binary_data_to_bin(message);
// Check CRC
@@ -2419,7 +2419,7 @@ std::string Rtcm::get_MSM_1_content_sat_data(const std::mapsecond.PRN);
- observables_vector.push_back(*gnss_synchro_iter);
+ observables_vector.emplace_back(*gnss_synchro_iter);
}
}
@@ -2448,7 +2448,7 @@ std::string Rtcm::get_MSM_1_content_signal_data(const std::map > ordered_by_signal = Rtcm::sort_by_signal(observables_vector);
@@ -2556,7 +2556,7 @@ std::string Rtcm::get_MSM_2_content_signal_data(const Gps_Ephemeris& ephNAV,
map_iter != observables.cend();
map_iter++)
{
- observables_vector.push_back(*map_iter);
+ observables_vector.emplace_back(*map_iter);
}
std::vector > ordered_by_signal = Rtcm::sort_by_signal(observables_vector);
@@ -2670,7 +2670,7 @@ std::string Rtcm::get_MSM_3_content_signal_data(const Gps_Ephemeris& ephNAV,
map_iter != observables.cend();
map_iter++)
{
- observables_vector.push_back(*map_iter);
+ observables_vector.emplace_back(*map_iter);
}
std::vector > ordered_by_signal = Rtcm::sort_by_signal(observables_vector);
@@ -2786,7 +2786,7 @@ std::string Rtcm::get_MSM_4_content_sat_data(const std::mapsecond.PRN);
- observables_vector.push_back(*gnss_synchro_iter);
+ observables_vector.emplace_back(*gnss_synchro_iter);
}
}
@@ -2827,7 +2827,7 @@ std::string Rtcm::get_MSM_4_content_signal_data(const Gps_Ephemeris& ephNAV,
map_iter != observables.cend();
map_iter++)
{
- observables_vector.push_back(*map_iter);
+ observables_vector.emplace_back(*map_iter);
}
std::vector > ordered_by_signal = Rtcm::sort_by_signal(observables_vector);
@@ -2947,7 +2947,7 @@ std::string Rtcm::get_MSM_5_content_sat_data(const std::mapsecond.PRN);
- observables_vector.push_back(*gnss_synchro_iter);
+ observables_vector.emplace_back(*gnss_synchro_iter);
}
}
@@ -2993,7 +2993,7 @@ std::string Rtcm::get_MSM_5_content_signal_data(const Gps_Ephemeris& ephNAV,
map_iter != observables.cend();
map_iter++)
{
- observables_vector.push_back(*map_iter);
+ observables_vector.emplace_back(*map_iter);
}
std::vector > ordered_by_signal = Rtcm::sort_by_signal(observables_vector);
@@ -3114,7 +3114,7 @@ std::string Rtcm::get_MSM_6_content_signal_data(const Gps_Ephemeris& ephNAV,
map_iter != observables.cend();
map_iter++)
{
- observables_vector.push_back(*map_iter);
+ observables_vector.emplace_back(*map_iter);
}
std::vector > ordered_by_signal = Rtcm::sort_by_signal(observables_vector);
@@ -3234,7 +3234,7 @@ std::string Rtcm::get_MSM_7_content_signal_data(const Gps_Ephemeris& ephNAV,
map_iter != observables.cend();
map_iter++)
{
- observables_vector.push_back(*map_iter);
+ observables_vector.emplace_back(*map_iter);
}
std::vector > ordered_by_signal = Rtcm::sort_by_signal(observables_vector);
@@ -3685,7 +3685,7 @@ uint32_t Rtcm::msm_extended_lock_time_indicator(uint32_t lock_time_period_s)
if( 16777216 <= lock_time_period_s && lock_time_period_s < 33554432 ) return (640 + (lock_time_period_s - 16777216) / 524288 );
if( 33554432 <= lock_time_period_s && lock_time_period_s < 67108864 ) return (672 + (lock_time_period_s - 33554432) / 1048576);
if( 67108864 <= lock_time_period_s ) return (704 );
- return 1023; // will never happen
+ return 1023; // will never happen
}
// clang-format on
@@ -5330,7 +5330,7 @@ int32_t Rtcm::set_DF398(const Gnss_Synchro& gnss_synchro)
}
else
{
- rr_mod_ms = static_cast(std::floor(rough_range_m / meters_to_miliseconds / TWO_N10) + 0.5) & 0x3FFu;
+ rr_mod_ms = static_cast(std::floor(rough_range_m / meters_to_miliseconds / TWO_N10) + 0.5) & 0x3FFU;
}
DF398 = std::bitset<10>(rr_mod_ms);
return 0;
diff --git a/src/algorithms/PVT/libs/rtklib_solver.cc b/src/algorithms/PVT/libs/rtklib_solver.cc
index ecf0efe9a..0f6e84b06 100644
--- a/src/algorithms/PVT/libs/rtklib_solver.cc
+++ b/src/algorithms/PVT/libs/rtklib_solver.cc
@@ -64,6 +64,7 @@
#include
#include
#include
+#include
Rtklib_Solver::Rtklib_Solver(int nchannels, std::string dump_filename, bool flag_dump_to_file, bool flag_dump_to_mat, const rtk_t &rtk)
@@ -76,16 +77,7 @@ Rtklib_Solver::Rtklib_Solver(int nchannels, std::string dump_filename, bool flag
count_valid_position = 0;
this->set_averaging_flag(false);
rtk_ = rtk;
- 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 (auto &i : pvt_ssat)
- {
- i = ssat0;
- }
+
// ############# ENABLE DATA FILE LOG #################
if (d_flag_dump_enabled == true)
{
@@ -103,35 +95,6 @@ Rtklib_Solver::Rtklib_Solver(int nchannels, std::string dump_filename, bool flag
}
}
}
- // PVT MONITOR
- monitor_pvt.TOW_at_current_symbol_ms = 0U;
- monitor_pvt.week = 0U;
- monitor_pvt.RX_time = 0.0;
- monitor_pvt.user_clk_offset = 0.0;
- monitor_pvt.pos_x = 0.0;
- monitor_pvt.pos_y = 0.0;
- monitor_pvt.pos_z = 0.0;
- monitor_pvt.vel_x = 0.0;
- monitor_pvt.vel_y = 0.0;
- monitor_pvt.vel_z = 0.0;
- monitor_pvt.cov_xx = 0.0;
- monitor_pvt.cov_yy = 0.0;
- monitor_pvt.cov_zz = 0.0;
- monitor_pvt.cov_xy = 0.0;
- monitor_pvt.cov_yz = 0.0;
- monitor_pvt.cov_zx = 0.0;
- monitor_pvt.latitude = 0.0;
- monitor_pvt.longitude = 0.0;
- monitor_pvt.height = 0.0;
- monitor_pvt.valid_sats = 0;
- monitor_pvt.solution_status = 0;
- monitor_pvt.solution_type = 0;
- monitor_pvt.AR_ratio_factor = 0.0;
- monitor_pvt.AR_ratio_threshold = 0.0;
- monitor_pvt.gdop = 0.0;
- monitor_pvt.pdop = 0.0;
- monitor_pvt.hdop = 0.0;
- monitor_pvt.vdop = 0.0;
}
bool Rtklib_Solver::save_matfile()
@@ -172,34 +135,34 @@ bool Rtklib_Solver::save_matfile()
return false;
}
- 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];
+ auto TOW_at_current_symbol_ms = std::vector(num_epoch);
+ auto week = std::vector(num_epoch);
+ auto RX_time = std::vector(num_epoch);
+ auto user_clk_offset = std::vector(num_epoch);
+ auto pos_x = std::vector(num_epoch);
+ auto pos_y = std::vector(num_epoch);
+ auto pos_z = std::vector(num_epoch);
+ auto vel_x = std::vector(num_epoch);
+ auto vel_y = std::vector(num_epoch);
+ auto vel_z = std::vector(num_epoch);
+ auto cov_xx = std::vector(num_epoch);
+ auto cov_yy = std::vector(num_epoch);
+ auto cov_zz = std::vector(num_epoch);
+ auto cov_xy = std::vector(num_epoch);
+ auto cov_yz = std::vector(num_epoch);
+ auto cov_zx = std::vector(num_epoch);
+ auto latitude = std::vector(num_epoch);
+ auto longitude = std::vector(num_epoch);
+ auto height = std::vector(num_epoch);
+ auto valid_sats = std::vector(num_epoch);
+ auto solution_status = std::vector(num_epoch);
+ auto solution_type = std::vector(num_epoch);
+ auto AR_ratio_factor = std::vector(num_epoch);
+ auto AR_ratio_threshold = std::vector(num_epoch);
+ auto gdop = std::vector(num_epoch);
+ auto pdop = std::vector(num_epoch);
+ auto hdop = std::vector(num_epoch);
+ auto vdop = std::vector(num_epoch);
try
{
@@ -242,35 +205,6 @@ bool Rtklib_Solver::save_matfile()
catch (const std::ifstream::failure &e)
{
std::cerr << "Problem reading dump file:" << e.what() << std::endl;
- delete[] TOW_at_current_symbol_ms;
- delete[] week;
- delete[] RX_time;
- delete[] user_clk_offset;
- delete[] pos_x;
- delete[] pos_y;
- delete[] pos_z;
- delete[] vel_x;
- delete[] vel_y;
- delete[] vel_z;
- delete[] cov_xx;
- delete[] cov_yy;
- delete[] cov_zz;
- delete[] cov_xy;
- delete[] cov_yz;
- delete[] cov_zx;
- delete[] latitude;
- delete[] longitude;
- delete[] height;
- delete[] valid_sats;
- delete[] solution_status;
- delete[] solution_type;
- delete[] AR_ratio_factor;
- delete[] AR_ratio_threshold;
- delete[] gdop;
- delete[] pdop;
- delete[] hdop;
- delete[] vdop;
-
return false;
}
@@ -284,149 +218,120 @@ bool Rtklib_Solver::save_matfile()
if (reinterpret_cast(matfp) != nullptr)
{
size_t dims[2] = {1, static_cast(num_epoch)};
- matvar = Mat_VarCreate("TOW_at_current_symbol_ms", MAT_C_UINT32, MAT_T_UINT32, 2, dims, TOW_at_current_symbol_ms, 0);
+ matvar = Mat_VarCreate("TOW_at_current_symbol_ms", MAT_C_UINT32, MAT_T_UINT32, 2, dims, TOW_at_current_symbol_ms.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar);
- matvar = Mat_VarCreate("week", MAT_C_UINT32, MAT_T_UINT32, 2, dims, week, 0);
+ matvar = Mat_VarCreate("week", MAT_C_UINT32, MAT_T_UINT32, 2, dims, week.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar);
- matvar = Mat_VarCreate("RX_time", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, RX_time, 0);
+ matvar = Mat_VarCreate("RX_time", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, RX_time.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar);
- matvar = Mat_VarCreate("user_clk_offset", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, user_clk_offset, 0);
+ matvar = Mat_VarCreate("user_clk_offset", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, user_clk_offset.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar);
- matvar = Mat_VarCreate("pos_x", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, pos_x, 0);
+ matvar = Mat_VarCreate("pos_x", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, pos_x.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar);
- matvar = Mat_VarCreate("pos_y", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, pos_y, 0);
+ matvar = Mat_VarCreate("pos_y", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, pos_y.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar);
- matvar = Mat_VarCreate("pos_z", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, pos_z, 0);
+ matvar = Mat_VarCreate("pos_z", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, pos_z.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar);
- matvar = Mat_VarCreate("vel_x", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, vel_x, 0);
+ matvar = Mat_VarCreate("vel_x", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, vel_x.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar);
- matvar = Mat_VarCreate("vel_y", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, vel_y, 0);
+ matvar = Mat_VarCreate("vel_y", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, vel_y.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar);
- matvar = Mat_VarCreate("vel_z", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, vel_z, 0);
+ matvar = Mat_VarCreate("vel_z", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, vel_z.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar);
- matvar = Mat_VarCreate("cov_xx", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, cov_xx, 0);
+ matvar = Mat_VarCreate("cov_xx", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, cov_xx.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar);
- matvar = Mat_VarCreate("cov_yy", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, cov_yy, 0);
+ matvar = Mat_VarCreate("cov_yy", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, cov_yy.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar);
- matvar = Mat_VarCreate("cov_zz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, cov_zz, 0);
+ matvar = Mat_VarCreate("cov_zz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, cov_zz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar);
- matvar = Mat_VarCreate("cov_xy", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, cov_xy, 0);
+ matvar = Mat_VarCreate("cov_xy", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, cov_xy.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar);
- matvar = Mat_VarCreate("cov_yz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, cov_yz, 0);
+ matvar = Mat_VarCreate("cov_yz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, cov_yz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar);
- matvar = Mat_VarCreate("cov_zx", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, cov_zx, 0);
+ matvar = Mat_VarCreate("cov_zx", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, cov_zx.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar);
- matvar = Mat_VarCreate("latitude", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, latitude, 0);
+ matvar = Mat_VarCreate("latitude", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, latitude.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar);
- matvar = Mat_VarCreate("longitude", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, longitude, 0);
+ matvar = Mat_VarCreate("longitude", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, longitude.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar);
- matvar = Mat_VarCreate("height", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, height, 0);
+ matvar = Mat_VarCreate("height", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, height.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar);
- matvar = Mat_VarCreate("valid_sats", MAT_C_UINT8, MAT_T_UINT8, 2, dims, valid_sats, 0);
+ matvar = Mat_VarCreate("valid_sats", MAT_C_UINT8, MAT_T_UINT8, 2, dims, valid_sats.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar);
- matvar = Mat_VarCreate("solution_status", MAT_C_UINT8, MAT_T_UINT8, 2, dims, solution_status, 0);
+ matvar = Mat_VarCreate("solution_status", MAT_C_UINT8, MAT_T_UINT8, 2, dims, solution_status.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar);
- matvar = Mat_VarCreate("solution_type", MAT_C_UINT8, MAT_T_UINT8, 2, dims, solution_type, 0);
+ matvar = Mat_VarCreate("solution_type", MAT_C_UINT8, MAT_T_UINT8, 2, dims, solution_type.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar);
- matvar = Mat_VarCreate("AR_ratio_factor", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, AR_ratio_factor, 0);
+ matvar = Mat_VarCreate("AR_ratio_factor", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, AR_ratio_factor.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar);
- matvar = Mat_VarCreate("AR_ratio_threshold", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, AR_ratio_threshold, 0);
+ matvar = Mat_VarCreate("AR_ratio_threshold", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, AR_ratio_threshold.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar);
- matvar = Mat_VarCreate("gdop", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, gdop, 0);
+ matvar = Mat_VarCreate("gdop", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, gdop.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar);
- matvar = Mat_VarCreate("pdop", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, pdop, 0);
+ matvar = Mat_VarCreate("pdop", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, pdop.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar);
- matvar = Mat_VarCreate("hdop", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, hdop, 0);
+ matvar = Mat_VarCreate("hdop", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, hdop.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar);
- matvar = Mat_VarCreate("vdop", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, vdop, 0);
+ matvar = Mat_VarCreate("vdop", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, vdop.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar);
}
Mat_Close(matfp);
- delete[] TOW_at_current_symbol_ms;
- delete[] week;
- delete[] RX_time;
- delete[] user_clk_offset;
- delete[] pos_x;
- delete[] pos_y;
- delete[] pos_z;
- delete[] vel_x;
- delete[] vel_y;
- delete[] vel_z;
- delete[] cov_xx;
- delete[] cov_yy;
- delete[] cov_zz;
- delete[] cov_xy;
- delete[] cov_yz;
- delete[] cov_zx;
- delete[] latitude;
- delete[] longitude;
- delete[] height;
- delete[] valid_sats;
- delete[] solution_status;
- delete[] solution_type;
- delete[] AR_ratio_factor;
- delete[] AR_ratio_threshold;
- delete[] gdop;
- delete[] pdop;
- delete[] hdop;
- delete[] vdop;
-
return true;
}
@@ -507,9 +412,9 @@ bool Rtklib_Solver::get_PVT(const std::map &gnss_observables_
int valid_obs = 0; // valid observations counter
int glo_valid_obs = 0; // GLONASS L1/L2 valid observations counter
- obsd_t obs_data[MAXOBS];
- eph_t eph_data[MAXOBS];
- geph_t geph_data[MAXOBS];
+ std::array obs_data{};
+ std::array eph_data{};
+ std::array geph_data{};
// Workaround for NAV/CNAV clash problem
bool gps_dual_band = false;
@@ -894,8 +799,8 @@ bool Rtklib_Solver::get_PVT(const std::map &gnss_observables_
int result = 0;
int sat = 0;
nav_t nav_data;
- nav_data.eph = eph_data;
- nav_data.geph = geph_data;
+ nav_data.eph = eph_data.data();
+ nav_data.geph = geph_data.data();
nav_data.n = valid_obs;
nav_data.ng = glo_valid_obs;
@@ -915,7 +820,7 @@ bool Rtklib_Solver::get_PVT(const std::map &gnss_observables_
}
}
- result = rtkpos(&rtk_, obs_data, valid_obs + glo_valid_obs, &nav_data);
+ result = rtkpos(&rtk_, obs_data.data(), valid_obs + glo_valid_obs, &nav_data);
if (result == 0)
{
@@ -976,7 +881,7 @@ bool Rtklib_Solver::get_PVT(const std::map &gnss_observables_
}
this->set_rx_pos(rx_position_and_time.rows(0, 2)); // save ECEF position for the next iteration
- //compute Ground speed and COG
+ // compute Ground speed and COG
double ground_speed_ms = 0.0;
double pos[3];
double enuv[3];
@@ -1015,9 +920,7 @@ bool Rtklib_Solver::get_PVT(const std::map &gnss_observables_
<< " [deg], Height= " << this->get_height() << " [m]"
<< " RX time offset= " << this->get_time_offset_s() << " [s]";
-
- // PVT MONITOR
-
+ // ######## PVT MONITOR #########
// TOW
monitor_pvt.TOW_at_current_symbol_ms = gnss_observables_map.begin()->second.TOW_at_current_symbol_ms;
// WEEK
@@ -1067,7 +970,6 @@ bool Rtklib_Solver::get_PVT(const std::map &gnss_observables_
monitor_pvt.hdop = dop_[2];
monitor_pvt.vdop = dop_[3];
-
// ######## LOG FILE #########
if (d_flag_dump_enabled == true)
{
diff --git a/src/algorithms/PVT/libs/rtklib_solver.h b/src/algorithms/PVT/libs/rtklib_solver.h
index 6457d28d6..128d8bebf 100644
--- a/src/algorithms/PVT/libs/rtklib_solver.h
+++ b/src/algorithms/PVT/libs/rtklib_solver.h
@@ -84,30 +84,18 @@
/*!
- * \brief This class implements a simple PVT Least Squares solution
+ * \brief This class implements a PVT solution based on RTKLIB
*/
class Rtklib_Solver : public Pvt_Solution
{
-private:
- rtk_t rtk_;
- std::string d_dump_filename;
- std::ofstream d_dump_file;
- bool save_matfile();
-
- bool d_flag_dump_enabled;
- bool d_flag_dump_mat_enabled;
- int d_nchannels; // Number of available channels for positioning
- std::array dop_;
- Monitor_Pvt monitor_pvt;
-
public:
Rtklib_Solver(int nchannels, std::string dump_filename, bool flag_dump_to_file, bool flag_dump_to_mat, const rtk_t& rtk);
~Rtklib_Solver();
bool get_PVT(const std::map& gnss_observables_map, bool flag_averaging);
- sol_t pvt_sol;
- ssat_t pvt_ssat[MAXSAT];
+ sol_t pvt_sol{};
+ std::array pvt_ssat{};
double get_hdop() const;
double get_vdop() const;
double get_pdop() const;
@@ -139,6 +127,17 @@ public:
std::map beidou_dnav_almanac_map;
int count_valid_position;
+
+private:
+ rtk_t rtk_{};
+ std::string d_dump_filename;
+ std::ofstream d_dump_file;
+ bool save_matfile();
+ bool d_flag_dump_enabled;
+ bool d_flag_dump_mat_enabled;
+ int d_nchannels; // Number of available channels for positioning
+ std::array dop_{};
+ Monitor_Pvt monitor_pvt{};
};
#endif
diff --git a/src/algorithms/PVT/libs/serdes_monitor_pvt.h b/src/algorithms/PVT/libs/serdes_monitor_pvt.h
index 7b3fdafc5..1b5ca11ca 100644
--- a/src/algorithms/PVT/libs/serdes_monitor_pvt.h
+++ b/src/algorithms/PVT/libs/serdes_monitor_pvt.h
@@ -48,13 +48,38 @@ public:
// Verify that the version of the library that we linked against is
// compatible with the version of the headers we compiled against.
GOOGLE_PROTOBUF_VERIFY_VERSION;
- monitor_.New();
}
+
~Serdes_Monitor_Pvt()
{
// google::protobuf::ShutdownProtobufLibrary();
}
+ inline Serdes_Monitor_Pvt(Serdes_Monitor_Pvt&& other) //!< Copy constructor
+ {
+ this->monitor_ = other.monitor_;
+ }
+
+ inline Serdes_Monitor_Pvt& operator=(const Serdes_Monitor_Pvt& rhs) //!< Copy assignment operator
+ {
+ this->monitor_ = rhs.monitor_;
+ return *this;
+ }
+
+ inline Serdes_Monitor_Pvt(const Serdes_Monitor_Pvt& other) //!< Move constructor
+ {
+ this->monitor_ = std::move(other.monitor_);
+ }
+
+ inline Serdes_Monitor_Pvt& operator=(Serdes_Monitor_Pvt&& other) //!< Move assignment operator
+ {
+ if (this != &other)
+ {
+ this->monitor_ = std::move(other.monitor_);
+ }
+ return *this;
+ }
+
inline std::string createProtobuffer(const Monitor_Pvt& monitor) //!< Serialization into a string
{
monitor_.Clear();
@@ -94,7 +119,6 @@ public:
return data;
}
-
inline Monitor_Pvt readProtobuffer(const gnss_sdr::MonitorPvt& mon) //!< Deserialization
{
Monitor_Pvt monitor;
@@ -132,7 +156,7 @@ public:
}
private:
- gnss_sdr::MonitorPvt monitor_;
+ gnss_sdr::MonitorPvt monitor_{};
};
#endif // GNSS_SDR_SERDES_MONITOR_PVT_H_
diff --git a/src/algorithms/acquisition/adapters/beidou_b1i_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/beidou_b1i_pcps_acquisition.cc
index 7317dbc0b..27dad02cd 100644
--- a/src/algorithms/acquisition/adapters/beidou_b1i_pcps_acquisition.cc
+++ b/src/algorithms/acquisition/adapters/beidou_b1i_pcps_acquisition.cc
@@ -39,6 +39,8 @@
#include "gnss_sdr_flags.h"
#include
#include
+#include
+#include
BeidouB1iPcpsAcquisition::BeidouB1iPcpsAcquisition(
@@ -49,48 +51,37 @@ BeidouB1iPcpsAcquisition::BeidouB1iPcpsAcquisition(
in_streams_(in_streams),
out_streams_(out_streams)
{
- Acq_Conf acq_parameters = Acq_Conf();
configuration_ = configuration;
std::string default_item_type = "gr_complex";
- std::string default_dump_filename = "./data/acquisition.dat";
+ std::string default_dump_filename = "./acquisition.mat";
- DLOG(INFO) << "role " << role;
+ LOG(INFO) << "role " << role;
item_type_ = configuration_->property(role + ".item_type", default_item_type);
+
int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000);
fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
- acq_parameters.fs_in = fs_in_;
+ acq_parameters_.fs_in = fs_in_;
dump_ = configuration_->property(role + ".dump", false);
- acq_parameters.dump = dump_;
+ acq_parameters_.dump = dump_;
+ acq_parameters_.dump_channel = configuration_->property(role + ".dump_channel", 0);
blocking_ = configuration_->property(role + ".blocking", true);
- acq_parameters.blocking = blocking_;
- doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
+ acq_parameters_.blocking = blocking_;
+ doppler_max_ = configuration->property(role + ".doppler_max", 5000);
if (FLAGS_doppler_max != 0)
{
doppler_max_ = FLAGS_doppler_max;
}
- acq_parameters.doppler_max = doppler_max_;
- sampled_ms_ = configuration_->property(role + ".coherent_integration_time_ms", 1);
- acq_parameters.sampled_ms = sampled_ms_;
+ acq_parameters_.doppler_max = doppler_max_;
bit_transition_flag_ = configuration_->property(role + ".bit_transition_flag", false);
- acq_parameters.bit_transition_flag = bit_transition_flag_;
+ acq_parameters_.bit_transition_flag = bit_transition_flag_;
use_CFAR_algorithm_flag_ = configuration_->property(role + ".use_CFAR_algorithm", true); //will be false in future versions
- acq_parameters.use_CFAR_algorithm_flag = use_CFAR_algorithm_flag_;
+ acq_parameters_.use_CFAR_algorithm_flag = use_CFAR_algorithm_flag_;
max_dwells_ = configuration_->property(role + ".max_dwells", 1);
- acq_parameters.max_dwells = max_dwells_;
+ acq_parameters_.max_dwells = max_dwells_;
dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename);
- acq_parameters.dump_filename = dump_filename_;
- //--- Find number of samples per spreading code -------------------------
- code_length_ = static_cast(std::round(static_cast(fs_in_) / (BEIDOU_B1I_CODE_RATE_HZ / BEIDOU_B1I_CODE_LENGTH_CHIPS)));
-
- vector_length_ = code_length_ * sampled_ms_;
-
- if (bit_transition_flag_)
- {
- vector_length_ *= 2;
- }
-
- code_ = new gr_complex[vector_length_];
+ acq_parameters_.dump_filename = dump_filename_;
+ acq_parameters_.sampled_ms = configuration_->property(role + ".coherent_integration_time_ms", 1);
if (item_type_ == "cshort")
{
@@ -100,18 +91,28 @@ BeidouB1iPcpsAcquisition::BeidouB1iPcpsAcquisition(
{
item_size_ = sizeof(gr_complex);
}
- acq_parameters.it_size = item_size_;
- acq_parameters.sampled_ms = sampled_ms_;
- acq_parameters.samples_per_ms = code_length_;
- acq_parameters.samples_per_code = code_length_;
- acq_parameters.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4);
- acq_parameters.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0);
- acq_parameters.make_2_steps = configuration_->property(role + ".make_two_steps", false);
- acquisition_ = pcps_make_acquisition(acq_parameters);
- DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")";
- stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_);
- DLOG(INFO) << "stream_to_vector(" << stream_to_vector_->unique_id() << ")";
+ acq_parameters_.ms_per_code = 1;
+ acq_parameters_.it_size = item_size_;
+ num_codes_ = acq_parameters_.sampled_ms;
+ acq_parameters_.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4);
+ acq_parameters_.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0);
+ acq_parameters_.make_2_steps = configuration_->property(role + ".make_two_steps", false);
+ acq_parameters_.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false);
+ acq_parameters_.use_automatic_resampler = configuration_->property("GNSS-SDR.use_acquisition_resampler", false);
+
+ acq_parameters_.resampled_fs = fs_in_;
+ //--- Find number of samples per spreading code -------------------------
+ code_length_ = static_cast(std::floor(static_cast(fs_in_) / (BEIDOU_B1I_CODE_RATE_HZ / BEIDOU_B1I_CODE_LENGTH_CHIPS)));
+ acq_parameters_.samples_per_ms = static_cast(fs_in_) * 0.001;
+ acq_parameters_.samples_per_chip = static_cast(ceil((1.0 / BEIDOU_B1I_CODE_RATE_HZ) * static_cast(acq_parameters_.fs_in)));
+
+
+ acq_parameters_.samples_per_code = acq_parameters_.samples_per_ms * static_cast(BEIDOU_B1I_CODE_PERIOD * 1000.0);
+ vector_length_ = std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2 : 1);
+ code_ = std::vector>(vector_length_);
+ acquisition_ = pcps_make_acquisition(acq_parameters_);
+ DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")";
if (item_type_ == "cbyte")
{
@@ -123,7 +124,7 @@ BeidouB1iPcpsAcquisition::BeidouB1iPcpsAcquisition(
threshold_ = 0.0;
doppler_step_ = 0;
gnss_synchro_ = nullptr;
-
+
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";
@@ -135,10 +136,7 @@ BeidouB1iPcpsAcquisition::BeidouB1iPcpsAcquisition(
}
-BeidouB1iPcpsAcquisition::~BeidouB1iPcpsAcquisition()
-{
- delete[] code_;
-}
+BeidouB1iPcpsAcquisition::~BeidouB1iPcpsAcquisition() = default;
void BeidouB1iPcpsAcquisition::stop_acquisition()
@@ -204,18 +202,17 @@ void BeidouB1iPcpsAcquisition::init()
void BeidouB1iPcpsAcquisition::set_local_code()
{
- auto* code = new std::complex[code_length_];
+ std::unique_ptr> code{new std::complex[code_length_]};
- beidou_b1i_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0);
+ beidou_b1i_code_gen_complex_sampled(gsl::span>(code, code_length_), gnss_synchro_->PRN, fs_in_, 0);
- for (uint32_t i = 0; i < sampled_ms_; i++)
+ gsl::span code_span(code_.data(), vector_length_);
+ for (unsigned int i = 0; i < num_codes_; i++)
{
- memcpy(&(code_[i * code_length_]), code,
- sizeof(gr_complex) * code_length_);
+ std::copy_n(code.get(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
}
- acquisition_->set_local_code(code_);
- delete[] code;
+ acquisition_->set_local_code(code_.data());
}
@@ -235,15 +232,7 @@ float BeidouB1iPcpsAcquisition::calculate_threshold(float pfa)
{
//Calculate the threshold
uint32_t frequency_bins = 0;
- /*
- for (int doppler = (int)(-doppler_max_); doppler <= (int)doppler_max_; doppler += doppler_step_)
- {
- frequency_bins++;
- }
- */
-
frequency_bins = (2 * doppler_max_ + doppler_step_) / doppler_step_;
-
DLOG(INFO) << "Channel " << channel_ << " Pfa = " << pfa;
uint32_t ncells = vector_length_ * frequency_bins;
double exponent = 1 / static_cast(ncells);
@@ -268,9 +257,11 @@ void BeidouB1iPcpsAcquisition::connect(gr::top_block_sptr top_block)
}
else if (item_type_ == "cbyte")
{
+ // Since a byte-based acq implementation is not available,
+ // we just convert cshorts to gr_complex
top_block->connect(cbyte_to_float_x2_, 0, float_to_complex_, 0);
top_block->connect(cbyte_to_float_x2_, 1, float_to_complex_, 1);
- top_block->connect(float_to_complex_, 0, stream_to_vector_, 0);
+ top_block->connect(float_to_complex_, 0, acquisition_, 0);
}
else
{
@@ -291,11 +282,9 @@ void BeidouB1iPcpsAcquisition::disconnect(gr::top_block_sptr top_block)
}
else if (item_type_ == "cbyte")
{
- // Since a byte-based acq implementation is not available,
- // we just convert cshorts to gr_complex
top_block->disconnect(cbyte_to_float_x2_, 0, float_to_complex_, 0);
top_block->disconnect(cbyte_to_float_x2_, 1, float_to_complex_, 1);
- top_block->disconnect(float_to_complex_, 0, stream_to_vector_, 0);
+ top_block->disconnect(float_to_complex_, 0, acquisition_, 0);
}
else
{
@@ -331,6 +320,7 @@ gr::basic_block_sptr BeidouB1iPcpsAcquisition::get_right_block()
return acquisition_;
}
+
void BeidouB1iPcpsAcquisition::set_resampler_latency(uint32_t latency_samples)
{
acquisition_->set_resampler_latency(latency_samples);
diff --git a/src/algorithms/acquisition/adapters/beidou_b1i_pcps_acquisition.h b/src/algorithms/acquisition/adapters/beidou_b1i_pcps_acquisition.h
index f274d3ee6..0c2e611e2 100644
--- a/src/algorithms/acquisition/adapters/beidou_b1i_pcps_acquisition.h
+++ b/src/algorithms/acquisition/adapters/beidou_b1i_pcps_acquisition.h
@@ -42,7 +42,9 @@
#include
#include
#include
+#include
#include
+#include
class ConfigurationInterface;
@@ -100,15 +102,14 @@ public:
}
/*!
- * \brief Set channel fsm associated to this acquisition instance
- */
+ * \brief Set channel fsm associated to this acquisition instance
+ */
inline void set_channel_fsm(std::weak_ptr channel_fsm) override
{
channel_fsm_ = channel_fsm;
acquisition_->set_channel_fsm(channel_fsm);
}
-
/*!
* \brief Set statistics threshold of PCPS algorithm
*/
@@ -159,36 +160,34 @@ public:
*/
void set_resampler_latency(uint32_t latency_samples) override;
-
private:
ConfigurationInterface* configuration_;
pcps_acquisition_sptr acquisition_;
- gr::blocks::stream_to_vector::sptr stream_to_vector_;
+ Acq_Conf acq_parameters_;
gr::blocks::float_to_complex::sptr float_to_complex_;
complex_byte_to_float_x2_sptr cbyte_to_float_x2_;
size_t item_size_;
std::string item_type_;
- uint32_t vector_length_;
- uint32_t code_length_;
+ unsigned int vector_length_;
+ unsigned int code_length_;
bool bit_transition_flag_;
bool use_CFAR_algorithm_flag_;
- uint32_t channel_;
+ unsigned int channel_;
std::weak_ptr channel_fsm_;
float threshold_;
- uint32_t doppler_max_;
- uint32_t doppler_step_;
- uint32_t sampled_ms_;
- uint32_t max_dwells_;
+ unsigned int doppler_max_;
+ unsigned int doppler_step_;
+ unsigned int max_dwells_;
int64_t fs_in_;
bool dump_;
bool blocking_;
std::string dump_filename_;
- std::complex* code_;
+ std::vector> code_;
Gnss_Synchro* gnss_synchro_;
std::string role_;
- uint32_t in_streams_;
- uint32_t out_streams_;
-
+ unsigned int num_codes_;
+ unsigned int in_streams_;
+ unsigned int out_streams_;
float calculate_threshold(float pfa);
};
diff --git a/src/algorithms/acquisition/adapters/beidou_b3i_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/beidou_b3i_pcps_acquisition.cc
index 6855d11fb..bdeede24e 100644
--- a/src/algorithms/acquisition/adapters/beidou_b3i_pcps_acquisition.cc
+++ b/src/algorithms/acquisition/adapters/beidou_b3i_pcps_acquisition.cc
@@ -37,7 +37,7 @@
#include "gnss_sdr_flags.h"
#include
#include
-
+#include
using google::LogMessage;
@@ -49,46 +49,37 @@ BeidouB3iPcpsAcquisition::BeidouB3iPcpsAcquisition(
in_streams_(in_streams),
out_streams_(out_streams)
{
- Acq_Conf acq_parameters = Acq_Conf();
configuration_ = configuration;
std::string default_item_type = "gr_complex";
- std::string default_dump_filename = "./data/acquisition.dat";
+ std::string default_dump_filename = "./acquisition.mat";
- DLOG(INFO) << "role " << role;
+ LOG(INFO) << "role " << role;
item_type_ = configuration_->property(role + ".item_type", default_item_type);
int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000);
fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
- acq_parameters.fs_in = fs_in_;
+ acq_parameters_.fs_in = fs_in_;
dump_ = configuration_->property(role + ".dump", false);
- acq_parameters.dump = dump_;
+ acq_parameters_.dump = dump_;
+ acq_parameters_.dump_channel = configuration_->property(role + ".dump_channel", 0);
blocking_ = configuration_->property(role + ".blocking", true);
- acq_parameters.blocking = blocking_;
- doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
- if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max;
- acq_parameters.doppler_max = doppler_max_;
- sampled_ms_ = configuration_->property(role + ".coherent_integration_time_ms", 1);
- acq_parameters.sampled_ms = sampled_ms_;
- bit_transition_flag_ = configuration_->property(role + ".bit_transition_flag", false);
- acq_parameters.bit_transition_flag = bit_transition_flag_;
- use_CFAR_algorithm_flag_ = configuration_->property(role + ".use_CFAR_algorithm", true); //will be false in future versions
- acq_parameters.use_CFAR_algorithm_flag = use_CFAR_algorithm_flag_;
- max_dwells_ = configuration_->property(role + ".max_dwells", 1);
- acq_parameters.max_dwells = max_dwells_;
- dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename);
- acq_parameters.dump_filename = dump_filename_;
- //--- Find number of samples per spreading code -------------------------
- code_length_ = static_cast(std::round(static_cast(fs_in_) / (BEIDOU_B3I_CODE_RATE_HZ / BEIDOU_B3I_CODE_LENGTH_CHIPS)));
-
- vector_length_ = code_length_ * sampled_ms_;
-
- if (bit_transition_flag_)
+ acq_parameters_.blocking = blocking_;
+ doppler_max_ = configuration->property(role + ".doppler_max", 5000);
+ if (FLAGS_doppler_max != 0)
{
- vector_length_ *= 2;
+ doppler_max_ = FLAGS_doppler_max;
}
-
- code_ = new gr_complex[vector_length_];
+ acq_parameters_.doppler_max = doppler_max_;
+ bit_transition_flag_ = configuration_->property(role + ".bit_transition_flag", false);
+ acq_parameters_.bit_transition_flag = bit_transition_flag_;
+ use_CFAR_algorithm_flag_ = configuration_->property(role + ".use_CFAR_algorithm", true); //will be false in future versions
+ acq_parameters_.use_CFAR_algorithm_flag = use_CFAR_algorithm_flag_;
+ max_dwells_ = configuration_->property(role + ".max_dwells", 1);
+ acq_parameters_.max_dwells = max_dwells_;
+ dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename);
+ acq_parameters_.dump_filename = dump_filename_;
+ acq_parameters_.sampled_ms = configuration_->property(role + ".coherent_integration_time_ms", 1);
if (item_type_ == "cshort")
{
@@ -98,18 +89,28 @@ BeidouB3iPcpsAcquisition::BeidouB3iPcpsAcquisition(
{
item_size_ = sizeof(gr_complex);
}
- acq_parameters.it_size = item_size_;
- acq_parameters.sampled_ms = sampled_ms_;
- acq_parameters.samples_per_ms = code_length_;
- acq_parameters.samples_per_code = code_length_;
- acq_parameters.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4);
- acq_parameters.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0);
- acq_parameters.make_2_steps = configuration_->property(role + ".make_two_steps", false);
- acquisition_ = pcps_make_acquisition(acq_parameters);
- DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")";
- stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_);
- DLOG(INFO) << "stream_to_vector(" << stream_to_vector_->unique_id() << ")";
+ acq_parameters_.ms_per_code = 1;
+ acq_parameters_.it_size = item_size_;
+ num_codes_ = acq_parameters_.sampled_ms;
+ acq_parameters_.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4);
+ acq_parameters_.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0);
+ acq_parameters_.make_2_steps = configuration_->property(role + ".make_two_steps", false);
+ acq_parameters_.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false);
+ acq_parameters_.use_automatic_resampler = configuration_->property("GNSS-SDR.use_acquisition_resampler", false);
+
+ acq_parameters_.resampled_fs = fs_in_;
+ //--- Find number of samples per spreading code -------------------------
+ code_length_ = static_cast(std::floor(static_cast(fs_in_) / (BEIDOU_B3I_CODE_RATE_HZ / BEIDOU_B3I_CODE_LENGTH_CHIPS)));
+ acq_parameters_.samples_per_ms = static_cast(fs_in_) * 0.001;
+ acq_parameters_.samples_per_chip = static_cast(ceil((1.0 / BEIDOU_B3I_CODE_RATE_HZ) * static_cast(acq_parameters_.fs_in)));
+
+
+ acq_parameters_.samples_per_code = acq_parameters_.samples_per_ms * static_cast(BEIDOU_B3I_CODE_PERIOD * 1000.0);
+ vector_length_ = std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2 : 1);
+ code_ = std::vector>(vector_length_);
+ acquisition_ = pcps_make_acquisition(acq_parameters_);
+ DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")";
if (item_type_ == "cbyte")
{
@@ -121,7 +122,7 @@ BeidouB3iPcpsAcquisition::BeidouB3iPcpsAcquisition(
threshold_ = 0.0;
doppler_step_ = 0;
gnss_synchro_ = nullptr;
-
+
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";
@@ -133,20 +134,22 @@ BeidouB3iPcpsAcquisition::BeidouB3iPcpsAcquisition(
}
-BeidouB3iPcpsAcquisition::~BeidouB3iPcpsAcquisition()
-{
- delete[] code_;
-}
+BeidouB3iPcpsAcquisition::~BeidouB3iPcpsAcquisition() = default;
void BeidouB3iPcpsAcquisition::stop_acquisition()
{
}
+
void BeidouB3iPcpsAcquisition::set_threshold(float threshold)
{
- float pfa = configuration_->property(role_ + ".pfa", 0.0);
+ float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", 0.0);
+ if (pfa == 0.0)
+ {
+ pfa = configuration_->property(role_ + ".pfa", 0.0);
+ }
if (pfa == 0.0)
{
threshold_ = threshold;
@@ -195,24 +198,22 @@ signed int BeidouB3iPcpsAcquisition::mag()
void BeidouB3iPcpsAcquisition::init()
{
acquisition_->init();
- set_local_code();
}
void BeidouB3iPcpsAcquisition::set_local_code()
{
- auto* code = new std::complex[code_length_];
+ std::unique_ptr> code{new std::complex[code_length_]};
- beidou_b3i_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0);
+ beidou_b3i_code_gen_complex_sampled(gsl::span>(code, code_length_), gnss_synchro_->PRN, fs_in_, 0);
- for (unsigned int i = 0; i < sampled_ms_; i++)
+ gsl::span code_span(code_.data(), vector_length_);
+ for (unsigned int i = 0; i < num_codes_; i++)
{
- memcpy(&(code_[i * code_length_]), code,
- sizeof(gr_complex) * code_length_);
+ std::copy_n(code.get(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
}
- acquisition_->set_local_code(code_);
- delete[] code;
+ acquisition_->set_local_code(code_.data());
}
@@ -232,20 +233,12 @@ float BeidouB3iPcpsAcquisition::calculate_threshold(float pfa)
{
//Calculate the threshold
unsigned int frequency_bins = 0;
- /*
- for (int doppler = (int)(-doppler_max_); doppler <= (int)doppler_max_; doppler += doppler_step_)
- {
- frequency_bins++;
- }
- */
-
frequency_bins = (2 * doppler_max_ + doppler_step_) / doppler_step_;
-
DLOG(INFO) << "Channel " << channel_ << " Pfa = " << pfa;
unsigned int ncells = vector_length_ * frequency_bins;
- double exponent = 1 / static_cast(ncells);
+ double exponent = 1.0 / static_cast(ncells);
double val = pow(1.0 - pfa, exponent);
- auto lambda = static_cast(vector_length_);
+ auto lambda = double(vector_length_);
boost::math::exponential_distribution mydist(lambda);
auto threshold = static_cast(quantile(mydist, val));
@@ -265,9 +258,11 @@ void BeidouB3iPcpsAcquisition::connect(gr::top_block_sptr top_block)
}
else if (item_type_ == "cbyte")
{
+ // Since a byte-based acq implementation is not available,
+ // we just convert cshorts to gr_complex
top_block->connect(cbyte_to_float_x2_, 0, float_to_complex_, 0);
top_block->connect(cbyte_to_float_x2_, 1, float_to_complex_, 1);
- top_block->connect(float_to_complex_, 0, stream_to_vector_, 0);
+ top_block->connect(float_to_complex_, 0, acquisition_, 0);
}
else
{
@@ -288,11 +283,9 @@ void BeidouB3iPcpsAcquisition::disconnect(gr::top_block_sptr top_block)
}
else if (item_type_ == "cbyte")
{
- // Since a byte-based acq implementation is not available,
- // we just convert cshorts to gr_complex
top_block->disconnect(cbyte_to_float_x2_, 0, float_to_complex_, 0);
top_block->disconnect(cbyte_to_float_x2_, 1, float_to_complex_, 1);
- top_block->disconnect(float_to_complex_, 0, stream_to_vector_, 0);
+ top_block->disconnect(float_to_complex_, 0, acquisition_, 0);
}
else
{
@@ -307,7 +300,7 @@ gr::basic_block_sptr BeidouB3iPcpsAcquisition::get_left_block()
{
return acquisition_;
}
- else if (item_type_ == "cshort")
+ if (item_type_ == "cshort")
{
return acquisition_;
}
diff --git a/src/algorithms/acquisition/adapters/beidou_b3i_pcps_acquisition.h b/src/algorithms/acquisition/adapters/beidou_b3i_pcps_acquisition.h
index d824c132a..c57f28127 100644
--- a/src/algorithms/acquisition/adapters/beidou_b3i_pcps_acquisition.h
+++ b/src/algorithms/acquisition/adapters/beidou_b3i_pcps_acquisition.h
@@ -41,7 +41,9 @@
#include
#include
#include
+#include
#include
+#include
class ConfigurationInterface;
@@ -99,15 +101,14 @@ public:
}
/*!
- * \brief Set channel fsm associated to this acquisition instance
- */
+ * \brief Set channel fsm associated to this acquisition instance
+ */
inline void set_channel_fsm(std::weak_ptr channel_fsm) override
{
channel_fsm_ = channel_fsm;
acquisition_->set_channel_fsm(channel_fsm);
}
-
/*!
* \brief Set statistics threshold of PCPS algorithm
*/
@@ -158,11 +159,10 @@ public:
*/
void set_resampler_latency(uint32_t latency_samples) override;
-
private:
ConfigurationInterface* configuration_;
pcps_acquisition_sptr acquisition_;
- gr::blocks::stream_to_vector::sptr stream_to_vector_;
+ Acq_Conf acq_parameters_;
gr::blocks::float_to_complex::sptr float_to_complex_;
complex_byte_to_float_x2_sptr cbyte_to_float_x2_;
size_t item_size_;
@@ -176,18 +176,17 @@ private:
float threshold_;
unsigned int doppler_max_;
unsigned int doppler_step_;
- unsigned int sampled_ms_;
unsigned int max_dwells_;
int64_t fs_in_;
bool dump_;
bool blocking_;
std::string dump_filename_;
- std::complex* code_;
+ std::vector> code_;
Gnss_Synchro* gnss_synchro_;
std::string role_;
+ unsigned int num_codes_;
unsigned int in_streams_;
unsigned int out_streams_;
-
float calculate_threshold(float pfa);
};
diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc
index 6c0f61c30..431a8142c 100644
--- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc
+++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc
@@ -36,6 +36,7 @@
#include "gnss_sdr_flags.h"
#include
#include
+#include
GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition(
@@ -86,7 +87,7 @@ GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition(
int samples_per_ms = code_length_ / 4;
- code_ = new gr_complex[vector_length_];
+ code_ = std::vector>(vector_length_);
if (item_type_ == "gr_complex")
{
@@ -110,7 +111,7 @@ GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition(
threshold_ = 0.0;
doppler_step_ = 0;
gnss_synchro_ = nullptr;
-
+
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";
@@ -122,10 +123,7 @@ GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition(
}
-GalileoE1Pcps8msAmbiguousAcquisition::~GalileoE1Pcps8msAmbiguousAcquisition()
-{
- delete[] code_;
-}
+GalileoE1Pcps8msAmbiguousAcquisition::~GalileoE1Pcps8msAmbiguousAcquisition() = default;
void GalileoE1Pcps8msAmbiguousAcquisition::stop_acquisition()
@@ -216,20 +214,20 @@ void GalileoE1Pcps8msAmbiguousAcquisition::set_local_code()
bool cboc = configuration_->property(
"Acquisition" + std::to_string(channel_) + ".cboc", false);
- auto* code = new std::complex[code_length_];
+ std::unique_ptr> code{new std::complex[code_length_]};
+ std::array Signal_;
+ std::memcpy(Signal_.data(), gnss_synchro_->Signal, 3);
- galileo_e1_code_gen_complex_sampled(code, gnss_synchro_->Signal,
+ galileo_e1_code_gen_complex_sampled(gsl::span>(code, code_length_), Signal_,
cboc, gnss_synchro_->PRN, fs_in_, 0, false);
+ gsl::span code_span(code_.data(), vector_length_);
for (unsigned int i = 0; i < sampled_ms_ / 4; i++)
{
- memcpy(&(code_[i * code_length_]), code,
- sizeof(gr_complex) * code_length_);
+ std::copy_n(code.get(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
}
- acquisition_cc_->set_local_code(code_);
-
- delete[] code;
+ acquisition_cc_->set_local_code(code_.data());
}
}
@@ -242,6 +240,7 @@ void GalileoE1Pcps8msAmbiguousAcquisition::reset()
}
}
+
float GalileoE1Pcps8msAmbiguousAcquisition::calculate_threshold(float pfa)
{
unsigned int frequency_bins = 0;
diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.h
index 27e9049de..a3be14fce 100644
--- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.h
+++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.h
@@ -36,7 +36,9 @@
#include "galileo_pcps_8ms_acquisition_cc.h"
#include "gnss_synchro.h"
#include
+#include
#include
+#include
class ConfigurationInterface;
@@ -165,7 +167,7 @@ private:
int64_t fs_in_;
bool dump_;
std::string dump_filename_;
- std::complex* code_;
+ std::vector> code_;
Gnss_Synchro* gnss_synchro_;
std::string role_;
unsigned int in_streams_;
diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc
index ea1b9ea73..60082fc4c 100644
--- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc
+++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc
@@ -37,6 +37,7 @@
#include "gnss_sdr_flags.h"
#include
#include
+#include
GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
@@ -126,7 +127,7 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
vector_length_ *= 2;
}
- code_ = new gr_complex[vector_length_];
+ code_ = std::vector>(vector_length_);
if (item_type_ == "cshort")
{
@@ -154,7 +155,7 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
threshold_ = 0.0;
doppler_step_ = 0;
gnss_synchro_ = nullptr;
-
+
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";
@@ -166,16 +167,14 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
}
-GalileoE1PcpsAmbiguousAcquisition::~GalileoE1PcpsAmbiguousAcquisition()
-{
- delete[] code_;
-}
+GalileoE1PcpsAmbiguousAcquisition::~GalileoE1PcpsAmbiguousAcquisition() = default;
void GalileoE1PcpsAmbiguousAcquisition::stop_acquisition()
{
}
+
void GalileoE1PcpsAmbiguousAcquisition::set_threshold(float threshold)
{
float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", 0.0);
@@ -242,45 +241,47 @@ void GalileoE1PcpsAmbiguousAcquisition::set_local_code()
bool cboc = configuration_->property(
"Acquisition" + std::to_string(channel_) + ".cboc", false);
- auto* code = new std::complex[code_length_];
+ std::unique_ptr> code{new std::complex[code_length_]};
+ gsl::span> code_span(code.get(), code_length_);
if (acquire_pilot_ == true)
{
//set local signal generator to Galileo E1 pilot component (1C)
- char pilot_signal[3] = "1C";
+ std::array pilot_signal = {{'1', 'C', '\0'}};
if (acq_parameters_.use_automatic_resampler)
{
- galileo_e1_code_gen_complex_sampled(code, pilot_signal,
+ galileo_e1_code_gen_complex_sampled(code_span, pilot_signal,
cboc, gnss_synchro_->PRN, acq_parameters_.resampled_fs, 0, false);
}
else
{
- galileo_e1_code_gen_complex_sampled(code, pilot_signal,
+ galileo_e1_code_gen_complex_sampled(code_span, pilot_signal,
cboc, gnss_synchro_->PRN, fs_in_, 0, false);
}
}
else
{
+ std::array Signal_;
+ std::memcpy(Signal_.data(), gnss_synchro_->Signal, 3);
if (acq_parameters_.use_automatic_resampler)
{
- galileo_e1_code_gen_complex_sampled(code, gnss_synchro_->Signal,
+ galileo_e1_code_gen_complex_sampled(code_span, Signal_,
cboc, gnss_synchro_->PRN, acq_parameters_.resampled_fs, 0, false);
}
else
{
- galileo_e1_code_gen_complex_sampled(code, gnss_synchro_->Signal,
+ galileo_e1_code_gen_complex_sampled(code_span, Signal_,
cboc, gnss_synchro_->PRN, fs_in_, 0, false);
}
}
-
+ gsl::span code__span(code_.data(), vector_length_);
for (unsigned int i = 0; i < sampled_ms_ / 4; i++)
{
- memcpy(&(code_[i * code_length_]), code, sizeof(gr_complex) * code_length_);
+ std::copy_n(code.get(), code_length_, code__span.subspan(i * code_length_, code_length_).data());
}
- acquisition_->set_local_code(code_);
- delete[] code;
+ acquisition_->set_local_code(code_.data());
}
diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h
index 12aebab73..92c25724b 100644
--- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h
+++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h
@@ -39,7 +39,9 @@
#include "pcps_acquisition.h"
#include
#include
+#include
#include
+#include
class ConfigurationInterface;
@@ -98,13 +100,14 @@ public:
}
/*!
- * \brief Set channel fsm associated to this acquisition instance
- */
+ * \brief Set channel fsm associated to this acquisition instance
+ */
inline void set_channel_fsm(std::weak_ptr channel_fsm) override
{
channel_fsm_ = channel_fsm;
acquisition_->set_channel_fsm(channel_fsm);
}
+
/*!
* \brief Set statistics threshold of PCPS algorithm
*/
@@ -153,10 +156,8 @@ public:
/*!
* \brief Sets the resampler latency to account it in the acquisition code delay estimation
*/
-
void set_resampler_latency(uint32_t latency_samples) override;
-
private:
ConfigurationInterface* configuration_;
Acq_Conf acq_parameters_;
@@ -181,7 +182,7 @@ private:
bool dump_;
bool blocking_;
std::string dump_filename_;
- std::complex* code_;
+ std::vector> code_;
Gnss_Synchro* gnss_synchro_;
std::string role_;
unsigned int in_streams_;
diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc
index e7a45bfe7..e1021b6b7 100644
--- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc
+++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc
@@ -40,9 +40,9 @@
#include // for gr_complex
#include // for volk_32fc_conjugate_32fc
#include
-#include // for abs, pow, floor
-#include // for complex
-#include // for memcpy
+#include // for copy_n
+#include // for abs, pow, floor
+#include // for complex
// the following flags are FPGA-specific and they are using arrange the values of the fft of the local code in the way the FPGA
// expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking.
@@ -108,11 +108,12 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
// compute all the GALILEO E1 PRN Codes (this is done only once in the class constructor in order to avoid re-computing the PRN codes every time
// a channel is assigned)
- auto* fft_if = new gr::fft::fft_complex(nsamples_total, true); // Direct FFT
- auto* code = new std::complex[nsamples_total]; // buffer for the local code
+ auto fft_if = std::unique_ptr(new gr::fft::fft_complex(nsamples_total, true)); // Direct FFT
+ std::vector> code(nsamples_total); // buffer for the local code
auto* fft_codes_padded = static_cast(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
- d_all_fft_codes_ = new uint32_t[(nsamples_total * GALILEO_E1_NUMBER_OF_CODES)]; // memory containing all the possible fft codes for PRN 0 to 32
- float max; // temporary maxima search
+ d_all_fft_codes_ = std::vector(nsamples_total * GALILEO_E1_NUMBER_OF_CODES); // memory containing all the possible fft codes for PRN 0 to 32
+
+ float max; // temporary maxima search
int32_t tmp, tmp2, local_code, fft_data;
for (uint32_t PRN = 1; PRN <= GALILEO_E1_NUMBER_OF_CODES; PRN++)
@@ -122,14 +123,14 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
if (acquire_pilot_ == true)
{
//set local signal generator to Galileo E1 pilot component (1C)
- char pilot_signal[3] = "1C";
- galileo_e1_code_gen_complex_sampled(code, pilot_signal,
+ std::array pilot_signal = {{'1', 'C', '\0'}};
+ galileo_e1_code_gen_complex_sampled(gsl::span>(code.data(), nsamples_total), pilot_signal,
cboc, PRN, fs_in, 0, false);
}
else
{
- char data_signal[3] = "1B";
- galileo_e1_code_gen_complex_sampled(code, data_signal,
+ std::array data_signal = {{'1', 'B', '\0'}};
+ galileo_e1_code_gen_complex_sampled(gsl::span>(code.data(), nsamples_total), data_signal,
cboc, PRN, fs_in, 0, false);
}
@@ -144,7 +145,7 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
code[s] = std::complex(0.0, 0.0);
}
- memcpy(fft_if->get_inbuf(), code, sizeof(gr_complex) * nsamples_total); // copy to FFT buffer
+ std::copy_n(code.data(), nsamples_total, fft_if->get_inbuf()); // copy to FFT buffer
fft_if->execute(); // Run the FFT of local code
volk_32fc_conjugate_32fc(fft_codes_padded, fft_if->get_outbuf(), nsamples_total); // conjugate values
@@ -173,7 +174,7 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
}
}
- acq_parameters.all_fft_codes = d_all_fft_codes_;
+ acq_parameters.all_fft_codes = d_all_fft_codes_.data();
acq_parameters.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4);
acq_parameters.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0);
@@ -188,17 +189,12 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
doppler_step_ = 0;
gnss_synchro_ = nullptr;
- // temporary buffers that we can delete
- delete[] code;
- delete fft_if;
- delete[] fft_codes_padded;
+ // temporary buffers that we can release
+ volk_gnsssdr_free(fft_codes_padded);
}
-GalileoE1PcpsAmbiguousAcquisitionFpga::~GalileoE1PcpsAmbiguousAcquisitionFpga()
-{
- delete[] d_all_fft_codes_;
-}
+GalileoE1PcpsAmbiguousAcquisitionFpga::~GalileoE1PcpsAmbiguousAcquisitionFpga() = default;
void GalileoE1PcpsAmbiguousAcquisitionFpga::stop_acquisition()
diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h
index 83c3f66f5..a92b65e31 100644
--- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h
+++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h
@@ -37,7 +37,9 @@
#include // for basic_block_sptr, top_block_sptr
#include // for lv_16sc_t
#include // for size_t
+#include
#include
+#include
class Gnss_Synchro;
class ConfigurationInterface;
@@ -97,8 +99,8 @@ public:
}
/*!
- * \brief Set channel fsm associated to this acquisition instance
- */
+ * \brief Set channel fsm associated to this acquisition instance
+ */
inline void set_channel_fsm(std::weak_ptr channel_fsm) override
{
channel_fsm_ = channel_fsm;
@@ -165,8 +167,7 @@ private:
std::string role_;
unsigned int in_streams_;
unsigned int out_streams_;
-
- uint32_t* d_all_fft_codes_; // memory that contains all the code ffts
+ std::vector d_all_fft_codes_; // memory that contains all the code ffts
};
#endif /* GNSS_SDR_GALILEO_E1_PCPS_AMBIGUOUS_ACQUISITION_FPGA_H_ */
diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc
index 1375a22a8..f16c6e5da 100644
--- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc
+++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc
@@ -86,8 +86,8 @@ GalileoE1PcpsCccwsrAmbiguousAcquisition::GalileoE1PcpsCccwsrAmbiguousAcquisition
int samples_per_ms = code_length_ / 4;
- code_data_ = new gr_complex[vector_length_];
- code_pilot_ = new gr_complex[vector_length_];
+ code_data_ = std::vector>(vector_length_);
+ code_pilot_ = std::vector>(vector_length_);
if (item_type_ == "gr_complex")
{
@@ -111,7 +111,7 @@ GalileoE1PcpsCccwsrAmbiguousAcquisition::GalileoE1PcpsCccwsrAmbiguousAcquisition
threshold_ = 0.0;
doppler_step_ = 0;
gnss_synchro_ = nullptr;
-
+
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";
@@ -123,11 +123,7 @@ GalileoE1PcpsCccwsrAmbiguousAcquisition::GalileoE1PcpsCccwsrAmbiguousAcquisition
}
-GalileoE1PcpsCccwsrAmbiguousAcquisition::~GalileoE1PcpsCccwsrAmbiguousAcquisition()
-{
- delete[] code_data_;
- delete[] code_pilot_;
-}
+GalileoE1PcpsCccwsrAmbiguousAcquisition::~GalileoE1PcpsCccwsrAmbiguousAcquisition() = default;
void GalileoE1PcpsCccwsrAmbiguousAcquisition::stop_acquisition()
@@ -168,6 +164,7 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisition::set_doppler_step(unsigned int dopp
}
}
+
void GalileoE1PcpsCccwsrAmbiguousAcquisition::set_gnss_synchro(
Gnss_Synchro* gnss_synchro)
{
@@ -203,19 +200,17 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisition::set_local_code()
bool cboc = configuration_->property(
"Acquisition" + std::to_string(channel_) + ".cboc", false);
- char signal[3];
+ std::array signal = {{'1', 'B', '\0'}};
- strcpy(signal, "1B");
-
- galileo_e1_code_gen_complex_sampled(code_data_, signal,
+ galileo_e1_code_gen_complex_sampled(gsl::span(code_data_.data(), vector_length_), signal,
cboc, gnss_synchro_->PRN, fs_in_, 0, false);
- strcpy(signal, "1C");
+ std::array signal_C = {{'1', 'C', '\0'}};
- galileo_e1_code_gen_complex_sampled(code_pilot_, signal,
+ galileo_e1_code_gen_complex_sampled(gsl::span(code_pilot_.data(), vector_length_), signal_C,
cboc, gnss_synchro_->PRN, fs_in_, 0, false);
- acquisition_cc_->set_local_code(code_data_, code_pilot_);
+ acquisition_cc_->set_local_code(code_data_.data(), code_pilot_.data());
}
}
@@ -228,6 +223,7 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisition::reset()
}
}
+
void GalileoE1PcpsCccwsrAmbiguousAcquisition::set_state(int state)
{
acquisition_cc_->set_state(state);
diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.h
index b79fe2d33..eac80983c 100644
--- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.h
+++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.h
@@ -36,7 +36,9 @@
#include "gnss_synchro.h"
#include "pcps_cccwsr_acquisition_cc.h"
#include
+#include
#include
+#include
class ConfigurationInterface;
@@ -94,13 +96,14 @@ public:
}
/*!
- * \brief Set channel fsm associated to this acquisition instance
- */
+ * \brief Set channel fsm associated to this acquisition instance
+ */
inline void set_channel_fsm(std::weak_ptr channel_fsm) override
{
channel_fsm_ = channel_fsm;
acquisition_cc_->set_channel_fsm(channel_fsm);
}
+
/*!
* \brief Set statistics threshold of CCCWSR algorithm
*/
@@ -153,7 +156,6 @@ private:
std::string item_type_;
unsigned int vector_length_;
unsigned int code_length_;
- //unsigned int satellite_;
unsigned int channel_;
std::weak_ptr channel_fsm_;
float threshold_;
@@ -164,8 +166,8 @@ private:
int64_t fs_in_;
bool dump_;
std::string dump_filename_;
- std::complex* code_data_;
- std::complex* code_pilot_;
+ std::vector> code_data_;
+ std::vector> code_pilot_;
Gnss_Synchro* gnss_synchro_;
std::string role_;
unsigned int in_streams_;
diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc
index a64b3abda..9a3462407 100644
--- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc
+++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc
@@ -36,6 +36,7 @@
#include "gnss_sdr_flags.h"
#include
#include
+#include
GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcquisition(
@@ -114,7 +115,7 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcqui
dump_filename_ = configuration_->property(role + ".dump_filename",
default_dump_filename);
- code_ = new gr_complex[code_length_];
+ code_ = std::vector>(code_length_);
LOG(INFO) << "Vector Length: " << vector_length_
<< ", Samples per ms: " << samples_per_ms
<< ", Folding factor: " << folding_factor_
@@ -144,7 +145,7 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcqui
threshold_ = 0.0;
doppler_step_ = 0;
gnss_synchro_ = nullptr;
-
+
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";
@@ -156,10 +157,7 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcqui
}
-GalileoE1PcpsQuickSyncAmbiguousAcquisition::~GalileoE1PcpsQuickSyncAmbiguousAcquisition()
-{
- delete[] code_;
-}
+GalileoE1PcpsQuickSyncAmbiguousAcquisition::~GalileoE1PcpsQuickSyncAmbiguousAcquisition() = default;
void GalileoE1PcpsQuickSyncAmbiguousAcquisition::stop_acquisition()
@@ -250,23 +248,20 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisition::set_local_code()
bool cboc = configuration_->property(
"Acquisition" + std::to_string(channel_) + ".cboc", false);
- auto* code = new std::complex[code_length_];
+ std::unique_ptr> code{new std::complex[code_length_]};
+ std::array Signal_;
+ std::memcpy(Signal_.data(), gnss_synchro_->Signal, 3);
- galileo_e1_code_gen_complex_sampled(code, gnss_synchro_->Signal,
+ galileo_e1_code_gen_complex_sampled(gsl::span>(code.get(), code_length_), Signal_,
cboc, gnss_synchro_->PRN, fs_in_, 0, false);
-
+ gsl::span code_span(code_.data(), vector_length_);
for (unsigned int i = 0; i < (sampled_ms_ / (folding_factor_ * 4)); i++)
{
- memcpy(&(code_[i * code_length_]), code,
- sizeof(gr_complex) * code_length_);
+ std::copy_n(code.get(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
}
- // memcpy(code_, code,sizeof(gr_complex)*code_length_);
- acquisition_cc_->set_local_code(code_);
-
- delete[] code;
- code = nullptr;
+ acquisition_cc_->set_local_code(code_.data());
}
}
@@ -279,6 +274,7 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisition::reset()
}
}
+
void GalileoE1PcpsQuickSyncAmbiguousAcquisition::set_state(int state)
{
if (item_type_ == "gr_complex")
diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.h
index c717c4ed7..ecbac95b6 100644
--- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.h
+++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.h
@@ -36,7 +36,9 @@
#include "gnss_synchro.h"
#include "pcps_quicksync_acquisition_cc.h"
#include
+#include
#include
+#include
class ConfigurationInterface;
@@ -169,7 +171,7 @@ private:
int64_t fs_in_;
bool dump_;
std::string dump_filename_;
- std::complex* code_;
+ std::vector> code_;
Gnss_Synchro* gnss_synchro_;
std::string role_;
unsigned int in_streams_;
diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc
index 6bc6b8ad3..3bb75b971 100644
--- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc
+++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc
@@ -36,6 +36,7 @@
#include "gnss_sdr_flags.h"
#include
#include
+#include
GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition(
@@ -89,7 +90,7 @@ GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition(
int samples_per_ms = code_length_ / 4;
- code_ = new gr_complex[vector_length_];
+ code_ = std::vector>(vector_length_);
if (item_type_ == "gr_complex")
{
@@ -114,7 +115,7 @@ GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition(
threshold_ = 0.0;
doppler_step_ = 0;
gnss_synchro_ = nullptr;
-
+
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";
@@ -126,10 +127,7 @@ GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition(
}
-GalileoE1PcpsTongAmbiguousAcquisition::~GalileoE1PcpsTongAmbiguousAcquisition()
-{
- delete[] code_;
-}
+GalileoE1PcpsTongAmbiguousAcquisition::~GalileoE1PcpsTongAmbiguousAcquisition() = default;
void GalileoE1PcpsTongAmbiguousAcquisition::stop_acquisition()
@@ -220,20 +218,19 @@ void GalileoE1PcpsTongAmbiguousAcquisition::set_local_code()
bool cboc = configuration_->property(
"Acquisition" + std::to_string(channel_) + ".cboc", false);
- auto* code = new std::complex[code_length_];
-
- galileo_e1_code_gen_complex_sampled(code, gnss_synchro_->Signal,
+ std::unique_ptr> code{new std::complex[code_length_]};
+ std::array Signal_;
+ std::memcpy(Signal_.data(), gnss_synchro_->Signal, 3);
+ galileo_e1_code_gen_complex_sampled(gsl::span>(code.get(), code_length_), Signal_,
cboc, gnss_synchro_->PRN, fs_in_, 0, false);
+ gsl::span