Skip to content

Commit

Permalink
Merge branch 'next' of git+ssh://github.com/gnss-sdr/gnss-sdr into next
Browse files Browse the repository at this point in the history
  • Loading branch information
carlesfernandez committed Apr 26, 2016
2 parents 5492c6a + ec4dd37 commit 59e2e61
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 25 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ $ sudo apt-get install build-essential cmake git libboost-dev libboost-date-time
libarmadillo-dev libgflags-dev libgoogle-glog-dev libgnutls-openssl-dev libgtest-dev
~~~~~~

Alternatively, and starting from Ubuntu 16.04 LTS, you can install all required dependencies by adding the line
Alternatively, and starting from Ubuntu 16.04 LTS, you can install all the required dependencies by adding the line

~~~~~~
deb-src http://us.archive.ubuntu.com/ubuntu/ xenial universe
~~~~~~

at your ```/etc/apt/sources.list``` file and doing:
to your ```/etc/apt/sources.list``` file and doing:

~~~~~~
$ sudo apt-get update
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ pcps_acquisition_cc_sptr pcps_make_acquisition_cc(
bool dump,
std::string dump_filename)
{

return pcps_acquisition_cc_sptr(
new pcps_acquisition_cc(sampled_ms, max_dwells, doppler_max, freq, fs_in, samples_per_ms,
samples_per_code, bit_transition_flag, use_CFAR_algorithm_flag, dump, dump_filename));
samples_per_code, bit_transition_flag, use_CFAR_algorithm_flag, dump, dump_filename));
}


pcps_acquisition_cc::pcps_acquisition_cc(
unsigned int sampled_ms, unsigned int max_dwells,
unsigned int doppler_max, long freq, long fs_in,
Expand All @@ -70,7 +70,6 @@ pcps_acquisition_cc::pcps_acquisition_cc(
gr::io_signature::make(1, 1, sizeof(gr_complex) * sampled_ms * samples_per_ms * ( bit_transition_flag ? 2 : 1 )),
gr::io_signature::make(0, 0, sizeof(gr_complex) * sampled_ms * samples_per_ms * ( bit_transition_flag ? 2 : 1 )) )
{

this->message_port_register_out(pmt::mp("events"));

d_sample_counter = 0; // SAMPLE COUNTER
Expand Down
12 changes: 6 additions & 6 deletions src/algorithms/channel/adapters/channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@
* -------------------------------------------------------------------------
*/
#include "channel.h"
#include <memory>
//#include <memory>
#include <boost/lexical_cast.hpp>
#include <glog/logging.h>
#include "channel_interface.h"
#include "acquisition_interface.h"
#include "tracking_interface.h"
#include "telemetry_decoder_interface.h"
//#include "channel_interface.h"
//#include "acquisition_interface.h"
//#include "tracking_interface.h"
//#include "telemetry_decoder_interface.h"
#include "configuration_interface.h"
#include "channel_msg_receiver_cc.h"
//#include "channel_msg_receiver_cc.h"

using google::LogMessage;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,13 @@ concurrent_queue<int> channel_internal_queue;
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
class GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx;


typedef boost::shared_ptr<GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx> GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_sptr;


GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_sptr GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make();


class GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx : public gr::block
{
private:
Expand All @@ -75,31 +78,35 @@ class GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx : public gr::block

};


GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_sptr GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make()
{
return GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_sptr(new GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx());
}


void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx::msg_handler_events(pmt::pmt_t msg)
{
try {
long int message=pmt::to_long(msg);
rx_message=message;
channel_internal_queue.push(rx_message);
}catch(boost::bad_any_cast& e)
try
{
long int message = pmt::to_long(msg);
rx_message = message;
channel_internal_queue.push(rx_message);
}
catch(boost::bad_any_cast& e)
{
LOG(WARNING) << "msg_handler_telemetry Bad any cast!\n";
rx_message = 0;
}
}


GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx::GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx() :
gr::block("GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
{

this->message_port_register_in(pmt::mp("events"));
this->set_msg_handler(pmt::mp("events"), boost::bind(&GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx::msg_handler_events, this, _1));
rx_message=0;
rx_message = 0;
}

GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx::~GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx()
Expand All @@ -122,8 +129,7 @@ class GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test: public ::testing::Test
}

~GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test()
{
}
{}

void init();
void config_1();
Expand Down Expand Up @@ -183,6 +189,7 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::init()
Pfa_a = 0;
}


void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::config_1()
{
gnss_synchro.Channel_ID = 0;
Expand Down Expand Up @@ -254,6 +261,7 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::config_1()
config->set_property("Acquisition.dump", "false");
}


void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::config_2()
{
gnss_synchro.Channel_ID = 0;
Expand Down Expand Up @@ -343,12 +351,14 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::config_2()
config->set_property("Acquisition.dump", "false");
}


void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::start_queue()
{
stop = false;
ch_thread = boost::thread(&GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::wait_message, this);
}


void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::wait_message()
{
struct timeval tv;
Expand All @@ -373,6 +383,7 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::wait_message()
}
}


void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::process_message()
{
if (message == 1)
Expand Down Expand Up @@ -412,6 +423,7 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::process_message()
}
}


void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::stop_queue()
{
stop = true;
Expand Down Expand Up @@ -446,7 +458,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ConnectAndRun)
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
top_block->connect(source, 0, valve, 0);
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
top_block->msg_connect(acquisition->get_right_block(),pmt::mp("events"), msg_rx,pmt::mp("events"));
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
}) << "Failure connecting the blocks of acquisition test." << std::endl;

