mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-11-07 10:43:58 +00:00
Changes in flowgraph and channel_fsm. Now the number of channels in acquisition mode can be controlled from the config file.
git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@179 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
@@ -200,7 +200,6 @@ void Channel::start()
|
||||
|
||||
void Channel::run()
|
||||
{
|
||||
start_acquisition();
|
||||
while (!stop_)
|
||||
{
|
||||
channel_internal_queue_.wait_and_pop(message_);
|
||||
@@ -208,6 +207,9 @@ void Channel::run()
|
||||
}
|
||||
|
||||
}
|
||||
void Channel::standby(){
|
||||
channel_fsm_.Event_gps_failed_tracking_standby();
|
||||
}
|
||||
|
||||
/*
|
||||
* Set stop_ to true and blocks the calling thread until
|
||||
@@ -215,8 +217,8 @@ void Channel::run()
|
||||
*/
|
||||
void Channel::stop()
|
||||
{
|
||||
stop_ = true;
|
||||
channel_internal_queue_.push(0); //message to stop channel
|
||||
stop_ = true;
|
||||
|
||||
/* When the boost::thread object that represents a thread of execution
|
||||
* is destroyed the thread becomes detached. Once a thread is detached,
|
||||
@@ -262,12 +264,7 @@ void Channel::process_channel_messages()
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
LOG_AT_LEVEL(INFO) << "Channel " << channel_
|
||||
<< " TRACKING FAILED satellite " << gnss_synchro_.System << " "<< gnss_synchro_.PRN
|
||||
<< ", reacquisition.";
|
||||
channel_fsm_.Event_gps_failed_tracking();
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
LOG_AT_LEVEL(WARNING) << "Default case, invalid message.";
|
||||
|
||||
@@ -91,7 +91,7 @@ public:
|
||||
void start_acquisition();
|
||||
void set_signal(Gnss_Signal gnss_signal_);
|
||||
void start();
|
||||
|
||||
void standby();
|
||||
/*!
|
||||
* \brief Set stop_ to true and blocks the calling thread until
|
||||
* the thread of the constructor has completed
|
||||
|
||||
@@ -34,185 +34,164 @@
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
|
||||
struct Ev_gps_channel_start_acquisition: sc::event<Ev_gps_channel_start_acquisition>
|
||||
{};
|
||||
|
||||
struct Ev_gps_channel_valid_acquisition: sc::event<Ev_gps_channel_valid_acquisition>
|
||||
{};
|
||||
|
||||
struct Ev_gps_channel_failed_acquisition_repeat: sc::event<Ev_gps_channel_failed_acquisition_repeat>
|
||||
{};
|
||||
|
||||
struct Ev_gps_channel_failed_acquisition_no_repeat: sc::event<Ev_gps_channel_failed_acquisition_no_repeat>
|
||||
{};
|
||||
|
||||
struct Ev_gps_channel_failed_tracking: sc::event<Ev_gps_channel_failed_tracking>
|
||||
{};
|
||||
|
||||
struct gps_channel_idle_fsm_S0: public sc::state<gps_channel_idle_fsm_S0,GpsL1CaChannelFsm>
|
||||
{
|
||||
public:
|
||||
// sc::transition(event, next state)
|
||||
typedef sc::transition<Ev_gps_channel_start_acquisition, gps_channel_acquiring_fsm_S1> reactions;
|
||||
gps_channel_idle_fsm_S0(my_context ctx) :
|
||||
my_base(ctx)
|
||||
{
|
||||
//std::cout << "Enter Channel_Idle_S0 " << std::endl;
|
||||
}
|
||||
struct Ev_gps_channel_start_acquisition: sc::event<
|
||||
Ev_gps_channel_start_acquisition> {
|
||||
};
|
||||
|
||||
|
||||
struct gps_channel_acquiring_fsm_S1: public sc::state<gps_channel_acquiring_fsm_S1, GpsL1CaChannelFsm>
|
||||
{
|
||||
public:
|
||||
typedef mpl::list<sc::transition<Ev_gps_channel_failed_acquisition_no_repeat, gps_channel_waiting_fsm_S3>,
|
||||
sc::transition<Ev_gps_channel_failed_acquisition_repeat, gps_channel_acquiring_fsm_S1>,
|
||||
sc::transition<Ev_gps_channel_valid_acquisition, gps_channel_tracking_fsm_S2> >reactions;
|
||||
|
||||
gps_channel_acquiring_fsm_S1(my_context ctx) : my_base(ctx)
|
||||
{
|
||||
//std::cout << "Enter Channel_Acq_S1 " << std::endl;
|
||||
context<GpsL1CaChannelFsm> ().start_acquisition();
|
||||
}
|
||||
struct Ev_gps_channel_valid_acquisition: sc::event<
|
||||
Ev_gps_channel_valid_acquisition> {
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct gps_channel_tracking_fsm_S2: public sc::state<gps_channel_tracking_fsm_S2, GpsL1CaChannelFsm>
|
||||
{
|
||||
public:
|
||||
typedef sc::transition<Ev_gps_channel_failed_tracking, gps_channel_acquiring_fsm_S1> reactions;
|
||||
|
||||
gps_channel_tracking_fsm_S2(my_context ctx) : my_base(ctx)
|
||||
{
|
||||
//std::cout << "Enter Channel_tracking_S2 " << std::endl;
|
||||
context<GpsL1CaChannelFsm> ().start_tracking();
|
||||
}
|
||||
struct Ev_gps_channel_failed_acquisition_repeat: sc::event<
|
||||
Ev_gps_channel_failed_acquisition_repeat> {
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct gps_channel_waiting_fsm_S3: public sc::state<gps_channel_waiting_fsm_S3, GpsL1CaChannelFsm>
|
||||
{
|
||||
public:
|
||||
typedef sc::transition<Ev_gps_channel_start_acquisition, gps_channel_acquiring_fsm_S1> reactions;
|
||||
|
||||
gps_channel_waiting_fsm_S3(my_context ctx) : my_base(ctx)
|
||||
{
|
||||
//std::cout << "Enter Channel_waiting_S3 " << std::endl;
|
||||
context<GpsL1CaChannelFsm> ().request_satellite();
|
||||
}
|
||||
struct Ev_gps_channel_failed_acquisition_no_repeat: sc::event<
|
||||
Ev_gps_channel_failed_acquisition_no_repeat> {
|
||||
};
|
||||
|
||||
struct Ev_gps_channel_failed_tracking_standby: sc::event<Ev_gps_channel_failed_tracking_standby> {
|
||||
};
|
||||
|
||||
//struct Ev_gps_channel_failed_tracking_reacq: sc::event<Ev_gps_channel_failed_tracking_reacq> {
|
||||
//};
|
||||
|
||||
GpsL1CaChannelFsm::GpsL1CaChannelFsm()
|
||||
{
|
||||
initiate(); //start the FSM
|
||||
struct gps_channel_idle_fsm_S0: public sc::state<gps_channel_idle_fsm_S0,
|
||||
GpsL1CaChannelFsm> {
|
||||
public:
|
||||
// sc::transition(event, next state)
|
||||
typedef sc::transition<Ev_gps_channel_start_acquisition,
|
||||
gps_channel_acquiring_fsm_S1> reactions;
|
||||
gps_channel_idle_fsm_S0(my_context ctx) :
|
||||
my_base(ctx) {
|
||||
//std::cout << "Enter Channel_Idle_S0 " << std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
struct gps_channel_acquiring_fsm_S1: public sc::state<
|
||||
gps_channel_acquiring_fsm_S1, GpsL1CaChannelFsm> {
|
||||
public:
|
||||
typedef mpl::list<sc::transition<
|
||||
Ev_gps_channel_failed_acquisition_no_repeat,
|
||||
gps_channel_waiting_fsm_S3>, sc::transition<
|
||||
Ev_gps_channel_failed_acquisition_repeat,
|
||||
gps_channel_acquiring_fsm_S1>, sc::transition<
|
||||
Ev_gps_channel_valid_acquisition, gps_channel_tracking_fsm_S2> >
|
||||
reactions;
|
||||
|
||||
gps_channel_acquiring_fsm_S1(my_context ctx) :
|
||||
my_base(ctx) {
|
||||
//std::cout << "Enter Channel_Acq_S1 " << std::endl;
|
||||
context<GpsL1CaChannelFsm> ().start_acquisition();
|
||||
}
|
||||
};
|
||||
|
||||
struct gps_channel_tracking_fsm_S2: public sc::state<
|
||||
gps_channel_tracking_fsm_S2, GpsL1CaChannelFsm> {
|
||||
public:
|
||||
typedef mpl::list<sc::transition<Ev_gps_channel_failed_tracking_standby,
|
||||
gps_channel_idle_fsm_S0>, sc::transition<Ev_gps_channel_start_acquisition,
|
||||
gps_channel_acquiring_fsm_S1>> reactions;
|
||||
|
||||
gps_channel_tracking_fsm_S2(my_context ctx) :
|
||||
my_base(ctx) {
|
||||
//std::cout << "Enter Channel_tracking_S2 " << std::endl;
|
||||
context<GpsL1CaChannelFsm> ().start_tracking();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
struct gps_channel_waiting_fsm_S3: public sc::state<gps_channel_waiting_fsm_S3,
|
||||
GpsL1CaChannelFsm> {
|
||||
public:
|
||||
typedef sc::transition<Ev_gps_channel_start_acquisition,
|
||||
gps_channel_acquiring_fsm_S1> reactions;
|
||||
|
||||
gps_channel_waiting_fsm_S3(my_context ctx) :
|
||||
my_base(ctx) {
|
||||
//std::cout << "Enter Channel_waiting_S3 " << std::endl;
|
||||
context<GpsL1CaChannelFsm> ().request_satellite();
|
||||
}
|
||||
~gps_channel_waiting_fsm_S3(){}
|
||||
};
|
||||
|
||||
GpsL1CaChannelFsm::GpsL1CaChannelFsm() {
|
||||
initiate(); //start the FSM
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
GpsL1CaChannelFsm::GpsL1CaChannelFsm(AcquisitionInterface *acquisition) : acq_(acquisition)
|
||||
{
|
||||
initiate(); //start the FSM
|
||||
GpsL1CaChannelFsm::GpsL1CaChannelFsm(AcquisitionInterface *acquisition) :
|
||||
acq_(acquisition) {
|
||||
initiate(); //start the FSM
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void GpsL1CaChannelFsm::Event_gps_start_acquisition()
|
||||
{
|
||||
this->process_event(Ev_gps_channel_start_acquisition());
|
||||
void GpsL1CaChannelFsm::Event_gps_start_acquisition() {
|
||||
this->process_event(Ev_gps_channel_start_acquisition());
|
||||
}
|
||||
|
||||
|
||||
|
||||
void GpsL1CaChannelFsm::Event_gps_valid_acquisition()
|
||||
{
|
||||
this->process_event(Ev_gps_channel_valid_acquisition());
|
||||
void GpsL1CaChannelFsm::Event_gps_valid_acquisition() {
|
||||
this->process_event(Ev_gps_channel_valid_acquisition());
|
||||
}
|
||||
|
||||
void GpsL1CaChannelFsm::Event_gps_failed_acquisition_repeat()
|
||||
{
|
||||
this->process_event(Ev_gps_channel_failed_acquisition_repeat());
|
||||
void GpsL1CaChannelFsm::Event_gps_failed_acquisition_repeat() {
|
||||
this->process_event(Ev_gps_channel_failed_acquisition_repeat());
|
||||
}
|
||||
|
||||
|
||||
|
||||
void GpsL1CaChannelFsm::Event_gps_failed_acquisition_no_repeat()
|
||||
{
|
||||
this->process_event(Ev_gps_channel_failed_acquisition_no_repeat());
|
||||
void GpsL1CaChannelFsm::Event_gps_failed_acquisition_no_repeat() {
|
||||
this->process_event(Ev_gps_channel_failed_acquisition_no_repeat());
|
||||
}
|
||||
|
||||
|
||||
|
||||
void GpsL1CaChannelFsm::Event_gps_failed_tracking()
|
||||
{
|
||||
this->process_event(Ev_gps_channel_failed_tracking());
|
||||
void GpsL1CaChannelFsm::Event_gps_failed_tracking_standby() {
|
||||
this->process_event(Ev_gps_channel_failed_tracking_standby());
|
||||
}
|
||||
|
||||
//void GpsL1CaChannelFsm::Event_gps_failed_tracking_reacq() {
|
||||
// this->process_event(Ev_gps_channel_failed_tracking_reacq());
|
||||
//}
|
||||
|
||||
void GpsL1CaChannelFsm::set_acquisition(AcquisitionInterface *acquisition)
|
||||
{
|
||||
acq_ = acquisition;
|
||||
void GpsL1CaChannelFsm::set_acquisition(AcquisitionInterface *acquisition) {
|
||||
acq_ = acquisition;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void GpsL1CaChannelFsm::set_tracking(TrackingInterface *tracking)
|
||||
{
|
||||
trk_ = tracking;
|
||||
void GpsL1CaChannelFsm::set_tracking(TrackingInterface *tracking) {
|
||||
trk_ = tracking;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void GpsL1CaChannelFsm::set_queue(gr_msg_queue_sptr queue)
|
||||
{
|
||||
queue_ = queue;
|
||||
void GpsL1CaChannelFsm::set_queue(gr_msg_queue_sptr queue) {
|
||||
queue_ = queue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void GpsL1CaChannelFsm::set_channel(unsigned int channel)
|
||||
{
|
||||
channel_ = channel;
|
||||
void GpsL1CaChannelFsm::set_channel(unsigned int channel) {
|
||||
channel_ = channel;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void GpsL1CaChannelFsm::start_acquisition()
|
||||
{
|
||||
acq_->reset();
|
||||
void GpsL1CaChannelFsm::start_acquisition() {
|
||||
acq_->reset();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void GpsL1CaChannelFsm::start_tracking()
|
||||
{
|
||||
//LOG_AT_LEVEL(INFO) << "Channel " << channel_
|
||||
//<< " passing prn code phase " << acq_->prn_code_phase();
|
||||
//LOG_AT_LEVEL(INFO) << "Channel " << channel_
|
||||
//<< " passing doppler freq shift " << acq_->doppler_freq_shift();
|
||||
//LOG_AT_LEVEL(INFO) << "Channel " << channel_
|
||||
//<< " passing acquisition sample stamp "
|
||||
//<< acq_->get_sample_stamp();
|
||||
//trk_->set_prn_code_phase(acq_->prn_code_phase());
|
||||
//trk_->set_doppler_freq_shift(acq_->doppler_freq_shift());
|
||||
//trk_->set_acq_sample_stamp(acq_->get_sample_stamp());
|
||||
trk_->start_tracking();
|
||||
void GpsL1CaChannelFsm::start_tracking() {
|
||||
//LOG_AT_LEVEL(INFO) << "Channel " << channel_
|
||||
//<< " passing prn code phase " << acq_->prn_code_phase();
|
||||
//LOG_AT_LEVEL(INFO) << "Channel " << channel_
|
||||
//<< " passing doppler freq shift " << acq_->doppler_freq_shift();
|
||||
//LOG_AT_LEVEL(INFO) << "Channel " << channel_
|
||||
//<< " passing acquisition sample stamp "
|
||||
//<< acq_->get_sample_stamp();
|
||||
//trk_->set_prn_code_phase(acq_->prn_code_phase());
|
||||
//trk_->set_doppler_freq_shift(acq_->doppler_freq_shift());
|
||||
//trk_->set_acq_sample_stamp(acq_->get_sample_stamp());
|
||||
trk_->start_tracking();
|
||||
ControlMessageFactory* cmf = new ControlMessageFactory();
|
||||
if (queue_ != gr_msg_queue_sptr()) {
|
||||
queue_->handle(cmf->GetQueueMessage(channel_, 1));
|
||||
}
|
||||
delete cmf;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void GpsL1CaChannelFsm::request_satellite()
|
||||
{
|
||||
ControlMessageFactory* cmf = new ControlMessageFactory();
|
||||
if (queue_ != gr_msg_queue_sptr())
|
||||
{
|
||||
queue_->handle(cmf->GetQueueMessage(channel_, 0));
|
||||
}
|
||||
delete cmf;
|
||||
void GpsL1CaChannelFsm::request_satellite() {
|
||||
ControlMessageFactory* cmf = new ControlMessageFactory();
|
||||
if (queue_ != gr_msg_queue_sptr()) {
|
||||
queue_->handle(cmf->GetQueueMessage(channel_, 0));
|
||||
}
|
||||
delete cmf;
|
||||
}
|
||||
|
||||
|
||||
@@ -80,7 +80,8 @@ public:
|
||||
void Event_gps_valid_acquisition();
|
||||
void Event_gps_failed_acquisition_repeat();
|
||||
void Event_gps_failed_acquisition_no_repeat();
|
||||
void Event_gps_failed_tracking();
|
||||
//void Event_gps_failed_tracking_reacq();
|
||||
void Event_gps_failed_tracking_standby();
|
||||
|
||||
private:
|
||||
AcquisitionInterface *acq_;
|
||||
|
||||
@@ -463,7 +463,7 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto
|
||||
d_CN0_SNV_dB_Hz = gps_l1_ca_CN0_SNV(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES, d_fs_in);
|
||||
d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES);
|
||||
// ###### TRACKING UNLOCK NOTIFICATION #####
|
||||
int tracking_message;
|
||||
//int tracking_message;
|
||||
if (d_carrier_lock_test < d_carrier_lock_threshold or d_carrier_lock_test > MINIMUM_VALID_CN0)
|
||||
{
|
||||
d_carrier_lock_fail_counter++;
|
||||
@@ -475,8 +475,13 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto
|
||||
if (d_carrier_lock_fail_counter > MAXIMUM_LOCK_FAIL_COUNTER)
|
||||
{
|
||||
std::cout << "Channel " << d_channel << " loss of lock!" << std::endl;
|
||||
tracking_message = 3; //loss of lock
|
||||
d_channel_internal_queue->push(tracking_message);
|
||||
// tracking_message = 3; //loss of lock
|
||||
// d_channel_internal_queue->push(tracking_message);
|
||||
ControlMessageFactory* cmf = new ControlMessageFactory();
|
||||
if (d_queue != gr_msg_queue_sptr()) {
|
||||
d_queue->handle(cmf->GetQueueMessage(d_channel, 2));
|
||||
}
|
||||
delete cmf;
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
d_enable_tracking = false; // TODO: check if disabling tracking is consistent with the channel state machine
|
||||
}
|
||||
|
||||
@@ -471,7 +471,7 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_in
|
||||
d_CN0_SNV_dB_Hz = gps_l1_ca_CN0_SNV(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES, d_fs_in);
|
||||
d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES);
|
||||
// ###### TRACKING UNLOCK NOTIFICATION #####
|
||||
int tracking_message;
|
||||
//int tracking_message;
|
||||
if (d_carrier_lock_test < d_carrier_lock_threshold or d_carrier_lock_test > MINIMUM_VALID_CN0)
|
||||
{
|
||||
d_carrier_lock_fail_counter++;
|
||||
@@ -483,8 +483,13 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_in
|
||||
if (d_carrier_lock_fail_counter > MAXIMUM_LOCK_FAIL_COUNTER)
|
||||
{
|
||||
std::cout << "Channel " << d_channel << " loss of lock!" << std::endl ;
|
||||
tracking_message = 3; //loss of lock
|
||||
d_channel_internal_queue->push(tracking_message);
|
||||
//tracking_message = 3; //loss of lock
|
||||
//d_channel_internal_queue->push(tracking_message);
|
||||
ControlMessageFactory* cmf = new ControlMessageFactory();
|
||||
if (d_queue != gr_msg_queue_sptr()) {
|
||||
d_queue->handle(cmf->GetQueueMessage(d_channel, 2));
|
||||
}
|
||||
delete cmf;
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
d_enable_tracking = false; // TODO: check if disabling tracking is consistent with the channel state machine
|
||||
|
||||
|
||||
Reference in New Issue
Block a user