1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-28 09:54:51 +00:00

Fix deadlock flowgraph

This commit is contained in:
Antonio Ramos 2018-01-02 12:29:15 +01:00
parent 8932e9a51b
commit 3eafe2047a
3 changed files with 13 additions and 26 deletions
src
algorithms
channel/libs
telemetry_decoder/gnuradio_blocks
core/receiver

View File

@ -62,10 +62,8 @@ struct channel_idle_fsm_S0: public sc::state<channel_idle_fsm_S0, ChannelFsm>
public: public:
// sc::transition(event, next state) // sc::transition(event, next state)
typedef sc::transition<Ev_channel_start_acquisition, channel_acquiring_fsm_S1> reactions; typedef sc::transition<Ev_channel_start_acquisition, channel_acquiring_fsm_S1> reactions;
channel_idle_fsm_S0(my_context ctx) : my_base(ctx) channel_idle_fsm_S0(my_context ctx) : my_base(ctx){}
{
//std::cout << "Enter Channel_Idle_S0 " << std::endl;
}
}; };
@ -78,13 +76,10 @@ public:
channel_acquiring_fsm_S1(my_context ctx) : my_base(ctx) channel_acquiring_fsm_S1(my_context ctx) : my_base(ctx)
{ {
//std::cout << "Enter Channel_Acq_S1 " << std::endl;
context<ChannelFsm> ().start_acquisition(); context<ChannelFsm> ().start_acquisition();
} }
~channel_acquiring_fsm_S1() ~channel_acquiring_fsm_S1(){}
{
//std::cout << "Exit Channel_Acq_S1 " << std::endl;
}
}; };
@ -96,13 +91,11 @@ public:
channel_tracking_fsm_S2(my_context ctx) : my_base(ctx) channel_tracking_fsm_S2(my_context ctx) : my_base(ctx)
{ {
//std::cout << "Enter Channel_tracking_S2 " << std::endl;
context<ChannelFsm> ().start_tracking(); context<ChannelFsm> ().start_tracking();
} }
~channel_tracking_fsm_S2() ~channel_tracking_fsm_S2()
{ {
//std::cout << "Exit Channel_tracking_S2 " << std::endl;
context<ChannelFsm> ().notify_stop_tracking(); context<ChannelFsm> ().notify_stop_tracking();
} }
@ -117,10 +110,9 @@ public:
channel_waiting_fsm_S3(my_context ctx) : my_base(ctx) channel_waiting_fsm_S3(my_context ctx) : my_base(ctx)
{ {
//std::cout << "Enter Channel_waiting_S3 " << std::endl;
context<ChannelFsm> ().request_satellite(); context<ChannelFsm> ().request_satellite();
} }
// ~channel_waiting_fsm_S3(){} ~channel_waiting_fsm_S3(){}
}; };
@ -148,7 +140,6 @@ ChannelFsm::ChannelFsm(std::shared_ptr<AcquisitionInterface> acquisition) :
void ChannelFsm::Event_start_acquisition() void ChannelFsm::Event_start_acquisition()
{ {
this->process_event(Ev_channel_start_acquisition()); this->process_event(Ev_channel_start_acquisition());
//std::cout<<"Ev_channel_start_acquisition launched"<<std::endl;
DLOG(INFO) << "CH = " << channel_ << ". Ev start acquisition"; DLOG(INFO) << "CH = " << channel_ << ". Ev start acquisition";
} }

View File

@ -404,7 +404,7 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attribute_
void gps_l1_ca_telemetry_decoder_cc::set_satellite(const Gnss_Satellite & satellite) void gps_l1_ca_telemetry_decoder_cc::set_satellite(const Gnss_Satellite & satellite)
{ {
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
LOG(INFO) << "Setting decoder Finite State Machine to satellite " << d_satellite; DLOG(INFO) << "Setting decoder Finite State Machine to satellite " << d_satellite;
d_GPS_FSM.i_satellite_PRN = d_satellite.get_PRN(); d_GPS_FSM.i_satellite_PRN = d_satellite.get_PRN();
DLOG(INFO) << "Navigation Satellite set to " << d_satellite; DLOG(INFO) << "Navigation Satellite set to " << d_satellite;
} }

View File

