Skip to content

Commit

Permalink
Publish using unique_ptr in stereo_image_proc
Browse files Browse the repository at this point in the history
  • Loading branch information
bjsowa committed Aug 1, 2024
1 parent c03ea44 commit 2f4693b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions stereo_image_proc/src/stereo_image_proc/disparity_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ void DisparityNode::imageCb(
model_.fromCameraInfo(l_info_msg, r_info_msg);

// Allocate new disparity image message
auto disp_msg = std::make_shared<stereo_msgs::msg::DisparityImage>();
auto disp_msg = std::make_unique<stereo_msgs::msg::DisparityImage>();
disp_msg->header = l_info_msg->header;
disp_msg->image.header = l_info_msg->header;

Expand Down Expand Up @@ -384,7 +384,7 @@ void DisparityNode::imageCb(
// Perform block matching to find the disparities
block_matcher_.processDisparity(l_image, r_image, model_, *disp_msg);

pub_disparity_->publish(*disp_msg);
pub_disparity_->publish(std::move(disp_msg));
}

rcl_interfaces::msg::SetParametersResult DisparityNode::parameterSetCb(
Expand Down
4 changes: 2 additions & 2 deletions stereo_image_proc/src/stereo_image_proc/point_cloud_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ void PointCloudNode::imageCb(
cv::Mat_<cv::Vec3f> mat = points_mat_;

// Fill in new PointCloud2 message (2D image-like layout)
auto points_msg = std::make_shared<sensor_msgs::msg::PointCloud2>();
auto points_msg = std::make_unique<sensor_msgs::msg::PointCloud2>();
points_msg->header = disp_msg->header;
points_msg->height = mat.rows;
points_msg->width = mat.cols;
Expand Down Expand Up @@ -351,7 +351,7 @@ void PointCloudNode::imageCb(
}
}

pub_points2_->publish(*points_msg);
pub_points2_->publish(std::move(points_msg));
}

} // namespace stereo_image_proc
Expand Down

0 comments on commit 2f4693b

Please sign in to comment.