mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2026-10-17 13:02:35 +00:00
Merge branch 'next' of https://github.com/gnss-sdr/gnss-sdr into kf
This commit is contained in:
@@ -20,29 +20,29 @@ set(SYSTEM_PARAMETERS_SOURCES
|
||||
gnss_satellite.cc
|
||||
gnss_signal.cc
|
||||
gps_navigation_message.cc
|
||||
gps_ephemeris.cc
|
||||
gps_iono.cc
|
||||
gps_almanac.cc
|
||||
gps_utc_model.cc
|
||||
gps_acq_assist.cc
|
||||
gps_ref_time.cc
|
||||
gps_ref_location.cc
|
||||
galileo_utc_model.cc
|
||||
galileo_ephemeris.cc
|
||||
galileo_almanac.cc
|
||||
galileo_iono.cc
|
||||
galileo_navigation_message.cc
|
||||
sbas_ephemeris.cc
|
||||
galileo_fnav_message.cc
|
||||
gps_cnav_ephemeris.cc
|
||||
gps_cnav_navigation_message.cc
|
||||
gps_cnav_iono.cc
|
||||
gps_cnav_utc_model.cc
|
||||
rtcm.cc
|
||||
glonass_gnav_ephemeris.cc
|
||||
glonass_gnav_almanac.cc
|
||||
glonass_gnav_utc_model.cc
|
||||
glonass_gnav_navigation_message.cc
|
||||
gps_ephemeris.cc
|
||||
gps_iono.cc
|
||||
gps_almanac.cc
|
||||
gps_utc_model.cc
|
||||
gps_acq_assist.cc
|
||||
gps_ref_time.cc
|
||||
gps_ref_location.cc
|
||||
galileo_utc_model.cc
|
||||
galileo_ephemeris.cc
|
||||
galileo_almanac.cc
|
||||
galileo_iono.cc
|
||||
galileo_navigation_message.cc
|
||||
sbas_ephemeris.cc
|
||||
galileo_fnav_message.cc
|
||||
gps_cnav_ephemeris.cc
|
||||
gps_cnav_navigation_message.cc
|
||||
gps_cnav_iono.cc
|
||||
gps_cnav_utc_model.cc
|
||||
rtcm.cc
|
||||
glonass_gnav_ephemeris.cc
|
||||
glonass_gnav_almanac.cc
|
||||
glonass_gnav_utc_model.cc
|
||||
glonass_gnav_navigation_message.cc
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -67,8 +67,8 @@ const double GPS_L1_CA_CHIP_PERIOD = 9.7752e-07; //!< GPS L1 C/A chip period
|
||||
const double MAX_TOA_DELAY_MS = 20;
|
||||
|
||||
//#define NAVIGATION_SOLUTION_RATE_MS 1000 // this cannot go here
|
||||
const double GPS_STARTOFFSET_ms = 68.802; //[ms] Initial sign. travel time (this cannot go here)
|
||||
|
||||
//const double GPS_STARTOFFSET_ms = 68.802; //[ms] Initial sign. travel time (this cannot go here)
|
||||
const double GPS_STARTOFFSET_ms = 69.0;
|
||||
|
||||
// OBSERVABLE HISTORY DEEP FOR INTERPOLATION
|
||||
const int GPS_L1_CA_HISTORY_DEEP = 100;
|
||||
@@ -82,6 +82,7 @@ const int GPS_L1_CA_HISTORY_DEEP = 100;
|
||||
const int GPS_CA_PREAMBLE_LENGTH_BITS = 8;
|
||||
const int GPS_CA_PREAMBLE_LENGTH_SYMBOLS = 160;
|
||||
const double GPS_CA_PREAMBLE_DURATION_S = 0.160;
|
||||
const int GPS_CA_PREAMBLE_DURATION_MS = 160;
|
||||
const int GPS_CA_TELEMETRY_RATE_BITS_SECOND = 50; //!< NAV message bit rate [bits/s]
|
||||
const int GPS_CA_TELEMETRY_SYMBOLS_PER_BIT = 20;
|
||||
const int GPS_CA_TELEMETRY_RATE_SYMBOLS_SECOND = GPS_CA_TELEMETRY_RATE_BITS_SECOND * GPS_CA_TELEMETRY_SYMBOLS_PER_BIT; //!< NAV message bit rate [symbols/s]
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* \author
|
||||
* Luis Esteve, 2012. luis(at)epsilon-formacion.com
|
||||
* Javier Arribas, 2012. jarribas(at)cttc.es
|
||||
* Álvaro Cebrián Juan, 2018. acebrianjuan(at)gmail.com
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors)
|
||||
@@ -66,13 +67,52 @@ public:
|
||||
int correlation_length_ms; //!< Set by Tracking processing block
|
||||
|
||||
//Telemetry Decoder
|
||||
bool Flag_valid_word; //!< Set by Telemetry Decoder processing block
|
||||
double TOW_at_current_symbol_s; //!< Set by Telemetry Decoder processing block
|
||||
bool Flag_valid_word; //!< Set by Telemetry Decoder processing block
|
||||
unsigned int TOW_at_current_symbol_ms; //!< Set by Telemetry Decoder processing block
|
||||
|
||||
// Observables
|
||||
double Pseudorange_m; //!< Set by Observables processing block
|
||||
double RX_time; //!< Set by Observables processing block
|
||||
bool Flag_valid_pseudorange; //!< Set by Observables processing block
|
||||
double interp_TOW_ms; //!< Set by Observables processing block
|
||||
|
||||
|
||||
/*!
|
||||
* \brief This member function is necessary to serialize and restore
|
||||
* Gnss_Synchro objects from a byte stream.
|
||||
*/
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int version)
|
||||
{
|
||||
// Satellite and signal info
|
||||
ar& System;
|
||||
ar& Signal;
|
||||
ar& PRN;
|
||||
ar& Channel_ID;
|
||||
ar& Acq_delay_samples;
|
||||
ar& Acq_doppler_hz;
|
||||
ar& Acq_samplestamp_samples;
|
||||
ar& Flag_valid_acquisition;
|
||||
//Tracking
|
||||
ar& fs;
|
||||
ar& Prompt_I;
|
||||
ar& Prompt_Q;
|
||||
ar& CN0_dB_hz;
|
||||
ar& Carrier_Doppler_hz;
|
||||
ar& Carrier_phase_rads;
|
||||
ar& Code_phase_samples;
|
||||
ar& Tracking_sample_counter;
|
||||
ar& Flag_valid_symbol_output;
|
||||
ar& correlation_length_ms;
|
||||
//Telemetry Decoder
|
||||
ar& Flag_valid_word;
|
||||
ar& TOW_at_current_symbol_ms;
|
||||
// Observables
|
||||
ar& Pseudorange_m;
|
||||
ar& RX_time;
|
||||
ar& Flag_valid_pseudorange;
|
||||
ar& interp_TOW_ms;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -53,7 +53,7 @@ Rtcm::Rtcm(unsigned short port)
|
||||
reserved_field = std::bitset<6>("000000");
|
||||
rtcm_message_queue = std::make_shared<concurrent_queue<std::string> >();
|
||||
boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), RTCM_port);
|
||||
servers.emplace_back(io_service, endpoint);
|
||||
servers.emplace_back(io_context, endpoint);
|
||||
server_is_running = false;
|
||||
}
|
||||
|
||||
@@ -85,13 +85,13 @@ Rtcm::~Rtcm()
|
||||
// *****************************************************************************************************
|
||||
void Rtcm::run_server()
|
||||
{
|
||||
std::cout << "Starting a TCP Server on port " << RTCM_port << std::endl;
|
||||
std::cout << "Starting a TCP/IP server of RTCM messages on port " << RTCM_port << std::endl;
|
||||
try
|
||||
{
|
||||
std::thread tq([&] { std::make_shared<Queue_Reader>(io_service, rtcm_message_queue, RTCM_port)->do_read_queue(); });
|
||||
std::thread tq([&] { std::make_shared<Queue_Reader>(io_context, rtcm_message_queue, RTCM_port)->do_read_queue(); });
|
||||
tq.detach();
|
||||
|
||||
std::thread t([&] { io_service.run(); });
|
||||
std::thread t([&] { io_context.run(); });
|
||||
server_is_running = true;
|
||||
t.detach();
|
||||
}
|
||||
@@ -104,13 +104,13 @@ void Rtcm::run_server()
|
||||
|
||||
void Rtcm::stop_service()
|
||||
{
|
||||
io_service.stop();
|
||||
io_context.stop();
|
||||
}
|
||||
|
||||
|
||||
void Rtcm::stop_server()
|
||||
{
|
||||
std::cout << "Stopping TCP Server on port " << RTCM_port << std::endl;
|
||||
std::cout << "Stopping TCP/IP server on port " << RTCM_port << std::endl;
|
||||
rtcm_message_queue->push("Goodbye"); // this terminates tq
|
||||
Rtcm::stop_service();
|
||||
servers.front().close_server();
|
||||
@@ -3313,7 +3313,7 @@ std::map<std::string, int> Rtcm::galileo_signal_map = [] {
|
||||
boost::posix_time::ptime Rtcm::compute_GPS_time(const Gps_Ephemeris& eph, double obs_time) const
|
||||
{
|
||||
const double gps_t = obs_time;
|
||||
boost::posix_time::time_duration t = boost::posix_time::millisec((gps_t + 604800 * static_cast<double>(eph.i_GPS_week % 1024)) * 1000);
|
||||
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<long>((gps_t + 604800 * static_cast<double>(eph.i_GPS_week % 1024)) * 1000));
|
||||
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
|
||||
return p_time;
|
||||
}
|
||||
@@ -3322,7 +3322,7 @@ boost::posix_time::ptime Rtcm::compute_GPS_time(const Gps_Ephemeris& eph, double
|
||||
boost::posix_time::ptime Rtcm::compute_GPS_time(const Gps_CNAV_Ephemeris& eph, double obs_time) const
|
||||
{
|
||||
const double gps_t = obs_time;
|
||||
boost::posix_time::time_duration t = boost::posix_time::millisec((gps_t + 604800 * static_cast<double>(eph.i_GPS_week % 1024)) * 1000);
|
||||
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<long>((gps_t + 604800 * static_cast<double>(eph.i_GPS_week % 1024)) * 1000));
|
||||
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
|
||||
return p_time;
|
||||
}
|
||||
@@ -3331,7 +3331,7 @@ boost::posix_time::ptime Rtcm::compute_GPS_time(const Gps_CNAV_Ephemeris& eph, d
|
||||
boost::posix_time::ptime Rtcm::compute_Galileo_time(const Galileo_Ephemeris& eph, double obs_time) const
|
||||
{
|
||||
double galileo_t = obs_time;
|
||||
boost::posix_time::time_duration t = boost::posix_time::millisec((galileo_t + 604800 * static_cast<double>(eph.WN_5)) * 1000);
|
||||
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<long>((galileo_t + 604800 * static_cast<double>(eph.WN_5)) * 1000));
|
||||
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
|
||||
return p_time;
|
||||
}
|
||||
@@ -4058,7 +4058,7 @@ int Rtcm::set_DF050(const Gnss_Synchro& gnss_synchro)
|
||||
int Rtcm::set_DF051(const Gps_Ephemeris& gps_eph, double obs_time)
|
||||
{
|
||||
const double gps_t = obs_time;
|
||||
boost::posix_time::time_duration t = boost::posix_time::millisec((gps_t + 604800 * static_cast<double>(gps_eph.i_GPS_week % 1024)) * 1000);
|
||||
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<long>((gps_t + 604800 * static_cast<double>(gps_eph.i_GPS_week % 1024)) * 1000));
|
||||
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
|
||||
std::string now_ptime = to_iso_string(p_time);
|
||||
std::string today_ptime = now_ptime.substr(0, 8);
|
||||
@@ -4072,7 +4072,7 @@ int Rtcm::set_DF051(const Gps_Ephemeris& gps_eph, double obs_time)
|
||||
int Rtcm::set_DF052(const Gps_Ephemeris& gps_eph, double obs_time)
|
||||
{
|
||||
const double gps_t = obs_time;
|
||||
boost::posix_time::time_duration t = boost::posix_time::millisec((gps_t + 604800 * static_cast<double>(gps_eph.i_GPS_week % 1024)) * 1000);
|
||||
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<long>((gps_t + 604800 * static_cast<double>(gps_eph.i_GPS_week % 1024)) * 1000));
|
||||
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
|
||||
std::string now_ptime = to_iso_string(p_time);
|
||||
std::string hours = now_ptime.substr(9, 2);
|
||||
|
||||
@@ -677,10 +677,10 @@ private:
|
||||
{
|
||||
if (first == true)
|
||||
{
|
||||
std::cout << "Client from " << socket_.remote_endpoint().address() << " says ";
|
||||
LOG(INFO) << "Client says:";
|
||||
first = false;
|
||||
}
|
||||
std::cout << client_says.substr(0, 80) << std::endl;
|
||||
LOG(INFO) << client_says;
|
||||
client_says = client_says.substr(80, client_says.length() - 80);
|
||||
}
|
||||
do_read_message_header();
|
||||
@@ -749,21 +749,21 @@ private:
|
||||
: public std::enable_shared_from_this<Tcp_Internal_Client>
|
||||
{
|
||||
public:
|
||||
Tcp_Internal_Client(boost::asio::io_service& io_service,
|
||||
Tcp_Internal_Client(boost::asio::io_service& io_context,
|
||||
boost::asio::ip::tcp::resolver::iterator endpoint_iterator)
|
||||
: io_service_(io_service), socket_(io_service)
|
||||
: io_context_(io_context), socket_(io_context)
|
||||
{
|
||||
do_connect(endpoint_iterator);
|
||||
}
|
||||
|
||||
inline void close()
|
||||
{
|
||||
io_service_.post([this]() { socket_.close(); });
|
||||
io_context_.post([this]() { socket_.close(); });
|
||||
}
|
||||
|
||||
inline void write(const Rtcm_Message& msg)
|
||||
{
|
||||
io_service_.post(
|
||||
io_context_.post(
|
||||
[this, msg]() {
|
||||
bool write_in_progress = !write_msgs_.empty();
|
||||
write_msgs_.push_back(msg);
|
||||
@@ -827,7 +827,7 @@ private:
|
||||
});
|
||||
}
|
||||
|
||||
boost::asio::io_service& io_service_;
|
||||
boost::asio::io_service& io_context_;
|
||||
boost::asio::ip::tcp::socket socket_;
|
||||
Rtcm_Message read_msg_;
|
||||
std::deque<Rtcm_Message> write_msgs_;
|
||||
@@ -837,13 +837,13 @@ private:
|
||||
class Queue_Reader
|
||||
{
|
||||
public:
|
||||
Queue_Reader(boost::asio::io_service& io_service, std::shared_ptr<concurrent_queue<std::string> >& queue, int port) : queue_(queue)
|
||||
Queue_Reader(boost::asio::io_service& io_context, std::shared_ptr<concurrent_queue<std::string> >& queue, int port) : queue_(queue)
|
||||
{
|
||||
boost::asio::ip::tcp::resolver resolver(io_service);
|
||||
boost::asio::ip::tcp::resolver resolver(io_context);
|
||||
std::string host("localhost");
|
||||
std::string port_str = std::to_string(port);
|
||||
auto queue_endpoint_iterator = resolver.resolve({host.c_str(), port_str.c_str()});
|
||||
c = std::make_shared<Tcp_Internal_Client>(io_service, queue_endpoint_iterator);
|
||||
c = std::make_shared<Tcp_Internal_Client>(io_context, queue_endpoint_iterator);
|
||||
}
|
||||
|
||||
inline void do_read_queue()
|
||||
@@ -871,8 +871,8 @@ private:
|
||||
class Tcp_Server
|
||||
{
|
||||
public:
|
||||
Tcp_Server(boost::asio::io_service& io_service, const boost::asio::ip::tcp::endpoint& endpoint)
|
||||
: io_service_(io_service), acceptor_(io_service), socket_(io_service)
|
||||
Tcp_Server(boost::asio::io_service& io_context, const boost::asio::ip::tcp::endpoint& endpoint)
|
||||
: acceptor_(io_context), socket_(io_context)
|
||||
{
|
||||
acceptor_.open(endpoint.protocol());
|
||||
acceptor_.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
|
||||
@@ -895,33 +895,47 @@ private:
|
||||
{
|
||||
if (first_client)
|
||||
{
|
||||
std::cout << "The TCP Server is up and running. Accepting connections ..." << std::endl;
|
||||
std::cout << "The TCP/IP server of RTCM messages is up and running. Accepting connections ..." << std::endl;
|
||||
first_client = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Starting RTCM TCP server session..." << std::endl;
|
||||
std::cout << "Serving client from " << socket_.remote_endpoint().address() << std::endl;
|
||||
LOG(INFO) << "Serving client from " << socket_.remote_endpoint().address();
|
||||
std::cout << "Starting RTCM TCP/IP server session..." << std::endl;
|
||||
boost::system::error_code ec2;
|
||||
boost::asio::ip::tcp::endpoint endpoint = socket_.remote_endpoint(ec2);
|
||||
if (ec2)
|
||||
{
|
||||
// Error creating remote_endpoint
|
||||
std::cout << "Error getting remote IP address, closing session." << std::endl;
|
||||
LOG(INFO) << "Error getting remote IP address";
|
||||
start_session = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string remote_addr = endpoint.address().to_string();
|
||||
std::cout << "Serving client from " << remote_addr << std::endl;
|
||||
LOG(INFO) << "Serving client from " << remote_addr;
|
||||
}
|
||||
}
|
||||
std::make_shared<Rtcm_Session>(std::move(socket_), room_)->start();
|
||||
if (start_session) std::make_shared<Rtcm_Session>(std::move(socket_), room_)->start();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Error when invoking a RTCM session. " << ec << std::endl;
|
||||
}
|
||||
start_session = true;
|
||||
do_accept();
|
||||
});
|
||||
}
|
||||
|
||||
boost::asio::io_service& io_service_;
|
||||
boost::asio::ip::tcp::acceptor acceptor_;
|
||||
boost::asio::ip::tcp::socket socket_;
|
||||
Rtcm_Listener_Room room_;
|
||||
bool first_client = true;
|
||||
bool start_session = true;
|
||||
};
|
||||
|
||||
boost::asio::io_service io_service;
|
||||
boost::asio::io_service io_context;
|
||||
std::shared_ptr<concurrent_queue<std::string> > rtcm_message_queue;
|
||||
std::thread t;
|
||||
std::thread tq;
|
||||
|
||||
Reference in New Issue
Block a user