Skip to content
Snippets Groups Projects
Commit 3f1bc2c7 authored by Javier Laplaza Galindo's avatar Javier Laplaza Galindo
Browse files

Update library

parent 1ddf8123
No related branches found
No related tags found
No related merge requests found
#edit the following line to add the librarie's header files
FIND_PATH(gnss_utils_INCLUDE_DIR gnss_utils.h obervation.h /usr/include/iridrivers /usr/local/lib)
FIND_LIBRARY(gnss_utils_LIBRARY
NAMES gnss_utils
PATHS /usr/lib /usr/local/lib /usr/local/lib)
IF (gnss_utils_INCLUDE_DIR AND gnss_utils_LIBRARY)
SET(gnss_utils_FOUND TRUE)
ENDIF (gnss_utils_INCLUDE_DIR AND gnss_utils_LIBRARY)
IF (gnss_utils_FOUND)
IF (NOT gnss_utils_FIND_QUIETLY)
MESSAGE(STATUS "Found gnss_utils: ${gnss_utils_LIBRARY}")
ENDIF (NOT gnss_utils_FIND_QUIETLY)
ELSE (gnss_utils_FOUND)
IF (gnss_utils_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find gnss_utils")
ENDIF (gnss_utils_FIND_REQUIRED)
ENDIF (gnss_utils_FOUND)
......@@ -5,54 +5,82 @@
#include <iostream>
#include <memory>
#include "observation.h"
extern "C"
{
#include "/home/jmarti/RTKLIB/src/rtklib.h"
#include "/home/jlaplaza/RTKLIB/src/rtklib.h"
}
namespace GNSSUtils
{
class Observation
{
public:
// Constructor
Observation();
// Constructor overloaded
Observation(int sat, int rcv);
// Destructor
~Observation();
// Public API
private:
gtime_t _time; // Receiver sampling time
int _sat; // Satellite number
int _rcv; // Receiver number
std::vector<int> _SNR;
std::vector<int> _LLI;
std::vector<int> _code;
std::vector<double> _L;
std::vector<double> _P;
std::vector<double> _D;
};
class Receiver
{
public:
// Constructor & Destructor
Receiver();
~Receiver();
public:
// Constructor & Destructor
Receiver();
~Receiver();
// Public objects
// Public methods
/* - Observations - */
void clearObservations();
void pushObservation(obsd_t obs);
std::vector<obsd_t> getObservations();
/* - Navigation - */
void clearNavigation();
void pushNavigation(nav_t nav);
std::vector<nav_t> getNavigation();
/* - Processing Options - */
void clearOptions();
void pushOption(prcopt_t opt);
std::vector<prcopt_t> getOptions();
/* - Solution - */
/* - Satellite status - */
/* - Compute Fix - */
int computeSPP(double *azel, char *msg);
private:
// 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
std::vector<nav_t> _navVector;
// rtklib-like attribute to represent the different options for a given epoch
std::vector<prcopt_t> _opt;
// rtklib-like attribute to represent the solution for a given epoch
std::Vector<sol_t> _sol;
// Public objects
// rtklib-like attribute to represent the satellite status for a given epoch
std::vector<ssat_t> _ssat;
// Public methods
void clearObservations();
void pushObservation(GNSSUtils::Observation obs);
private:
std::vector<Observation> _obsVector;
};
}
......
# driver source files
SET(sources gnss_utils.cpp)
SET(sources gnss_utils.cpp observation.cpp)
# application header files
SET(headers ../include/gnss_utils.h)
SET(headers ../include/gnss_utils.h ../include/observation.h)
# RTKLIB
INCLUDE (${PROJECT_SOURCE_DIR}/cmake_modules/FindRTKLIB.cmake)
......@@ -27,9 +27,11 @@ ADD_LIBRARY(gnss_utils SHARED ${sources})
TARGET_LINK_LIBRARIES(gnss_utils ${Boost_LIBRARIES})
# Installing
INSTALL(TARGETS
INSTALL(TARGETS gnss_utils
RUNTIME DESTINATION bin
LIBRARY DESTINATION /usr/local/lib
ARCHIVE DESTINATION lib)
INSTALL(FILES ${headers} DESTINATION include/gnss_utils)
# INSTALL(FILES ../gnss_utils.cmake DESTINATION ${CMAKE_ROOT}/Modules/)
INSTALL(FILES ../Findgnss_utils.cmake DESTINATION ${CMAKE_ROOT}/Modules/)
ADD_SUBDIRECTORY(examples)
# create an example application
ADD_EXECUTABLE(gnss_utils_test gnss_utils_test.cpp)
# link necessary libraries
TARGET_LINK_LIBRARIES(gnss_utils_test gnss_utils)
#include "../../include/gnss_utils.h"
#include "../../include/observation.h"
#include <iostream>
using namespace GNSSUtils;
int main(int argc, char *argv[])
{
// header
std::cout << "--------------------------" << std::endl;
std::cout << "GNSS Utils Library Example" << std::endl;
std::cout << "--------------------------" << std::endl;
// create a Receiver object
GNSSUtils::Receiver test_rcv;
// create a Observation object
gtime_t ts={0};
unsigned char q=1, w=2, e=3;
std::vector<unsigned char> vu({q, w, e});
std::vector<double> vd({1., 2., 3.});
std::vector<float> vf({1., 2., 3.});
Observation test_obs(ts, 1, 1, vu, vu, vu, vd, vd, vf);
// Display current Observation
std::cout << "Current observation (sat): " << "(" << test_obs.getSat() << ")" << std::endl;
std::cout << "Current observation (SNR): " << "(" ;
for (unsigned char i=0; i < 3; ++i)
std::cout << test_obs.getSNR()[i] << ", ";
std::cout << ")" << std::endl;
obsd_t obs = test_obs.convert2rtk();
std::cout << "Observation SNR in RTKLIB format: " << "(";
for (unsigned char i=0; i < 3; ++i)
std::cout << obs.SNR[i] << ", ";
std::cout << ")" << std::endl;
}
......@@ -2,45 +2,70 @@
using namespace GNSSUtils;
// XXX: Separate Classes into different .cpp .h files
/******************************* RECEIVER CLASS *******************************************/
// OBSERVATION METHODS
Receiver::Receiver()
{
}
Observation::Observation()
Receiver::~Receiver()
{
}
Observation::Observation(int sat, int rcv)
/* - Observation - */
void Receiver::clearObservations()
{
_obsVector.clear();
}
void Receiver::pushObservation(obsd_t obs)
{
this->_sat = sat;
this->_rcv = rcv;
_obsVector.push_back(obs);
}
Observation::~Observation()
std::vector<obsd_t> Receiver::getObservations()
{
//
return this->_obsVector;
}
// RECEIVER METHODS
/* - Navigation - */
Receiver::Receiver()
void Receiver::clearNavigation()
{
_navVector.clear();
}
Receiver::~Receiver()
void Receiver::pushNavigation(nav_t nav)
{
_navVector.push_back(nav);
}
void Receiver::clearObservations()
std::vector<nav_t> Receiver::getNavigation()
{
_obsVector.clear();
return this->_navVector;
}
void Receiver::pushObservation(GNSSUtils::Observation obs)
int Receiver::getSPP(double *azel, char *msg)
{
_obsVector.push_back(obs);
obsd_t *obs = &this->_obsVector[0];
int n = this->_obsVector.size();
return int pntpos(*obs, n, nav_t *nav, *opt, *sol, *azel, *ssat, *msg)
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment