fix publish rgb point cloud

This commit is contained in:
Joe Dong
2022-06-09 17:47:12 +08:00
parent 61bf2dd7b2
commit c748b580ec
2 changed files with 10 additions and 7 deletions
@@ -14,12 +14,12 @@
enable_ir: false enable_ir: false
depth_width: 640 depth_width: 640
depth_height: 480 depth_height: 480
depth_fps: 30 depth_fps: 25
depth_frame_id: "depth_frame" depth_frame_id: "depth_frame"
depth_optical_frame_id: "depth_optical_frame" depth_optical_frame_id: "depth_optical_frame"
enable_depth: true enable_depth: true
publish_tf: true publish_tf: true
align_depth: true align_depth: true
tf_publish_rate: 10.0 tf_publish_rate: 10.0
publish_rgb_point_cloud : false publish_rgb_point_cloud : true
d2c_mode : "hw" d2c_mode : "hw"
+8 -5
View File
@@ -122,16 +122,18 @@ void OBCameraNode::setupProfiles() {
auto selected_profile = auto selected_profile =
profiles->getVideoStreamProfile(width_[elem], height_[elem], format_[elem], fps_[elem]); profiles->getVideoStreamProfile(width_[elem], height_[elem], format_[elem], fps_[elem]);
auto default_profile = profiles->getVideoStreamProfile(); auto default_profile =
profiles->getVideoStreamProfile(width_[elem], height_[elem], format_[elem]);
if (!selected_profile) { if (!selected_profile) {
RCLCPP_WARN_STREAM(logger_, "Given stream configuration is not supported by the device! " RCLCPP_WARN_STREAM(logger_, "Given stream configuration is not supported by the device! "
<< " Stream: " << magic_enum::enum_name(elem.first) << " Stream: " << magic_enum::enum_name(elem.first)
<< ", Stream Index: " << elem.second << ", Stream Index: " << elem.second
<< ", Width: " << width_[elem] << ", Width: " << width_[elem]
<< ", Height: " << height_[elem] << ", FPS: " << fps_[elem] << ", Height: " << height_[elem] << ", FPS: " << fps_[elem]
<< ", Format: " << format_[elem]); << ", Format: " << magic_enum::enum_name(format_[elem]));
if (default_profile) { if (default_profile) {
RCLCPP_WARN_STREAM(logger_, "Using default profile instead."); RCLCPP_WARN_STREAM(logger_, "Using default profile instead.");
RCLCPP_WARN_STREAM(logger_, "default FPS " << default_profile->fps());
selected_profile = default_profile; selected_profile = default_profile;
} else { } else {
RCLCPP_ERROR_STREAM( RCLCPP_ERROR_STREAM(
@@ -226,9 +228,10 @@ void OBCameraNode::publishPointCloud(std::shared_ptr<ob::FrameSet> frame_set) {
return; return;
} }
try { try {
if (publish_rgb_point_cloud_ && frame_set->depthFrame() != nullptr && if(publish_rgb_point_cloud_) {
frame_set->colorFrame() != nullptr) { if (frame_set->depthFrame() != nullptr && frame_set->colorFrame() != nullptr) {
publishColorPointCloud(frame_set); publishColorPointCloud(frame_set);
}
} else if (frame_set->depthFrame() != nullptr) { } else if (frame_set->depthFrame() != nullptr) {
publishDepthPointCloud(frame_set); publishDepthPointCloud(frame_set);
} }