1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-14 04:00:34 +00:00

Add colors to display

This commit is contained in:
Antonio Ramos 2018-02-23 16:17:51 +01:00
parent c849738da0
commit 5cba843eaa
6 changed files with 87 additions and 11 deletions

View File

@ -137,6 +137,7 @@ set(OS_IS_LINUX "")
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(OperatingSystem "Linux")
set(OS_IS_LINUX TRUE)
add_definitions(-DDISPLAY_COLORS)
if(ARCH_64BITS)
set(ARCH_ "(64 bits)")
else(ARCH_64BITS)

View File

@ -40,6 +40,7 @@
#include <gnuradio/gr_complex.h>
#include <gnuradio/io_signature.h>
#include <glog/logging.h>
#include "display.h"
using google::LogMessage;
@ -1713,7 +1714,7 @@ int rtklib_pvt_cc::work (int noutput_items, gr_vector_const_void_star &input_ite
// DEBUG MESSAGE: Display position in console output
if( (d_ls_pvt->is_valid_position() == true) && (flag_display_pvt == true) )
{
std::cout << TEXT_GREEN << "Position at " << boost::posix_time::to_simple_string(d_ls_pvt->get_position_UTC_time())
std::cout << TEXT_BOLD_GREEN << "Position at " << boost::posix_time::to_simple_string(d_ls_pvt->get_position_UTC_time())
<< " UTC using " << d_ls_pvt->get_num_valid_observations() << " observations is Lat = " << d_ls_pvt->get_latitude() << " [deg], Long = " << d_ls_pvt->get_longitude()
<< " [deg], Height= " << d_ls_pvt->get_height() << " [m]" << TEXT_RESET << std::endl;

View File

@ -396,14 +396,15 @@ std::pair<Gnss_Synchro, Gnss_Synchro> hybrid_observables_cc::find_closest(std::d
void hybrid_observables_cc::correct_TOW_and_compute_prange(std::vector<Gnss_Synchro>& data)
{
double TOW_ref = std::numeric_limits<double>::lowest();
std::vector<Gnss_Synchro>::iterator it;
/////////////////////// DEBUG //////////////////////////
// Logs if there is a pseudorange difference between
// signals of the same satellite higher than a threshold
////////////////////////////////////////////////////////
#ifndef NDEBUG
std::vector<Gnss_Synchro>::iterator it2;
double thr_ = 250.0 / 3e8; // Maximum pseudorange difference = 250 meters
double thr_ = 250.0 / SPEED_OF_LIGHT; // Maximum pseudorange difference = 250 meters
for(it = data.begin(); it != (data.end() - 1); it++)
{
for(it2 = it + 1; it2 != data.end(); it2++)
@ -415,7 +416,7 @@ void hybrid_observables_cc::correct_TOW_and_compute_prange(std::vector<Gnss_Sync
{
DLOG(INFO) << "System " << it->System << ". Signals " << it->Signal << " and " << it2->Signal
<< ". TOW difference in PRN " << it->PRN
<< " = " << tow_dif_ * 1e3 << "[ms]. Equivalent to " << tow_dif_ * 3e8
<< " = " << tow_dif_ * 1e3 << "[ms]. Equivalent to " << tow_dif_ * SPEED_OF_LIGHT
<< " meters in pseudorange";
}
}
@ -424,7 +425,7 @@ void hybrid_observables_cc::correct_TOW_and_compute_prange(std::vector<Gnss_Sync
#endif
///////////////////////////////////////////////////////////
double TOW_ref = std::numeric_limits<double>::lowest();
for(it = data.begin(); it != data.end(); it++)
{
if(it->TOW_at_current_symbol_s > TOW_ref) { TOW_ref = it->TOW_at_current_symbol_s; }

View File

@ -43,11 +43,6 @@
ONE_PI_TWO_PX = (1/Pi)*2^X
*/
const std::string TEXT_RED = "\033[31m";
const std::string TEXT_GREEN = "\033[32m";
const std::string TEXT_RESET = "\033[0m";
const double PI = 3.1415926535897932; //!< pi
const double PI_2 = 2.0 * PI; //!< 2 * pi

View File

@ -0,0 +1,77 @@
/*!
* \file display.h
* \brief Defines useful display constants
* \author Antonio Ramos, 2018. antonio.ramos(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_DISPLAY_H_
#define GNSS_SDR_DISPLAY_H_
#include<string>
#ifdef DISPLAY_COLORS
const std::string TEXT_RESET = "\033[0m";
const std::string TEXT_BLACK = "\033[30m";
const std::string TEXT_RED = "\033[31m";
const std::string TEXT_GREEN = "\033[32m";
const std::string TEXT_YELLOW = "\033[33m";
const std::string TEXT_BLUE = "\033[34m";
const std::string TEXT_MAGENTA = "\033[35m";
const std::string TEXT_CYAN = "\033[36m";
const std::string TEXT_WHITE = "\033[37m";
const std::string TEXT_BOLD_BLACK = "\033[1m\033[30m";
const std::string TEXT_BOLD_RED = "\033[1m\033[31m";
const std::string TEXT_BOLD_GREEN = "\033[1m\033[32m";
const std::string TEXT_BOLD_YELLOW = "\033[1m\033[33m";
const std::string TEXT_BOLD_BLUE = "\033[1m\033[34m";
const std::string TEXT_BOLD_MAGENTA = "\033[1m\033[35m";
const std::string TEXT_BOLD_CYAN = "\033[1m\033[36m";
const std::string TEXT_BOLD_WHITE = "\033[1m\033[37m";
#else
const std::string TEXT_RESET = "";
const std::string TEXT_BLACK = "";
const std::string TEXT_RED = "";
const std::string TEXT_GREEN = "";
const std::string TEXT_YELLOW = "";
const std::string TEXT_BLUE = "";
const std::string TEXT_MAGENTA = "";
const std::string TEXT_CYAN = "";
const std::string TEXT_WHITE = "";
const std::string TEXT_BOLD_BLACK = "";
const std::string TEXT_BOLD_RED = "";
const std::string TEXT_BOLD_GREEN = "";
const std::string TEXT_BOLD_YELLOW = "";
const std::string TEXT_BOLD_BLUE = "";
const std::string TEXT_BOLD_MAGENTA = "";
const std::string TEXT_BOLD_CYAN = "";
const std::string TEXT_BOLD_WHITE = "";
#endif /* DISPLAY_COLORS */
#endif /* GNSS_SDR_DISPLAY_H_ */

View File

@ -50,6 +50,7 @@
#include "concurrent_queue.h"
#include "concurrent_map.h"
#include "gnss_sdr_flags.h"
#include "display.h"
#if CUDA_GPU_ACCEL
// For the CUDA runtime routines (prefixed with "cuda_")