1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-06-18 11:09:56 +00:00

Group all flags in a single file

This makes easier to document and to add new ones.
Shortened version of common files have been added:
-c for -config_file
-s for -signal_source
This commit is contained in:
Carles Fernandez 2018-02-18 12:23:55 +01:00
parent af69cba8e1
commit 2b8ab9dcee
20 changed files with 143 additions and 62 deletions

View File

@ -36,24 +36,25 @@ include_directories(
${CMAKE_SOURCE_DIR}/src/core/interfaces
${CMAKE_SOURCE_DIR}/src/core/receiver
${CMAKE_SOURCE_DIR}/src/algorithms/PVT/adapters
${CMAKE_SOURCE_DIR}/src/algorithms/libs
${CMAKE_SOURCE_DIR}/src/algorithms/libs/rtklib
${Boost_INCLUDE_DIRS}
${ARMADILLO_INCLUDE_DIRS}
${GFlags_INCLUDE_DIRS}
${GLOG_INCLUDE_DIRS}
)
file(GLOB PVT_LIB_HEADERS "*.h")
list(SORT PVT_LIB_HEADERS)
add_library(pvt_lib ${PVT_LIB_SOURCES} ${PVT_LIB_HEADERS})
source_group(Headers FILES ${PVT_LIB_HEADERS})
add_dependencies(pvt_lib rtklib_lib armadillo-${armadillo_RELEASE} glog-${glog_RELEASE})
target_link_libraries(
pvt_lib
rtklib_lib
gnss_sdr_flags
${Boost_LIBRARIES}
${GFlags_LIBS}
${GLOG_LIBRARIES}
${ARMADILLO_LIBRARIES}
${BLAS}

View File

@ -33,7 +33,6 @@
#include <exception>
#include <stdexcept>
#include "GPS_L1_CA.h"
#include <gflags/gflags.h>
#include <glog/logging.h>

View File

@ -38,13 +38,10 @@
#include <termios.h>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <glog/logging.h>
#include <gflags/gflags.h>
using google::LogMessage;
//DEFINE_string(NMEA_version, "2.1", "Specifies the NMEA version (2.1)");
Nmea_Printer::Nmea_Printer(std::string filename, bool flag_nmea_tty_port, std::string nmea_dump_devname)
{
@ -72,8 +69,6 @@ Nmea_Printer::Nmea_Printer(std::string filename, bool flag_nmea_tty_port, std::s
}
Nmea_Printer::~Nmea_Printer()
{
if (nmea_file_descriptor.is_open())
@ -84,8 +79,6 @@ Nmea_Printer::~Nmea_Printer()
}
int Nmea_Printer::init_serial (std::string serial_device)
{
/*!
@ -123,7 +116,6 @@ int Nmea_Printer::init_serial (std::string serial_device)
}
void Nmea_Printer::close_serial ()
{
if (nmea_dev_descriptor != -1)
@ -200,7 +192,6 @@ bool Nmea_Printer::Print_Nmea_Line(const std::shared_ptr<Pvt_Solution>& pvt_data
}
char Nmea_Printer::checkSum(std::string sentence)
{
char check = 0;
@ -214,7 +205,6 @@ char Nmea_Printer::checkSum(std::string sentence)
}
std::string Nmea_Printer::latitude_to_hm(double lat)
{
bool north;
@ -253,7 +243,6 @@ std::string Nmea_Printer::latitude_to_hm(double lat)
}
std::string Nmea_Printer::longitude_to_hm(double longitude)
{
bool east;
@ -291,7 +280,6 @@ std::string Nmea_Printer::longitude_to_hm(double longitude)
}
std::string Nmea_Printer::get_UTC_NMEA_time(boost::posix_time::ptime d_position_UTC_time)
{
//UTC Time: hhmmss.sss
@ -336,7 +324,6 @@ std::string Nmea_Printer::get_UTC_NMEA_time(boost::posix_time::ptime d_position_
}
std::string Nmea_Printer::get_GPRMC()
{
// Sample -> $GPRMC,161229.487,A,3723.2475,N,12158.3416,W,0.13,309.62,120598,*10
@ -438,7 +425,6 @@ std::string Nmea_Printer::get_GPRMC()
}
std::string Nmea_Printer::get_GPGSA()
{
//$GPGSA,A,3,07,02,26,27,09,04,15, , , , , ,1.8,1.0,1.5*33
@ -523,8 +509,6 @@ std::string Nmea_Printer::get_GPGSA()
}
std::string Nmea_Printer::get_GPGSV()
{
// GSV-GNSS Satellites in View
@ -613,9 +597,6 @@ std::string Nmea_Printer::get_GPGSV()
}
std::string Nmea_Printer::get_GPGGA()
{
//boost::posix_time::ptime d_position_UTC_time=boost::posix_time::microsec_clock::universal_time();
@ -727,3 +708,4 @@ std::string Nmea_Printer::get_GPGGA()
return sentence_str.str();
//$GPGGA,104427.591,5920.7009,N,01803.2938,E,1,05,3.3,78.2,M,23.2,M,0.0,0000*4A
}

View File

@ -32,13 +32,11 @@
#include "pvt_solution.h"
#include <exception>
#include "GPS_L1_CA.h"
#include <gflags/gflags.h>
#include <glog/logging.h>
using google::LogMessage;
DEFINE_bool(tropo, true, "Apply tropospheric correction");
Pvt_Solution::Pvt_Solution()
{

View File

@ -42,14 +42,12 @@
#include <boost/date_time/gregorian/gregorian.hpp>
#include <boost/date_time/local_time/local_time.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <gflags/gflags.h>
#include <glog/logging.h>
#include "gnss_sdr_flags.h"
using google::LogMessage;
DEFINE_string(RINEX_version, "3.02", "Specifies the RINEX version (2.11 or 3.02)");
Rinex_Printer::Rinex_Printer(int conf_version)
{

View File

@ -37,7 +37,6 @@
#include <fcntl.h> // for O_RDWR
#include <termios.h> // for tcgetattr
#include <boost/date_time/posix_time/posix_time.hpp>
#include <gflags/gflags.h>
#include <glog/logging.h>
using google::LogMessage;

View File

@ -39,7 +39,6 @@ set(GNSS_SPLIBS_SOURCES
conjugate_ic.cc
)
if(OPENCL_FOUND)
set(GNSS_SPLIBS_SOURCES ${GNSS_SPLIBS_SOURCES}
fft_execute.cc # Needs OpenCL
@ -71,7 +70,10 @@ if(OPENCL_FOUND)
endif(OS_IS_MACOSX)
endif(OPENCL_FOUND)
add_definitions(-DGNSSSDR_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}")
file(GLOB GNSS_SPLIBS_HEADERS "*.h")
list(REMOVE_ITEM GNSS_SPLIBS_HEADERS gnss_sdr_flags.h)
list(SORT GNSS_SPLIBS_HEADERS)
add_library(gnss_sp_libs ${GNSS_SPLIBS_SOURCES} ${GNSS_SPLIBS_HEADERS})
source_group(Headers FILES ${GNSS_SPLIBS_HEADERS})
@ -79,6 +81,7 @@ source_group(Headers FILES ${GNSS_SPLIBS_HEADERS})
target_link_libraries(gnss_sp_libs ${GNURADIO_RUNTIME_LIBRARIES}
${VOLK_LIBRARIES} ${ORC_LIBRARIES}
${VOLK_GNSSSDR_LIBRARIES} ${ORC_LIBRARIES}
${GFlags_LIBS}
${GNURADIO_BLOCKS_LIBRARIES}
${GNURADIO_FFT_LIBRARIES}
${GNURADIO_FILTER_LIBRARIES}
@ -89,3 +92,7 @@ target_link_libraries(gnss_sp_libs ${GNURADIO_RUNTIME_LIBRARIES}
if(NOT VOLK_GNSSSDR_FOUND)
add_dependencies(gnss_sp_libs volk_gnsssdr_module)
endif(NOT VOLK_GNSSSDR_FOUND)
add_library(gnss_sdr_flags gnss_sdr_flags.cc gnss_sdr_flags.h)
source_group(Headers FILES gnss_sdr_flags.h)
target_link_libraries(gnss_sdr_flags ${GFlags_LIBS})

View File

@ -0,0 +1,43 @@
/*!
* \file gnss_sdr_flags.cc
* \brief Helper file for gnss-sdr commandline flags
* \author Carles Fernandez-Prades, 2018. cfernandez(at)cttc.es
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* 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 <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#include <gnss_sdr_flags.h>
DEFINE_string(c, "-", "Path to the configuration file (if set, overrides --config_file)");
DEFINE_string(s, "-",
"If defined, path to the file containing the signal samples (overrides the configuration file and --signal_source)");
DEFINE_string(signal_source, "-",
"If defined, path to the file containing the signal samples (overrides the configuration file)");
DEFINE_string(RINEX_version, "3.02", "Specifies the RINEX version (2.11 or 3.02)");

View File

@ -0,0 +1,51 @@
/*!
* \file gnss_sdr_flags.h
* \brief Helper file for gnss-sdr commandline flags
* \author Carles Fernandez-Prades, 2018. cfernandez(at)cttc.es
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* 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 <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_FLAGS_H_
#define GNSS_SDR_FLAGS_H_
#include <gflags/gflags.h>
DECLARE_string(c); //<! path to the configuration file
DECLARE_string(config_file); //<! path to the configuration file
DECLARE_string(log_dir); //<! path to the folder in which logging will be stored
// Declare flags for signal sources
DECLARE_string(s); //<! path to the file containing the signal samples
DECLARE_string(signal_source); //<! path to the file containing the signal samples
//PVT
DECLARE_string(RINEX_version); //<! RINEX version
#endif

View File

@ -35,18 +35,16 @@
#include <fstream>
#include <iomanip>
#include <exception>
#include <gflags/gflags.h>
#include <glog/logging.h>
#include "gnss_sdr_valve.h"
#include "configuration_interface.h"
#include "gnss_sdr_flags.h"
#include "gnss_sdr_valve.h"
using google::LogMessage;
DEFINE_string(signal_source, "-",
"If defined, path to the file containing the signal samples (overrides the configuration file)");
FileSignalSource::FileSignalSource(ConfigurationInterface* configuration,
std::string role, unsigned int in_streams, unsigned int out_streams,
boost::shared_ptr<gr::msg_queue> queue) :
@ -64,6 +62,7 @@ FileSignalSource::FileSignalSource(ConfigurationInterface* configuration,
// override value with commandline flag, if present
if (FLAGS_signal_source.compare("-") != 0) filename_= FLAGS_signal_source;
if (FLAGS_s.compare("-") != 0) filename_= FLAGS_s;
item_type_ = configuration->property(role + ".item_type", default_item_type);
repeat_ = configuration->property(role + ".repeat", false);

View File

@ -31,7 +31,6 @@
#include "gn3s_signal_source.h"
#include <gnuradio/blocks/file_sink.h>
#include <gnuradio/msg_queue.h>
#include <gflags/gflags.h>
#include <glog/logging.h>
#include <gn3s/gn3s_source_cc.h>
#include "configuration_interface.h"

View File

@ -35,17 +35,14 @@
#include <fstream>
#include <iomanip>
#include <iostream>
#include <gflags/gflags.h>
#include <glog/logging.h>
#include "gnss_sdr_valve.h"
#include "configuration_interface.h"
#include "gnss_sdr_flags.h"
#include "gnss_sdr_valve.h"
using google::LogMessage;
DEFINE_string(nsr_signal_source, "-",
"If defined, path to the file containing the NSR (byte to 2-bit packed) signal samples (overrides the configuration file)");
NsrFileSignalSource::NsrFileSignalSource(ConfigurationInterface* configuration,
std::string role, unsigned int in_streams, unsigned int out_streams,
@ -61,7 +58,8 @@ NsrFileSignalSource::NsrFileSignalSource(ConfigurationInterface* configuration,
filename_ = configuration->property(role + ".filename", default_filename);
// override value with commandline flag, if present
if (FLAGS_nsr_signal_source.compare("-") != 0) filename_= FLAGS_nsr_signal_source;
if (FLAGS_signal_source.compare("-") != 0) filename_= FLAGS_signal_source;
if (FLAGS_s.compare("-") != 0) filename_= FLAGS_s;
item_type_ = configuration->property(role + ".item_type", default_item_type);
repeat_ = configuration->property(role + ".repeat", false);

View File

@ -34,17 +34,14 @@
#include <fstream>
#include <iomanip>
#include <iostream>
#include <gflags/gflags.h>
#include <glog/logging.h>
#include "gnss_sdr_valve.h"
#include "configuration_interface.h"
#include "gnss_sdr_flags.h"
#include "gnss_sdr_valve.h"
using google::LogMessage;
DEFINE_string(spir_signal_source, "-",
"If defined, path to the file containing the NSR (byte to 2-bit packed) signal samples (overrides the configuration file)");
SpirFileSignalSource::SpirFileSignalSource(ConfigurationInterface* configuration,
std::string role, unsigned int in_streams, unsigned int out_streams,
@ -60,7 +57,8 @@ SpirFileSignalSource::SpirFileSignalSource(ConfigurationInterface* configuration
filename_ = configuration->property(role + ".filename", default_filename);
// override value with commandline flag, if present
if (FLAGS_spir_signal_source.compare("-") != 0) filename_= FLAGS_spir_signal_source;
if (FLAGS_signal_source.compare("-") != 0) filename_= FLAGS_signal_source;
if (FLAGS_s.compare("-") != 0) filename_= FLAGS_s;
item_type_ = configuration->property(role + ".item_type", default_item_type);
repeat_ = configuration->property(role + ".repeat", false);

View File

@ -34,8 +34,8 @@
#include <fstream>
#include <iomanip>
#include <iostream>
#include <gflags/gflags.h>
#include <glog/logging.h>
#include "gnss_sdr_flags.h"
#include "gnss_sdr_valve.h"
#include "configuration_interface.h"
@ -57,7 +57,8 @@ TwoBitCpxFileSignalSource::TwoBitCpxFileSignalSource(ConfigurationInterface* con
filename_ = configuration->property(role + ".filename", default_filename);
// override value with commandline flag, if present
//if (FLAGS_nsr_signal_source.compare("-") != 0) filename_= FLAGS_nsr_signal_source;
if (FLAGS_signal_source.compare("-") != 0) filename_= FLAGS_signal_source;
if (FLAGS_s.compare("-") != 0) filename_= FLAGS_s;
item_type_ = configuration->property(role + ".item_type", default_item_type);
repeat_ = configuration->property(role + ".repeat", false);

View File

@ -35,11 +35,12 @@
#include <fstream>
#include <iomanip>
#include <iostream>
#include <gflags/gflags.h>
#include <glog/logging.h>
#include <gnuradio/blocks/char_to_float.h>
#include "gnss_sdr_flags.h"
#include "gnss_sdr_valve.h"
#include "configuration_interface.h"
#include <gnuradio/blocks/char_to_float.h>
using google::LogMessage;
@ -61,7 +62,8 @@ TwoBitPackedFileSignalSource::TwoBitPackedFileSignalSource(ConfigurationInterfac
filename_ = configuration->property(role + ".filename", default_filename);
// override value with commandline flag, if present
//if (FLAGS_nsr_signal_source.compare("-") != 0) filename_= FLAGS_nsr_signal_source;
if (FLAGS_signal_source.compare("-") != 0) filename_= FLAGS_signal_source;
if (FLAGS_s.compare("-") != 0) filename_= FLAGS_s;
item_type_ = configuration->property(role + ".item_type", default_item_type);
big_endian_items_ = configuration->property(role + ".big_endian_items", true);

View File

@ -57,6 +57,7 @@
#include "concurrent_queue.h"
#include "concurrent_map.h"
#include "gnss_flowgraph.h"
#include "gnss_sdr_flags.h"
#include "file_configuration.h"
#include "control_message_factory.h"
@ -66,11 +67,18 @@ extern concurrent_queue<Gps_Acq_Assist> global_gps_acq_assist_queue;
using google::LogMessage;
DEFINE_string(config_file, std::string(GNSSSDR_INSTALL_DIR "/share/gnss-sdr/conf/default.conf"),
"File containing the configuration parameters");
"Path to the configuration file");
ControlThread::ControlThread()
{
if(!FLAGS_c.compare("-"))
{
configuration_ = std::make_shared<FileConfiguration>(FLAGS_config_file);
}
else
{
configuration_ = std::make_shared<FileConfiguration>(FLAGS_c);
}
delete_configuration_ = false;
init();
}

View File

@ -57,6 +57,7 @@ include_directories(
${CMAKE_SOURCE_DIR}/src/core/libs/supl
${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-rrlp
${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-supl
${CMAKE_SOURCE_DIR}/src/algorithms/libs
${GLOG_INCLUDE_DIRS}
${GFlags_INCLUDE_DIRS}
${ARMADILLO_INCLUDE_DIRS}
@ -95,6 +96,7 @@ target_link_libraries(gnss-sdr ${MAC_LIBRARIES}
${VOLK_GNSSSDR_LIBRARIES}
${GNSS_SDR_OPTIONAL_LIBS}
gnss_sp_libs
gnss_sdr_flags
gnss_rx
)

View File

@ -8,7 +8,7 @@
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
@ -30,6 +30,7 @@
*
* -------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_VERSION
#define GNSS_SDR_VERSION "0.0.9"
#endif
@ -44,11 +45,11 @@
#include <boost/exception/diagnostic_information.hpp>
#include <boost/exception_ptr.hpp>
#include <boost/filesystem.hpp>
#include <gflags/gflags.h>
#include <glog/logging.h>
#include "control_thread.h"
#include "concurrent_queue.h"
#include "concurrent_map.h"
#include "gnss_sdr_flags.h"
#if CUDA_GPU_ACCEL
// For the CUDA runtime routines (prefixed with "cuda_")
@ -58,7 +59,6 @@
using google::LogMessage;
DECLARE_string(log_dir);
/*
* Concurrent queues that communicates the Telemetry Decoder
@ -74,7 +74,7 @@ int main(int argc, char** argv)
const std::string intro_help(
std::string("\nGNSS-SDR is an Open Source GNSS Software Defined Receiver\n")
+
"Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)\n"
"Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors)\n"
+
"This program comes with ABSOLUTELY NO WARRANTY;\n"
+

View File

@ -31,7 +31,6 @@ include_directories(
${CMAKE_SOURCE_DIR}/src/core/libs/supl
${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-rrlp
${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-supl
${CMAKE_SOURCE_DIR}/src/algorithms/libs
${CMAKE_SOURCE_DIR}/src/algorithms/acquisition/adapters
${CMAKE_SOURCE_DIR}/src/algorithms/acquisition/gnuradio_blocks
${GLOG_INCLUDE_DIRS}
@ -62,7 +61,6 @@ target_link_libraries(front_end_cal_lib ${MAC_LIBRARIES}
rx_core_lib
gnss_rx
channel_fsm
gnss_sp_libs
)
add_dependencies(front_end_cal_lib glog-${glog_RELEASE} armadillo-${armadillo_RELEASE})
@ -90,7 +88,6 @@ target_link_libraries(front-end-cal ${MAC_LIBRARIES}
${GNSS_SDR_OPTIONAL_LIBS}
rx_core_lib
gnss_rx
gnss_sp_libs
front_end_cal_lib
)

View File

@ -34,7 +34,6 @@
#include <memory>
#include <exception>
#include <boost/filesystem.hpp>
#include <gflags/gflags.h>
#include <glog/logging.h>
#include <boost/thread/mutex.hpp>
#include <boost/thread/thread.hpp>