1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-16 04:05:46 +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

View File

@ -62,10 +62,8 @@ struct channel_idle_fsm_S0: public sc::state<channel_idle_fsm_S0, ChannelFsm>
public:
// sc::transition(event, next state)
typedef sc::transition<Ev_channel_start_acquisition, channel_acquiring_fsm_S1> reactions;
channel_idle_fsm_S0(my_context ctx) : my_base(ctx)
{
//std::cout << "Enter Channel_Idle_S0 " << std::endl;
}
channel_idle_fsm_S0(my_context ctx) : my_base(ctx){}
};
@ -78,13 +76,10 @@ public:
channel_acquiring_fsm_S1(my_context ctx) : my_base(ctx)
{
//std::cout << "Enter Channel_Acq_S1 " << std::endl;
context<ChannelFsm> ().start_acquisition();
}
~channel_acquiring_fsm_S1()
{
//std::cout << "Exit Channel_Acq_S1 " << std::endl;
}
~channel_acquiring_fsm_S1(){}
};
@ -96,13 +91,11 @@ public:
channel_tracking_fsm_S2(my_context ctx) : my_base(ctx)
{
//std::cout << "Enter Channel_tracking_S2 " << std::endl;
context<ChannelFsm> ().start_tracking();
}
~channel_tracking_fsm_S2()
{
//std::cout << "Exit Channel_tracking_S2 " << std::endl;
context<ChannelFsm> ().notify_stop_tracking();
}
@ -117,10 +110,9 @@ public:
channel_waiting_fsm_S3(my_context ctx) : my_base(ctx)
{
//std::cout << "Enter Channel_waiting_S3 " << std::endl;
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()
{
this->process_event(Ev_channel_start_acquisition());
//std::cout<<"Ev_channel_start_acquisition launched"<<std::endl;
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)
{
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();
DLOG(INFO) << "Navigation Satellite set to " << d_satellite;
}

View File

@ -295,7 +295,7 @@ void GNSSFlowgraph::connect()
{
channels_.at(i)->start_acquisition();
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";
}
else
@ -367,12 +367,10 @@ bool GNSSFlowgraph::send_telemetry_msg(pmt::pmt_t msg)
void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
{
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)
{
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();
VLOG(-100) << "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();
available_GNSS_signals_.push_back(channels_.at(who)->get_signal());
//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 )
@ -382,14 +380,12 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
}
channels_.at(who)->set_signal(available_GNSS_signals_.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();
VLOG(-100) << "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();
channels_.at(who)->start_acquisition();
break;
case 1:
DLOG(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();
LOG(INFO) << "Channel " << who << " ACQ SUCCESS satellite " << channels_.at(who)->get_signal().get_satellite();
channels_state_[who] = 2;
acq_channels_count_--;
for (unsigned int i = 0; i < channels_count_; i++)
@ -435,20 +431,20 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
break;
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_;
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_)
{
channels_state_[who] = 1;
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();
}
else
{
channels_state_[who] = 0;
LOG(INFO) << "Channel "<< who << " Idle state";
available_GNSS_signals_.push_back( channels_.at(who)->get_signal() );
}
break;