Contents

[TOC]

image_transport

  1. ROS image_transport 懒发布机制

    没有订阅者不会发布

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
void Publisher::publish(const sensor_msgs::msg::Image & message) const
{
  if (!impl_ || !impl_->isValid()) {
    // TODO(ros2) Switch to RCUTILS_ASSERT when ros2/rcutils#112 is merged
    auto logger = impl_ ? impl_->logger_ : rclcpp::get_logger("image_transport");
    RCLCPP_FATAL(logger, "Call to publish() on an invalid image_transport::Publisher");
    return;
  }

  for (const auto & pub : impl_->publishers_) {
    if (pub->getNumSubscribers() > 0) {
      pub->publish(message);
    }
  }
}

相机ROS封装

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/ob_camera_waist/color/camera_info
/ob_camera_waist/color/image_raw
/ob_camera_waist/color/image_raw/compressed
/ob_camera_waist/color/image_raw/compressedDepth
/ob_camera_waist/color/image_raw/theora
/ob_camera_waist/color/metadata
/ob_camera_waist/depth/camera_info
/ob_camera_waist/depth/image_raw
/ob_camera_waist/depth/image_raw/compressed
/ob_camera_waist/depth/image_raw/compressedDepth
/ob_camera_waist/depth/image_raw/theora
/ob_camera_waist/depth/metadata
/ob_camera_waist/depth/points
/ob_camera_waist/depth_filter_status
/ob_camera_waist/depth_to_color
/ob_camera_waist/depth_to_left_ir
/ob_camera_waist/depth_to_right_ir
/ob_camera_waist/left_ir/camera_info
/ob_camera_waist/left_ir/image_raw
/ob_camera_waist/left_ir/image_raw/compressed
/ob_camera_waist/left_ir/image_raw/compressedDepth
/ob_camera_waist/left_ir/image_raw/theora
/ob_camera_waist/left_ir/metadata
/ob_camera_waist/right_ir/camera_info
/ob_camera_waist/right_ir/image_raw
/ob_camera_waist/right_ir/image_raw/compressed
/ob_camera_waist/right_ir/image_raw/compressedDepth
/ob_camera_waist/right_ir/image_raw/theora
/ob_camera_waist/right_ir/metadata
  1. 每个子topic /compressed /compressedDepth /theora 不必关注,其是由 ros image_transport 由 主topic 数据 (如 /ob_camera_waist/color/image_raw ) 产生没有订阅不会有相关转化逻辑。

  2. 关注topic 参数

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    
    ros2 param get /camera/camera align_mode
    ros2 param set /camera/camera align_mode HW
    
    ros2 param get  /ob_camera_back/ob_camera_back align_mode
    ros2 param set  /ob_camera_back/ob_camera_back align_mode HW
    ros2 param set  /ob_camera_back/ob_camera_back align_mode SW
    
    ros2 param get /ob_camera_waist/ob_camera_waist align_mode
    ros2 param set /ob_camera_waist/ob_camera_waist align_mode HW
    ros2 param set /ob_camera_waist/ob_camera_waist align_mode SW
    

相机SDK