EXPECT_NO_THROW( {
Expand All @@ -460,6 +472,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ConnectAndRun)
std::cout << "Processed " << nsamples << " samples in " << (end - begin) << " microseconds" << std::endl;
}


TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
{
config_1();
Expand All @@ -470,7 +483,6 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)

boost::shared_ptr<GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx> msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make();


ASSERT_NO_THROW( {
acquisition->set_channel(1);
}) << "Failure setting channel." << std::endl;
Expand Down Expand Up @@ -504,7 +516,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue));
signal_source->connect(top_block);
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
top_block->msg_connect(acquisition->get_right_block(),pmt::mp("events"), msg_rx,pmt::mp("events"));
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
}) << "Failure connecting the blocks of acquisition test." << std::endl;

// i = 0 --> satellite in acquisition is visible
Expand Down Expand Up @@ -590,7 +602,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProbabi
signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue));
signal_source->connect(top_block);
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
top_block->msg_connect(acquisition->get_right_block(),pmt::mp("events"), msg_rx,pmt::mp("events"));
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
}) << "Failure connecting the blocks of acquisition test." << std::endl;

std::cout << "Probability of false alarm (target) = " << 0.1 << std::endl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
#include "pass_through.h"


concurrent_queue<int> channel_internal_queue;

class GpsL1CaPcpsAcquisitionGSoC2013Test: public ::testing::Test
{
protected:
Expand Down
3 changes: 2 additions & 1 deletion src/tests/test_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ DECLARE_string(log_dir);
#include "gnss_block/fir_filter_test.cc"
#include "gnss_block/gps_l1_ca_pcps_acquisition_test.cc"
#include "gnss_block/gps_l2_m_pcps_acquisition_test.cc"
//#include "gnss_block/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc"
#include "gnss_block/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc"
//#include "gnss_block/gps_l1_ca_pcps_multithread_acquisition_gsoc2013_test.cc"
//#if OPENCL_BLOCKS_TEST
//#include "gnss_block/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc"
Expand Down Expand Up @@ -117,6 +117,7 @@ DECLARE_string(log_dir);
concurrent_queue<Gps_Acq_Assist> global_gps_acq_assist_queue;
concurrent_map<Gps_Acq_Assist> global_gps_acq_assist_map;

concurrent_queue<int> channel_internal_queue;

int main(int argc, char **argv)
{
Expand Down
62 changes: 62 additions & 0 deletions src/utils/front-end-cal/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,63 @@ GpsL1CaPcpsAcquisitionFineDoppler *acquisition;
Gnss_Synchro *gnss_synchro;
std::vector<Gnss_Synchro> gnss_sync_vector;


// ######## GNURADIO BLOCK MESSAGE RECEVER #########
class FrontEndCal_msg_rx;

typedef boost::shared_ptr<FrontEndCal_msg_rx> FrontEndCal_msg_rx_sptr;

FrontEndCal_msg_rx_sptr FrontEndCal_msg_rx_make();


class FrontEndCal_msg_rx : public gr::block
{
private:
friend FrontEndCal_msg_rx_sptr FrontEndCal_msg_rx_make();
void msg_handler_events(pmt::pmt_t msg);
FrontEndCal_msg_rx();

public:
int rx_message;
~FrontEndCal_msg_rx(); //!< Default destructor
};


FrontEndCal_msg_rx_sptr FrontEndCal_msg_rx_make()
{
return FrontEndCal_msg_rx_sptr(new FrontEndCal_msg_rx());
}


void FrontEndCal_msg_rx::msg_handler_events(pmt::pmt_t msg)
{
try
{
long int message = pmt::to_long(msg);
rx_message = message;
channel_internal_queue.push(rx_message);
}
catch(boost::bad_any_cast& e)
{
LOG(WARNING) << "msg_handler_telemetry Bad any cast!\n";
rx_message = 0;
}
}


FrontEndCal_msg_rx::FrontEndCal_msg_rx() :
gr::block("FrontEndCal_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
{
this->message_port_register_in(pmt::mp("events"));
this->set_msg_handler(pmt::mp("events"), boost::bind(&FrontEndCal_msg_rx::msg_handler_events, this, _1));
rx_message = 0;
}

FrontEndCal_msg_rx::~FrontEndCal_msg_rx()
{}

// ###########################################################

void wait_message()
{
while (!stop)
Expand All @@ -125,6 +182,7 @@ void wait_message()
}
}


bool front_end_capture(std::shared_ptr<ConfigurationInterface> configuration)
{
gr::top_block_sptr top_block;
Expand Down Expand Up @@ -320,6 +378,9 @@ int main(int argc, char** argv)
gr::block_sptr source;
source = gr::blocks::file_source::make(sizeof(gr_complex), "tmp_capture.dat");

boost::shared_ptr<FrontEndCal_msg_rx> msg_rx = FrontEndCal_msg_rx_make();


//gr_basic_block_sptr head = gr_make_head(sizeof(gr_complex), nsamples);
//gr_head_sptr head_sptr = boost::dynamic_pointer_cast<gr_head>(head);
//head_sptr->set_length(nsamples);
Expand All @@ -329,6 +390,7 @@ int main(int argc, char** argv)
{
acquisition->connect(top_block);
top_block->connect(source, 0, acquisition->get_left_block(), 0);
top_block->msg_connect(acquisition->get_right_block(),pmt::mp("events"), msg_rx,pmt::mp("events"));
}
catch(const std::exception & e)
{
Expand Down

0 comments on commit 59e2e61

Please sign in to comment.