moveit2
The MoveIt Motion Planning Framework for ROS 2.
Loading...
Searching...
No Matches
depth_image_octomap_updater.cpp
Go to the documentation of this file.
1/*********************************************************************
2 * Software License Agreement (BSD License)
3 *
4 * Copyright (c) 2011, Willow Garage, Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
17 * * Neither the name of Willow Garage nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 *********************************************************************/
34
35/* Author: Ioan Sucan, Suat Gedikli */
36
39#include <cmath>
40#include <tf2_geometry_msgs/tf2_geometry_msgs.hpp>
41#include <tf2/LinearMath/Vector3.h>
42#include <tf2/LinearMath/Transform.h>
43#include <geometric_shapes/shape_operations.h>
44#include <sensor_msgs/image_encodings.hpp>
45#include <stdint.h>
47
48#include <memory>
49
51{
52
54 : OccupancyMapUpdater("DepthImageUpdater")
55 , image_topic_("depth")
56 , queue_size_(5)
57 , near_clipping_plane_distance_(0.3)
58 , far_clipping_plane_distance_(5.0)
59 , shadow_threshold_(0.04)
60 , padding_scale_(0.0)
61 , padding_offset_(0.02)
62 , max_update_rate_(0)
63 , skip_vertical_pixels_(4)
64 , skip_horizontal_pixels_(6)
65 , image_callback_count_(0)
66 , average_callback_dt_(0.0)
67 , good_tf_(5)
68 , // start optimistically, so we do not output warnings right from the beginning
69 failed_tf_(0)
70 , K0_(0.0)
71 , K2_(0.0)
72 , K4_(0.0)
73 , K5_(0.0)
74 , logger_(moveit::getLogger("moveit.ros.depth_image_octomap_updater"))
75{
76}
77
79{
80 sub_depth_image_.shutdown();
81}
82
83bool DepthImageOctomapUpdater::setParams(const std::string& name_space)
84{
85 try
86 {
87 node_->get_parameter(name_space + ".image_topic", image_topic_) &&
88 node_->get_parameter(name_space + ".queue_size", queue_size_) &&
89 node_->get_parameter(name_space + ".near_clipping_plane_distance", near_clipping_plane_distance_) &&
90 node_->get_parameter(name_space + ".far_clipping_plane_distance", far_clipping_plane_distance_) &&
91 node_->get_parameter(name_space + ".shadow_threshold", shadow_threshold_) &&
92 node_->get_parameter(name_space + ".padding_scale", padding_scale_) &&
93 node_->get_parameter(name_space + ".padding_offset", padding_offset_) &&
94 node_->get_parameter(name_space + ".max_update_rate", max_update_rate_) &&
95 node_->get_parameter(name_space + ".skip_vertical_pixels", skip_vertical_pixels_) &&
96 node_->get_parameter(name_space + ".skip_horizontal_pixels", skip_horizontal_pixels_) &&
97 node_->get_parameter(name_space + ".filtered_cloud_topic", filtered_cloud_topic_) &&
98 node_->get_parameter(name_space + ".ns", ns_);
99 return true;
100 }
101 catch (const rclcpp::exceptions::InvalidParameterTypeException& e)
102 {
103 RCLCPP_ERROR_STREAM(logger_, e.what() << '\n');
104 return false;
105 }
106}
107
108bool DepthImageOctomapUpdater::initialize(const rclcpp::Node::SharedPtr& node)
109{
110 node_ = node;
111 input_depth_transport_ = std::make_unique<image_transport::ImageTransport>(node_);
112 model_depth_transport_ = std::make_unique<image_transport::ImageTransport>(node_);
113 filtered_depth_transport_ = std::make_unique<image_transport::ImageTransport>(node_);
114 filtered_label_transport_ = std::make_unique<image_transport::ImageTransport>(node_);
115
116 tf_buffer_ = monitor_->getTFClient();
117 free_space_updater_ = std::make_unique<LazyFreeSpaceUpdater>(tree_);
118
119 // create our mesh filter
120 mesh_filter_ = std::make_unique<mesh_filter::MeshFilter<mesh_filter::StereoCameraModel>>(
122 mesh_filter_->parameters().setDepthRange(near_clipping_plane_distance_, far_clipping_plane_distance_);
123 mesh_filter_->setShadowThreshold(shadow_threshold_);
124 mesh_filter_->setPaddingOffset(padding_offset_);
125 mesh_filter_->setPaddingScale(padding_scale_);
126 mesh_filter_->setTransformCallback(
127 [this](mesh_filter::MeshHandle mesh, Eigen::Isometry3d& tf) { return getShapeTransform(mesh, tf); });
128
129 return true;
130}
131
133{
134 pub_model_depth_image_ = model_depth_transport_->advertiseCamera("model_depth", 1);
135
136 std::string prefix = "";
137 if (!ns_.empty())
138 prefix = ns_ + "/";
139
140 pub_model_depth_image_ = model_depth_transport_->advertiseCamera(prefix + "model_depth", 1);
141 if (!filtered_cloud_topic_.empty())
142 {
143 pub_filtered_depth_image_ = filtered_depth_transport_->advertiseCamera(prefix + filtered_cloud_topic_, 1);
144 }
145 else
146 {
147 pub_filtered_depth_image_ = filtered_depth_transport_->advertiseCamera(prefix + "filtered_depth", 1);
148 }
149
150 pub_filtered_label_image_ = filtered_label_transport_->advertiseCamera(prefix + "filtered_label", 1);
151
152 sub_depth_image_ = image_transport::create_camera_subscription(
153 node_.get(), image_topic_,
154 [this](const sensor_msgs::msg::Image::ConstSharedPtr& depth_msg,
155 const sensor_msgs::msg::CameraInfo::ConstSharedPtr& info_msg) {
156 return depthImageCallback(depth_msg, info_msg);
157 },
158 "raw", rmw_qos_profile_sensor_data);
159}
160
162{
163 sub_depth_image_.shutdown();
164}
165
167{
169 if (mesh_filter_)
170 {
171 if (shape->type == shapes::MESH)
172 {
173 h = mesh_filter_->addMesh(static_cast<const shapes::Mesh&>(*shape));
174 }
175 else
176 {
177 std::unique_ptr<shapes::Mesh> m(shapes::createMeshFromShape(shape.get()));
178 if (m)
179 h = mesh_filter_->addMesh(*m);
180 }
181 }
182 else
183 RCLCPP_ERROR(logger_, "Mesh filter not yet initialized!");
184 return h;
185}
186
188{
189 if (mesh_filter_)
190 mesh_filter_->removeMesh(handle);
191}
192
193bool DepthImageOctomapUpdater::getShapeTransform(mesh_filter::MeshHandle h, Eigen::Isometry3d& transform) const
194{
195 ShapeTransformCache::const_iterator it = transform_cache_.find(h);
196 if (it == transform_cache_.end())
197 {
198 RCLCPP_ERROR(logger_, "Internal error. Mesh filter handle %u not found", h);
199 return false;
200 }
201 transform = it->second;
202 return true;
203}
204
205namespace
206{
207const bool HOST_IS_BIG_ENDIAN = []() {
208 union
209 {
210 uint32_t i;
211 char c[sizeof(uint32_t)];
212 } bint = { 0x01020304 };
213 return bint.c[0] == 1;
214}();
215} // namespace
216
217void DepthImageOctomapUpdater::depthImageCallback(const sensor_msgs::msg::Image::ConstSharedPtr& depth_msg,
218 const sensor_msgs::msg::CameraInfo::ConstSharedPtr& info_msg)
219{
220 RCLCPP_DEBUG(logger_, "Received a new depth image message (frame = '%s', encoding='%s')",
221 depth_msg->header.frame_id.c_str(), depth_msg->encoding.c_str());
222 rclcpp::Time start = node_->now();
223
224 if (max_update_rate_ > 0)
225 {
226 // ensure we are not updating the octomap representation too often
227 if (node_->now() - last_update_time_ <= rclcpp::Duration::from_seconds(1.0 / max_update_rate_))
228 return;
229 last_update_time_ = node_->now();
230 }
231
232 // measure the frequency at which we receive updates
233 if (image_callback_count_ < 1000)
234 {
235 if (image_callback_count_ > 0)
236 {
237 const double dt_start = (start - last_depth_callback_start_).seconds();
238 if (image_callback_count_ < 2)
239 {
240 average_callback_dt_ = dt_start;
241 }
242 else
243 {
244 average_callback_dt_ = ((image_callback_count_ - 1) * average_callback_dt_ + dt_start) /
245 static_cast<double>(image_callback_count_);
246 }
247 }
248 }
249 else
250 {
251 // every 1000 updates we reset the counter almost to the beginning (use 2 so we don't have so much of a ripple in
252 // the measured average)
253 image_callback_count_ = 2;
254 }
255 last_depth_callback_start_ = start;
256 ++image_callback_count_;
257
258 if (monitor_->getMapFrame().empty())
259 monitor_->setMapFrame(depth_msg->header.frame_id);
260
261 /* get transform for cloud into map frame */
262 tf2::Stamped<tf2::Transform> map_h_sensor;
263 if (monitor_->getMapFrame() == depth_msg->header.frame_id)
264 {
265 map_h_sensor.setIdentity();
266 }
267 else
268 {
269 if (tf_buffer_)
270 {
271 // wait at most 50ms
272 static const double TEST_DT = 0.005;
273 const int nt =
274 static_cast<int>((0.5 + average_callback_dt_ / TEST_DT) * std::max(1, (static_cast<int>(queue_size_) / 2)));
275 bool found = false;
276 std::string err;
277 for (int t = 0; t < nt; ++t)
278 {
279 try
280 {
281 tf2::fromMsg(tf_buffer_->lookupTransform(monitor_->getMapFrame(), depth_msg->header.frame_id,
282 depth_msg->header.stamp),
283 map_h_sensor);
284 found = true;
285 break;
286 }
287 catch (tf2::TransformException& ex)
288 {
289 std::chrono::duration<double, std::nano> tmp_duration(TEST_DT);
290 static const rclcpp::Duration D(tmp_duration);
291 err = ex.what();
292 std::this_thread::sleep_for(D.to_chrono<std::chrono::seconds>());
293 }
294 }
295 static const unsigned int MAX_TF_COUNTER = 1000; // so we avoid int overflow
296 if (found)
297 {
298 good_tf_++;
299 if (good_tf_ > MAX_TF_COUNTER)
300 {
301 const unsigned int div = MAX_TF_COUNTER / 10;
302 good_tf_ /= div;
303 failed_tf_ /= div;
304 }
305 }
306 else
307 {
308 failed_tf_++;
309 if (failed_tf_ > good_tf_)
310 {
311#pragma GCC diagnostic push
312#pragma GCC diagnostic ignored "-Wold-style-cast"
313 RCLCPP_WARN_THROTTLE(logger_, *node_->get_clock(), 1000,
314 "More than half of the image messages discarded due to TF being unavailable (%u%%). "
315 "Transform error of sensor data: %s; quitting callback.",
316 (100 * failed_tf_) / (good_tf_ + failed_tf_), err.c_str());
317#pragma GCC diagnostic pop
318 }
319 else
320 {
321#pragma GCC diagnostic push
322#pragma GCC diagnostic ignored "-Wold-style-cast"
323 RCLCPP_DEBUG_THROTTLE(logger_, *node_->get_clock(), 1000,
324 "Transform error of sensor data: %s; quitting callback", err.c_str());
325#pragma GCC diagnostic pop
326 }
327 if (failed_tf_ > MAX_TF_COUNTER)
328 {
329 const unsigned int div = MAX_TF_COUNTER / 10;
330 good_tf_ /= div;
331 failed_tf_ /= div;
332 }
333 return;
334 }
335 }
336 else
337 return;
338 }
339
340 if (!updateTransformCache(depth_msg->header.frame_id, depth_msg->header.stamp))
341 return;
342
343 if (depth_msg->is_bigendian && !HOST_IS_BIG_ENDIAN)
344 {
345#pragma GCC diagnostic push
346#pragma GCC diagnostic ignored "-Wold-style-cast"
347 RCLCPP_ERROR_THROTTLE(logger_, *node_->get_clock(), 1000, "endian problem: received image data does not match host");
348#pragma GCC diagnostic pop
349 }
350
351 const int w = depth_msg->width;
352 const int h = depth_msg->height;
353
354 // call the mesh filter
355 mesh_filter::StereoCameraModel::Parameters& params = mesh_filter_->parameters();
356 params.setCameraParameters(info_msg->k[0], info_msg->k[4], info_msg->k[2], info_msg->k[5]);
357 params.setImageSize(w, h);
358
359 const bool is_u_short = depth_msg->encoding == sensor_msgs::image_encodings::TYPE_16UC1;
360 if (is_u_short)
361 {
362 mesh_filter_->filter(&depth_msg->data[0], GL_UNSIGNED_SHORT);
363 }
364 else
365 {
366 if (depth_msg->encoding != sensor_msgs::image_encodings::TYPE_32FC1)
367 {
368#pragma GCC diagnostic push
369#pragma GCC diagnostic ignored "-Wold-style-cast"
370 RCLCPP_ERROR_THROTTLE(logger_, *node_->get_clock(), 1000, "Unexpected encoding type: '%s'. Ignoring input.",
371 depth_msg->encoding.c_str());
372#pragma GCC diagnostic pop
373 return;
374 }
375 mesh_filter_->filter(&depth_msg->data[0], GL_FLOAT);
376 }
377
378 // the mesh filter runs in background; compute extra things in the meantime
379
380 // Use correct principal point from calibration
381 const double px = info_msg->k[2];
382 const double py = info_msg->k[5];
383
384 // if the camera parameters have changed at all, recompute the cache we had
385 if (w >= static_cast<int>(x_cache_.size()) || h >= static_cast<int>(y_cache_.size()) || K2_ != px || K5_ != py ||
386 K0_ != info_msg->k[0] || K4_ != info_msg->k[4])
387 {
388 K2_ = px;
389 K5_ = py;
390 K0_ = info_msg->k[0];
391 K4_ = info_msg->k[4];
392
393 inv_fx_ = 1.0 / K0_;
394 inv_fy_ = 1.0 / K4_;
395
396 // if there are any NaNs, discard data
397 if (isnan(px) || isnan(py) || isnan(inv_fx_) || isnan(inv_fy_))
398 return;
399
400 // Pre-compute some constants
401 if (static_cast<int>(x_cache_.size()) < w)
402 x_cache_.resize(w);
403 if (static_cast<int>(y_cache_.size()) < h)
404 y_cache_.resize(h);
405
406 for (int x = 0; x < w; ++x)
407 x_cache_[x] = (x - px) * inv_fx_;
408
409 for (int y = 0; y < h; ++y)
410 y_cache_[y] = (y - py) * inv_fy_;
411 }
412
413 const octomap::point3d sensor_origin(map_h_sensor.getOrigin().getX(), map_h_sensor.getOrigin().getY(),
414 map_h_sensor.getOrigin().getZ());
415
416 octomap::KeySet* occupied_cells_ptr = new octomap::KeySet();
417 octomap::KeySet* model_cells_ptr = new octomap::KeySet();
418 octomap::KeySet& occupied_cells = *occupied_cells_ptr;
419 octomap::KeySet& model_cells = *model_cells_ptr;
420
421 // allocate memory if needed
422 std::size_t img_size = h * w;
423 if (filtered_labels_.size() < img_size)
424 filtered_labels_.resize(img_size);
425
426 // get the labels of the filtered data
427 const unsigned int* labels_row = &filtered_labels_[0];
428 mesh_filter_->getFilteredLabels(&filtered_labels_[0]);
429
430 // publish debug information if needed
431 if (debug_info_)
432 {
433 sensor_msgs::msg::Image debug_msg;
434 debug_msg.header = depth_msg->header;
435 debug_msg.height = h;
436 debug_msg.width = w;
437 debug_msg.is_bigendian = HOST_IS_BIG_ENDIAN;
438 debug_msg.encoding = sensor_msgs::image_encodings::TYPE_32FC1;
439 debug_msg.step = w * sizeof(float);
440 debug_msg.data.resize(img_size * sizeof(float));
441 mesh_filter_->getModelDepth(reinterpret_cast<float*>(&debug_msg.data[0]));
442 pub_model_depth_image_.publish(debug_msg, *info_msg);
443
444 sensor_msgs::msg::Image filtered_depth_msg;
445 filtered_depth_msg.header = depth_msg->header;
446 filtered_depth_msg.height = h;
447 filtered_depth_msg.width = w;
448 filtered_depth_msg.is_bigendian = HOST_IS_BIG_ENDIAN;
449 filtered_depth_msg.encoding = sensor_msgs::image_encodings::TYPE_32FC1;
450 filtered_depth_msg.step = w * sizeof(float);
451 filtered_depth_msg.data.resize(img_size * sizeof(float));
452 mesh_filter_->getFilteredDepth(reinterpret_cast<float*>(&filtered_depth_msg.data[0]));
453 pub_filtered_depth_image_.publish(filtered_depth_msg, *info_msg);
454
455 sensor_msgs::msg::Image label_msg;
456 label_msg.header = depth_msg->header;
457 label_msg.height = h;
458 label_msg.width = w;
459 label_msg.is_bigendian = HOST_IS_BIG_ENDIAN;
460 label_msg.encoding = sensor_msgs::image_encodings::RGBA8;
461 label_msg.step = w * sizeof(unsigned int);
462 label_msg.data.resize(img_size * sizeof(unsigned int));
463 mesh_filter_->getFilteredLabels(reinterpret_cast<unsigned int*>(&label_msg.data[0]));
464
465 pub_filtered_label_image_.publish(label_msg, *info_msg);
466 }
467
468 if (!filtered_cloud_topic_.empty())
469 {
470 sensor_msgs::msg::Image filtered_msg;
471 filtered_msg.header = depth_msg->header;
472 filtered_msg.height = h;
473 filtered_msg.width = w;
474 filtered_msg.is_bigendian = HOST_IS_BIG_ENDIAN;
475 filtered_msg.encoding = sensor_msgs::image_encodings::TYPE_16UC1;
476 filtered_msg.step = w * sizeof(unsigned short);
477 filtered_msg.data.resize(img_size * sizeof(unsigned short));
478
479 // reuse float buffer across callbacks
480 static std::vector<float> filtered_data;
481 if (filtered_data.size() < img_size)
482 filtered_data.resize(img_size);
483
484 mesh_filter_->getFilteredDepth(reinterpret_cast<float*>(&filtered_data[0]));
485 unsigned short* msg_data = reinterpret_cast<unsigned short*>(&filtered_msg.data[0]);
486 for (std::size_t i = 0; i < img_size; ++i)
487 {
488 // rescale depth to millimeter to work with `unsigned short`
489 msg_data[i] = static_cast<unsigned short>(filtered_data[i] * 1000 + 0.5);
490 }
491 pub_filtered_depth_image_.publish(filtered_msg, *info_msg);
492 }
493
494 // figure out occupied cells and model cells
495 tree_->lockRead();
496
497 try
498 {
499 const int h_bound = h - skip_vertical_pixels_;
500 const int w_bound = w - skip_horizontal_pixels_;
501
502 if (is_u_short)
503 {
504 const uint16_t* input_row = reinterpret_cast<const uint16_t*>(&depth_msg->data[0]);
505
506 for (int y = skip_vertical_pixels_; y < h_bound; ++y, labels_row += w, input_row += w)
507 {
508 for (int x = skip_horizontal_pixels_; x < w_bound; ++x)
509 {
510 // not filtered
511 if (labels_row[x] == mesh_filter::MeshFilterBase::BACKGROUND)
512 {
513 float zz = static_cast<float>(input_row[x]) * 1e-3; // scale from mm to m
514 float yy = y_cache_[y] * zz;
515 float xx = x_cache_[x] * zz;
516 /* transform to map frame */
517 tf2::Vector3 point_tf = map_h_sensor * tf2::Vector3(xx, yy, zz);
518 occupied_cells.insert(tree_->coordToKey(point_tf.getX(), point_tf.getY(), point_tf.getZ()));
519 }
520 // on far plane or a model point -> remove
521 else if (labels_row[x] >= mesh_filter::MeshFilterBase::FAR_CLIP)
522 {
523 float zz = input_row[x] * 1e-3;
524 float yy = y_cache_[y] * zz;
525 float xx = x_cache_[x] * zz;
526 /* transform to map frame */
527 tf2::Vector3 point_tf = map_h_sensor * tf2::Vector3(xx, yy, zz);
528 // add to the list of model cells
529 model_cells.insert(tree_->coordToKey(point_tf.getX(), point_tf.getY(), point_tf.getZ()));
530 }
531 }
532 }
533 }
534 else
535 {
536 const float* input_row = reinterpret_cast<const float*>(&depth_msg->data[0]);
537
538 for (int y = skip_vertical_pixels_; y < h_bound; ++y, labels_row += w, input_row += w)
539 {
540 for (int x = skip_horizontal_pixels_; x < w_bound; ++x)
541 {
542 if (labels_row[x] == mesh_filter::MeshFilterBase::BACKGROUND)
543 {
544 float zz = input_row[x];
545 float yy = y_cache_[y] * zz;
546 float xx = x_cache_[x] * zz;
547 /* transform to map frame */
548 tf2::Vector3 point_tf = map_h_sensor * tf2::Vector3(xx, yy, zz);
549 occupied_cells.insert(tree_->coordToKey(point_tf.getX(), point_tf.getY(), point_tf.getZ()));
550 }
551 else if (labels_row[x] >= mesh_filter::MeshFilterBase::FAR_CLIP)
552 {
553 float zz = input_row[x];
554 float yy = y_cache_[y] * zz;
555 float xx = x_cache_[x] * zz;
556 /* transform to map frame */
557 tf2::Vector3 point_tf = map_h_sensor * tf2::Vector3(xx, yy, zz);
558 // add to the list of model cells
559 model_cells.insert(tree_->coordToKey(point_tf.getX(), point_tf.getY(), point_tf.getZ()));
560 }
561 }
562 }
563 }
564 }
565 catch (...)
566 {
567 tree_->unlockRead();
568 RCLCPP_ERROR(logger_, "Internal error while parsing depth data");
569 return;
570 }
571 tree_->unlockRead();
572
573 /* cells that overlap with the model are not occupied */
574 for (const octomap::OcTreeKey& model_cell : model_cells)
575 occupied_cells.erase(model_cell);
576
577 // mark occupied cells
578 tree_->lockWrite();
579 try
580 {
581 /* now mark all occupied cells */
582 for (const octomap::OcTreeKey& occupied_cell : occupied_cells)
583 tree_->updateNode(occupied_cell, true);
584 }
585 catch (...)
586 {
587 RCLCPP_ERROR(logger_, "Internal error while updating octree");
588 }
589 tree_->unlockWrite();
590 tree_->triggerUpdateCallback();
591
592 // at this point we still have not freed the space
593 free_space_updater_->pushLazyUpdate(occupied_cells_ptr, model_cells_ptr, sensor_origin);
594
595 RCLCPP_DEBUG(logger_, "Processed depth image in %lf ms", (node_->now() - start).seconds() * 1000.0);
596}
597} // namespace occupancy_map_monitor
std::function< bool(MeshHandle, Eigen::Isometry3d &)> TransformCallback
void setImageSize(unsigned width, unsigned height)
sets the image size
Parameters for Stereo-like devices.
void setCameraParameters(float fx, float fy, float cx, float cy)
sets the camera parameters of the pinhole camera where the disparities were obtained....
static const StereoCameraModel::Parameters & REGISTERED_PSDK_PARAMS
predefined sensor model for OpenNI compatible devices (e.g., PrimeSense, Kinect, Asus Xtion)
bool initialize(const rclcpp::Node::SharedPtr &node) override
Do any necessary setup (subscribe to ros topics, etc.). This call assumes setMonitor() and setParams(...
ShapeHandle excludeShape(const shapes::ShapeConstPtr &shape) override
bool setParams(const std::string &name_space) override
Set updater params using struct that comes from parsing a yaml string. This must be called after setM...
const std::shared_ptr< tf2_ros::Buffer > & getTFClient() const
Gets the tf client.
const std::string & getMapFrame() const
Gets the map frame (this is set either by the constor or a parameter).
void setMapFrame(const std::string &frame)
Sets the map frame.
Base class for classes which update the occupancy map.
collision_detection::OccMapTreePtr tree_
bool updateTransformCache(const std::string &target_frame, const rclcpp::Time &target_time)
unsigned int MeshHandle
Main namespace for MoveIt.
Definition exceptions.h:43