# Cant subscribe to PoinCloud2 [closed]

Hallo, Can someone explain me the difference of the two publishers?

(1)

pub_point_cloud_ = create_publisher<PointCloud2>("points", rclcpp::SensorDataQoS());


(2)

pub_point_cloud_ = create_publisher<PointCloud2>("points", 1);


In the case of the first publisher, I can't subscribe to the PointCloud message as follows which I don't understand. Moreover, I cannot display the points of the message in rviz2.

d435_test_2 = this->create_subscription<sensor_msgs::msg::PointCloud2>(
"/points", 1, std::bind(&ObjectDetectionNode::test_2_callback, this, std::placeholders::_1));

void test_2_callback(const sensor_msgs::msg::PointCloud2::SharedPtr msgs)
{
std::cout << "start_//color/image_raw-------" << "\n";
}


When I use publisher 2 I can do everything normally.

Please give me a short explanation. An example of how to make a subscriber for the first publisher would also be nice

Thanks for the help

edit retag reopen merge delete