@@ -186,6 +186,7 @@ ElevationMappingNode::ElevationMappingNode(const rclcpp::NodeOptions& options)
186186 // rmw_qos_profile_t qos_profile = rmw_qos_profile_default;
187187 // auto qos = rclcpp::QoS(rclcpp::QoSInitialization(qos_profile.history, qos_profile.depth), qos_profile);
188188
189+ // Use sensor data QoS (BEST_EFFORT) for high-frequency point clouds
189190 rmw_qos_profile_t sensor_qos_profile = rmw_qos_profile_sensor_data;
190191 auto sensor_qos = rclcpp::QoS (rclcpp::QoSInitialization (sensor_qos_profile.history , sensor_qos_profile.depth ), sensor_qos_profile);
191192
@@ -201,30 +202,13 @@ ElevationMappingNode::ElevationMappingNode(const rclcpp::NodeOptions& options)
201202 // point_cloud_transport::Subscriber sub = pct.subscribe(pointcloud_topic, 100, callback, {}, transport_hint.get())
202203
203204
204- auto callback_transport = [this , key](const sensor_msgs::msg::PointCloud2::ConstSharedPtr msg) {
205- this ->pointcloudtransportCallback (msg, key);
206- };
207-
208- // Create transport hints (e.g., "draco")
209- // auto transport_hint = std::make_shared<point_cloud_transport::TransportHints>("draco");
210-
211-
212- // Use PointCloudTransport to create a subscriber
213- point_cloud_transport::PointCloudTransport pct (node_);
214- auto sub_transport = pct.subscribe (pointcloud_topic, 100 , callback_transport);
215-
216- // Add the subscriber to the vector to manage its lifetime
217- pointcloudtransportSubs_.push_back (sub_transport);
218-
219-
220- // auto callback = [this, key](const sensor_msgs::msg::PointCloud2::SharedPtr msg) {
221- // this->pointcloudCallback(msg, key);
222- // };
223-
224- // auto sub = this->create_subscription<sensor_msgs::msg::PointCloud2>(pointcloud_topic, sensor_qos, callback);
205+ auto callback = [this , key](const sensor_msgs::msg::PointCloud2::ConstSharedPtr msg) {
206+ this ->pointcloudtransportCallback (msg, key);
207+ };
225208
226- // pointcloudSubs_.push_back(sub);
227- RCLCPP_INFO (this ->get_logger (), " Subscribed to PointCloud2 topic: %s" , pointcloud_topic.c_str ());
209+ auto sub = this ->create_subscription <sensor_msgs::msg::PointCloud2>(pointcloud_topic, sensor_qos, callback);
210+ pointcloudSubs_.push_back (sub);
211+ RCLCPP_INFO (this ->get_logger (), " Subscribed to PointCloud2 topic: %s" , pointcloud_topic.c_str ());
228212 }
229213 }
230214 }
0 commit comments