@@ -124,8 +124,8 @@ pcl_ros::Filter::subscribe()
124124 if (use_indices_) {
125125 // Subscribe to the input using a filter
126126 auto sensor_qos_profile = rclcpp::SensorDataQoS ().keep_last (max_queue_size_);
127- sub_input_filter_.subscribe (this , " input" , sensor_qos_profile);
128- sub_indices_filter_.subscribe (this , " indices" , sensor_qos_profile);
127+ sub_input_filter_.subscribe (this , " input" , sensor_qos_profile. get_rmw_qos_profile () );
128+ sub_indices_filter_.subscribe (this , " indices" , sensor_qos_profile. get_rmw_qos_profile () );
129129
130130 if (approximate_sync_) {
131131 sync_input_indices_a_ =
@@ -182,23 +182,16 @@ pcl_ros::Filter::Filter(std::string node_name, const rclcpp::NodeOptions & optio
182182void
183183pcl_ros::Filter::createPublishers ()
184184{
185- auto pub_options = rclcpp::PublisherOptions ();
186- pub_options.event_callbacks .matched_callback = [this ](rclcpp::MatchedInfo & /* info*/ ) {
187- if (pub_output_->get_subscription_count () == 0 ) {
188- unsubscribe ();
189- } else {
190- if (use_indices_) {
191- if (!sub_input_filter_.getSubscriber () || !sub_indices_filter_.getSubscriber ()) {
192- subscribe ();
193- }
194- } else {
195- if (!sub_input_) {
196- subscribe ();
197- }
198- }
199- }
200- };
201- pub_output_ = create_publisher<PointCloud2>(" output" , max_queue_size_, pub_options);
185+ if (use_indices_) {
186+ if (!sub_input_filter_.getSubscriber () || !sub_indices_filter_.getSubscriber ()) {
187+ subscribe ();
188+ }
189+ } else {
190+ if (!sub_input_) {
191+ subscribe ();
192+ }
193+ }
194+ pub_output_ = create_publisher<PointCloud2>(" output" , max_queue_size_);
202195}
203196
204197// ////////////////////////////////////////////////////////////////////////////////////////////
0 commit comments