File tree Expand file tree Collapse file tree
human_detector/src/module/hal_camera_module Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,6 +11,12 @@ bool HalCameraModule::Initialize(aimrt::CoreRef core) {
1111
1212 try {
1313 // Write your other initialization logic here ...
14+ // Read cfg
15+ auto file_path = core_.GetConfigurator ().GetConfigFilePath ();
16+ if (!file_path.empty ()) {
17+ YAML::Node cfg_node = YAML::LoadFile (std::string (file_path));
18+ freq_ = cfg_node[" freq" ].as <double >();
19+ }
1420 // Get executor handle
1521 executor_ = core_.GetExecutorManager ().GetExecutor (" work_executor" );
1622 AIMRT_CHECK_ERROR_THROW (executor_, " Get executor 'work_executor' failed." );
@@ -74,6 +80,8 @@ void HalCameraModule::MainLoop() {
7480
7581 // publish event
7682 aimrt::channel::Publish (publisher_, msg);
83+
84+ std::this_thread::sleep_for (std::chrono::milliseconds (static_cast <int >(1000 / freq_)));
7785 }
7886
7987 } catch (const std::exception& e) {
Original file line number Diff line number Diff line change @@ -33,4 +33,6 @@ class HalCameraModule : public aimrt::ModuleBase {
3333 aimrt::executor::ExecutorRef executor_;
3434
3535 std::unique_ptr<cv::VideoCapture> camera_ptr_;
36+
37+ double freq_ = 10 ;
3638};
You can’t perform that action at this time.
0 commit comments