This commit is contained in:
Álvaro Cebrián Juan 2024-04-22 15:43:00 -03:00 committed by GitHub
commit c5bcca32fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 82 additions and 11 deletions

View File

@ -95,6 +95,8 @@ public:
inline std::shared_ptr<TrackingInterface> tracking() const { return trk_; }
inline std::shared_ptr<TelemetryDecoderInterface> telemetry() const { return nav_; }
inline uint32_t fsm_state() const { return channel_fsm_->state(); }
private:
bool glonass_dll_pll_c_aid_tracking_check() const;
std::shared_ptr<ChannelFsm> channel_fsm_;

View File

@ -61,6 +61,8 @@ public:
virtual bool Event_failed_acquisition_repeat();
virtual bool Event_failed_acquisition_no_repeat();
inline uint32_t state() const { return state_; }
private:
void start_tracking();
void stop_acquisition();

View File

@ -414,6 +414,7 @@ int ControlThread::run()
// start the telecommand listener thread
cmd_interface_.set_pvt(flowgraph_->get_pvt());
cmd_interface_.set_channels(flowgraph_->get_channels());
cmd_interface_thread_ = std::thread(&ControlThread::telecommand_listener, this);
#ifdef ENABLE_FPGA

View File

@ -151,6 +151,14 @@ public:
return std::dynamic_pointer_cast<PvtInterface>(pvt_);
}
/*!
* \brief Returns a smart pointer to the Channels object
*/
std::shared_ptr<std::vector<std::shared_ptr<ChannelInterface>>> get_channels()
{
return std::make_shared<std::vector<std::shared_ptr<ChannelInterface>>>(channels_);
}
/*!
* \brief Priorize visible satellites in the specified vector
*/

View File

@ -16,6 +16,7 @@
*/
#include "tcp_cmd_interface.h"
#include "channel.h"
#include "command_event.h"
#include "pvt_interface.h"
#include <boost/asio.hpp>
@ -31,6 +32,7 @@ using b_io_context = boost::asio::io_context;
using b_io_context = boost::asio::io_service;
#endif
TcpCmdInterface::TcpCmdInterface()
: rx_latitude_(0.0),
rx_longitude_(0.0),
@ -71,6 +73,12 @@ void TcpCmdInterface::set_pvt(std::shared_ptr<PvtInterface> PVT_sptr)
}
void TcpCmdInterface::set_channels(std::shared_ptr<std::vector<std::shared_ptr<ChannelInterface>>> channels_sptr)
{
channels_sptr_ = std::move(channels_sptr);
}
time_t TcpCmdInterface::get_utc_time() const
{
return receiver_utc_time_;
@ -120,18 +128,46 @@ std::string TcpCmdInterface::standby(const std::vector<std::string> &commandLine
std::string TcpCmdInterface::status(const std::vector<std::string> &commandLine __attribute__((unused)))
{
std::stringstream str_stream;
// todo: implement the receiver status report
// str_stream << "-------------------------------------------------------\n";
// str_stream << "ch | sys | sig | mode | Tlm | Eph | Doppler | CN0 |\n";
// str_stream << " | | | | | | [Hz] | [dB - Hz] |\n";
// str_stream << "-------------------------------------------------------\n";
// int n_ch = 10;
// for (int n = 0; n < n_ch; n++)
// {
// str_stream << n << "GPS | L1CA | TRK | YES | YES | 23412.4 | 44.3 |\n";
// }
// str_stream << "--------------------------------------------------------\n";
str_stream << "-------------------------------------------------------------------------\n";
str_stream << "| Ch | System | Signal | PRN | Mode | Tlm | Eph | Doppler | CN0 |\n";
str_stream << "| | | | | | | | [Hz] | [dB-Hz] |\n";
str_stream << "-------------------------------------------------------------------------\n";
int n_ch = static_cast<int>(channels_sptr_->size());
for (int n = 0; n < n_ch; n++)
{
std::shared_ptr<Channel>
ch_sptr = std::dynamic_pointer_cast<Channel>(channels_sptr_->at(n));
std::string system = ch_sptr->get_signal().get_satellite().get_system();
std::string signal = map_signal_pretty_name_.at(ch_sptr->get_signal().get_signal_str());
uint32_t prn = ch_sptr->get_signal().get_satellite().get_PRN();
std::string state = map_state_name_.at(ch_sptr->fsm_state());
str_stream << std::fixed << std::setprecision(1)
<< "| "
<< std::right << std::setw(3) << n
<< " | "
<< std::left << std::setw(7) << system
<< " | "
<< std::left << std::setw(6) << signal
<< " | "
<< std::right << std::setw(3) << prn
<< " | "
<< std::left << std::setw(4) << state
<< " | "
<< std::left << std::setw(3) << "---"
<< " | "
<< std::left << std::setw(3) << "---"
<< " | "
<< std::right << std::setw(9) << 23412.46
<< " | "
<< std::right << std::setw(7) << 44.32
<< " |"
<< "\n";
}
str_stream << "-------------------------------------------------------------------------\n";
double longitude_deg;
double latitude_deg;

View File

@ -25,6 +25,7 @@
#include <cstdint>
#include <ctime>
#include <functional>
#include <map>
#include <memory>
#include <string>
#include <unordered_map>
@ -37,6 +38,7 @@
class PvtInterface;
class ChannelInterface;
class TcpCmdInterface
{
@ -57,6 +59,7 @@ public:
std::array<float, 3> get_LLH() const;
void set_pvt(std::shared_ptr<PvtInterface> PVT_sptr);
void set_channels(std::shared_ptr<std::vector<std::shared_ptr<ChannelInterface>>> channels_sptr);
private:
std::unordered_map<std::string, std::function<std::string(const std::vector<std::string> &)>>
@ -73,6 +76,25 @@ private:
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> control_queue_;
std::shared_ptr<PvtInterface> PVT_sptr_;
std::shared_ptr<std::vector<std::shared_ptr<ChannelInterface>>> channels_sptr_;
const std::map<std::string, std::string> map_signal_pretty_name_{
{"1C", "L1 C/A"},
{"1B", "E1"},
{"1G", "L1 C/A"},
{"2S", "L2C"},
{"2G", "L2 C/A"},
{"5X", "E5a"},
{"7X", "E5b"},
{"L5", "L5"},
{"B1", "B1I"},
{"B3", "B3I"}};
const std::map<uint32_t, std::string> map_state_name_{
{0, "STBY"},
{1, "ACQ"},
{2, "TRK"},
{3, "DROP"}};
float rx_latitude_;
float rx_longitude_;