@@ -72,6 +72,7 @@ DepthCloudDisplay::DepthCloudDisplay()
72
72
: rviz_common::Display()
73
73
, messages_received_(0 )
74
74
, depthmap_sub_()
75
+ , depthmap_tf_filter_(nullptr )
75
76
, rgb_sub_()
76
77
, cam_info_sub_()
77
78
, queue_size_(5 )
@@ -161,6 +162,11 @@ DepthCloudDisplay::DepthCloudDisplay()
161
162
use_occlusion_compensation_property_, SLOT (updateOcclusionTimeOut ()), this );
162
163
}
163
164
165
+ void DepthCloudDisplay::transformerChangedCallback ()
166
+ {
167
+ updateTopic ();
168
+ }
169
+
164
170
void DepthCloudDisplay::onInitialize ()
165
171
{
166
172
auto rviz_ros_node_ = context_->getRosNodeAbstraction ().lock ();
@@ -184,6 +190,12 @@ void DepthCloudDisplay::onInitialize()
184
190
185
191
depth_topic_property_->initialize (rviz_ros_node_);
186
192
color_topic_property_->initialize (rviz_ros_node_);
193
+
194
+ QObject::connect (
195
+ reinterpret_cast <QObject *>(context_->getTransformationManager ()),
196
+ SIGNAL (transformerChanged (std::shared_ptr<rviz_common::transformation::FrameTransformer>)),
197
+ this ,
198
+ SLOT (transformerChangedCallback ()));
187
199
}
188
200
189
201
DepthCloudDisplay::~DepthCloudDisplay ()
@@ -209,6 +221,9 @@ void DepthCloudDisplay::setTopic(const QString & topic, const QString & datatype
209
221
210
222
void DepthCloudDisplay::updateQueueSize ()
211
223
{
224
+ if (depthmap_tf_filter_) {
225
+ depthmap_tf_filter_->setQueueSize (static_cast <uint32_t >(queue_size_property_->getInt ()));
226
+ }
212
227
queue_size_ = queue_size_property_->getInt ();
213
228
}
214
229
@@ -303,7 +318,7 @@ void DepthCloudDisplay::subscribe()
303
318
rviz_common::transformation::FrameTransformer>>(
304
319
*context_->getFrameManager ()->getTransformer (),
305
320
fixed_frame_.toStdString (),
306
- 10 ,
321
+ queue_size_ ,
307
322
rviz_ros_node_->get_raw_node ());
308
323
309
324
depthmap_tf_filter_->connectInput (*depthmap_sub_);
@@ -382,6 +397,9 @@ void DepthCloudDisplay::unsubscribe()
382
397
void DepthCloudDisplay::clear ()
383
398
{
384
399
pointcloud_common_->reset ();
400
+ if (depthmap_tf_filter_) {
401
+ depthmap_tf_filter_->clear ();
402
+ }
385
403
}
386
404
387
405
void DepthCloudDisplay::update (float wall_dt, float ros_dt)
@@ -603,6 +621,9 @@ void DepthCloudDisplay::fillTransportOptionList(rviz_common::properties::EnumPro
603
621
604
622
void DepthCloudDisplay::fixedFrameChanged ()
605
623
{
624
+ if (depthmap_tf_filter_) {
625
+ depthmap_tf_filter_->setTargetFrame (fixed_frame_.toStdString ());
626
+ }
606
627
Display::reset ();
607
628
}
608
629
0 commit comments