@ -295,7 +295,7 @@ void GNSSFlowgraph::connect()
{ {
channels_.at(i)->start_acquisition(); channels_.at(i)->start_acquisition();
available_GNSS_signals_.pop_front(); available_GNSS_signals_.pop_front();
LOG(INFO) << "Channel " << i << " assigned to " << available_GNSS_signals_.front(); LOG(INFO) << "Channel " << i << " assigned to " << channels_.at(i)->get_signal();
LOG(INFO) << "Channel " << i << " connected to observables and ready for acquisition"; LOG(INFO) << "Channel " << i << " connected to observables and ready for acquisition";
} }
else else
@ -367,12 +367,10 @@ bool GNSSFlowgraph::send_telemetry_msg(pmt::pmt_t msg)
void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what) void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
{ {
DLOG(INFO) << "Received " << what << " from " << who << ". Number of applied actions = " << applied_actions_; DLOG(INFO) << "Received " << what << " from " << who << ". Number of applied actions = " << applied_actions_;
VLOG(-100) << "Received " << what << " from " << who << ". Number of applied actions = " << applied_actions_;
switch (what) switch (what)
{ {
case 0: case 0:
DLOG(INFO) << "Channel " << who << " ACQ FAILED satellite " << channels_.at(who)->get_signal().get_satellite() << ", Signal " << channels_.at(who)->get_signal().get_signal_str(); LOG(INFO) << "Channel " << who << " ACQ FAILED satellite " << channels_.at(who)->get_signal().get_satellite() << ", Signal " << channels_.at(who)->get_signal().get_signal_str();
VLOG(-100) << "Channel " << who << " ACQ FAILED satellite " << channels_.at(who)->get_signal().get_satellite() << ", Signal " << channels_.at(who)->get_signal().get_signal_str();
available_GNSS_signals_.push_back(channels_.at(who)->get_signal()); available_GNSS_signals_.push_back(channels_.at(who)->get_signal());
//TODO: Optimize the channel and signal matching! //TODO: Optimize the channel and signal matching!
while ( channels_.at(who)->get_signal().get_signal_str().compare(available_GNSS_signals_.front().get_signal_str()) != 0 ) while ( channels_.at(who)->get_signal().get_signal_str().compare(available_GNSS_signals_.front().get_signal_str()) != 0 )
@ -382,14 +380,12 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
} }
channels_.at(who)->set_signal(available_GNSS_signals_.front()); channels_.at(who)->set_signal(available_GNSS_signals_.front());
available_GNSS_signals_.pop_front(); available_GNSS_signals_.pop_front();
DLOG(INFO) << "Channel "<< who << " Starting acquisition " << channels_.at(who)->get_signal().get_satellite() << ", Signal " << channels_.at(who)->get_signal().get_signal_str(); LOG(INFO) << "Channel "<< who << " Starting acquisition " << channels_.at(who)->get_signal().get_satellite() << ", Signal " << channels_.at(who)->get_signal().get_signal_str();
VLOG(-100) << "Channel "<< who << " Starting acquisition " << channels_.at(who)->get_signal().get_satellite() << ", Signal " << channels_.at(who)->get_signal().get_signal_str();
channels_.at(who)->start_acquisition(); channels_.at(who)->start_acquisition();
break; break;
case 1: case 1:
DLOG(INFO) << "Channel " << who << " ACQ SUCCESS satellite " << channels_.at(who)->get_signal().get_satellite(); LOG(INFO) << "Channel " << who << " ACQ SUCCESS satellite " << channels_.at(who)->get_signal().get_satellite();
VLOG(-100) << "Channel " << who << " ACQ SUCCESS satellite " << channels_.at(who)->get_signal().get_satellite();
channels_state_[who] = 2; channels_state_[who] = 2;
acq_channels_count_--; acq_channels_count_--;
for (unsigned int i = 0; i < channels_count_; i++) for (unsigned int i = 0; i < channels_count_; i++)
@ -435,20 +431,20 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
break; break;
case 2: case 2:
DLOG(INFO) << "Channel " << who << " TRK FAILED satellite " << channels_.at(who)->get_signal().get_satellite(); LOG(INFO) << "Channel " << who << " TRK FAILED satellite " << channels_.at(who)->get_signal().get_satellite();
DLOG(INFO) << "Number of channels in acquisition = " << acq_channels_count_; DLOG(INFO) << "Number of channels in acquisition = " << acq_channels_count_;
VLOG(-100) << "Channel " << who << " TRK FAILED satellite " << channels_.at(who)->get_signal().get_satellite();
VLOG(-100) << "Number of channels in acquisition = " << acq_channels_count_;
if (acq_channels_count_ < max_acq_channels_) if (acq_channels_count_ < max_acq_channels_)
{ {
channels_state_[who] = 1; channels_state_[who] = 1;
acq_channels_count_++; acq_channels_count_++;
LOG(INFO) << "Channel "<< who << " Starting acquisition " << channels_.at(who)->get_signal().get_satellite() << ", Signal " << channels_.at(who)->get_signal().get_signal_str();
channels_.at(who)->start_acquisition(); channels_.at(who)->start_acquisition();
} }
else else
{ {
channels_state_[who] = 0; channels_state_[who] = 0;
LOG(INFO) << "Channel "<< who << " Idle state";
available_GNSS_signals_.push_back( channels_.at(who)->get_signal() ); available_GNSS_signals_.push_back( channels_.at(who)->get_signal() );
} }
break; break;