@@ -69,16 +69,18 @@ void fillConfigFromInfo(const CameraInfo& msg, Camera::Config& cam_config) {
6969 cam_config.cy = msg.k [5 ];
7070}
7171
72- std::optional<sensor_msgs::msg::CameraInfo> getCameraInfo (const RosCamera::Config& c,
73- const std::string& ns) {
72+ std::optional<sensor_msgs::msg::CameraInfo> getCameraInfo (
73+ const RosCamera::Config& config, const std::string& ns) {
7474 auto nh = ianvs::NodeHandle::this_node (ns);
7575 const auto resolved_topic = nh.resolve_name (" camera_info" , false );
7676 LOG (INFO) << " Waiting for CameraInfo on " << resolved_topic
7777 << " to initialize sensor model" ;
7878
7979 const auto start = nh.now ();
80- const auto qos = rclcpp::QoS (1 ).durability (rclcpp::DurabilityPolicy::BestAvailable);
81- const size_t timeout = std::floor (c.warning_timeout_s * 1000 );
80+ const auto qos = rclcpp::QoS (1 ).durability (
81+ config.latch_info_sub ? rclcpp::DurabilityPolicy::TransientLocal
82+ : rclcpp::DurabilityPolicy::Volatile);
83+ const size_t timeout = std::floor (config.warning_timeout_s * 1000 );
8284
8385 std::optional<sensor_msgs::msg::CameraInfo> msg;
8486 while (!msg && rclcpp::ok ()) {
@@ -88,7 +90,7 @@ std::optional<sensor_msgs::msg::CameraInfo> getCameraInfo(const RosCamera::Confi
8890 }
8991
9092 const auto diff = nh.now () - start;
91- if (c .error_timeout_s && (diff.seconds () > c .error_timeout_s )) {
93+ if (config .error_timeout_s && (diff.seconds () > config .error_timeout_s )) {
9294 LOG (ERROR) << " Sensor intrinsics lookup timed out on '" << resolved_topic << " '" ;
9395 break ;
9496 }
@@ -170,6 +172,7 @@ void declare_config(RosCamera::Config& config) {
170172 field (config.ns , " ns" );
171173 field (config.warning_timeout_s , " warning_timeout_s" , " s" );
172174 field (config.error_timeout_s , " error_timeout_s" , " s" );
175+ field (config.latch_info_sub , " latch_info_sub" );
173176 check (config.warning_timeout_s , GE, 0.0 , " warning_timeout_s" );
174177 check (config.error_timeout_s , GE, 0.0 , " error_timeout_s" );
175178}
0 commit comments