diff --git a/CMakeLists.txt b/CMakeLists.txt index a517b9294242d5e9b1781a41e4a3f365a0545d61..7fdfa2d7db4b06b68091b3877a52ca3fdda23502 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 41289eba5411914f02094b1541e01d573682cd93..0000000000000000000000000000000000000000 --- 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 8cca79a3ede338d3bc14922fc471ccd2faa6b94f..805187ba9a67d5e5a2ce839d6b0dd3a3da14add5 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 34f16ebd2e44391467867949aa2e950b7a54c1f0..c0fed77669fb446003a38954e0b9f364e218a22d 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 ca4eec2e2ea8e23b3a3031912039f9f3901419b7..16e230cbb0f9e09a5be19cdddf3a975fed8097ba 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 2e3538c4baef889967cd680ae8dfaab96f53e866..37da0b737235087e36b5fd17bac9ebfd52cb341a 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 bad53127b0ca837df73099a072c9ec6a49c2f692..5d6f5a6558bef128fa74d2c715276a8e8b91a0c7 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}};