[hamradio-commits] [gnss-sdr] 53/303: Add sysV queue to the GPS PVT block
Carles Fernandez
carles_fernandez-guest at moszumanska.debian.org
Mon Feb 13 22:35:47 UTC 2017
This is an automated email from the git hooks/post-receive script.
carles_fernandez-guest pushed a commit to branch master
in repository gnss-sdr.
commit a2eaab884e87575cc2aadbc7f6461c54572bc11e
Author: Carles Fernandez <carles.fernandez at gmail.com>
Date: Sat Oct 1 11:03:40 2016 +0200
Add sysV queue to the GPS PVT block
---
.../PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc | 33 ++++++++++++++
.../PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.h | 12 +++++
src/tests/system-tests/ttff_gps_l1.cc | 52 +++++++++++-----------
3 files changed, 71 insertions(+), 26 deletions(-)
diff --git a/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc b/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc
index 3f656e8..038f867 100644
--- a/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc
+++ b/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc
@@ -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);
diff --git a/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.h b/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.h
index fbe2dda..f0b3b02 100644
--- a/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.h
+++ b/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.h
@@ -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:
/*!
diff --git a/src/tests/system-tests/ttff_gps_l1.cc b/src/tests/system-tests/ttff_gps_l1.cc
index eda88be..20d1952 100644
--- a/src/tests/system-tests/ttff_gps_l1.cc
+++ b/src/tests/system-tests/ttff_gps_l1.cc
@@ -63,9 +63,9 @@ concurrent_map<Gps_Acq_Assist> global_gps_acq_assist_map;
double TTFF;
typedef struct {
- long mtype;//required by sys v message
- double ttff;
- } ttff_msgbuf;
+ long mtype;//required by sys v message
+ double ttff;
+} ttff_msgbuf;
@@ -80,20 +80,20 @@ public:
void receive_msg()
{
ttff_msgbuf msg;
- double ttff_msg=0.0;
+ double ttff_msg=0.0;
int msgrcv_size=sizeof(msg.ttff);
int msqid;
key_t key=1101;
while((msqid = msgget(key, 0644)) == -1){}
-// if ((msqid = msgget(key, 0644)) == -1) { /* connect to the queue */
-// perror("TTFF MSG QUEUE NOT AVAILABLE");
-// exit(1);
-// }
+ // if ((msqid = msgget(key, 0644)) == -1) { /* connect to the queue */
+ // perror("TTFF MSG QUEUE NOT AVAILABLE");
+ // exit(1);
+ // }
- // msqid = msgget(key, 0644);
+ // msqid = msgget(key, 0644);
//while (keep_capturing==1) {
- if (msgrcv(msqid, &msg, msgrcv_size, 1, 0) != -1)
+ if (msgrcv(msqid, &msg, msgrcv_size, 1, 0) != -1)
{
//jammer=msg.jammer_msg;
ttff_msg = msg.ttff;
@@ -107,7 +107,7 @@ void receive_msg()
}
//}
-std::cout << "--------RECEIVEr msg thread stops " << std::endl;
+ std::cout << "--------RECEIVEr msg thread stops " << std::endl;
//std::cout<<"RECEIVER MSG THREAD STOP.\n";
return;
}
@@ -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));
@@ -279,7 +279,7 @@ TEST(TTFF_GPS_L1_CA_Test, ColdStart)
}
std::cout << "BYE " << num_measurements << std::endl;
// Compute min, max, mean, stdev,
-//receive_msg_thread.join();
+ //receive_msg_thread.join();
// Print TTFF report
}
@@ -294,17 +294,17 @@ int main(int argc, char **argv)
google::InitGoogleLogging(argv[0]);
//Create Sys V message queue
key_t sysv_msg_key;
- int sysv_msqid;
- //
-
- sysv_msg_key=1101;
-int msgflg = IPC_CREAT | 0666;
-if ((sysv_msqid = msgget(sysv_msg_key, msgflg )) == -1){}
-//{
-// std::cout<<"SDRJD can not create message queues!\n";
-// perror("msgget");
-// throw new std::exception();
-//}
+ int sysv_msqid;
+ //
+
+ sysv_msg_key=1101;
+ int msgflg = IPC_CREAT | 0666;
+ if ((sysv_msqid = msgget(sysv_msg_key, msgflg )) == -1){}
+ //{
+ // std::cout<<"SDRJD can not create message queues!\n";
+ // perror("msgget");
+ // throw new std::exception();
+ //}
std::thread receive_msg_thread(receive_msg);
try
{
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-hamradio/gnss-sdr.git
More information about the pkg-hamradio-commits
mailing list