ifw-ccf 4.0.0
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
10#include <ccf/common/base.hpp>
13
14namespace 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 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<ccf::common::FrameQueue>& queue);
40
43
45 virtual void UserLogic();
46
49
50 private:
51 bool m_allow_frame_skippping;
52
53 // Current data frame used for receiving data. Should not be shared_ptr.
54 ccf::common::DataFrame* m_cur_frame;
55
56 ccf::common::DataFrame m_spare_frame;
57 uint64_t m_iteration_count;
58 uint64_t m_iterations_since_start_count;
59 uint64_t m_frames_acquired;
60
61 double m_time_last_no_free_input_frames_log;
62 double m_time_for_last_cam_check;
63
64 // Members to handle check for timely frame reception.
65 double m_time_for_last_fr_reception;
66 double m_current_fr_period;
67 double m_time_for_last_fr_reception_warning;
68 bool m_fr_periodicity_warning_active;
69
70 void GetFreeFrame(uint8_t attempts);
71 void ReceiveFrame(bool& frame_received,
72 double& fr_reception_time);
73 void HandleFrameRecvStatus();
74 void SubmitAndNotify();
75 void CheckCameraHealth();
76 void CheckMessageBus(bool& new_setup);
77 void AssessAndUpdateAcqStatus();
78 void HandleNewSetup(ccf::Status status,
79 std::string& diagnostics);
80 void CheckFramePeriodicity();
81 void ResetFramePeriodicityCheckPars();
82
83 // Note: The queues are allocated and deleted by the ccf::control::application class.
84 std::shared_ptr<ccf::common::FrameQueue> m_input_q;
85 ccf::mptk::Message m_cur_msg; // Current thread message being handled.
86
88 };
89
90}
91
92#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:17
The FrameQueue class implements a queue, to manage a set of CCF DataFrame instances as a ring buffer.
Definition: frameQueue.hpp:14
Class used by the threads to store info for generating performance statistics.
Definition: utilities.hpp:25
CCF Acquisition Thread, handling the reception of image data from the camera.
Definition: acqThread.hpp:23
ccf::common::FrameStatistics & GetFrameStat()
Get reference to frame handling statistics.
Definition: acqThread.cpp:302
void SetInputQ(std::shared_ptr< ccf::common::FrameQueue > &queue)
Set reference to the Application Input Queue.
Definition: acqThread.cpp:39
void Initialise()
Definition: acqThread.cpp:27
void ResetCounters()
Reset counters for the internal household.
Definition: acqThread.cpp:52
virtual ~AcqThread()
Definition: acqThread.cpp:23
ccf::common::FrameQueue & GetInputQ()
Get refrence to the Application Input Queue.
Definition: acqThread.cpp:44
virtual void UserLogic()
Acquisition Thread user logic.
Definition: acqThread.cpp:71
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:29
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:143