1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-10-02 17:00:50 +00:00
This commit is contained in:
Carles Fernandez 2018-05-19 23:21:56 +02:00
commit c7215034c9
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
8 changed files with 233 additions and 95 deletions

View File

@ -471,7 +471,7 @@ void *rtksvrthread(void *arg)
q = svr->buff[i] + svr->buffsize;
/* read receiver raw/rtcm data from input stream */
if ((n = strread(svr->stream + i, p, q - p)) <= 0)
if ((n = strread(svr->stream + i, p, static_cast<int>(q[0]) - static_cast<int>(p[0]))) <= 0)
{
continue;
}

View File

@ -120,8 +120,8 @@ serial_t *openserial(const char *path, int mode, char *msg)
std::string s_aux = "/dev/" + std::string(port);
s_aux.resize(128, '\0');
int n = s_aux.length();
if (n < 128)
for (int i = 0; i < n; i++) dev[i] = s_aux[i];
for (int i = 0; i < n; i++) dev[i] = s_aux[i];
if (n == 0) dev[0] = '\0';
if ((mode & STR_MODE_R) && (mode & STR_MODE_W))
rw = O_RDWR;
@ -1493,7 +1493,7 @@ void decodeftppath(const char *path, char *addr, char *file, char *user,
*q = '\0';
if (passwd) strcpy(passwd, q + 1);
}
*q = '\0';
if (*q != 0) *q = '\0';
if (user) strcpy(user, buff);
}
else

View File

@ -36,6 +36,7 @@
#include "GPS_L1_CA.h"
#include "GPS_L2C.h"
#include <glog/logging.h>
#include <exception>
#include <iostream> // for cout, endl
#ifdef __APPLE__
@ -122,7 +123,14 @@ Ad9361FpgaSignalSource::~Ad9361FpgaSignalSource()
if (enable_dds_lo_)
{
ad9361_disable_lo_local();
try
{
ad9361_disable_lo_local();
}
catch (const std::exception& e)
{
LOW(WARNING) << "Problem closing the Ad9361FpgaSignalSource: " << e.what();
}
}
// std::cout<<"* AD9361 Destroying context\n";
@ -132,12 +140,18 @@ Ad9361FpgaSignalSource::~Ad9361FpgaSignalSource()
void Ad9361FpgaSignalSource::connect(gr::top_block_sptr top_block)
{
if (top_block)
{ /* top_block is not null */
};
DLOG(INFO) << "AD9361 FPGA source nothing to connect";
}
void Ad9361FpgaSignalSource::disconnect(gr::top_block_sptr top_block)
{
if (top_block)
{ /* top_block is not null */
};
DLOG(INFO) << "AD9361 FPGA source nothing to disconnect";
}

View File

