mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-18 21:23:02 +00:00
Clean flowgraph
This commit is contained in:
parent
3a37345d4c
commit
cfc0a4a498
@ -30,7 +30,6 @@
|
||||
*/
|
||||
|
||||
#include "channel_fsm.h"
|
||||
#include <memory>
|
||||
#include <glog/logging.h>
|
||||
#include "control_message_factory.h"
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
#define GNSS_SDR_CHANNEL_FSM_H
|
||||
|
||||
#include <mutex>
|
||||
#include <memory>
|
||||
#include <gnuradio/msg_queue.h>
|
||||
#include "acquisition_interface.h"
|
||||
#include "tracking_interface.h"
|
||||
|
@ -33,7 +33,6 @@
|
||||
*/
|
||||
|
||||
#include "gnss_flowgraph.h"
|
||||
#include <memory>
|
||||
#include <algorithm>
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
@ -284,12 +283,7 @@ void GNSSFlowgraph::connect()
|
||||
}
|
||||
|
||||
std::string gnss_signal = channels_.at(i)->get_signal().get_signal_str(); // use channel's implicit signal!
|
||||
while (gnss_signal.compare(available_GNSS_signals_.front().get_signal_str()) != 0 )
|
||||
{
|
||||
available_GNSS_signals_.push_back(available_GNSS_signals_.front());
|
||||
available_GNSS_signals_.pop_front();
|
||||
}
|
||||
channels_.at(i)->set_signal(available_GNSS_signals_.front());
|
||||
channels_.at(i)->set_signal(search_next_signal(gnss_signal, false));
|
||||
|
||||
if (channels_state_[i] == 1)
|
||||
{
|
||||
@ -370,17 +364,10 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
|
||||
switch (what)
|
||||
{
|
||||
case 0:
|
||||
LOG(INFO) << "Channel " << who << " ACQ FAILED satellite " << channels_.at(who)->get_signal().get_satellite() << ", Signal " << channels_.at(who)->get_signal().get_signal_str();
|
||||
DLOG(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 )
|
||||
{
|
||||
available_GNSS_signals_.push_back(available_GNSS_signals_.front());
|
||||
available_GNSS_signals_.pop_front();
|
||||
}
|
||||
channels_.at(who)->set_signal(available_GNSS_signals_.front());
|
||||
available_GNSS_signals_.pop_front();
|
||||
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)->set_signal(search_next_signal(channels_.at(who)->get_signal().get_signal_str(), true));
|
||||
DLOG(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;
|
||||
|
||||
@ -393,13 +380,7 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
|
||||
if(!available_GNSS_signals_.empty() && (acq_channels_count_ < max_acq_channels_) && (channels_state_[i] == 0))
|
||||
{
|
||||
channels_state_[i] = 1;
|
||||
while (channels_.at(i)->get_signal().get_signal_str().compare(available_GNSS_signals_.front().get_signal_str()) != 0)
|
||||
{
|
||||
available_GNSS_signals_.push_back(available_GNSS_signals_.front());
|
||||
available_GNSS_signals_.pop_front();
|
||||
}
|
||||
channels_.at(i)->set_signal(available_GNSS_signals_.front());
|
||||
available_GNSS_signals_.pop_front();
|
||||
channels_.at(i)->set_signal(search_next_signal(channels_.at(i)->get_signal().get_signal_str(), true));
|
||||
acq_channels_count_++;
|
||||
channels_.at(i)->start_acquisition();
|
||||
}
|
||||
@ -761,3 +742,15 @@ void GNSSFlowgraph::set_channels_state()
|
||||
acq_channels_count_ = max_acq_channels_;
|
||||
DLOG(INFO) << acq_channels_count_ << " channels in acquisition state";
|
||||
}
|
||||
|
||||
Gnss_Signal GNSSFlowgraph::search_next_signal(std::string searched_signal, bool pop)
|
||||
{
|
||||
while(searched_signal.compare(available_GNSS_signals_.front().get_signal_str()) != 0)
|
||||
{
|
||||
available_GNSS_signals_.push_back(available_GNSS_signals_.front());
|
||||
available_GNSS_signals_.pop_front();
|
||||
}
|
||||
Gnss_Signal result = available_GNSS_signals_.front();
|
||||
if(pop){available_GNSS_signals_.pop_front();}
|
||||
return result;
|
||||
}
|
||||
|
@ -63,8 +63,7 @@ public:
|
||||
/*!
|
||||
* \brief Constructor that initializes the receiver flowgraph
|
||||
*/
|
||||
GNSSFlowgraph(std::shared_ptr<ConfigurationInterface> configuration,
|
||||
boost::shared_ptr<gr::msg_queue> queue);
|
||||
GNSSFlowgraph(std::shared_ptr<ConfigurationInterface> configuration, gr::msg_queue::sptr queue);
|
||||
|
||||
/*!
|
||||
* \brief Virtual destructor
|
||||
@ -119,6 +118,7 @@ private:
|
||||
void set_signals_list();
|
||||
void set_channels_state(); // Initializes the channels state (start acquisition or keep standby)
|
||||
// using the configuration parameters (number of channels and max channels in acquisition)
|
||||
Gnss_Signal search_next_signal(std::string searched_signal, bool pop);
|
||||
bool connected_;
|
||||
bool running_;
|
||||
int sources_count_;
|
||||
|
Loading…
Reference in New Issue
Block a user