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