22#ifndef _LIBS_PCL_UTILS_UTILS_H_
23#define _LIBS_PCL_UTILS_UTILS_H_
25#include "compatibility.h"
27#include <config/config.h>
28#include <core/utils/refptr.h>
29#include <pcl/console/print.h>
30#include <pcl/point_cloud.h>
31#include <utils/time/time.h>
53 pcl::console::setVerbosityLevel(pcl::console::L_ALWAYS);
64 bool pcl_shutup =
false;
66 pcl_shutup = config->
get_bool(
"/pcl/shutup");
67 }
catch (Exception &e) {
70 ::fawkes::pcl_utils::shutup();
79template <
typename Po
intT>
83#if PCL_VERSION_COMPARE(>=, 1, 7, 0)
84 cloud.header.stamp = time.
in_usec();
86# if defined(HAVE_ROS_PCL) || defined(ROSCPP_TYPES_H)
87 cloud.header.stamp.sec = time.
get_sec();
88 cloud.header.stamp.nsec = time.
get_usec() * 1000;
90 PointCloudTimestamp pclts;
91 pclts.time.sec = time.
get_sec();
93 cloud.header.stamp = pclts.timestamp;
104template <
typename Po
intT>
108 set_time<PointT>(**cloud, time);
117template <
typename CloudPtrT>
121 set_time<typename CloudPtrT::element_type::PointType>(*cloud, time);
130template <
typename CloudPtrT>
134#if PCL_VERSION_COMPARE(>=, 1, 7, 0)
135 time.
set_time(cloud->header.stamp / 1000000U, cloud->header.stamp % 1000000);
137# if defined(HAVE_ROS_PCL) || defined(ROSCPP_TYPES_H)
138 time.
set_time(cloud->header.stamp.sec, cloud->header.stamp.nsec / 1000);
140 PointCloudTimestamp pclts;
141 pclts.timestamp = cloud->header.stamp;
142 time.
set_time(pclts.time.sec, pclts.time.usec);
153template <
typename Po
intT>
157#if PCL_VERSION_COMPARE(>=, 1, 7, 0)
158 time.
set_time(cloud.header.stamp / 1000000U, cloud.header.stamp % 1000000);
160# if defined(HAVE_ROS_PCL) || defined(ROSCPP_TYPES_H)
161 time.
set_time(cloud.header.stamp.sec, cloud.header.stamp.nsec / 1000);
163 PointCloudTimestamp pclts;
164 pclts.timestamp = cloud.header.stamp;
165 time.
set_time(pclts.time.sec, pclts.time.usec);
174template <
typename CloudPtrT,
typename Po
intT2>
178 to->header.stamp = from->header.stamp;
192 template <
typename T>
199template <
typename Po
intT>
206template <
typename Po
intT>
Interface for configuration handling.
virtual bool get_bool(const char *path)=0
Get value from configuration which is of type bool.
RefPtr<> is a reference-counting shared smartpointer.
A class for handling time.
long get_usec() const
Get microseconds.
long in_usec() const
Convert the stored time into micro-seconds.
void set_time(const timeval *tv)
Sets the time.
long get_sec() const
Get seconds.
Fawkes library namespace.
Helper struct to avoid deletion of PointClouds.
void operator()(T *)
Delete operator that does nothing.
Union to pack fawkes::Time into the pcl::PointCloud timestamp.
uint64_t timestamp
Access timestamp as number only.
uint64_t sec
seconds part of time
uint64_t usec
microseconds part of time