ifw-ccf 6.0.0
 
Loading...
Searching...
No Matches
acqThread.hpp
Go to the documentation of this file.
1
6
7#ifndef IFW_CCF_CTL_ACQ_THREAD_HPP_
8#define IFW_CCF_CTL_ACQ_THREAD_HPP_
9
10#include <boost/exception/diagnostic_information.hpp>
11
15
16namespace ifw::ccf::control {
17
19 constexpr double FRAME_RECV_TIMEOUT = 0.100;
20
22 constexpr double NO_FRAME_RECV_SLEEP_TIME = 0.001;
23
26 public:
27
29 AcqThread(const std::string& thread_name,
30 ifw::ccf::mptk::MessageBus& message_bus,
31 const double period = 0.1);
32
33 virtual ~AcqThread();
34
35 void Initialise();
36
38 void ResetCounters();
39
41 void SetInputQ(std::shared_ptr<ifw::ccf::common::FrameQueue>& queue);
42
45
47 virtual void UserLogic();
48
51
52 private:
53 bool m_allow_frame_skippping;
54 int16_t m_fr_periodicity_chk_tolerance{2};
55 bool m_fr_periodicity_chk_auto_error{true};
56 float m_fr_periodicity_chk_min_timeout{5.0};
57
58 // Current data frame used for receiving data. Should not be shared_ptr.
59 ifw::ccf::common::DataFrame* m_cur_frame;
60
61 ifw::ccf::common::DataFrame m_spare_frame;
62 uint64_t m_iteration_count;
63 uint64_t m_iterations_since_start_count;
64 uint64_t m_frames_acquired;
65
66 double m_time_last_no_free_input_frames_log;
67 double m_time_for_last_cam_check;
68
69 // Members to handle check for timely frame reception.
70 double m_time_for_last_fr_reception;
71 double m_current_fr_period;
72 double m_time_for_last_fr_reception_warning;
73 bool m_fr_periodicity_warning_active;
74
75 bool m_exec_telemetry_after_setup{true};
76
77 void GetFreeFrame(uint8_t attempts);
78 void HandleCcfTriggering();
79 void HandleCustomTrigger(bool frame_received);
80 void ReceiveFrame(bool& frame_received,
81 double& fr_reception_time);
82 void HandleFrameRecvStatus();
83 void SubmitAndNotify();
84 void CheckCameraHealth();
85 void CheckMessageBus(bool& new_setup);
86 //void AssessAndUpdateAcqStatus();
87 void HandleNewSetup(ifw::ccf::Status status,
88 std::string& diagnostics);
89 void CheckFramePeriodicity();
90 void ResetFramePeriodicityCheckPars();
91
92 // Note: The queues are allocated and deleted by the ifw::ccf::control::application class.
93 std::shared_ptr<ifw::ccf::common::FrameQueue> m_input_q;
94 ifw::ccf::mptk::Message m_cur_msg; // Current thread message being handled.
95
96 double m_last_acq_status_check;
97
99 };
100
101}
102
103#endif // IFW_CCF_CTL_ACQ_THREAD_HPP_
Frame class used to store the data and metadata for one frames received from the camera.
Definition dataFrame.hpp:20
The FrameQueue class implements a queue, to manage a set of CCF DataFrame instances as a ring buffer.
Definition frameQueue.hpp:17
Class used by the threads to store info for generating performance statistics.
Definition utilities.hpp:29
virtual ~AcqThread()
Definition acqThread.cpp:25
void SetInputQ(std::shared_ptr< ifw::ccf::common::FrameQueue > &queue)
Set reference to the Application Input Queue.
Definition acqThread.cpp:52
ifw::ccf::common::FrameStatistics & GetFrameStat()
Get reference to frame handling statistics.
Definition acqThread.cpp:423
void Initialise()
Definition acqThread.cpp:29
AcqThread(const std::string &thread_name, ifw::ccf::mptk::MessageBus &message_bus, const double period=0.1)
Acquisition Thread, handling the interfacing and data acquisition from the camera.
Definition acqThread.cpp:13
void ResetCounters()
Reset counters for the internal household.
Definition acqThread.cpp:65
virtual void UserLogic()
Acquisition Thread user logic.
Definition acqThread.cpp:84
ifw::ccf::common::FrameQueue & GetInputQ()
Get refrence to the Application Input Queue.
Definition acqThread.cpp:57
IFW CTD Multiprocessing Toolkit Message Bus.
Definition messageBus.hpp:92
IFW CTD Multiprocessing Toolkit Message class.
Definition message.hpp:25
IFW CTD Multiprocessing Toolkit Thread base class.
Definition thread.hpp:31
Definition acqThread.cpp:11
constexpr double NO_FRAME_RECV_SLEEP_TIME
Sleep to apply when no frame is available.
Definition acqThread.hpp:22
constexpr double FRAME_RECV_TIMEOUT
Timeout to apply, waiting for the next frame.
Definition acqThread.hpp:19
Status
General status variable.
Definition base.hpp:158