HLCC Documentation 2.2.0
Loading...
Searching...
No Matches
oldbInterface.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2020-2025 European Southern Observatory (ESO)
2//
3// SPDX-License-Identifier: LGPL-3.0-only
4
13#ifndef HLCC_TRKSIM_OLDBINTERFACE_HPP
14#define HLCC_TRKSIM_OLDBINTERFACE_HPP
15
16#include <string>
17#include <vector>
18#include <memory> // shared_ptr
19#include "Msif.hpp"
20
22#include <boost/asio/thread_pool.hpp>
23#include <taiclock/taiClock.hpp>
24#include <ptk/posastro.hpp>
25#include <rad/oldbInterface.hpp>
26#include <rad/cii/oldbAdapter.hpp>
27#include "Ccsinsif.hpp"
28#include "Ccsinsdetif.hpp"
30
31#include "trksim/monitoring.hpp"
32
33
34namespace hlcc::trksim {
35
36/*
37 * Monitor OLDB Attributes.
38 */
39const std::string KEY_MON_TARG_CIRS_RA = "ms/lsv/trackctr/mon/ra"; // currently still apparent position rather than CIRS
40const std::string KEY_MON_TARG_CIRS_DEC = "ms/lsv/trackctr/mon/dec";
41const std::string KEY_MON_TARG_ALT = "ms/lsv/trackest/mon/estimate/sv/track/target_alt";
42const std::string KEY_MON_TARG_AZ = "ms/lsv/trackest/mon/estimate/sv/track/target_az";
43const std::string KEY_MON_CURR_ALT = "ms/lsv/trackest/mon/estimate/sv/track/current_alt";
44const std::string KEY_MON_CURR_AZ = "ms/lsv/trackest/mon/estimate/sv/track/current_az";
45const std::string KEY_MON_STATE_APP = "mon/state"; // HLCC application style: combines application and estimation
46const std::string KEY_MON_STATE_TRACK = "ms/lsv/trackest/mon/estimate/sv/track/state"; // MS LSV style: Tracking state separate, from estimator
47
48
49class Config;
50
51struct OldbData{
52 /* TODO: make the following fields private with getters. */
53
54 std::shared_ptr<::ccsinsif::RaDec> target_ra_dec_cirs; // currently still apparent position, will later become CIRS
55 std::shared_ptr<::hlcc::oldbmux::ObservablePublisher<::ccsinsif::RaDec>> target_ra_dec_cirs_publisher;
56
57 std::shared_ptr<::ccsinsif::AltAz> target_alt_az;
58 std::shared_ptr<::hlcc::oldbmux::ObservablePublisher<::ccsinsif::AltAz>> target_alt_az_publisher;
59
60 std::shared_ptr<::ccsinsif::AltAz> current_alt_az;
61 std::shared_ptr<::hlcc::oldbmux::ObservablePublisher<::ccsinsif::AltAz>> current_alt_az_publisher;
62
63// std::shared_ptr<::ccsinsif::TrackingData> tracking_data;
64// std::shared_ptr<::hlcc::oldbmux::ObservablePublisher<::ccsinsif::TrackingData>> tracking_data_publisher;
65//
66// std::shared_ptr<::ccsinsif::TrackingDataExtended> tracking_data_extended;
67// std::shared_ptr<::hlcc::oldbmux::ObservablePublisher<::ccsinsif::TrackingDataExtended>> tracking_data_extended_publisher;
68
69 // Removed mudpi send of pk positions(ETCS-1027)
70
71 std::shared_ptr<::stdif::Status> status_app;
72 std::shared_ptr<::hlcc::oldbmux::ObservablePublisher<::stdif::Status>> status_app_publisher;
73
74 // Port oldb->dds
75 std::shared_ptr<::msif::TrackTarget> track_target;
76 std::shared_ptr<::hlcc::oldbmux::ObservablePublisher<::msif::TrackTarget>> track_target_publisher;
77
78 std::shared_ptr<::msif::TrackSv> track_sv;
79 std::shared_ptr<::hlcc::oldbmux::ObservablePublisher<::msif::TrackSv>> track_sv_publisher;
80
81 std::shared_ptr<::hlcc::oldbmux::CiiOldbDataPointAsync<double>> heartbeat_subscriber;
82
83};
87struct AsmData {
88 bool data_quality; /* false means the quality of the data in this struct is not reliable */
95};
96
100class OldbInterface : public rad::OldbInterface {
101 public:
108 OldbInterface(const std::string& prefix = "");
109
113 virtual ~OldbInterface();
114
119 void Init(::hlcc::trksim::Config& config);
120
124 void PublishTargets(ElapsedTimeStats& stats);
125
129 void PublishCurrentPositions(ElapsedTimeStats& stats, const bool& radec_validity, taiclock::TaiClock::time_point timestamp);
130
135 //void PublishCurrentTime(ElapsedTimeStats& stats);
136
141 ptk::HorizonPositionEsoTimestamped GetCurrentObservedAltAz();
142
148
155 void SetControlState(const std::string& value,
156 const taiclock::TaiClock::time_point& timestamp,
157 ElapsedTimeStats& stats);
158
162 void SetTrackingState(const std::string& value,
163 const taiclock::TaiClock::time_point& timestamp,
164 ElapsedTimeStats& stats);
165
166 void SetConfig(const rad::Config& cfg); // solves hidden virtual function
167
168 void SetControlState(const std::string& value); // solves hidden virtual function
174 void UpdateHeartbeat();
175 OldbInterface(const OldbInterface&) = delete;
178 private:
179
189 boost::asio::thread_pool m_async_exec {5};
190
196 log4cplus::Logger m_logger_oldb_async;
197 OldbData m_oldb_data;
198
199};
200
201} // namespace hlcc::trksim
202
203#endif // HLCC_TRKSIM_OLDBINTERFACE_HPP
Definition config.hpp:253
Definition monitoring.hpp:31
Definition oldbInterface.hpp:100
void PublishTargets(ElapsedTimeStats &stats)
Definition oldbInterface.cpp:399
OldbInterface(const std::string &prefix="")
Definition oldbInterface.cpp:40
OldbData & GetOldbData()
Disable assignment operator.
Definition oldbInterface.cpp:678
ptk::HorizonPositionEsoTimestamped GetCurrentObservedAltAz()
Definition oldbInterface.cpp:520
void Init(::hlcc::trksim::Config &config)
Definition oldbInterface.cpp:74
void SetTrackingState(const std::string &value, const taiclock::TaiClock::time_point &timestamp, ElapsedTimeStats &stats)
Definition oldbInterface.cpp:501
AsmData ReadAsm()
Definition oldbInterface.cpp:555
OldbInterface & operator=(const OldbInterface &)=delete
Disable copy constructor.
void SetConfig(hlcc::trksim::Config &cfg)
Definition oldbInterface.cpp:459
void PublishCurrentPositions(ElapsedTimeStats &stats, const bool &radec_validity, taiclock::TaiClock::time_point timestamp)
Definition oldbInterface.cpp:418
virtual ~OldbInterface()
Definition oldbInterface.cpp:49
void SetControlState(const std::string &value, const taiclock::TaiClock::time_point &timestamp, ElapsedTimeStats &stats)
Definition oldbInterface.cpp:489
OldbInterface(const OldbInterface &)=delete
void UpdateHeartbeat()
Definition oldbInterface.cpp:513
Definition actionMgr.cpp:35
const std::string KEY_MON_CURR_ALT
Definition oldbInterface.hpp:43
const std::string KEY_MON_TARG_CIRS_RA
Definition oldbInterface.hpp:39
const std::string KEY_MON_CURR_AZ
Definition oldbInterface.hpp:44
const std::string KEY_MON_TARG_CIRS_DEC
Definition oldbInterface.hpp:40
const std::string KEY_MON_STATE_TRACK
Definition oldbInterface.hpp:46
const std::string KEY_MON_TARG_AZ
Definition oldbInterface.hpp:42
const std::string KEY_MON_TARG_ALT
Definition oldbInterface.hpp:41
const std::string KEY_MON_STATE_APP
Definition oldbInterface.hpp:45
Definition oldbInterface.hpp:87
double ambient_pressure
Definition oldbInterface.hpp:93
double air_temperature
Definition oldbInterface.hpp:89
double relative_humidity_average
Definition oldbInterface.hpp:92
bool data_quality
Definition oldbInterface.hpp:88
double ambient_pressure_average
Definition oldbInterface.hpp:94
double relative_humidity
Definition oldbInterface.hpp:91
double air_temperature_average
Definition oldbInterface.hpp:90
Definition oldbInterface.hpp:51
std::shared_ptr<::hlcc::oldbmux::ObservablePublisher<::ccsinsif::AltAz > > target_alt_az_publisher
Definition oldbInterface.hpp:58
std::shared_ptr<::stdif::Status > status_app
Definition oldbInterface.hpp:71
std::shared_ptr<::hlcc::oldbmux::CiiOldbDataPointAsync< double > > heartbeat_subscriber
Definition oldbInterface.hpp:81
std::shared_ptr<::hlcc::oldbmux::ObservablePublisher<::stdif::Status > > status_app_publisher
Definition oldbInterface.hpp:72
std::shared_ptr<::hlcc::oldbmux::ObservablePublisher<::ccsinsif::RaDec > > target_ra_dec_cirs_publisher
Definition oldbInterface.hpp:55
std::shared_ptr<::msif::TrackTarget > track_target
Definition oldbInterface.hpp:75
std::shared_ptr<::hlcc::oldbmux::ObservablePublisher<::msif::TrackTarget > > track_target_publisher
Definition oldbInterface.hpp:76
std::shared_ptr<::msif::TrackSv > track_sv
Definition oldbInterface.hpp:78
std::shared_ptr<::hlcc::oldbmux::ObservablePublisher<::ccsinsif::AltAz > > current_alt_az_publisher
Definition oldbInterface.hpp:61
std::shared_ptr<::ccsinsif::AltAz > target_alt_az
Definition oldbInterface.hpp:57
std::shared_ptr<::hlcc::oldbmux::ObservablePublisher<::msif::TrackSv > > track_sv_publisher
Definition oldbInterface.hpp:79
std::shared_ptr<::ccsinsif::RaDec > target_ra_dec_cirs
Definition oldbInterface.hpp:54
std::shared_ptr<::ccsinsif::AltAz > current_alt_az
Definition oldbInterface.hpp:60
Performance and other monitoring.