1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-06-28 07:53:15 +00:00
This commit is contained in:
Carles Fernandez 2015-05-23 12:00:50 +02:00
commit bc9080e1cd
12 changed files with 96 additions and 43 deletions

View File

@ -52,6 +52,7 @@ option(ENABLE_OPENCL "Enable building of processing blocks implemented with Open
option(ENABLE_GENERIC_ARCH "Builds a portable binary" OFF) option(ENABLE_GENERIC_ARCH "Builds a portable binary" OFF)
option(ENABLE_PACKAGING "Enable software packaging" OFF) option(ENABLE_PACKAGING "Enable software packaging" OFF)
option(ENABLE_OWN_GLOG "Download glog and link it to gflags" OFF) option(ENABLE_OWN_GLOG "Download glog and link it to gflags" OFF)
option(ENABLE_LOG "Enable logging" ON)
if(ENABLE_PACKAGING) if(ENABLE_PACKAGING)
set(ENABLE_GENERIC_ARCH ON) set(ENABLE_GENERIC_ARCH ON)
endif(ENABLE_PACKAGING) endif(ENABLE_PACKAGING)
@ -596,6 +597,11 @@ else(NOT GLOG_FOUND OR ${LOCAL_GFLAGS})
set_property(TARGET glog-${glog_RELEASE} PROPERTY IMPORTED_LOCATION "${GLOG_LIBRARIES}") set_property(TARGET glog-${glog_RELEASE} PROPERTY IMPORTED_LOCATION "${GLOG_LIBRARIES}")
endif(NOT GLOG_FOUND OR ${LOCAL_GFLAGS}) endif(NOT GLOG_FOUND OR ${LOCAL_GFLAGS})
if(NOT ENABLE_LOG)
message(STATUS "Logging is not enabled")
add_definitions(-DGOOGLE_STRIP_LOG=1)
endif(NOT ENABLE_LOG)
################################################################################ ################################################################################

View File

@ -101,7 +101,7 @@ int Nmea_Printer::init_serial (std::string serial_device)
fd = open(serial_device.c_str(), O_RDWR | O_NOCTTY | O_NDELAY); fd = open(serial_device.c_str(), O_RDWR | O_NOCTTY | O_NDELAY);
if (fd == -1) return fd; //failed to open TTY port if (fd == -1) return fd; //failed to open TTY port
fcntl(fd, F_SETFL, 0); // clear all flags on descriptor, enable direct I/O if(fcntl(fd, F_SETFL, 0) == -1) LOG(INFO) << "Error enabling direct I/O"; // clear all flags on descriptor, enable direct I/O
tcgetattr(fd, &options); // read serial port options tcgetattr(fd, &options); // read serial port options
BAUD = B9600; BAUD = B9600;

View File

@ -513,7 +513,7 @@ inline std::string& Rinex_Printer::sci2for(std::string& aStr,
long iexp; long iexp;
//If checkSwitch is false, always redo the exponential. Otherwise, //If checkSwitch is false, always redo the exponential. Otherwise,
//set it to false. //set it to false.
bool redoexp=!checkSwitch; bool redoexp =! checkSwitch;
// Check for decimal place within specified boundaries // Check for decimal place within specified boundaries
if ((idx == 0) || (idx >= (startPos + length - expLen - 1))) if ((idx == 0) || (idx >= (startPos + length - expLen - 1)))
@ -526,12 +526,12 @@ inline std::string& Rinex_Printer::sci2for(std::string& aStr,
// account for the possibility of non-scientific // account for the possibility of non-scientific
// notation (more than one digit to the left of the // notation (more than one digit to the left of the
// decimal) // decimal)
if (idx > startPos) if ((idx > startPos) && (idx >= 1))
{ {
redoexp = true; redoexp = true;
// Swap digit and decimal. // Swap digit and decimal.
aStr[idx] = aStr[idx-1]; aStr[idx] = aStr[idx - 1];
aStr[idx-1] = '.'; aStr[idx - 1] = '.';
// Only add one to the exponent if the number is non-zero // Only add one to the exponent if the number is non-zero
if (asDouble(aStr.substr(startPos, length)) != 0.0) if (asDouble(aStr.substr(startPos, length)) != 0.0)
expAdd = 1; expAdd = 1;

View File

@ -84,14 +84,16 @@ Rtcm_Printer::~Rtcm_Printer()
long pos; long pos;
rtcm_file_descriptor.close(); rtcm_file_descriptor.close();
pos = rtcm_file_descriptor.tellp(); pos = rtcm_file_descriptor.tellp();
if (pos == 0) remove(rtcm_filename.c_str()); if (pos == 0)
{
if(remove(rtcm_filename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
}
} }
close_serial(); close_serial();
} }
int Rtcm_Printer::init_serial(std::string serial_device) int Rtcm_Printer::init_serial(std::string serial_device)
{ {
/*! /*!
@ -108,7 +110,7 @@ int Rtcm_Printer::init_serial(std::string serial_device)
fd = open(serial_device.c_str(), O_RDWR | O_NOCTTY | O_NDELAY); fd = open(serial_device.c_str(), O_RDWR | O_NOCTTY | O_NDELAY);
if (fd == -1) return fd; // failed to open TTY port if (fd == -1) return fd; // failed to open TTY port
fcntl(fd, F_SETFL, 0); // clear all flags on descriptor, enable direct I/O if(fcntl(fd, F_SETFL, 0) == -1) LOG(INFO) << "Error enabling direct I/O"; // clear all flags on descriptor, enable direct I/O
tcgetattr(fd, &options); // read serial port options tcgetattr(fd, &options); // read serial port options
BAUD = B9600; BAUD = B9600;

View File

@ -103,7 +103,7 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc::galileo_e5a_noncoherentIQ_acquisit
d_input_power = 0.0; d_input_power = 0.0;
d_num_doppler_bins = 0; d_num_doppler_bins = 0;
d_bit_transition_flag = bit_transition_flag; d_bit_transition_flag = bit_transition_flag;
d_buffer_count=0; d_buffer_count = 0;
d_both_signal_components = both_signal_components_; d_both_signal_components = both_signal_components_;
d_CAF_window_hz = CAF_window_hz_; d_CAF_window_hz = CAF_window_hz_;
@ -137,6 +137,20 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc::galileo_e5a_noncoherentIQ_acquisit
// For dumping samples into a file // For dumping samples into a file
d_dump = dump; d_dump = dump;
d_dump_filename = dump_filename; d_dump_filename = dump_filename;
d_doppler_resolution = 0;
d_threshold = 0;
d_doppler_step = 250;
d_grid_doppler_wipeoffs = 0;
d_gnss_synchro = 0;
d_code_phase = 0;
d_doppler_freq = 0;
d_test_statistics = 0;
d_channel_internal_queue = 0;
d_CAF_vector_I = 0;
d_CAF_vector_Q = 0;
d_channel = 0;
d_gr_stream_buffer = 0;
} }
galileo_e5a_noncoherentIQ_acquisition_caf_cc::~galileo_e5a_noncoherentIQ_acquisition_caf_cc() galileo_e5a_noncoherentIQ_acquisition_caf_cc::~galileo_e5a_noncoherentIQ_acquisition_caf_cc()
@ -365,7 +379,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
// If buffer will be full in next iteration // If buffer will be full in next iteration
if (d_buffer_count >= d_fft_size - d_gr_stream_buffer) if (d_buffer_count >= d_fft_size - d_gr_stream_buffer)
{ {
d_state=2; d_state = 2;
} }
d_buffer_count += buff_increment; d_buffer_count += buff_increment;
d_sample_counter += buff_increment; // sample counter d_sample_counter += buff_increment; // sample counter

View File

@ -92,6 +92,17 @@ galileo_pcps_8ms_acquisition_cc::galileo_pcps_8ms_acquisition_cc(
// For dumping samples into a file // For dumping samples into a file
d_dump = dump; d_dump = dump;
d_dump_filename = dump_filename; d_dump_filename = dump_filename;
d_doppler_resolution = 0;
d_threshold = 0;
d_doppler_step = 0;
d_grid_doppler_wipeoffs = 0;
d_gnss_synchro = 0;
d_code_phase = 0;
d_doppler_freq = 0;
d_test_statistics = 0;
d_channel_internal_queue = 0;
d_channel = 0;
} }
galileo_pcps_8ms_acquisition_cc::~galileo_pcps_8ms_acquisition_cc() galileo_pcps_8ms_acquisition_cc::~galileo_pcps_8ms_acquisition_cc()

View File

@ -126,5 +126,5 @@ void galileo_e5_a_code_gen_complex_sampled(std::complex<float>* _dest, char _Sig
_dest[(i + delay) % _samplesPerCode] = _code[i]; _dest[(i + delay) % _samplesPerCode] = _code[i];
} }
free(_code); delete[] _code;
} }

View File

@ -247,7 +247,7 @@ galileo_e5a_telemetry_decoder_cc::galileo_e5a_telemetry_decoder_cc(
// //
d_sample_counter = 0; d_sample_counter = 0;
d_state = 0; d_state = 0;
d_preamble_lock=false; d_preamble_lock = false;
d_preamble_index = 0; d_preamble_index = 0;
d_preamble_time_seconds = 0; d_preamble_time_seconds = 0;
d_flag_frame_sync = false; d_flag_frame_sync = false;
@ -260,6 +260,15 @@ galileo_e5a_telemetry_decoder_cc::galileo_e5a_telemetry_decoder_cc(
d_CRC_error_counter = 0; d_CRC_error_counter = 0;
d_sign_init = 0; d_sign_init = 0;
d_flag_preamble = false;
d_ephemeris_queue = 0;
d_iono_queue = 0;
d_utc_model_queue = 0;
d_almanac_queue = 0;
d_channel = 0;
Prn_timestamp_at_preamble_ms = 0;
flag_TOW_set = false;
} }
galileo_e5a_telemetry_decoder_cc::~galileo_e5a_telemetry_decoder_cc() galileo_e5a_telemetry_decoder_cc::~galileo_e5a_telemetry_decoder_cc()

View File

@ -104,7 +104,7 @@ private:
signed int d_preamble_bits[GALILEO_FNAV_PREAMBLE_LENGTH_BITS]; signed int d_preamble_bits[GALILEO_FNAV_PREAMBLE_LENGTH_BITS];
// signed int d_page_symbols[GALILEO_FNAV_SYMBOLS_PER_PAGE + GALILEO_FNAV_PREAMBLE_LENGTH_BITS]; // signed int d_page_symbols[GALILEO_FNAV_SYMBOLS_PER_PAGE + GALILEO_FNAV_PREAMBLE_LENGTH_BITS];
double d_page_symbols[GALILEO_FNAV_SYMBOLS_PER_PAGE + GALILEO_FNAV_PREAMBLE_LENGTH_BITS]; double d_page_symbols[GALILEO_FNAV_SYMBOLS_PER_PAGE + GALILEO_FNAV_PREAMBLE_LENGTH_BITS];
signed int *d_preamble_symbols; // signed int *d_preamble_symbols;
double d_current_symbol; double d_current_symbol;
long unsigned int d_symbol_counter; long unsigned int d_symbol_counter;
int d_prompt_counter; int d_prompt_counter;

View File

@ -338,7 +338,11 @@ int Viterbi_Decoder::do_tb_and_decode(int traceback_length, int requested_decodi
state = it->get_anchestor_state_of_current_state(state); state = it->get_anchestor_state_of_current_state(state);
t_out--; t_out--;
} }
indicator_metric /= n_im; if(n_im > 0)
{
indicator_metric /= n_im;
}
VLOG(BLOCK) << "indicator metric: " << indicator_metric; VLOG(BLOCK) << "indicator metric: " << indicator_metric;
// remove old states // remove old states
if (d_trellis_paths.begin() + traceback_length + overstep_length <= d_trellis_paths.end()) if (d_trellis_paths.begin() + traceback_length + overstep_length <= d_trellis_paths.end())

View File

@ -273,7 +273,7 @@ void Gnss_Satellite::set_block(const std::string& system_, unsigned int PRN_ )
block = std::string("IIR-M"); //Plane A block = std::string("IIR-M"); //Plane A
break; break;
case 8 : case 8 :
block = std::string("UNKNOWN"); // Decommissioned block = std::string("IIA*"); // Decommissed
break; break;
case 9 : case 9 :
block = std::string("IIF"); //Plane F block = std::string("IIF"); //Plane F

View File

@ -34,6 +34,10 @@
#define GNSS_SDR_VERSION "0.0.5" #define GNSS_SDR_VERSION "0.0.5"
#endif #endif
#ifndef GOOGLE_STRIP_LOG
#define GOOGLE_STRIP_LOG 0
#endif
#include <ctime> #include <ctime>
#include <cstdlib> #include <cstdlib>
#include <memory> #include <memory>
@ -131,34 +135,37 @@ int main(int argc, char** argv)
google::ParseCommandLineFlags(&argc, &argv, true); google::ParseCommandLineFlags(&argc, &argv, true);
std::cout << "Initializing GNSS-SDR v" << gnss_sdr_version << " ... Please wait." << std::endl; std::cout << "Initializing GNSS-SDR v" << gnss_sdr_version << " ... Please wait." << std::endl;
google::InitGoogleLogging(argv[0]); if(GOOGLE_STRIP_LOG == 0)
if (FLAGS_log_dir.empty())
{ {
std::cout << "Logging will be done at " google::InitGoogleLogging(argv[0]);
<< boost::filesystem::temp_directory_path() if (FLAGS_log_dir.empty())
<< std::endl
<< "Use gnss-sdr --log_dir=/path/to/log to change that."
<< std::endl;
}
else
{
const boost::filesystem::path p (FLAGS_log_dir);
if (!boost::filesystem::exists(p))
{ {
std::cout << "The path " std::cout << "Logging will be done at "
<< FLAGS_log_dir << boost::filesystem::temp_directory_path()
<< " does not exist, attempting to create it." << std::endl
<< "Use gnss-sdr --log_dir=/path/to/log to change that."
<< std::endl; << std::endl;
boost::system::error_code ec;
boost::filesystem::create_directory(p, ec);
if(ec != 0)
{
std::cout << "Could not create the " << FLAGS_log_dir << " folder. GNSS-SDR program ended." << std::endl;
google::ShutDownCommandLineFlags();
std::exit(0);
}
} }
std::cout << "Logging with be done at " << FLAGS_log_dir << std::endl; else
{
const boost::filesystem::path p (FLAGS_log_dir);
if (!boost::filesystem::exists(p))
{
std::cout << "The path "
<< FLAGS_log_dir
<< " does not exist, attempting to create it."
<< std::endl;
boost::system::error_code ec;
boost::filesystem::create_directory(p, ec);
if(ec != 0)
{
std::cout << "Could not create the " << FLAGS_log_dir << " folder. GNSS-SDR program ended." << std::endl;
google::ShutDownCommandLineFlags();
std::exit(0);
}
}
std::cout << "Logging with be done at " << FLAGS_log_dir << std::endl;
}
} }
std::unique_ptr<ControlThread> control_thread(new ControlThread()); std::unique_ptr<ControlThread> control_thread(new ControlThread());
@ -176,14 +183,14 @@ int main(int argc, char** argv)
{ {
LOG(FATAL) << "Boost exception: " << boost::diagnostic_information(e); LOG(FATAL) << "Boost exception: " << boost::diagnostic_information(e);
} }
catch( boost::lock_error & le )
{
LOG(FATAL) << "Lock error exception: " << boost::diagnostic_information(le);
}
catch(std::exception const& ex) catch(std::exception const& ex)
{ {
LOG(FATAL) << "STD exception: " << ex.what(); LOG(FATAL) << "STD exception: " << ex.what();
} }
catch(...)
{
LOG(INFO) << "Unexpected catch";
}
// report the elapsed time // report the elapsed time
gettimeofday(&tv, NULL); gettimeofday(&tv, NULL);
long long int end = tv.tv_sec * 1000000 + tv.tv_usec; long long int end = tv.tv_sec * 1000000 + tv.tv_usec;