Skip to content
Snippets Groups Projects
Commit 751ae2a2 authored by Joan Vallvé Navarro's avatar Joan Vallvé Navarro
Browse files

Merge branch 'devel' into main

parents 4ffe6748 d5cb5a8b
No related branches found
No related tags found
2 merge requests!21merge back,!20new tag
Pipeline #9987 passed
Showing
with 3812 additions and 13 deletions
<?xml version="1.0" encoding="UTF-8"?>
<configurations>
<configuration id="org.eclipse.linuxtools.cdt.autotools.core.configuration.build.1456028388">
<option id="configure" value="configure"/>
<option id="configdir" value=""/>
<option id="cache-file" value=""/>
<option id="help" value="false"/>
<option id="no-create" value="false"/>
<option id="quiet" value="false"/>
<option id="version" value="false"/>
<option id="host" value=""/>
<option id="build" value=""/>
<option id="target" value=""/>
<option id="prefix" value=""/>
<option id="exec-prefix" value=""/>
<option id="libdir" value=""/>
<option id="bindir" value=""/>
<option id="sbindir" value=""/>
<option id="includedir" value=""/>
<option id="datadir" value=""/>
<option id="sysconfdir" value=""/>
<option id="infodir" value=""/>
<option id="mandir" value=""/>
<option id="srcdir" value=""/>
<option id="localstatedir" value=""/>
<option id="sharedstatedir" value=""/>
<option id="libexecdir" value=""/>
<option id="oldincludedir" value=""/>
<option id="program-prefix" value=""/>
<option id="program-suffix" value=""/>
<option id="program-transform-name" value=""/>
<option id="env_vars" value=""/>
<option id="enable-maintainer-mode" value="false"/>
<flag id="CFLAGS" value="CFLAGS|CXXFLAGS">
<flagvalue id="cflags-debug" value="false"/>
<flagvalue id="cflags-gprof" value="false"/>
<flagvalue id="cflags-gcov" value="false"/>
</flag>
<option id="user" value=""/>
<option id="autogen" value="autogen.sh"/>
<option id="autogenOpts" value=""/>
</configuration>
<configuration id="org.eclipse.linuxtools.cdt.autotools.core.configuration.build.debug.116232725">
<option id="configure" value="configure"/>
<option id="configdir" value=""/>
<option id="cache-file" value=""/>
<option id="help" value="false"/>
<option id="no-create" value="false"/>
<option id="quiet" value="false"/>
<option id="version" value="false"/>
<option id="host" value=""/>
<option id="build" value=""/>
<option id="target" value=""/>
<option id="prefix" value=""/>
<option id="exec-prefix" value=""/>
<option id="libdir" value=""/>
<option id="bindir" value=""/>
<option id="sbindir" value=""/>
<option id="includedir" value=""/>
<option id="datadir" value=""/>
<option id="sysconfdir" value=""/>
<option id="infodir" value=""/>
<option id="mandir" value=""/>
<option id="srcdir" value=""/>
<option id="localstatedir" value=""/>
<option id="sharedstatedir" value=""/>
<option id="libexecdir" value=""/>
<option id="oldincludedir" value=""/>
<option id="program-prefix" value=""/>
<option id="program-suffix" value=""/>
<option id="program-transform-name" value=""/>
<option id="env_vars" value=""/>
<option id="enable-maintainer-mode" value="false"/>
<flag id="CFLAGS" value="CFLAGS|CXXFLAGS">
<flagvalue id="cflags-debug" value="false"/>
<flagvalue id="cflags-gprof" value="false"/>
<flagvalue id="cflags-gcov" value="false"/>
</flag>
<option id="user" value="CFLAGS=&apos;-g -O0&apos; CXXFLAGS=&apos;-g -O0&apos;"/>
<option id="autogen" value="autogen.sh"/>
<option id="autogenOpts" value=""/>
</configuration>
</configurations>
stages:
- license
- build_and_test
############ YAML ANCHORS ############
.preliminaries_template: &preliminaries_definition
## Install ssh-agent if not already installed, it is required by Docker.
## (change apt-get to yum if you use an RPM-based image)
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
## Run ssh-agent (inside the build environment)
- eval $(ssh-agent -s)
## Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store
## We're using tr to fix line endings which makes ed25519 keys work
## without extra base64 encoding.
## https://gitlab.com/gitlab-examples/ssh-private-key/issues/1#note_48526556
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
# - echo "$SSH_KNOWN_HOSTS" > $HOME/.ssh/known_hosts
- ssh-keyscan -H -p 2202 gitlab.iri.upc.edu >> $HOME/.ssh/known_hosts
# update apt
- apt-get update
.license_header_template: &license_header_definition
- cd $CI_PROJECT_DIR
# configure git
- export CI_NEW_BRANCH=ci_processing$RANDOM
- echo creating new temporary branch... $CI_NEW_BRANCH
#- export CI_NEW_BRANCH=ci_processing$CI_COMMIT_SHORT_SHA
- git config --global user.email "${CI_EMAIL}"
- git config --global user.name "${CI_USERNAME}"
- git checkout -b $CI_NEW_BRANCH # temporary branch
# license headers
- export CURRENT_YEAR=$( date +'%Y' )
- echo "current year:" ${CURRENT_YEAR}
- cd scripts
- if [ -f license_header_${CURRENT_YEAR}.txt ]; then
# add license headers to new files
- echo "File license_header_${CURRENT_YEAR}.txt already exists. License headers are assumed to be updated. Adding headers to new files..."
- ./license_manager.sh --add --path=${CI_PROJECT_DIR} --license-header=license_header_${CURRENT_YEAR}.txt
- else
# update license headers of all files
- export PREV_YEAR=$(( CURRENT_YEAR-1 ))
- echo "Creating new file license_header_${CURRENT_YEAR}.txt..."
- git mv license_header_${PREV_YEAR}.txt license_header_${CURRENT_YEAR}.txt
- sed -i "s/${PREV_YEAR}/${PREV_YEAR},${CURRENT_YEAR}/g" license_header_${CURRENT_YEAR}.txt
- ./license_manager.sh --update --path=${CI_PROJECT_DIR} --license-header=license_header_${CURRENT_YEAR}.txt
- fi
- cd ..
# push changes (if any)
- if git commit -a -m "[skip ci] license headers added or modified" ; then
- git remote set-url --push origin "ssh://git@gitlab.iri.upc.edu:2202/${CI_PROJECT_PATH}.git"
- git push origin $CI_NEW_BRANCH:${CI_COMMIT_REF_NAME}
- else
- echo "No changes, nothing to commit!"
- fi
.build_and_test_template: &build_and_test_definition
- cd $CI_PROJECT_DIR
- git submodule update --init
- mkdir -pv build
- cd build
- cmake -DCMAKE_BUILD_TYPE=release -DBUILD_EXAMPLES=ON -DBUILD_TESTS=ON ..
- make -j2
- ctest -j2
- make install
############ LICENSE HEADERS ############
license_headers:
stage: license
image: labrobotica/wolf_deps:16.04
before_script:
- *preliminaries_definition
script:
- *license_header_definition
############ UBUNTU 16.04 TESTS ############
build_and_test_none:xenial:
stage: build_and_test
image: labrobotica/wolf_vision_deps:16.04
before_script:
- *preliminaries_definition
script:
- *build_and_test_definition
############ UBUNTU 18.04 TESTS ############
build_and_test_none:bionic:
stage: build_and_test
image: labrobotica/wolf_vision_deps:18.04
before_script:
- *preliminaries_definition
script:
- *build_and_test_definition
\ No newline at end of file
[submodule "deps/RTKLIB"]
path = deps/RTKLIB
url = ssh://git@gitlab.iri.upc.edu:2202/mobile_robotics/gauss_project/RTKLIB.git
branch = demo5
url = https://gitlab.iri.upc.edu/mobile_robotics/gauss_project/RTKLIB.git
branch = devel
#Start gnss-utils build
MESSAGE("Starting gnss-utils CMakeLists ...")
# Pre-requisites about cmake itself
CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
if(COMMAND cmake_policy)
cmake_policy(SET CMP0005 NEW)
......@@ -7,8 +10,11 @@ if(COMMAND cmake_policy)
endif(COMMAND cmake_policy)
# MAC OSX RPATH
set(CMAKE_MACOSX_RPATH true)
# The project name and the type of project
PROJECT(gnss-utils)
PROJECT(gnss_utils)
SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/bin)
SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib)
......@@ -35,7 +41,127 @@ else()
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()
ADD_SUBDIRECTORY(src)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
FIND_PACKAGE(Eigen3 3.3 REQUIRED)
IF(Eigen3_FOUND)
INCLUDE_DIRECTORIES(${EIGEN3_INCLUDE_DIRS})
ENDIF(Eigen3_FOUND)
# Testing
IF(NOT BUILD_TESTS)
OPTION(BUILD_TESTS "Build Unit tests" ON)
ENDIF(NOT BUILD_TESTS)
if(BUILD_TESTS)
# Enables testing for this directory and below.
# Note that ctest expects to find a test file in the build directory root.
# Therefore, this command should be in the source directory root.
#include(CTest) # according to http://public.kitware.com/pipermail/cmake/2012-June/050853.html
MESSAGE("Building tests.")
enable_testing()
set(_GNSS_UTILS_ROOT_DIR ${CMAKE_SOURCE_DIR})
endif()
# Define the directory where will be the configured config.h
SET(GNSS_UTILS_CONFIG_DIR ${PROJECT_BINARY_DIR}/conf/gnss_utils/internal)
# Create the specified output directory if it does not exist.
IF(NOT EXISTS "${GNSS_UTILS_CONFIG_DIR}")
message(STATUS "Creating config output directory: ${GNSS_UTILS_CONFIG_DIR}")
file(MAKE_DIRECTORY "${GNSS_UTILS_CONFIG_DIR}")
ENDIF()
IF(EXISTS "${GNSS_UTILS_CONFIG_DIR}" AND NOT IS_DIRECTORY "${GNSS_UTILS_CONFIG_DIR}")
message(FATAL_ERROR "Bug: Specified CONFIG_DIR: "
"${GNSS_UTILS_CONFIG_DIR} exists, but is not a directory.")
ENDIF()
# Configure config.h
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/internal/config.h.in "${GNSS_UTILS_CONFIG_DIR}/config.h")
message("GNSS_UTILS CONFIG ${GNSS_UTILS_CONFIG_DIR}/config.h")
message("CONFIG DIRECTORY ${PROJECT_BINARY_DIR}")
include_directories("${PROJECT_BINARY_DIR}/conf")
# rtklib path
SET(RTKLIB_DIR deps/RTKLIB)
SET(RTKLIB_SRC_DIR ${RTKLIB_DIR}/src)
# driver source files
SET(SOURCES
src/navigation.cpp
src/observations.cpp
src/range.cpp
src/receiver_raw_base.cpp
src/receivers/ublox_raw.cpp
src/receivers/novatel_raw.cpp
src/snapshot.cpp
src/tdcp.cpp
src/utils/utils.cpp
src/utils/transformations.cpp
src/utils/rcv_position.cpp
src/utils/satellite.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
${RTKLIB_SRC_DIR}/rcvraw.c
${RTKLIB_SRC_DIR}/rcv/binex.c
${RTKLIB_SRC_DIR}/rcv/cmr.c
${RTKLIB_SRC_DIR}/rcv/comnav.c
${RTKLIB_SRC_DIR}/rcv/crescent.c
${RTKLIB_SRC_DIR}/rcv/gw10.c
${RTKLIB_SRC_DIR}/rcv/javad.c
${RTKLIB_SRC_DIR}/rcv/novatel.c
${RTKLIB_SRC_DIR}/rcv/nvs.c
${RTKLIB_SRC_DIR}/rcv/rt17.c
${RTKLIB_SRC_DIR}/rcv/septentrio.c
${RTKLIB_SRC_DIR}/rcv/skytraq.c
${RTKLIB_SRC_DIR}/rcv/swiftnav.c
${RTKLIB_SRC_DIR}/rcv/tersus.c
${RTKLIB_SRC_DIR}/rcv/ublox.c)
# application header files
# NOT SET SINCE WE COPY THE WHOLE include FOLDER
# Eigen #######
FIND_PACKAGE(Eigen3 REQUIRED)
# Adding libraries' directories
link_directories(/usr/lib/x86_64-linux-gnu/)
# Adding include directories
INCLUDE_DIRECTORIES(include/ ${EIGEN3_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} ${RTKLIB_SRC_DIR})
# create the shared library
ADD_LIBRARY(gnss_utils SHARED ${SOURCES} ${RTKLIB_SRC})
TARGET_LINK_LIBRARIES(gnss_utils ${Boost_LIBRARIES})
# Examples
ADD_SUBDIRECTORY(src/examples)
# Testing
if(BUILD_TESTS)
add_subdirectory(test)
endif()
# Installing
INSTALL(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
INSTALL(DIRECTORY include/gnss_utils DESTINATION include/iri-algorithms)
INSTALL(FILES ${RTKLIB_SRC_DIR}/rtklib.h DESTINATION include/iri-algorithms/gnss_utils)
INSTALL(FILES Findgnss_utils.cmake DESTINATION ${CMAKE_ROOT}/Modules/)
INSTALL(FILES "${GNSS_UTILS_CONFIG_DIR}/config.h"
DESTINATION include/iri-algorithms/gnss_utils/internal)
FIND_PACKAGE(Doxygen)
......
#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_PATH(
gnss_utils_INCLUDE_DIRS
NAMES gnss_utils.h
PATHS /usr/local/include/iri-algorithms/gnss_utils /usr/local/lib/iri-algorithms/gnss_utils)
#change INCLUDE_DIRS to its parent directory (to force includes with libname in front
get_filename_component(gnss_utils_INCLUDE_DIRS ${gnss_utils_INCLUDE_DIRS} DIRECTORY)
IF(gnss_utils_INCLUDE_DIRS)
MESSAGE("Found gnss_utils include dirs: ${gnss_utils_INCLUDE_DIRS}")
ELSE(gnss_utils_INCLUDE_DIRS)
MESSAGE("Couldn't find gnss_utils include dirs")
ENDIF(gnss_utils_INCLUDE_DIRS)
FIND_LIBRARY(gnss_utils_LIBRARY
NAMES gnss_utils
PATHS /usr/lib /usr/local/lib /usr/local/lib)
FIND_LIBRARY(
gnss_utils_LIBRARIES
NAMES libgnss_utils.so libgnss_utils.dylib
PATHS /usr/local/lib/iri-algorithms)
IF(gnss_utils_LIBRARIES)
MESSAGE("Found gnss_utils lib: ${gnss_utils_LIBRARIES}")
ELSE(gnss_utils_LIBRARIES)
MESSAGE("Couldn't find gnss_utils lib")
ENDIF(gnss_utils_LIBRARIES)
IF (gnss_utils_INCLUDE_DIR AND gnss_utils_LIBRARY)
IF (gnss_utils_INCLUDE_DIRS AND gnss_utils_LIBRARIES)
SET(gnss_utils_FOUND TRUE)
ENDIF (gnss_utils_INCLUDE_DIR AND gnss_utils_LIBRARY)
SET(gnss_utils_INCLUDE_DIR ${gnss_utils_INCLUDE_DIRS})
SET(gnss_utils_LIBRARY ${gnss_utils_LIBRARIES})
ELSE(gnss_utils_INCLUDE_DIRS AND gnss_utils_LIBRARIES)
set(gnss_utils_FOUND FALSE)
ENDIF (gnss_utils_INCLUDE_DIRS AND gnss_utils_LIBRARIES)
IF (gnss_utils_FOUND)
IF (NOT gnss_utils_FIND_QUIETLY)
MESSAGE(STATUS "Found gnss_utils: ${gnss_utils_LIBRARY}")
MESSAGE(STATUS "Found gnss_utils: ${gnss_utils_LIBRARIES}")
ENDIF (NOT gnss_utils_FIND_QUIETLY)
ELSE (gnss_utils_FOUND)
IF (gnss_utils_FIND_REQUIRED)
......
LICENSE 0 → 100644
This diff is collapsed.
......@@ -7,6 +7,11 @@ cd <your/path>
git clone <repo-link>
```
Clone the RTKLIB lib as a sub-module:
```
git submodule update --init
```
Create a directory to build all the source files:
```
$ mkdir build
......
//--------LICENSE_START--------
//
// Copyright (C) 2020,2021,2022 Institut de Robòtica i Informàtica Industrial, CSIC-UPC.
// Authors: Joan Vallvé Navarro (jvallve@iri.upc.edu)
// All rights reserved.
//
// This file is part of gnss_utils
// gnss_utils is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// at your option) any later version.
//
// This program 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 Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
//--------LICENSE_END--------
#ifndef INCLUDE_GNSS_UTILS_GNSS_UTILS_H_
#define INCLUDE_GNSS_UTILS_GNSS_UTILS_H_
extern "C" {
#include "rtklib.h"
}
// std includes
#include <set>
#include <map>
#include <vector>
#include <iostream>
#include <memory>
#include <cassert>
// eigen
#include <Eigen/Dense>
#ifndef RAD2DEG
#define RAD2DEG 180.0 / 3.14159265358979323846
#endif
#ifndef DEG2RAD
#define DEG2RAD 3.14159265358979323846 / 180.0
#endif
namespace GnssUtils
{
// Structs
struct ComputePosOutput
{
time_t time;
double sec;
Eigen::Vector3d pos; // position (m)
Eigen::Vector3d vel; // velocity (m/s)
Eigen::Matrix3d pos_covar; // position covariance (m^2)
// {c_xx,c_yy,c_zz,c_xy,c_yz,c_zx}
Eigen::VectorXd rcv_bias; // receiver clock bias to time systems (s) 0: receiver clock bias (s), 1: glo-gps time offset (s), 2: gal-gps time offset (s), 3: bds-gps time offset (s)
int type; // coordinates used (0:xyz-ecef,1:enu-baseline)
int stat; // solution status (SOLQ_???)
int ns; // number of valid satellites
double age; // age of differential (s)
double ratio; // AR ratio factor for valiation
bool success; // return from pntpos true/false
std::string msg; // message returned (in case of error)
Eigen::Vector3d lat_lon; // latitude_longitude_altitude
std::map<int,Eigen::Vector2d> sat_azel; // azimuth and elevation of each satellite provided
std::set<int> used_sats; // used sats for computing fix (applying RAIM if the case and discarding wrong data)
std::set<int> discarded_sats; // discarded sats when computing fix (applying RAIM if the case and discarding wrong data)
std::map<int,double> prange_residuals; // residuals of used pseudoranges (applying RAIM if the case and discarding wrong data)
};
/* defaults processing options */
const prcopt_t default_prcopt = {
PMODE_SINGLE, /* mode: positioning mode (PMODE_???) */
0, /* soltype: solution type (0:forward,1:backward,2:combined) */
2, /* nf: number of frequencies (1:L1,2:L1+L2,3:L1+L2+L3,4:L1+L2+L3+L4) */
SYS_GPS|SYS_GLO|SYS_GAL, /* navsys */
15.0*D2R,{{0,0}}, /* elmin (rad) ,snrmask */
0, /* satellite ephemeris option: EPHOPT_BRDC(0):broadcast ephemeris, EPHOPT_PREC(1): precise ephemeris, EPHOPT_SBAS(2): broadcast + SBAS, EPHOPT_SSRAPC(3): broadcast + SSR_APC, EPHOPT_SSRCOM(4): broadcast + SSR_COM, EPHOPT_LEX(5): QZSS LEX ephemeris */
3,3,1,0,1, /* modear,glomodear,gpsmodear,bdsmodear,arfilter */
20,0,4,5,10,20, /* maxout,minlock,minfixsats,minholdsats,mindropsats,minfix */
0,1, /* rcvstds,armaxiter */
IONOOPT_BRDC, /* ionoopt: IONOOPT_OFF(0):correction off, IONOOPT_BRDC(1):broadcast mode, IONOOPT_SBAS(2):SBAS model, IONOOPT_IFLC(3):L1/L2 or L1/L5, IONOOPT_EST(4):estimation, IONOOPT_TEC(5):IONEX TEC model, IONOOPT_QZS(6):QZSS broadcast, IONOOPT_LEX(7):QZSS LEX ionosphere, IONOOPT_STEC(8):SLANT TEC mode */
TROPOPT_SAAS, /* tropopt: TROPOPT_OFF(0):correction off, TROPOPT_SAAS(1):Saastamoinen model, TROPOPT_SBAS(2):SBAS model, TROPOPT_EST(3):troposphere option: ZTD estimation, TROPOPT_ESTG(4):ZTD+grad estimation, TROPOPT_ZTD(5):ZTD correction,6:ZTD+grad correction */
1,0, /* dynamics,tidecorr */
3, /* niter: number of filter iteration */
0,0, /* codesmooth,intpref */
0, /* sbascorr: SBAS correction options (can be added): SBSOPT_LCORR(1): long term correction, SBSOPT_FCORR(2): fast correction, SBSOPT_ICORR(4): ionosphere correction, SBSOPT_RANGE(8): ranging */
0, /* sbasssatsel: SBAS satellite selection (0:all) */
0,0, /* rovpos,refpos */
WEIGHTOPT_ELEVATION, /* weightmode */
{300.0,300.0,300.0}, /* eratio[]: measurement error factor [0]:reserved [1-3]:error factor a/b/c of phase (m) [4]:doppler frequency (hz) [5]: snr max value (dB.Hz) */
{100.0,0.003,0.003,0.0,1.0,52.0}, /* err[]: */
{30.0,0.03,0.3}, /* std[] initial-state std [0]bias,[1]iono [2]trop */
{1E-4,1E-3,1E-4,1E-1,1E-2,0.0}, /* prn[] */
5E-12, /* sclkstab */
{3.0,0.25,0.0,1E-9,1E-5,0.0,0.0,0.0}, /* thresar */
0.0,0.0,0.05,0.1,0.01, /* elmaskar,elmaskhold,thresslip,varholdamb,gainholdamb */
30.0, /* maxtdiff: max difference of time (sec) */
5.0, /* maxinno: reject threshold of innovation (m) */
30.0, /* maxgdop: reject threshold of gdop */
{0},{0},{0}, /* baseline,ru,rb */
{"",""}, /* anttype */
{{0}},{{0}},{0}, /* antdel,pcvr,exsats */
1,1, /* maxaveep,initrst */
0, /* outsingle */
{{0}}, /* rnxopt */
{0,0,0,0,1,0}, /* posopt: positioning options [0-1]:PPP pcv [2]:PPP phase windup [3]:PPP exclude eclipsing [4]:PNTPOS RAIM, [5]:PPP clock jump */
0, /* syncsol */
{{0}}, /* odisp */
{{0}}, /* exterr */
0, /* freqopt */
{0} /* pppopt */
};
struct TdcpOptions
{
bool loss_function; // apply loss function in TDCP factors
double sigma_atm;
double sigma_carrier;
bool use_old_nav;
bool multi_freq;
double time_window; // window of time in which we perform TDCP
// Batch TDCP params
bool batch; // precompute global displacement between 2 epochs
int min_common_sats;
int raim_n;
bool validate_residual;
double max_residual_ci; // Confidence interval that defines the max residual to be considered good solution. RAIM applied if enabled in this case.
bool relinearize_jacobian;
int max_iterations;
int residual_opt; // 0: Normalized RMS of residual vector. 1: Max residual in Mahalanobis squared distance
int sagnac_correction; // 0 deactivated, 1/2 substraction/addition
};
struct CarrierPhaseOptions
{
bool corr_iono;
bool corr_tropo;
bool corr_clock;
};
struct Options
{
int sateph; // satellite ephemeris option: EPHOPT_BRDC(0):broadcast ephemeris, EPHOPT_PREC(1): precise ephemeris, EPHOPT_SBAS(2): broadcast + SBAS, EPHOPT_SSRAPC(3): broadcast + SSR_APC, EPHOPT_SSRCOM(4): broadcast + SSR_COM, EPHOPT_LEX(5): QZSS LEX ephemeris, EPHOPT_SBAS2(6):broadcast + SBAS(sats with SBAS corr and sats with BRDC eph), EPHOPT_SBAS3(7):broadcast + SBAS(EPHOPT_SBAS if possible, otherwise EPHOPT_SBAS2), EPHOPT_SBAS4(8):broadcast + SBAS(EPHOPT_SBAS if possible, otherwise EPHOPT_BRDC)
int ionoopt; // ionosphere option: IONOOPT_OFF(0):correction off, IONOOPT_BRDC(1):broadcast mode, IONOOPT_SBAS(2):SBAS model, IONOOPT_IFLC(3):L1/L2 or L1/L5, IONOOPT_EST(4):estimation, IONOOPT_TEC(5):IONEX TEC model, IONOOPT_QZS(6):QZSS broadcast, IONOOPT_LEX(7):QZSS LEX ionosphere, IONOOPT_STEC(8):SLANT TEC mode, IONOOPT_SBAS2(9):broadcast + SBAS(sats with SBAS corr and sats with BRDC eph), IONOOPT_SBAS3(10):broadcast + SBAS(IONOOPT_SBAS if possible, otherwise IONOOPT_SBAS2), IONOOPT_SBAS4(11):broadcast + SBAS(IONOOPT_SBAS if possible, otherwise IONOOPT_BRDC)
int tropopt; // troposphere option: TROPOPT_OFF(0):correction off, TROPOPT_SAAS(1):Saastamoinen model, TROPOPT_SBAS(2):SBAS model, TROPOPT_EST(3):troposphere option: ZTD estimation, TROPOPT_ESTG(4):ZTD+grad estimation, TROPOPT_ZTD(5):ZTD correction,6:ZTD+grad correction
int sbascorr; // SBAS correction options (can be added): SBSOPT_LCORR(1): long term correction, SBSOPT_FCORR(2): fast correction, SBSOPT_ICORR(4): ionosphere correction, SBSOPT_RANGE(8): ranging
int raim; // RAIM removed sats
double elmin; // min elevation (rad)
double maxgdop; // maxgdop: reject threshold of gdop
bool GPS,SBS,GLO,GAL,QZS,CMP,IRN,LEO; // constellations used
CarrierPhaseOptions carrier_opt; // Carrier phase correction options
// compute navsys int
int getNavSys() const
{
return GPS*SYS_GPS + SBS*SYS_SBS + GLO*SYS_GLO + GAL*SYS_GAL + QZS*SYS_QZS + CMP*SYS_CMP + IRN*SYS_IRN + LEO*SYS_LEO;
}
snrmask_t getSnrMask() const
{
return default_prcopt.snrmask;
}
// create a rtklib option struct from this
prcopt_t getPrcopt() const
{
prcopt_t opt{default_prcopt};
opt.sateph = sateph;
opt.ionoopt = ionoopt;
opt.tropopt = tropopt;
opt.sbascorr = sbascorr;
opt.posopt[4] = raim;
opt.elmin = elmin;
opt.maxgdop = maxgdop;
opt.navsys = getNavSys();
return opt;
}
};
const Options default_options =
{
EPHOPT_BRDC, // satellite ephemeris option: EPHOPT_BRDC(0):broadcast ephemeris, EPHOPT_PREC(1): precise ephemeris, EPHOPT_SBAS(2): broadcast + SBAS, EPHOPT_SSRAPC(3): broadcast + SSR_APC, EPHOPT_SSRCOM(4): broadcast + SSR_COM, EPHOPT_LEX(5): QZSS LEX ephemeris, EPHOPT_SBAS2(6):broadcast + SBAS(sats with SBAS corr and sats with BRDC eph), EPHOPT_SBAS3(7):broadcast + SBAS(EPHOPT_SBAS if possible, otherwise EPHOPT_SBAS2), EPHOPT_SBAS4(8):broadcast + SBAS(EPHOPT_SBAS if possible, otherwise EPHOPT_BRDC)
IONOOPT_BRDC, // ionosphere option: IONOOPT_OFF(0):correction off, IONOOPT_BRDC(1):broadcast mode, IONOOPT_SBAS(2):SBAS model, IONOOPT_IFLC(3):L1/L2 or L1/L5, IONOOPT_EST(4):estimation, IONOOPT_TEC(5):IONEX TEC model, IONOOPT_QZS(6):QZSS broadcast, IONOOPT_LEX(7):QZSS LEX ionosphere, IONOOPT_STEC(8):SLANT TEC mode, IONOOPT_SBAS2(9):broadcast + SBAS(sats with SBAS corr and sats with BRDC eph), IONOOPT_SBAS3(10):broadcast + SBAS(IONOOPT_SBAS if possible, otherwise IONOOPT_SBAS2), IONOOPT_SBAS4(8):broadcast + SBAS(IONOOPT_SBAS if possible, otherwise IONOOPT_BRDC)
TROPOPT_SAAS, // troposphere option: TROPOPT_OFF(0):correction off, TROPOPT_SAAS(1):Saastamoinen model, TROPOPT_SBAS(2):SBAS model, TROPOPT_EST(3):troposphere option: ZTD estimation, TROPOPT_ESTG(4):ZTD+grad estimation, TROPOPT_ZTD(5):ZTD correction,6:ZTD+grad correction
15, // SBAS correction options (can be added): SBSOPT_LCORR(1): long term correction, SBSOPT_FCORR(2): fast correction, SBSOPT_ICORR(4): ionosphere correction, SBSOPT_RANGE(8): ranging
1, // RAIM enabled
D2R*15.0, // min elevation (degrees)
30.0, // maxgdop: reject threshold of gdop
true, false, true, true, false, false, false, false, //GPS,SBS,GLO,GAL,QZS,CMP,IRN,LEO; // constellations used
{true, true, true} // carrier phase options
};
// forward declarations
class Observations;
class Navigation;
class Snapshot;
struct Satellite;
class Range;
// Typedefs
typedef std::map<int,Satellite> Satellites;
typedef std::map<int,Range> Ranges;
typedef std::map<int,Eigen::Vector2d> Azels; // Azimuth and elevation (rad)
// pointer typedefs
typedef std::shared_ptr<Observations> ObservationsPtr;
typedef std::shared_ptr<const Observations> ObservationsConstPtr;
typedef std::shared_ptr<Navigation> NavigationPtr;
typedef std::shared_ptr<const Navigation> NavigationConstPtr;
typedef std::shared_ptr<Snapshot> SnapshotPtr;
typedef std::shared_ptr<const Snapshot> SnapshotConstPtr;
enum Combination
{
CODE_L1, ///< only L1 code
CARRIER_L1, ///< only L1 carrier phase
CODE_IONO_FREE, ///< iono-free combination for code
CARRIER_IONO_FREE ///< iono-free combination for carrier phase
};
}
#endif
//--------LICENSE_START--------
//
// Copyright (C) 2020,2021,2022 Institut de Robòtica i Informàtica Industrial, CSIC-UPC.
// Authors: Joan Vallvé Navarro (jvallve@iri.upc.edu)
// All rights reserved.
//
// This file is part of gnss_utils
// gnss_utils is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// at your option) any later version.
//
// This program 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 Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
//--------LICENSE_END--------
#ifndef INCLUDE_GNSS_UTILS_NAVIGATION_H_
#define INCLUDE_GNSS_UTILS_NAVIGATION_H_
#include "gnss_utils/gnss_utils.h"
#include "gnss_utils/utils/utils.h"
namespace GnssUtils
{
class Navigation
{
public:
// Constructor & Destructor
Navigation();
Navigation(const Navigation& nav);
~Navigation();
// Public objects
// Public methods
void setNavigation(nav_t nav);
void clearNavigation();
void
loadFromRinex(const std::string& rnx_file, gtime_t t_start, gtime_t t_end, double dt = 0.0, const char* opt = "");
const nav_t& getNavigation() const;
nav_t& getNavigation();
void uniqueNavigation(); // remove duplicated ephemerides and update carrier phase wave lengths
/****************** Array memory management ******************/
bool addEphemeris(const eph_t& eph);
bool addGlonassEphemeris(const geph_t& geph);
bool addSbasEphemeris(const seph_t& seph);
bool addPreciseEphemeris(const peph_t& peph);
bool addPreciseClock(const pclk_t& pclk);
bool addAlmanac(const alm_t& alm);
bool addTec(const tec_t& tec);
bool addFcb(const fcbd_t& fcb);
void addSbasMessage(const sbsmsg_t& sbas_msg);
void copyAllArrays(const nav_t& nav);
void copyEphemeris(const nav_t& nav);
void copyAlmanac(const nav_t& nav);
void copyIonUtc(const nav_t& nav);
void copySbasCorrections(const nav_t& nav);
void copyBias(const nav_t& nav);
void freeNavigationArrays();
void freeEphemeris();
void freeGlonassEphemeris();
void freeSbasEphemeris();
void freePreciseEphemeris();
void freeAlmanac();
void freePreciseClock();
void freeTecData();
void freeFcbData();
void print();
//////////////////////////////// nav UTILS //////////////////////////////////////
static void freeEph(nav_t& nav);
static void freeGeph(nav_t& nav);
static void freeSeph(nav_t& nav);
static void freePeph(nav_t& nav);
static void freeAlm(nav_t& nav);
static void freePclk(nav_t& nav);
static void freeTec(nav_t& nav);
static void freeFcb(nav_t& nav);
static void freeNavArrays(nav_t& nav);
private:
// rtklib-like attribute to represent the different navigation msgs for a given epoch
nav_t nav_;
// Private methods
};
inline void Navigation::uniqueNavigation() // remove duplicated ephemerides and update wave lengths
{
uniqnav(&nav_);
}
inline const nav_t& Navigation::getNavigation() const
{
return nav_;
}
inline nav_t& Navigation::getNavigation()
{
return nav_;
}
inline bool Navigation::addEphemeris(const eph_t& eph)
{
return addToArray<eph_t>(eph, nav_.eph, nav_.n, nav_.nmax);
}
inline bool Navigation::addGlonassEphemeris(const geph_t& geph)
{
return addToArray<geph_t>(geph, nav_.geph, nav_.ng, nav_.ngmax);
}
inline bool Navigation::addSbasEphemeris(const seph_t& seph)
{
return addToArray<seph_t>(seph, nav_.seph, nav_.ns, nav_.nsmax);
}
inline bool Navigation::addPreciseEphemeris(const peph_t& peph)
{
return addToArray<peph_t>(peph, nav_.peph, nav_.ne, nav_.nemax);
}
inline bool Navigation::addPreciseClock(const pclk_t& pclk)
{
return addToArray<pclk_t>(pclk, nav_.pclk, nav_.nc, nav_.ncmax);
}
inline bool Navigation::addAlmanac(const alm_t& alm)
{
return addToArray<alm_t>(alm, nav_.alm, nav_.na, nav_.namax);
}
inline bool Navigation::addTec(const tec_t& tec)
{
return addToArray<tec_t>(tec, nav_.tec, nav_.nt, nav_.ntmax);
}
inline bool Navigation::addFcb(const fcbd_t& fcb)
{
return addToArray<fcbd_t>(fcb, nav_.fcb, nav_.nf, nav_.nfmax);
}
inline void Navigation::freeEphemeris()
{
freeEph(nav_);
}
inline void Navigation::freeGlonassEphemeris()
{
freeGeph(nav_);
}
inline void Navigation::freePreciseEphemeris()
{
freePeph(nav_);
}
inline void Navigation::freeSbasEphemeris()
{
freeSeph(nav_);
}
inline void Navigation::freePreciseClock()
{
freePclk(nav_);
}
inline void Navigation::freeTecData()
{
freeTec(nav_);
}
inline void Navigation::freeFcbData()
{
freeFcb(nav_);
}
inline void Navigation::freeAlmanac()
{
freeAlm(nav_);
}
//////////////////////////////// nav UTILS //////////////////////////////////////
inline void Navigation::freeEph(nav_t& nav)
{
freeArray<eph_t>(nav.eph, nav.n, nav.nmax);
}
inline void Navigation::freeGeph(nav_t& nav)
{
freeArray<geph_t>(nav.geph, nav.ng, nav.ngmax);
}
inline void Navigation::freeSeph(nav_t& nav)
{
freeArray<seph_t>(nav.seph, nav.ns, nav.nsmax);
}
inline void Navigation::freePeph(nav_t& nav)
{
freeArray<peph_t>(nav.peph, nav.ne, nav.nemax);
}
inline void Navigation::freeAlm(nav_t& nav)
{
freeArray<alm_t>(nav.alm, nav.na, nav.namax);
}
inline void Navigation::freePclk(nav_t& nav)
{
freeArray<pclk_t>(nav.pclk, nav.nc, nav.ncmax);
}
inline void Navigation::freeTec(nav_t& nav)
{
freeArray<tec_t>(nav.tec, nav.nt, nav.ntmax);
}
inline void Navigation::freeFcb(nav_t& nav)
{
freeArray<fcbd_t>(nav.fcb, nav.nf, nav.nfmax);
}
inline void Navigation::freeNavArrays(nav_t& nav)
{
// RTKLIB "freenav(&nav_,255)" doesn't check if is NULL before freeing
freeEph(nav);
freeGeph(nav);
freeSeph(nav);
freePeph(nav);
freePclk(nav);
freeAlm(nav);
freeTec(nav);
freeFcb(nav);
}
} // namespace GnssUtils
#endif // INCLUDE_GNSS_UTILS_NAVIGATION_H_
//--------LICENSE_START--------
//
// Copyright (C) 2020,2021,2022 Institut de Robòtica i Informàtica Industrial, CSIC-UPC.
// Authors: Joan Vallvé Navarro (jvallve@iri.upc.edu)
// All rights reserved.
//
// This file is part of gnss_utils
// gnss_utils is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// at your option) any later version.
//
// This program 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 Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
//--------LICENSE_END--------
#ifndef INCLUDE_GNSS_UTILS_OBSERVATIONS_H_
#define INCLUDE_GNSS_UTILS_OBSERVATIONS_H_
#include "gnss_utils/gnss_utils.h"
namespace GnssUtils
{
class Observations
{
public:
// Constructor & Destructor
Observations();
Observations(const Observations& obs);
~Observations();
void clearObservations();
void addObservation(const obsd_t& obs);
void removeObservationByIdx(const int& _idx);
void removeObservationBySat(const int& _sat);
std::vector<obsd_t>& getObservations();
const std::vector<obsd_t>& getObservations() const;
obsd_t& getObservationBySat(const unsigned char& sat_number);
const obsd_t& getObservationBySat(const unsigned char& sat_number) const;
obsd_t& getObservationByIdx(const int& idx);
const obsd_t& getObservationByIdx(const int& idx) const;
obsd_t* data();
const obsd_t* data() const;
size_t size() const;
bool hasSatellite(const unsigned char& i) const;
static void print(obsd_t& _obs);
void printBySat(const int& _sat);
void printByIdx(const int& _idx);
void print();
// Filter observations
std::set<int> filterByEphemeris(const Satellites& sats);
std::set<int> filterBySatellites(const std::set<int>& discarded_sats);
std::set<int> filterByCode();
std::set<int> filterByCarrierPhase();
std::set<int> filterByConstellations(const int& navsys);
std::set<int> filterByElevationSnr(const Azels& azels,
const snrmask_t& snrmask,
const double& elmin,
const bool& multi_freq);
std::set<int> filter(const Satellites& sats,
const std::set<int>& discarded_sats,
const Eigen::Vector3d& x_r,
const bool& check_code,
const bool& check_carrier_phase,
const Options& opt);
std::set<int> filter(const Satellites& sats,
const std::set<int>& discarded_sats,
const Eigen::Vector3d& x_r,
const bool& check_code,
const bool& check_carrier_phase,
const int& navsys,
const snrmask_t& snrmask,
const double& elmin,
const bool& multi_freq);
std::set<int> filter(const Satellites& sats,
const std::set<int>& discarded_sats,
const Azels& azels,
const bool& check_code,
const bool& check_carrier_phase,
const Options& opt);
std::set<int> filter(const Satellites& sats,
const std::set<int>& discarded_sats,
const Azels& azels,
const bool& check_code,
const bool& check_carrier_phase,
const int& navsys,
const snrmask_t& snrmask,
const double& elmin,
const bool& multi_freq);
// Others
static std::set<int> findCommonObservations(const Observations& obs_1, const Observations& obs_2);
bool operator==(const Observations& other_obs) const;
bool operator!=(const Observations& other_obs) const;
private:
// Private objects
std::map<unsigned char, int> sat_2_idx_; //< key: corresponding sat number, value: idx in obs_ vector
std::vector<unsigned char> idx_2_sat_; //< key: idx in obs_ vector, value: corresponding sat number
std::vector<obsd_t> obs_; //< vector of RTKLIB observations for a given epoch
};
} // namespace GnssUtils
// IMPLEMENTATION
#include "gnss_utils/utils/utils.h"
#include "gnss_utils/utils/satellite.h"
namespace GnssUtils
{
inline const std::vector<obsd_t>& Observations::getObservations() const
{
return this->obs_;
}
inline std::vector<obsd_t>& Observations::getObservations()
{
return this->obs_;
}
inline obsd_t& Observations::getObservationBySat(const unsigned char& sat_number)
{
assert(sat_2_idx_.count(sat_number) != 0);
return obs_.at(sat_2_idx_.at(sat_number));
}
inline const obsd_t& Observations::getObservationBySat(const unsigned char& sat_number) const
{
assert(sat_2_idx_.count(sat_number) != 0);
return obs_.at(sat_2_idx_.at(sat_number));
}
inline obsd_t& Observations::getObservationByIdx(const int& idx)
{
assert(obs_.size() > idx && idx >= 0);
return obs_.at(idx);
}
inline const obsd_t& Observations::getObservationByIdx(const int& idx) const
{
assert(obs_.size() > idx && idx >= 0);
return obs_.at(idx);
}
inline obsd_t* Observations::data()
{
return obs_.data();
}
inline const obsd_t* Observations::data() const
{
return obs_.data();
}
inline size_t Observations::size() const
{
return obs_.size();
}
inline bool Observations::hasSatellite(const unsigned char& i) const
{
return sat_2_idx_.count(i) != 0;
}
inline bool Observations::operator!=(const Observations& other_obs) const
{
return !(*this == other_obs);
}
} // namespace GnssUtils
#endif // INCLUDE_GNSS_UTILS_OBSERVATIONS_H_
//--------LICENSE_START--------
//
// Copyright (C) 2020,2021,2022 Institut de Robòtica i Informàtica Industrial, CSIC-UPC.
// Authors: Joan Vallvé Navarro (jvallve@iri.upc.edu)
// All rights reserved.
//
// This file is part of gnss_utils
// gnss_utils is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// at your option) any later version.
//
// This program 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 Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
//--------LICENSE_END--------
/*
* range.h
*
* Created on: May 28, 2020
* Author: joanvallve
*/
#ifndef INCLUDE_GNSS_UTILS_RANGE_H_
#define INCLUDE_GNSS_UTILS_RANGE_H_
#include "gnss_utils/gnss_utils.h"
#include "gnss_utils/observations.h"
#include "gnss_utils/navigation.h"
namespace GnssUtils
{
class Range
{
public:
int sys = SYS_GPS;
int sat = 0;
double P = -1;
double P_var = 1;
double P_corrected = -1;
double iono_corr = 0;
double tropo_corr = 0;
double sat_clock_corr = 0;
double L = -1;
double L_corrected = -1;
double L_var = 1;
double L2 = -1;
double L2_corrected = -1;
double L2_var = 1;
public:
Range();
virtual ~Range();
static Ranges computeRanges(ObservationsPtr obs,
NavigationPtr nav,
const Satellites& sats,
const Azels& azel,
const Eigen::Vector3d& latlonalt,
const Options& opt);
static std::set<int> findCommonSatellites(const Ranges& ranges_1, const Ranges& ranges_2);
};
double computeSagnacCorrection(const Eigen::Vector3d& rcv_ECEF, const Eigen::Vector3d& sat_ECEF);
} /* namespace GnssUtils */
#endif /* INCLUDE_GNSS_UTILS_RANGE_H_ */
//--------LICENSE_START--------
//
// Copyright (C) 2020,2021,2022 Institut de Robòtica i Informàtica Industrial, CSIC-UPC.
// Authors: Joan Vallvé Navarro (jvallve@iri.upc.edu)
// All rights reserved.
//
// This file is part of gnss_utils
// gnss_utils is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// at your option) any later version.
//
// This program 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 Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
//--------LICENSE_END--------
#ifndef INCLUDE_GNSS_UTILS_RECEIVER_RAW_BASE_H_
#define INCLUDE_GNSS_UTILS_RECEIVER_RAW_BASE_H_
#include "gnss_utils/observations.h"
#include "gnss_utils/navigation.h"
namespace GnssUtils
{
enum RawDataType : int
{
NO = 0,
OBS = 1,
NAV_EPH = 2,
NAV_SBAS = 3,
NAV_ALM_IONUTC = 9,
NAV_ANT = 5,
NAV_DGPS = 7,
NAV_SSR = 10,
NAV_LEX = 31,
ERROR = -1
};
// pointer typedefs
class ReceiverRawAbstract;
typedef std::shared_ptr<ReceiverRawAbstract> ReceiverRawAbstractPtr;
typedef std::shared_ptr<const ReceiverRawAbstract> ReceiverRawAbstractConstPtr;
class ReceiverRawAbstract
{
public:
ReceiverRawAbstract();
~ReceiverRawAbstract();
virtual RawDataType addDataStream(const std::vector<uint8_t>& data_stream) = 0;
const Observations& getObservations() const;
const Navigation& getNavigation() const;
Observations getObservations();
Navigation getNavigation();
RawDataType getRawDataType() const;
protected:
void updateObservations();
raw_t raw_data_;
RawDataType raw_data_type_;
Observations obs_;
Navigation nav_;
};
inline const Observations& ReceiverRawAbstract::getObservations() const
{
return obs_;
}
inline Observations ReceiverRawAbstract::getObservations()
{
return obs_;
}
inline const Navigation& ReceiverRawAbstract::getNavigation() const
{
return nav_;
}
inline Navigation ReceiverRawAbstract::getNavigation()
{
return nav_;
}
inline RawDataType ReceiverRawAbstract::getRawDataType() const
{
return raw_data_type_;
}
} // namespace GnssUtils
#endif
//--------LICENSE_START--------
//
// Copyright (C) 2020,2021,2022 Institut de Robòtica i Informàtica Industrial, CSIC-UPC.
// Authors: Joan Vallvé Navarro (jvallve@iri.upc.edu)
// All rights reserved.
//
// This file is part of gnss_utils
// gnss_utils is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// at your option) any later version.
//
// This program 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 Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
//--------LICENSE_END--------
#ifndef INCLUDE_GNSS_UTILS_NOVATEL_RAW_H_
#define INCLUDE_GNSS_UTILS_NOVATEL_RAW_H_
#include "gnss_utils/receiver_raw_base.h"
namespace GnssUtils
{
class NovatelRaw : public ReceiverRawAbstract
{
public:
NovatelRaw();
~NovatelRaw();
RawDataType addDataStream(const std::vector<uint8_t>& data_stream) override;
};
} // namespace GnssUtils
#endif
//--------LICENSE_START--------
//
// Copyright (C) 2020,2021,2022 Institut de Robòtica i Informàtica Industrial, CSIC-UPC.
// Authors: Joan Vallvé Navarro (jvallve@iri.upc.edu)
// All rights reserved.
//
// This file is part of gnss_utils
// gnss_utils is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// at your option) any later version.
//
// This program 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 Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
//--------LICENSE_END--------
#ifndef INCLUDE_GNSS_UTILS_UBLOX_RAW_H_
#define INCLUDE_GNSS_UTILS_UBLOX_RAW_H_
#include "gnss_utils/receiver_raw_base.h"
namespace GnssUtils
{
class UBloxRaw : public ReceiverRawAbstract
{
public:
UBloxRaw();
~UBloxRaw();
RawDataType addDataStream(const std::vector<uint8_t>& data_stream) override;
private:
};
} // namespace GnssUtils
#endif // INCLUDE_GNSS_UTILS_UBLOX_RAW_H_
//--------LICENSE_START--------
//
// Copyright (C) 2020,2021,2022 Institut de Robòtica i Informàtica Industrial, CSIC-UPC.
// Authors: Joan Vallvé Navarro (jvallve@iri.upc.edu)
// All rights reserved.
//
// This file is part of gnss_utils
// gnss_utils is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// at your option) any later version.
//
// This program 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 Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
//--------LICENSE_END--------
#ifndef INCLUDE_GNSS_UTILS_SNAPSHOT_H_
#define INCLUDE_GNSS_UTILS_SNAPSHOT_H_
#include <map>
#include <set>
#include <iostream>
#include <memory>
#include <cassert>
#include <Eigen/Dense>
#include "gnss_utils/gnss_utils.h"
namespace GnssUtils
{
class Snapshot
{
public:
// Constructor & Destructor
Snapshot();
Snapshot(ObservationsPtr obs, NavigationPtr nav);
~Snapshot(){};
// Public objects
// Public methods
void loadFromRinex(const std::string& rnx_file, gtime_t t_start, gtime_t t_end, double dt = 0.0, const char* opt = "");
double getGPST() const;
// Navigation
NavigationPtr getNavigation() const;
void setNavigation(NavigationPtr nav);
// Observations
ObservationsPtr getObservations() const;
void setObservations(ObservationsPtr obs);
std::set<int> filterObservations(const std::set<int>& discarded_sats,
const Eigen::Vector3d& x_r,
const bool& check_code,
const bool& check_carrier_phase,
const Options& opt);
std::set<int> filterObservations(const std::set<int>& discarded_sats,
const Azels& azels,
const bool& check_code,
const bool& check_carrier_phase,
const Options& opt);
// Satellites
const Satellites& getSatellites() const;
Satellites& getSatellites();
void computeSatellites(const int& eph_opt); // see rtklib.h L396);
bool satellitesComputed() const;
// Ranges
Ranges& getRanges();
const Ranges& getRanges() const;
bool rangesComputed() const;
void computeRanges(const Azels& azel,
const Eigen::Vector3d& latlonalt,
const Options& opt);
void computeRanges(const Eigen::Vector3d& x_ecef,
const Options& opt);
void print();
private:
// Private objects
Satellites sats_;
ObservationsPtr obs_;
NavigationPtr nav_;
Ranges ranges_;
// Private methods
};
} // namespace GnssUtils
// IMPLEMENTATION
#include "gnss_utils/utils/satellite.h"
#include "gnss_utils/observations.h"
#include "gnss_utils/navigation.h"
#include "gnss_utils/utils/utils.h"
#include "gnss_utils/range.h"
namespace GnssUtils
{
inline double Snapshot::getGPST() const
{
return obs_->getObservations()[0].time.time + obs_->getObservations()[0].time.sec;
}
inline GnssUtils::ObservationsPtr Snapshot::getObservations() const
{
return obs_;
}
inline GnssUtils::NavigationPtr Snapshot::getNavigation() const
{
return nav_;
}
inline Satellites& Snapshot::getSatellites()
{
return sats_;
}
inline const Satellites& Snapshot::getSatellites() const
{
return sats_;
}
inline void Snapshot::setObservations(ObservationsPtr obs)
{
obs_ = obs;
}
inline void Snapshot::setNavigation(NavigationPtr nav)
{
nav_ = nav;
}
inline bool Snapshot::satellitesComputed() const
{
return !sats_.empty();
}
inline std::set<int> Snapshot::filterObservations(const std::set<int>& discarded_sats,
const Eigen::Vector3d& x_r,
const bool& check_code,
const bool& check_carrier_phase,
const Options& opt)
{
std::set<int> filtered_sats = obs_->filter(sats_, discarded_sats, x_r, check_code, check_carrier_phase, opt);
for (auto sat : filtered_sats)
{
sats_.erase(sat);
ranges_.erase(sat);
}
return filtered_sats;
}
inline std::set<int> Snapshot::filterObservations(const std::set<int>& discarded_sats,
const Azels& azels,
const bool& check_code,
const bool& check_carrier_phase,
const Options& opt)
{
std::set<int> filtered_sats = obs_->filter(sats_, discarded_sats, azels, check_code, check_carrier_phase, opt);
for (auto sat : filtered_sats)
{
sats_.erase(sat);
ranges_.erase(sat);
}
return filtered_sats;
}
inline const Ranges& Snapshot::getRanges() const
{
return ranges_;
}
inline Ranges& Snapshot::getRanges()
{
return ranges_;
}
inline bool Snapshot::rangesComputed() const
{
return !ranges_.empty();
}
} // namespace GnssUtils
#endif // INCLUDE_GNSS_UTILS_SNAPSHOT_H_
//--------LICENSE_START--------
//
// Copyright (C) 2020,2021,2022 Institut de Robòtica i Informàtica Industrial, CSIC-UPC.
// Authors: Joan Vallvé Navarro (jvallve@iri.upc.edu)
// All rights reserved.
//
// This file is part of gnss_utils
// gnss_utils is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// at your option) any later version.
//
// This program 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 Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
//--------LICENSE_END--------
#ifndef INCLUDE_GNSS_UTILS_TDCP_H_
#define INCLUDE_GNSS_UTILS_TDCP_H_
#define GNSS_UTILS_TDCP_DEBUG 0
#include "gnss_utils/gnss_utils.h"
#include "gnss_utils/utils/chisquare_ci.h"
namespace GnssUtils
{
struct TdcpOutput
{
bool success = false;
std::string msg = "";
std::set<int> raim_discarded_sats;
std::set<int> used_sats;
Eigen::Vector4d d = Eigen::Vector4d::Zero();
Eigen::Matrix4d cov_d = Eigen::Matrix4d::Zero();
double dt = 0;
double residual = 0;
double residual_ci = 0;
};
TdcpOutput Tdcp(SnapshotPtr snapshot_r,
SnapshotPtr snapshot_k,
const Eigen::Vector4d& d_0,
const std::set<int>& discarded_sats,
const TdcpOptions& tdcp_params,
const Options& opt);
TdcpOutput Tdcp(SnapshotPtr snapshot_r,
SnapshotPtr snapshot_k,
const Eigen::Vector3d& x_r,
const Eigen::Vector4d& d_0,
const std::set<int>& discarded_sats,
const TdcpOptions& tdcp_params,
const Options& opt);
TdcpOutput Tdcp(SnapshotPtr snapshot_r,
SnapshotPtr snapshot_k,
const Eigen::Vector3d& x_r,
const Eigen::Vector4d& d_0,
const std::set<int>& discarded_sats,
const std::set<int>& tracked_sats,
const TdcpOptions& tdcp_params,
const Options& opt);
TdcpOutput Tdcp(SnapshotPtr snapshot_r,
SnapshotPtr snapshot_k,
const Eigen::Vector3d& x_r,
const std::set<int>& common_sats,
const Eigen::Vector4d& d_0,
const TdcpOptions& tdcp_params);
TdcpOutput Tdcp(const Eigen::Vector3d& x_r,
Eigen::MatrixXd& A,
Eigen::VectorXd& r,
Eigen::VectorXd& drho_m,
const Eigen::MatrixXd& s_k,
const Eigen::MatrixXd& s_r,
const Eigen::Vector4d& d_0,
const double& var_tdcp,
std::set<int>& raim_discarded_rows,
const TdcpOptions& tdcp_params);
} // namespace GnssUtils
#endif /* INCLUDE_GNSS_UTILS_Tdcp_H_ */
//--------LICENSE_START--------
//
// Copyright (C) 2020,2021,2022 Institut de Robòtica i Informàtica Industrial, CSIC-UPC.
// Authors: Joan Vallvé Navarro (jvallve@iri.upc.edu)
// All rights reserved.
//
// This file is part of gnss_utils
// gnss_utils is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// at your option) any later version.
//
// This program 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 Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
//--------LICENSE_END--------
/*
* chisquare_ci.h
*
* Created on: Jul 28, 2021
* Author: joanvallve
*/
#ifndef INCLUDE_GNSS_UTILS_UTILS_CHISQUARE_CI_H_
#define INCLUDE_GNSS_UTILS_UTILS_CHISQUARE_CI_H_
#include "chisquare_ci_maps.h"
namespace GnssUtils
{
inline double chisq2ci(double chisq, int dof)
{
assert(dof > 0);
if (dof > 30)
dof = 30;
if (chisq_2_CI.at(dof).count(chisq) == 1)
return chisq_2_CI.at(dof).at(chisq);
auto upper = chisq_2_CI.at(dof).upper_bound(chisq);
if (upper == chisq_2_CI.at(dof).begin())
return upper->second;
auto lower = std::prev(upper);
return lower->second + (chisq - lower->first) / (upper->first - lower->first) * (upper->second - lower->second);
};
inline double ci2chisq(double ci, int dof)
{
assert(dof > 0);
if (dof > 30)
dof = 30;
if (CI_2_chisq.at(dof).count(ci) == 1)
return CI_2_chisq.at(dof).at(ci);
auto upper = CI_2_chisq.at(dof).upper_bound(ci);
if (upper == CI_2_chisq.at(dof).begin())
return upper->second;
auto lower = std::prev(upper);
return lower->second + (ci - lower->first) / (upper->first - lower->first) * (upper->second - lower->second);
};
} // namespace GnssUtils
#endif /* INCLUDE_GNSS_UTILS_UTILS_CHISQUARE_CI_H_ */
This diff is collapsed.
//--------LICENSE_START--------
//
// Copyright (C) 2020,2021,2022 Institut de Robòtica i Informàtica Industrial, CSIC-UPC.
// Authors: Joan Vallvé Navarro (jvallve@iri.upc.edu)
// All rights reserved.
//
// This file is part of gnss_utils
// gnss_utils is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// at your option) any later version.
//
// This program 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 Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
//--------LICENSE_END--------
/*
* transfromation.h
*
* Created on: April 3, 2020
* Author: Joan Vallvé, Pep Martí-Saumell
*/
#ifndef INCLUDE_GNSS_UTILS_UTILS_RCV_POSITION_H_
#define INCLUDE_GNSS_UTILS_UTILS_RCV_POSITION_H_
#include <Eigen/Dense>
#include <Eigen/Geometry>
#include <Eigen/Sparse>
#include "gnss_utils/observations.h"
#include "gnss_utils/navigation.h"
#include "gnss_utils/utils/transformations.h"
#include "gnss_utils/gnss_utils.h"
namespace GnssUtils
{
ComputePosOutput computePos(const Observations& _observations, const Navigation& _navigation, const Options& _opt);
ComputePosOutput computePos(const Observations& _observations, const Navigation& _navigation, const prcopt_t& _prcopt);
// ComputePosOutput computePosOwn(const Observations & _observations,
// Navigation & _navigation,
// const prcopt_t & _prcopt);
// int pntposOwn(const obsd_t *obs, int n, const nav_t *nav,
// const prcopt_t *opt, sol_t *sol, double *azel, ssat_t *ssat,
// char *msg);
int estposOwn(const obsd_t* obs,
int n,
const double* rs,
const double* dts,
const double* vare,
const int* svh,
const nav_t* nav,
const prcopt_t* opt,
sol_t* sol,
double* azel,
int* vsat,
double* resp,
char* msg);
} // namespace GnssUtils
#endif // INCLUDE_GNSS_UTILS_UTILS_RCV_POSITION_H_
//--------LICENSE_START--------
//
// Copyright (C) 2020,2021,2022 Institut de Robòtica i Informàtica Industrial, CSIC-UPC.
// Authors: Joan Vallvé Navarro (jvallve@iri.upc.edu)
// All rights reserved.
//
// This file is part of gnss_utils
// gnss_utils is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// at your option) any later version.
//
// This program 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 Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
//--------LICENSE_END--------
/*
* sat_position.h
*
* Created on: April 3, 2020
* Author: Joan Vallvé, Pep Martí-Saumell
*/
#ifndef INCLUDE_GNSS_UTILS_UTILS_SAT_POSITION_H_
#define INCLUDE_GNSS_UTILS_UTILS_SAT_POSITION_H_
#include <Eigen/Dense>
#include <Eigen/Geometry>
#include "gnss_utils/gnss_utils.h"
namespace GnssUtils
{
// forward declarations
class Observations;
class Navigation;
Satellites computeSatellites(const Observations& obs,
const Navigation& nav,
const int& eph_opt); // see rtklib.h L396
Eigen::Vector2d computeAzel(const Eigen::Vector3d& sat_ecef, const Eigen::Vector3d& receiver_ecef);
Eigen::Vector2d computeAzel(const Satellite& sat, const Eigen::Vector3d& receiver_ecef);
Azels computeAzels(const Satellites& sats, const Eigen::Vector3d& receiver_ecef);
struct Satellite
{
int sys;
int sat;
Eigen::Vector3d pos;
Eigen::Vector3d vel;
double var;
double clock_bias;
double clock_drift;
int svh;
};
} // namespace GnssUtils
#endif // INCLUDE_GNSS_UTILS_UTILS_SAT_POSITION_H_
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