@@ -84,6 +84,18 @@ DepthCloudDisplay::DepthCloudDisplay()
84
84
QRegExp depth_filter (" depth" );
85
85
depth_filter.setCaseSensitivity (Qt::CaseInsensitive);
86
86
87
+ reliability_policy_property_ = new rviz_common::properties::EditableEnumProperty (
88
+ " Reliability Policy" ,
89
+ " Best effort" ,
90
+ " Set the reliability policy: When choosing 'Best effort', no guarantee will be given that the "
91
+ " messages will be delivered, choosing 'Reliable', messages will be sent until received." , this ,
92
+ SLOT (updateQosProfile ()));
93
+ reliability_policy_property_->addOption (" System Default" );
94
+ reliability_policy_property_->addOption (" Reliable" );
95
+ reliability_policy_property_->addOption (" Best effort" );
96
+
97
+ qos_profile_ = rmw_qos_profile_sensor_data;
98
+
87
99
topic_filter_property_ =
88
100
new rviz_common::properties::Property (
89
101
" Topic Filter" , true ,
@@ -162,6 +174,26 @@ DepthCloudDisplay::DepthCloudDisplay()
162
174
use_occlusion_compensation_property_, SLOT (updateOcclusionTimeOut ()), this );
163
175
}
164
176
177
+ void DepthCloudDisplay::updateQosProfile ()
178
+ {
179
+ updateQueueSize ();
180
+ qos_profile_ = rmw_qos_profile_default;
181
+ qos_profile_.depth = queue_size_;
182
+
183
+ auto policy = reliability_policy_property_->getString ().toStdString ();
184
+
185
+ if (policy == " Best effort" ) {
186
+ qos_profile_.reliability = RMW_QOS_POLICY_RELIABILITY_BEST_EFFORT;
187
+
188
+ } else if (policy == " Reliable" ) {
189
+ qos_profile_.reliability = RMW_QOS_POLICY_RELIABILITY_RELIABLE;
190
+ } else {
191
+ qos_profile_.reliability = RMW_QOS_POLICY_RELIABILITY_SYSTEM_DEFAULT;
192
+ }
193
+
194
+ updateTopic ();
195
+ }
196
+
165
197
void DepthCloudDisplay::transformerChangedCallback ()
166
198
{
167
199
updateTopic ();
@@ -225,6 +257,7 @@ void DepthCloudDisplay::updateQueueSize()
225
257
depthmap_tf_filter_->setQueueSize (static_cast <uint32_t >(queue_size_property_->getInt ()));
226
258
}
227
259
queue_size_ = queue_size_property_->getInt ();
260
+ qos_profile_.depth = queue_size_;
228
261
}
229
262
230
263
void DepthCloudDisplay::updateUseAutoSize ()
@@ -311,7 +344,8 @@ void DepthCloudDisplay::subscribe()
311
344
depthmap_sub_->subscribe (
312
345
rviz_ros_node_->get_raw_node ().get (),
313
346
depthmap_topic,
314
- depthmap_transport);
347
+ depthmap_transport,
348
+ qos_profile_);
315
349
316
350
depthmap_tf_filter_ =
317
351
std::make_shared<tf2_ros::MessageFilter<sensor_msgs::msg::Image,
@@ -353,7 +387,7 @@ void DepthCloudDisplay::subscribe()
353
387
// subscribe to color image topic
354
388
rgb_sub_->subscribe (
355
389
rviz_ros_node_->get_raw_node ().get (),
356
- color_topic, color_transport, rclcpp::SensorDataQoS (). get_rmw_qos_profile () );
390
+ color_topic, color_transport, qos_profile_ );
357
391
358
392
// connect message filters to synchronizer
359
393
sync_depth_color_->connectInput (*depthmap_tf_filter_, *rgb_sub_);
0 commit comments