From 1faefa4d826b4674f9c802b84802a72d66142399 Mon Sep 17 00:00:00 2001 From: PepMS <jmarti@iri.upc.edu> Date: Thu, 20 Jun 2019 10:41:03 +0200 Subject: [PATCH] Compiling issues: RTKLIB added as git submodule Changed to RTKLIB relative paths CMakeLists.txt error corrections --- CMakeLists.txt | 2 ++ cmake_modules/FindRTKLIB.cmake | 18 ------------------ include/gnss_utils.h | 23 +++++++++++------------ include/navigation.h | 14 ++++---------- include/observations.h | 11 +++++------ src/CMakeLists.txt | 30 +++++++++++++++++++++++------- src/examples/gnss_utils_test.cpp | 26 +++++++++++++------------- 7 files changed, 58 insertions(+), 66 deletions(-) delete mode 100644 cmake_modules/FindRTKLIB.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index a517b92..7fdfa2d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,6 +37,8 @@ else() message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") endif() +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive") + ADD_SUBDIRECTORY(src) FIND_PACKAGE(Doxygen) diff --git a/cmake_modules/FindRTKLIB.cmake b/cmake_modules/FindRTKLIB.cmake deleted file mode 100644 index 41289eb..0000000 --- a/cmake_modules/FindRTKLIB.cmake +++ /dev/null @@ -1,18 +0,0 @@ -#edit the following line to add the librarie's header files - -FIND_PATH(RTKLIB_INCLUDE_DIR rtklib.h /usr/include /usr/local/include ~/RTKLIB/src) -GET_FILENAME_COMPONENT(RTK_LIB_PATH ${RTKLIB_INCLUDE_DIR} DIRECTORY) - -IF (RTKLIB_INCLUDE_DIR) - SET(RTKLIB_FOUND TRUE) -ENDIF (RTKLIB_INCLUDE_DIR) - -IF (RTKLIB_FOUND) - IF (NOT RTKLIB_FOUND_QUIETLY) - MESSAGE(STATUS "Found RTKLIB: ${RTKLIB_INCLUDE_DIR}") - ENDIF (NOT RTKLIB_FOUND_QUIETLY) -ELSE (RTKLIB_FOUND) - IF (RTKLIB_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could not find RTKLIB") - ENDIF (RTKLIB_FIND_REQUIRED) -ENDIF (RTKLIB_FOUND) diff --git a/include/gnss_utils.h b/include/gnss_utils.h index 8cca79a..805187b 100644 --- a/include/gnss_utils.h +++ b/include/gnss_utils.h @@ -7,7 +7,7 @@ extern "C" { - + #include "../deps/RTKLIB/src/rtklib.h" } namespace GNSSUtils @@ -29,23 +29,23 @@ namespace GNSSUtils void clearObservations(); void pushObservation(obsd_t obs); - + std::vector<obsd_t> getObservations(); /* - Navigation - */ void clearNavigation(); - + void setNavigation(nav_t nav); nav_t getNavigation(); - + /* - Processing Options - */ void clearOptions(); - + void setOptions(prcopt_t opt); prcopt_t getOptions(); @@ -54,7 +54,7 @@ namespace GNSSUtils /* - Solution - */ void clearSolution(); - + void setSolution(sol_t sol); sol_t getSolution(); @@ -63,21 +63,21 @@ namespace GNSSUtils /* - Satellite status - */ void clearSatStatus(); - + void setSatStatus(ssat_t ssat); ssat_t getSatStatus(); - + /* - Compute Fix - */ int computeSPP(double *azel, char *msg); - + private: - // Private objects + // Private objects // rtklib-like attribute to represent the different observation msgs for a given epoch std::vector<obsd_t> _obsVector; - + // rtklib-like attribute to represent the different navigation msgs for a given epoch nav_t _nav; @@ -96,4 +96,3 @@ namespace GNSSUtils }; } #endif - diff --git a/include/navigation.h b/include/navigation.h index 34f16eb..c0fed77 100644 --- a/include/navigation.h +++ b/include/navigation.h @@ -8,7 +8,7 @@ extern "C" { - #include "/home/jlaplaza/RTKLIB/src/rtklib.h" + #include "../deps/RTKLIB/src/rtklib.h" } namespace GNSSUtils @@ -25,7 +25,7 @@ namespace GNSSUtils // Public methods void clearNavigation(); - + void setNavigation(nav_t nav); nav_t getNavigation(); @@ -86,7 +86,7 @@ namespace GNSSUtils void allocateIonGal(int n); // Galileo void deleteIonGal(); - + void allocateIonQZS(int n); // QZS void deleteIonQZS(); @@ -125,13 +125,8 @@ namespace GNSSUtils void deletesbsion(); - - - - - private: - + // rtklib-like attribute to represent the different navigation msgs for a given epoch nav_t _nav; @@ -141,4 +136,3 @@ namespace GNSSUtils }; } #endif - diff --git a/include/observations.h b/include/observations.h index ca4eec2..16e230c 100644 --- a/include/observations.h +++ b/include/observations.h @@ -9,7 +9,7 @@ extern "C" { - #include "/home/jlaplaza/RTKLIB/src/rtklib.h" + #include "../deps/RTKLIB/src/rtklib.h" } namespace GNSSUtils @@ -31,16 +31,16 @@ namespace GNSSUtils void clearObservations(); void pushObservation(obsd_t obs); - + std::vector<obsd_t> getObservations(); - + private: - // Private objects + // Private objects // rtklib-like attribute to represent the different observation msgs for a given epoch std::vector<obsd_t> _obsVector; - + // Private methods @@ -48,4 +48,3 @@ namespace GNSSUtils }; } #endif - diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2e3538c..37da0b7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,17 +1,33 @@ # rtklib path -set(rtklib_dir $ENV{HOME}/RTKLIB) +set(rtklib_dir ../deps/RTKLIB) set(rtklib_src_dir ${rtklib_dir}/src) # driver source files -SET(sources observations.cpp navigation.cpp) -SET(rtklib_src ${rtklib_src_dir}/pntpos.c ${rtklib_src_dir}/rtkcmn.c ${rtklib_src_dir}/sbas.c ${rtklib_src_dir}/ephemeris.c ${rtklib_src_dir}/preceph.c ${rtklib_src_dir}/qzslex.c ${rtklib_src_dir}/rtcm.c ${rtklib_src_dir}/rtcm2.c ${rtklib_src_dir}/rtcm3.c ${rtklib_src_dir}/rtcm3e.c ${rtklib_src_dir}/ionex.c ${rtklib_src_dir}/rinex.c) +SET(sources + gnss_utils.cpp + observations.cpp + navigation.cpp) + +SET(rtklib_src + ${rtklib_src_dir}/pntpos.c + ${rtklib_src_dir}/rtkcmn.c + ${rtklib_src_dir}/sbas.c + ${rtklib_src_dir}/ephemeris.c + ${rtklib_src_dir}/preceph.c + ${rtklib_src_dir}/qzslex.c + ${rtklib_src_dir}/rtcm.c + ${rtklib_src_dir}/rtcm2.c + ${rtklib_src_dir}/rtcm3.c + ${rtklib_src_dir}/rtcm3e.c + ${rtklib_src_dir}/ionex.c + ${rtklib_src_dir}/rinex.c) # application header files -SET(headers ../include/observations.h ../include/navigation.h) - -# RTKLIB -INCLUDE (${PROJECT_SOURCE_DIR}/cmake_modules/FindRTKLIB.cmake) +SET(headers + ../include/gnss_utils.h + ../include/observations.h + ../include/navigation.h) # Eigen ####### FIND_PACKAGE(Eigen3 REQUIRED) diff --git a/src/examples/gnss_utils_test.cpp b/src/examples/gnss_utils_test.cpp index bad5312..5d6f5a6 100644 --- a/src/examples/gnss_utils_test.cpp +++ b/src/examples/gnss_utils_test.cpp @@ -9,7 +9,7 @@ extern "C" { - #include "/home/jlaplaza/RTKLIB/src/rinex.c" + #include "../deps/RTKLIB/src/rinex.c" } using namespace GNSSUtils; @@ -27,7 +27,7 @@ Observations createObs() time_t te = {0}; gtime_t time = {te, seconds_frac}; - + obsd_t observation; observation.time = time; observation.sat = 25; @@ -86,17 +86,17 @@ Navigation createNav(char * nav_path) { /* create a Navigation object */ Navigation navigation; - + /* Load _nav attribute into nav variable */ - nav_t nav = navigation.getNavigation(); - + nav_t nav = navigation.getNavigation(); + /* Open navigation file */ FILE *fp = fopen(nav_path,"r"); /* Set constellation mask -SYS=sys[,sys...]: select navi systems (sys=G:GPS,R:GLO,E:GAL,J:QZS,C:BDS,S:SBS) */ char* opt = "-SYS=G"; - /* Read navigation file, SYS can be SYS_ALL, SYS_GPS, SYS_SBS, SYS_GLO, SYS_GAL, ... */ + /* Read navigation file, SYS can be SYS_ALL, SYS_GPS, SYS_SBS, SYS_GLO, SYS_GAL, ... */ if (readrnxnav(fp, opt, 3.03, SYS_ALL, &nav)){ std::cout << "Navigation file loaded" << std::endl; std::cout << "GPS satellites: " << nav.n << std::endl; @@ -126,7 +126,7 @@ Navigation createNav(char * nav_path) } - + navigation.setNavigation(nav); std::cout << "Navigation message loaded to Navigation class." << std::endl; @@ -151,13 +151,13 @@ int main(int argc, char *argv[]) std::cout << "_obsVector size: " << observations.getObservations().size() << std::endl; // Create Navigation object - Navigation navigation = createNav("/home/jlaplaza/gitlab/gnss_utils/src/examples/raw_201805171357.nav"); + Navigation navigation = createNav("../src/examples/raw_201805171357.nav"); //readrnx() /* Set processing options */ - - prcopt_t prcopt = prcopt_default; + + prcopt_t prcopt = prcopt_default; prcopt.mode = PMODE_SINGLE; prcopt.soltype = 0; prcopt.nf = 1; @@ -169,10 +169,10 @@ int main(int argc, char *argv[]) prcopt.sbascorr = SBSOPT_FCORR; std::cout << "Processing options defined." << std::endl; - - + + //Compute fix - + int stat; sol_t solb={{0}}; -- GitLab