Skip to content

Compress and convert sensor_msgs::msg::PointCloud2 to rclcpp::SerializedMessage#56

Open
alireza-moayyedi wants to merge 2 commits intofacontidavide:mainfrom
nobleo:compress-and-convert-ros-pcd-msgs
Open

Compress and convert sensor_msgs::msg::PointCloud2 to rclcpp::SerializedMessage#56
alireza-moayyedi wants to merge 2 commits intofacontidavide:mainfrom
nobleo:compress-and-convert-ros-pcd-msgs

Conversation

@alireza-moayyedi
Copy link

Hi,

As I mentioned in #55, I want to compress and publish my sensor_msgs::msg::PointCloud2 directly in my code to avoid the middle man topic converter node. So I took a look at the topic converter's code and tried to do something similar here. This way, in my own code I can have something like this:

Initialization:
..............
#include "cloudini_ros/conversion_utils.hpp"

// Cloudini compression publisher
const std::string compressed_topic_type = "point_cloud_interfaces/msg/CompressedPointCloud2";
cloudini_publisher_ =
  this->create_generic_publisher("~/points/compressed", compressed_topic_type, qos_pub);
.............

When required:
.............
if (cloudini_publisher_->get_subscription_count() > 0) {
  cloudini_publisher_->publish(Cloudini::ConvertToCompressedCloud(pcd_msg, resolution));
}

To be frank I do not have the full scope of Cloudini so I am not sure if this is the cleanest or easiset way to do this. In any case, I got what I was looking for!

By the way the commit is on top of #55 so you can just review the .cpp and .hpp files here and ignore the Cmake and package.xml ones. As as soon as #55 is merged I will rebase. Sorry for being impatient!

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant