This repository was archived by the owner on Jul 26, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -874,12 +874,15 @@ void K4AROSDevice::framePublisherThread()
874874 calibration_data_.getRgbCameraInfo (depth_rect_camera_info);
875875 calibration_data_.getDepthCameraInfo (ir_raw_camera_info);
876876
877+ const std::chrono::milliseconds firstFrameWaitTime = std::chrono::milliseconds (4 * 1000 );
878+ const std::chrono::milliseconds regularFrameWaitTime = std::chrono::milliseconds (1000 * 5 / params_.fps );
879+ std::chrono::milliseconds waitTime = firstFrameWaitTime;
880+
877881 while (running_ && rclcpp::ok ())
878882 {
879883 if (k4a_device_)
880884 {
881- // TODO: consider appropriate capture timeout based on camera framerate
882- if (!k4a_device_.get_capture (&capture, std::chrono::milliseconds (K4A_WAIT_INFINITE)))
885+ if (!k4a_device_.get_capture (&capture, waitTime))
883886 {
884887 RCLCPP_FATAL (this ->get_logger ()," Failed to poll cameras: node cannot continue." );
885888 rclcpp::shutdown ();
@@ -900,6 +903,7 @@ void K4AROSDevice::framePublisherThread()
900903 capture.get_color_image ().get_system_timestamp ());
901904 }
902905 }
906+ waitTime = regularFrameWaitTime;
903907 }
904908 else if (k4a_playback_handle_)
905909 {
You can’t perform that action at this time.
0 commit comments