@ -1,6 +1,6 @@
/*!
* \filei fmcomms2_signal_source.cc
* \brief signal source for sdr hardware from analog devices based on
* \file fmcomms2_signal_source.cc
* \brief Signal source for SDR hardware from Analog Devices based on
* fmcomms2 evaluation board.
* \author Rodrigo Muñoz, 2017, rmunozl(at)inacap.cl
*
@ -36,6 +36,7 @@
#include "GPS_L1_CA.h"
#include "GPS_L2C.h"
#include <glog/logging.h>
#include <exception>
#include <iostream>
@ -70,7 +71,7 @@ Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface* configuration
dump_ = configuration->property(role + ".dump", false);
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file);
//AD9361 Local Oscillator generation for dual band operation
// AD9361 Local Oscillator generation for dual band operation
enable_dds_lo_ = configuration->property(role + ".enable_dds_lo", false);
freq_rf_tx_hz_ = configuration->property(role + ".freq_rf_tx_hz", GPS_L1_FREQ_HZ - GPS_L2_FREQ_HZ - 1000);
freq_dds_tx_hz_ = configuration->property(role + ".freq_dds_tx_hz", 1000);
@ -104,7 +105,7 @@ Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface* configuration
rf_port_select_.c_str(), filter_file_.c_str(),
filter_auto_);
//configure LO
// configure LO
if (enable_dds_lo_ == true)
{
std::cout << "Enabling Local Oscillator generator in FMCOMMS2\n";
@ -135,7 +136,7 @@ Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface* configuration
gain_mode_rx2_.c_str(), rf_gain_rx2_,
rf_port_select_.c_str(), filter_file_.c_str(),
filter_auto_);
//configure LO
// configure LO
if (enable_dds_lo_ == true)
{
std::cout << "Enabling Local Oscillator generator in FMCOMMS2\n";
@ -179,7 +180,14 @@ Fmcomms2SignalSource::~Fmcomms2SignalSource()
{
if (enable_dds_lo_ == true)
{
ad9361_disable_lo_remote(uri_);
try
{
ad9361_disable_lo_remote(uri_);
}
catch (const std::exception& e)
{
LOG(WARNING) << "Exception thrown in Fmcomms2SignalSource destructor: " << e.what();
}
}
}

View File

@ -33,10 +33,8 @@
#include "gr_complex_ip_packet_source.h"
#include <gnuradio/io_signature.h>
//#include <cstdlib>
#define FIFO_SIZE 1472000
const int FIFO_SIZE = 1472000;
/* 4 bytes IP address */
@ -48,6 +46,7 @@ typedef struct gr_ip_address
u_char byte4;
} gr_ip_address;
/* IPv4 header */
typedef struct gr_ip_header
{
@ -64,6 +63,7 @@ typedef struct gr_ip_header
u_int op_pad; // Option + Padding
} gr_ip_header;
/* UDP header*/
typedef struct gr_udp_header
{
@ -73,6 +73,7 @@ typedef struct gr_udp_header
u_short crc; // Checksum
} gr_udp_header;
gr_complex_ip_packet_source::sptr
gr_complex_ip_packet_source::make(std::string src_device,
std::string origin_address,
@ -93,6 +94,7 @@ gr_complex_ip_packet_source::make(std::string src_device,
IQ_swap_));
}
/*
* The private constructor
*/
@ -106,9 +108,8 @@ gr_complex_ip_packet_source::gr_complex_ip_packet_source(std::string src_device,
bool IQ_swap_)
: gr::sync_block("gr_complex_ip_packet_source",
gr::io_signature::make(0, 0, 0),
gr::io_signature::make(1, 4, item_size)) //1 to 4 baseband complex channels
gr::io_signature::make(1, 4, item_size)) // 1 to 4 baseband complex channels
{
// constructor code here
std::cout << "Start Ethernet packet capture\n";
d_n_baseband_channels = n_baseband_channels;
@ -133,7 +134,7 @@ gr_complex_ip_packet_source::gr_complex_ip_packet_source(std::string src_device,
d_udp_payload_size = udp_packet_size;
d_fifo_full = false;
//allocate signal samples buffer
// allocate signal samples buffer
fifo_buff = new char[FIFO_SIZE];
fifo_read_ptr = 0;
fifo_write_ptr = 0;
@ -143,14 +144,16 @@ gr_complex_ip_packet_source::gr_complex_ip_packet_source(std::string src_device,
d_sock_raw = 0;
d_pcap_thread = NULL;
descr = NULL;
memset(reinterpret_cast<char *>(&si_me), 0, sizeof(si_me));
}
//Called by gnuradio to enable drivers, etc for i/o devices.
// Called by gnuradio to enable drivers, etc for i/o devices.
bool gr_complex_ip_packet_source::start()
{
std::cout << "gr_complex_ip_packet_source START\n";
//open the ethernet device
// open the ethernet device
if (open() == true)
{
// start pcap capture thread
@ -163,7 +166,8 @@ bool gr_complex_ip_packet_source::start()
}
}
//Called by gnuradio to disable drivers, etc for i/o devices.
// Called by gnuradio to disable drivers, etc for i/o devices.
bool gr_complex_ip_packet_source::stop()
{
std::cout << "gr_complex_ip_packet_source STOP\n";
@ -176,42 +180,44 @@ bool gr_complex_ip_packet_source::stop()
return true;
}
bool gr_complex_ip_packet_source::open()
{
char errbuf[PCAP_ERRBUF_SIZE];
boost::mutex::scoped_lock lock(d_mutex); // hold mutex for duration of this function
/* open device for reading */
// open device for reading
descr = pcap_open_live(d_src_device.c_str(), 1500, 1, 1000, errbuf);
if (descr == NULL)
{
std::cout << "Error openning Ethernet device " << d_src_device << std::endl;
printf("Fatal Error in pcap_open_live(): %s\n", errbuf);
std::cout << "Error opening Ethernet device " << d_src_device << std::endl;
std::cout << "Fatal Error in pcap_open_live(): " << std::string(errbuf) << std::endl;
return false;
}
//bind UDP port to avoid automatic reply with ICMP port ureacheable packets from kernel
// bind UDP port to avoid automatic reply with ICMP port unreachable packets from kernel
d_sock_raw = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (d_sock_raw == -1)
{
std::cout << "Error openning UDP socket" << std::endl;
std::cout << "Error opening UDP socket" << std::endl;
return false;
}
// zero out the structure
memset((char *)&si_me, 0, sizeof(si_me));
memset(reinterpret_cast<char *>(&si_me), 0, sizeof(si_me));
si_me.sin_family = AF_INET;
si_me.sin_port = htons(d_udp_port);
si_me.sin_addr.s_addr = htonl(INADDR_ANY);
//bind socket to port
if (bind(d_sock_raw, (struct sockaddr *)&si_me, sizeof(si_me)) == -1)
// bind socket to port
if (bind(d_sock_raw, reinterpret_cast<struct sockaddr *>(&si_me), sizeof(si_me)) == -1)
{
std::cout << "Error openning UDP socket" << std::endl;
std::cout << "Error opening UDP socket" << std::endl;
return false;
}
return true;
}
gr_complex_ip_packet_source::~gr_complex_ip_packet_source()
{
if (d_pcap_thread != NULL)
@ -222,35 +228,36 @@ gr_complex_ip_packet_source::~gr_complex_ip_packet_source()
std::cout << "Stop Ethernet packet capture\n";
}
void gr_complex_ip_packet_source::static_pcap_callback(u_char *args, const struct pcap_pkthdr *pkthdr,
const u_char *packet)
{
gr_complex_ip_packet_source *bridge = (gr_complex_ip_packet_source *)args;
gr_complex_ip_packet_source *bridge = reinterpret_cast<gr_complex_ip_packet_source *>(args);
bridge->pcap_callback(args, pkthdr, packet);
}
void gr_complex_ip_packet_source::pcap_callback(__attribute__((unused)) u_char *args, __attribute__((unused)) const struct pcap_pkthdr *pkthdr,
const u_char *packet)
{
boost::mutex::scoped_lock lock(d_mutex); // hold mutex for duration of this function
gr_ip_header *ih;
gr_udp_header *uh;
const gr_ip_header *ih;
const gr_udp_header *uh;
// eth frame parameters
// **** UDP RAW PACKET DECODER ****
if ((packet[12] == 0x08) & (packet[13] == 0x00)) //IP FRAME
if ((packet[12] == 0x08) & (packet[13] == 0x00)) // IP FRAME
{
/* retireve the position of the ip header */
ih = (gr_ip_header *)(packet +
14); //length of ethernet header
// retrieve the position of the ip header
ih = reinterpret_cast<const gr_ip_header *>(packet + 14); // length of ethernet header
/* retireve the position of the udp header */
// retrieve the position of the udp header
u_int ip_len;
ip_len = (ih->ver_ihl & 0xf) * 4;
uh = (gr_udp_header *)((u_char *)ih + ip_len);
uh = reinterpret_cast<const gr_udp_header *>(reinterpret_cast<const u_char *>(ih) + ip_len);
/* convert from network byte order to host byte order */
// convert from network byte order to host byte order
//u_short sport;
u_short dport;
dport = ntohs(uh->dport);
@ -271,44 +278,45 @@ void gr_complex_ip_packet_source::pcap_callback(__attribute__((unused)) u_char *
// dport);
// std::cout<<"uh->len:"<<ntohs(uh->len)<<std::endl;
int payload_lenght_bytes = ntohs(uh->len) - 8; //total udp packet lenght minus the header lenght
//read the payload bytes and insert them into the shared circular buffer
u_char *udp_payload = ((u_char *)uh + sizeof(gr_udp_header));
if (fifo_items <= (FIFO_SIZE - payload_lenght_bytes))
int payload_length_bytes = ntohs(uh->len) - 8; // total udp packet length minus the header length
// read the payload bytes and insert them into the shared circular buffer
const u_char *udp_payload = (reinterpret_cast<const u_char *>(uh) + sizeof(gr_udp_header));
if (fifo_items <= (FIFO_SIZE - payload_length_bytes))
{
int aligned_write_items = FIFO_SIZE - fifo_write_ptr;
if (aligned_write_items >= payload_lenght_bytes)
if (aligned_write_items >= payload_length_bytes)
{
//write all in a single memcpy
memcpy(&fifo_buff[fifo_write_ptr], &udp_payload[0], payload_lenght_bytes); //size in bytes
fifo_write_ptr += payload_lenght_bytes;
// write all in a single memcpy
memcpy(&fifo_buff[fifo_write_ptr], &udp_payload[0], payload_length_bytes); // size in bytes
fifo_write_ptr += payload_length_bytes;
if (fifo_write_ptr == FIFO_SIZE) fifo_write_ptr = 0;
fifo_items += payload_lenght_bytes;
fifo_items += payload_length_bytes;
}
else
{
//two step wrap write
memcpy(&fifo_buff[fifo_write_ptr], &udp_payload[0], aligned_write_items); //size in bytes
fifo_write_ptr = payload_lenght_bytes - aligned_write_items;
memcpy(&fifo_buff[0], &udp_payload[aligned_write_items], fifo_write_ptr); //size in bytes
fifo_items += payload_lenght_bytes;
// two step wrap write
memcpy(&fifo_buff[fifo_write_ptr], &udp_payload[0], aligned_write_items); // size in bytes
fifo_write_ptr = payload_length_bytes - aligned_write_items;
memcpy(&fifo_buff[0], &udp_payload[aligned_write_items], fifo_write_ptr); // size in bytes
fifo_items += payload_length_bytes;
}
}
else
{
//notify overflow
// notify overflow
std::cout << "O" << std::flush;
}
}
}
}
void gr_complex_ip_packet_source::my_pcap_loop_thread(pcap_t *pcap_handle)
void gr_complex_ip_packet_source::my_pcap_loop_thread(pcap_t *pcap_handle)
{
pcap_loop(pcap_handle, -1, gr_complex_ip_packet_source::static_pcap_callback, (u_char *)this);
pcap_loop(pcap_handle, -1, gr_complex_ip_packet_source::static_pcap_callback, reinterpret_cast<u_char *>(this));
}
void gr_complex_ip_packet_source::demux_samples(gr_vector_void_star output_items, int num_samples_readed)
{
int8_t real;
@ -318,22 +326,22 @@ void gr_complex_ip_packet_source::demux_samples(gr_vector_void_star output_items
{
switch (d_wire_sample_type)
{
case 1: //interleaved byte samples
case 1: // interleaved byte samples
for (long unsigned int i = 0; i < output_items.size(); i++)
{
real = fifo_buff[fifo_read_ptr++];
imag = fifo_buff[fifo_read_ptr++];
if (d_IQ_swap)
{
(static_cast<gr_complex *>(output_items[i]))[n] = gr_complex(real, imag);
static_cast<gr_complex *>(output_items[i])[n] = gr_complex(real, imag);
}
else
{
(static_cast<gr_complex *>(output_items[i]))[n] = gr_complex(imag, real);
static_cast<gr_complex *>(output_items[i])[n] = gr_complex(imag, real);
}
}
break;
case 2: // 4bits samples
case 2: // 4-bit samples
for (long unsigned int i = 0; i < output_items.size(); i++)
{
tmp_char2 = fifo_buff[fifo_read_ptr] & 0x0F;
@ -357,11 +365,11 @@ void gr_complex_ip_packet_source::demux_samples(gr_vector_void_star output_items
}
if (d_IQ_swap)
{
(static_cast<gr_complex *>(output_items[i]))[n] = gr_complex(imag, real);
static_cast<gr_complex *>(output_items[i])[n] = gr_complex(imag, real);
}
else
{
(static_cast<gr_complex *>(output_items[i]))[n] = gr_complex(real, imag);
static_cast<gr_complex *>(output_items[i])[n] = gr_complex(real, imag);
}
}
break;
@ -373,6 +381,7 @@ void gr_complex_ip_packet_source::demux_samples(gr_vector_void_star output_items
}
}
int gr_complex_ip_packet_source::work(int noutput_items,
__attribute__((unused)) gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
@ -390,44 +399,44 @@ int gr_complex_ip_packet_source::work(int noutput_items,
int bytes_requested;
switch (d_wire_sample_type)
{
case 1: //complex byte samples
case 1: // complex byte samples
bytes_requested = noutput_items * d_bytes_per_sample;
if (bytes_requested < fifo_items)
{
num_samples_readed = noutput_items; //read all
num_samples_readed = noutput_items; // read all
}
else
{
num_samples_readed = fifo_items / d_bytes_per_sample; //read what we have
num_samples_readed = fifo_items / d_bytes_per_sample; // read what we have
}
break;
case 2: //complex 4 bits samples
case 2: // complex 4 bits samples
bytes_requested = noutput_items * d_bytes_per_sample;
if (bytes_requested < fifo_items)
{
num_samples_readed = noutput_items; //read all
num_samples_readed = noutput_items; // read all
}
else
{
num_samples_readed = fifo_items / d_bytes_per_sample; //read what we have
num_samples_readed = fifo_items / d_bytes_per_sample; // read what we have
}
break;
default: //complex byte samples
default: // complex byte samples
bytes_requested = noutput_items * d_bytes_per_sample;
if (bytes_requested < fifo_items)
{
num_samples_readed = noutput_items; //read all
num_samples_readed = noutput_items; // read all
}
else
{
num_samples_readed = fifo_items / d_bytes_per_sample; //read what we have
num_samples_readed = fifo_items / d_bytes_per_sample; // read what we have
}
}
bytes_requested = num_samples_readed * d_bytes_per_sample;
//read all in a single loop
// read all in a single loop
demux_samples(output_items, num_samples_readed); // it also increases the fifo read pointer
//update fifo items
// update fifo items
fifo_items = fifo_items - bytes_requested;
for (long unsigned int n = 0; n < output_items.size(); n++)

View File

@ -154,7 +154,7 @@ rtl_tcp_signal_source_c::rtl_tcp_signal_source_c(const std::string &address,
rtl_tcp_signal_source_c::~rtl_tcp_signal_source_c()
{
boost::mutex::scoped_lock lock(mutex_);
mutex_.unlock();
io_service_.stop();
not_empty_.notify_one();
not_full_.notify_one();

View File

@ -281,7 +281,7 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(dllpllconf_t conf_) : gr::block("dl
d_correlator_outs = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
d_local_code_shift_chips = static_cast<float *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(float), volk_gnsssdr_get_alignment()));
std::fill_n(d_correlator_outs, d_n_correlator_taps, gr_complex(0.0, 0.0));
clear_tracking_vars();
// map memory pointers of correlator outputs
if (d_veml)
@ -328,17 +328,14 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(dllpllconf_t conf_) : gr::block("dl
{
// Extra correlator for the data component
correlator_data_cpu.init(2 * trk_parameters.vector_length, 1);
d_Prompt_Data = static_cast<gr_complex *>(volk_gnsssdr_malloc(sizeof(gr_complex), volk_gnsssdr_get_alignment()));
d_Prompt_Data[0] = gr_complex(0.0, 0.0);
d_data_code = static_cast<float *>(volk_gnsssdr_malloc(2 * d_code_length_chips * sizeof(float), volk_gnsssdr_get_alignment()));
}
else
{
d_Prompt_Data = nullptr;
d_data_code = nullptr;
}
//--- Initializations ---//
// --- Initializations ---
// Initial code frequency basis of NCO
d_code_freq_chips = d_code_chip_rate;
// Residual code phase (in chips)
@ -359,8 +356,7 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(dllpllconf_t conf_) : gr::block("dl
d_CN0_SNV_dB_Hz = 0.0;
d_carrier_lock_fail_counter = 0;
d_carrier_lock_threshold = trk_parameters.carrier_lock_th;
clear_tracking_vars();
d_Prompt_Data[0] = gr_complex(0.0, 0.0);
d_acquisition_gnss_synchro = nullptr;
d_channel = 0;
@ -383,9 +379,8 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(dllpllconf_t conf_) : gr::block("dl
void dll_pll_veml_tracking::start_tracking()
{
gr::thread::scoped_lock l(d_setlock);
/*
* correct the code phase according to the delay between acq and trk
*/
// correct the code phase according to the delay between acq and trk
d_acq_code_phase_samples = d_acquisition_gnss_synchro->Acq_delay_samples;
d_acq_carrier_doppler_hz = d_acquisition_gnss_synchro->Acq_doppler_hz;
d_acq_sample_stamp = d_acquisition_gnss_synchro->Acq_samplestamp_samples;
@ -396,7 +391,7 @@ void dll_pll_veml_tracking::start_tracking()
DLOG(INFO) << "Number of seconds between Acquisition and Tracking = " << acq_trk_diff_seconds;
// Doppler effect Fd = (C / (C + Vr)) * F
double radial_velocity = (d_signal_carrier_freq + d_acq_carrier_doppler_hz) / d_signal_carrier_freq;
// new chip and prn sequence periods based on acq Doppler
// new chip and PRN sequence periods based on acq Doppler
d_code_freq_chips = radial_velocity * d_code_chip_rate;
d_code_phase_step_chips = d_code_freq_chips / trk_parameters.fs_in;
double T_chip_mod_seconds = 1.0 / d_code_freq_chips;
@ -566,7 +561,6 @@ dll_pll_veml_tracking::~dll_pll_veml_tracking()
volk_gnsssdr_free(d_tracking_code);
if (trk_parameters.track_pilot)
{
volk_gnsssdr_free(d_Prompt_Data);
volk_gnsssdr_free(d_data_code);
correlator_data_cpu.free();
}
@ -735,7 +729,7 @@ void dll_pll_veml_tracking::run_dll_pll()
void dll_pll_veml_tracking::clear_tracking_vars()
{
std::fill_n(d_correlator_outs, d_n_correlator_taps, gr_complex(0.0, 0.0));
if (trk_parameters.track_pilot) *d_Prompt_Data = gr_complex(0.0, 0.0);
if (trk_parameters.track_pilot) d_Prompt_Data[0] = gr_complex(0.0, 0.0);
d_carr_error_hz = 0.0;
d_carr_error_filt_hz = 0.0;
d_code_error_chips = 0.0;

View File

@ -35,12 +35,128 @@
#include "nmea_printer.h"
TEST(NmeaPrinterTest, PrintLine)
class NmeaPrinterTest : public ::testing::Test
{
protected:
NmeaPrinterTest()
{
this->conf();
}
~NmeaPrinterTest()
{
}
void conf();
rtk_t rtk;
};
void NmeaPrinterTest::conf()
{
snrmask_t snrmask = {{}, {{}, {}}};
int positioning_mode = 0; // Single
int number_of_frequencies = 1;
double elevation_mask = 5;
int navigation_system = 1; // GPS
int integer_ambiguity_resolution_gps = 0;
int integer_ambiguity_resolution_glo = 0;
int integer_ambiguity_resolution_bds = 0;
int outage_reset_ambiguity = 5;
int min_lock_to_fix_ambiguity = 0;
int iono_model = 0;
int trop_model = 0;
int dynamics_model = 0;
int earth_tide = 0;
int number_filter_iter = 1;
double code_phase_error_ratio_l1 = 100.0;
double code_phase_error_ratio_l2 = 100.0;
double code_phase_error_ratio_l5 = 100.0;
double carrier_phase_error_factor_a = 0.003;
double carrier_phase_error_factor_b = 0.003;
double bias_0 = 30.0;
double iono_0 = 0.03;
double trop_0 = 0.3;
double sigma_bias = 1e-4;
double sigma_iono = 1e-3;
double sigma_trop = 1e-4;
double sigma_acch = 1e-1;
double sigma_accv = 1e-2;
double sigma_pos = 0.0;
double min_ratio_to_fix_ambiguity = 3.0;
double min_elevation_to_fix_ambiguity = 0.0;
double slip_threshold = 0.05;
double threshold_reject_innovation = 30.0;
double threshold_reject_gdop = 30.0;
int sat_PCV = 0;
int rec_PCV = 0;
int phwindup = 0;
int reject_GPS_IIA = 0;
int raim_fde = 0;
prcopt_t rtklib_configuration_options = {
positioning_mode, /* positioning mode (PMODE_XXX) see src/algorithms/libs/rtklib/rtklib.h */
0, /* solution type (0:forward,1:backward,2:combined) */
number_of_frequencies, /* number of frequencies (1:L1, 2:L1+L2, 3:L1+L2+L5)*/
navigation_system, /* navigation system */
elevation_mask * D2R, /* elevation mask angle (degrees) */
snrmask, /* snrmask_t snrmask SNR mask */
0, /* satellite ephemeris/clock (EPHOPT_XXX) */
integer_ambiguity_resolution_gps, /* AR mode (0:off,1:continuous,2:instantaneous,3:fix and hold,4:ppp-ar) */
integer_ambiguity_resolution_glo, /* GLONASS AR mode (0:off,1:on,2:auto cal,3:ext cal) */
integer_ambiguity_resolution_bds, /* BeiDou AR mode (0:off,1:on) */
outage_reset_ambiguity, /* obs outage count to reset bias */
min_lock_to_fix_ambiguity, /* min lock count to fix ambiguity */
10, /* min fix count to hold ambiguity */
1, /* max iteration to resolve ambiguity */
iono_model, /* ionosphere option (IONOOPT_XXX) */
trop_model, /* troposphere option (TROPOPT_XXX) */
dynamics_model, /* dynamics model (0:none, 1:velocity, 2:accel) */
earth_tide, /* earth tide correction (0:off,1:solid,2:solid+otl+pole) */
number_filter_iter, /* number of filter iteration */
0, /* code smoothing window size (0:none) */
0, /* interpolate reference obs (for post mission) */
0, /* sbssat_t sbssat SBAS correction options */
0, /* sbsion_t sbsion[MAXBAND+1] SBAS satellite selection (0:all) */
0, /* rover position for fixed mode */
0, /* base position for relative mode */
/* 0:pos in prcopt, 1:average of single pos, */
/* 2:read from file, 3:rinex header, 4:rtcm pos */
{code_phase_error_ratio_l1, code_phase_error_ratio_l2, code_phase_error_ratio_l5}, /* eratio[NFREQ] code/phase error ratio */
{100.0, carrier_phase_error_factor_a, carrier_phase_error_factor_b, 0.0, 1.0}, /* err[5]: measurement error factor [0]:reserved, [1-3]:error factor a/b/c of phase (m) , [4]:doppler frequency (hz) */
{bias_0, iono_0, trop_0}, /* std[3]: initial-state std [0]bias,[1]iono [2]trop*/
{sigma_bias, sigma_iono, sigma_trop, sigma_acch, sigma_accv, sigma_pos}, /* prn[6] process-noise std */
5e-12, /* sclkstab: satellite clock stability (sec/sec) */
{min_ratio_to_fix_ambiguity, 0.9999, 0.25, 0.1, 0.05, 0.0, 0.0, 0.0}, /* thresar[8]: AR validation threshold */
min_elevation_to_fix_ambiguity, /* elevation mask of AR for rising satellite (deg) */
0.0, /* elevation mask to hold ambiguity (deg) */
slip_threshold, /* slip threshold of geometry-free phase (m) */
30.0, /* max difference of time (sec) */
threshold_reject_innovation, /* reject threshold of innovation (m) */
threshold_reject_gdop, /* reject threshold of gdop */
{}, /* double baseline[2] baseline length constraint {const,sigma} (m) */
{}, /* double ru[3] rover position for fixed mode {x,y,z} (ecef) (m) */
{}, /* double rb[3] base position for relative mode {x,y,z} (ecef) (m) */
{"", ""}, /* char anttype[2][MAXANT] antenna types {rover,base} */
{{}, {}}, /* double antdel[2][3] antenna delta {{rov_e,rov_n,rov_u},{ref_e,ref_n,ref_u}} */
{}, /* pcv_t pcvr[2] receiver antenna parameters {rov,base} */
{}, /* unsigned char exsats[MAXSAT] excluded satellites (1:excluded, 2:included) */
0, /* max averaging epoches */
0, /* initialize by restart */
1, /* output single by dgps/float/fix/ppp outage */
{"", ""}, /* char rnxopt[2][256] rinex options {rover,base} */
{sat_PCV, rec_PCV, phwindup, reject_GPS_IIA, raim_fde}, /* posopt[6] positioning options [0]: satellite and receiver antenna PCV model; [1]: interpolate antenna parameters; [2]: apply phase wind-up correction for PPP modes; [3]: exclude measurements of GPS Block IIA satellites satellite [4]: RAIM FDE (fault detection and exclusion) [5]: handle day-boundary clock jump */
0, /* solution sync mode (0:off,1:on) */
{{}, {}}, /* odisp[2][6*11] ocean tide loading parameters {rov,base} */
{{}, {{}, {}}, {{}, {}}, {}, {}}, /* exterr_t exterr extended receiver error model */
0, /* disable L2-AR */
{} /* char pppopt[256] ppp option "-GAP_RESION=" default gap to reset iono parameters (ep) */
};
rtkinit(&rtk, &rtklib_configuration_options);
}
TEST_F(NmeaPrinterTest, PrintLine)
{
std::string filename("nmea_test.nmea");
rtk_t rtk;
prcopt_t rtklib_configuration_options;
rtkinit(&rtk, &rtklib_configuration_options);
std::shared_ptr<rtklib_solver> pvt_solution = std::make_shared<rtklib_solver>(12, "filename", false, rtk);
boost::posix_time::ptime pt(boost::gregorian::date(1994, boost::date_time::Nov, 19),
@ -76,12 +192,9 @@ TEST(NmeaPrinterTest, PrintLine)
}
TEST(NmeaPrinterTest, PrintLineLessthan10min)
TEST_F(NmeaPrinterTest, PrintLineLessthan10min)
{
std::string filename("nmea_test.nmea");
rtk_t rtk;
prcopt_t rtklib_configuration_options;
rtkinit(&rtk, &rtklib_configuration_options);
std::shared_ptr<rtklib_solver> pvt_solution = std::make_shared<rtklib_solver>(12, "filename", false, rtk);
boost::posix_time::ptime pt(boost::gregorian::date(1994, boost::date_time::Nov, 19),