1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-06-06 08:34:10 +00:00

Add sysV queue to the GPS PVT block

This commit is contained in:
Carles Fernandez 2016-10-01 11:03:40 +02:00
parent 56be4616bf
commit a2eaab884e
3 changed files with 70 additions and 25 deletions

View File

@ -179,6 +179,21 @@ std::map<int,Gps_Ephemeris> gps_l1_ca_pvt_cc::get_GPS_L1_ephemeris_map()
return d_ls_pvt->gps_ephemeris_map;
}
bool gps_l1_ca_pvt_cc::send_sys_v_ttff_msg(ttff_msgbuf ttff)
{
/* Fill Sys V message structures */
int msgsend_size;
ttff_msgbuf msg;
msg.ttff = ttff.ttff;
msgsend_size = sizeof(msg.ttff);
msg.mtype = 1; /* default message ID */
/* SEND SOLUTION OVER A MESSAGE QUEUE */
/* non-blocking Sys V message send */
msgsnd(sysv_msqid, &msg, msgsend_size, IPC_NOWAIT);
return true;
}
gps_l1_ca_pvt_cc::gps_l1_ca_pvt_cc(unsigned int nchannels,
bool dump, std::string dump_filename,
int averaging_depth,
@ -284,6 +299,16 @@ gps_l1_ca_pvt_cc::gps_l1_ca_pvt_cc(unsigned int nchannels,
}
}
}
// Create Sys V message queue
first_fix = true;
sysv_msg_key = 1101;
int msgflg = IPC_CREAT | 0666;
if ((sysv_msqid = msgget(sysv_msg_key, msgflg )) == -1)
{
std::cout << "GNSS-SDR can not create message queues!" << std::endl;
throw new std::exception();
}
}
@ -349,6 +374,14 @@ int gps_l1_ca_pvt_cc::general_work (int noutput_items __attribute__((unused)), g
pvt_result = d_ls_pvt->get_PVT(gnss_pseudoranges_map, d_rx_time, d_flag_averaging);
if (pvt_result == true)
{
if( first_fix == true)
{
ttff_msgbuf ttff;
ttff.mtype = 1;
ttff.ttff = d_sample_counter;
send_sys_v_ttff_msg(ttff);
first_fix = false;
}
d_kml_printer->print_position(d_ls_pvt, d_flag_averaging);
d_geojson_printer->print_position(d_ls_pvt, d_flag_averaging);
d_nmea_printer->Print_Nmea_Line(d_ls_pvt, d_flag_averaging);

View File

@ -32,6 +32,9 @@
#include <fstream>
#include <string>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <gnuradio/block.h>
#include "nmea_printer.h"
#include "kml_printer.h"
@ -137,6 +140,15 @@ private:
std::map<int,Gnss_Synchro> gnss_pseudoranges_map;
bool first_fix;
key_t sysv_msg_key;
int sysv_msqid;
typedef struct {
long mtype;//required by sys v message
double ttff;
} ttff_msgbuf;
bool send_sys_v_ttff_msg(ttff_msgbuf ttff);
public:
/*!

View File

@ -161,13 +161,13 @@ TEST(TTFF_GPS_L1_CA_Test, ColdStart)
config->set_property("InputFilter.band2_error", std::to_string(1.0));
config->set_property("InputFilter.filter_type", "bandpass");
config->set_property("InputFilter.grid_density", std::to_string(16));
config->set_property("InputFilter.sampling_frequency", std::to_string(4000000));
config->set_property("InputFilter.sampling_frequency", std::to_string(FLAGS_fs_in));
config->set_property("InputFilter.IF", std::to_string(0));
config->set_property("Resampler.implementation", "Pass_Through");
config->set_property("Resampler.dump", "false");
config->set_property("Resampler.item_type", "gr_complex");
config->set_property("Resampler.sample_freq_in", std::to_string(4000000));
config->set_property("Resampler.sample_freq_out", std::to_string(4000000));
config->set_property("Resampler.sample_freq_in", std::to_string(FLAGS_fs_in));
config->set_property("Resampler.sample_freq_out", std::to_string(FLAGS_fs_in));
// Set the number of Channels
config->set_property("Channels_1C.count", std::to_string(8));