Fix deadlock flowgraph

This commit is contained in:
Antonio Ramos
2018-01-02 16:56:18 +01:00
parent 8932e9a51b
commit 3eafe2047a
3 changed files with 13 additions and 26 deletions
+7 -11
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;