22 #ifndef _LIBS_PCL_UTILS_UTILS_H_ 23 #define _LIBS_PCL_UTILS_UTILS_H_ 25 #include <config/config.h> 26 #include <core/utils/refptr.h> 27 #include <pcl/console/print.h> 28 #include <pcl/point_cloud.h> 29 #include <utils/time/time.h> 51 pcl::console::setVerbosityLevel(pcl::console::L_ALWAYS);
62 bool pcl_shutup =
false;
64 pcl_shutup = config->
get_bool(
"/pcl/shutup");
65 }
catch (Exception &e) {
68 ::fawkes::pcl_utils::shutup();
77 template <
typename Po
intT>
81 #if defined(HAVE_ROS_PCL) || defined(ROSCPP_TYPES_H) 82 cloud.header.stamp.sec = time.
get_sec();
83 cloud.header.stamp.nsec = time.
get_usec() * 1000;
85 # if PCL_VERSION_COMPARE(>=, 1, 7, 0) 86 cloud.header.stamp = time.
in_usec();
88 PointCloudTimestamp pclts;
89 pclts.time.sec = time.
get_sec();
91 cloud.header.stamp = pclts.timestamp;
102 template <
typename Po
intT>
106 set_time<PointT>(**cloud, time);
115 template <
typename Po
intT>
119 set_time<PointT>(*cloud, time);
128 template <
typename Po
intT>
132 #if defined(HAVE_ROS_PCL) || defined(ROSCPP_TYPES_H) 133 time.
set_time(cloud->header.stamp.sec, cloud->header.stamp.nsec / 1000);
135 # if PCL_VERSION_COMPARE(>=, 1, 7, 0) 136 time.
set_time(cloud->header.stamp / 1000000U, cloud->header.stamp % 1000000);
138 PointCloudTimestamp pclts;
139 pclts.timestamp = cloud->header.stamp;
140 time.
set_time(pclts.time.sec, pclts.time.usec);
151 template <
typename Po
intT>
155 #if defined(HAVE_ROS_PCL) || defined(ROSCPP_TYPES_H) 156 time.
set_time(cloud->header.stamp.sec, cloud->header.stamp.nsec / 1000);
158 # if PCL_VERSION_COMPARE(>=, 1, 7, 0) 159 time.
set_time(cloud->header.stamp / 1000000U, cloud->header.stamp % 1000000);
161 PointCloudTimestamp pclts;
162 pclts.timestamp = cloud->header.stamp;
163 time.
set_time(pclts.time.sec, pclts.time.usec);
174 template <
typename Po
intT>
178 #if defined(HAVE_ROS_PCL) || defined(ROSCPP_TYPES_H) 179 time.
set_time(cloud.header.stamp.sec, cloud.header.stamp.nsec / 1000);
181 # if PCL_VERSION_COMPARE(>=, 1, 7, 0) 182 time.
set_time(cloud.header.stamp / 1000000U, cloud.header.stamp % 1000000);
184 PointCloudTimestamp pclts;
185 pclts.timestamp = cloud.header.stamp;
186 time.
set_time(pclts.time.sec, pclts.time.usec);
197 template <
typename Po
intT>
201 #if defined(HAVE_ROS_PCL) || defined(ROSCPP_TYPES_H) 202 time.
set_time(cloud->header.stamp.sec, cloud->header.stamp.nsec / 1000);
204 # if PCL_VERSION_COMPARE(>=, 1, 7, 0) 205 time.
set_time(cloud->header.stamp / 1000000U, cloud->header.stamp % 1000000);
207 PointCloudTimestamp pclts;
208 pclts.timestamp = cloud->header.stamp;
209 time.
set_time(pclts.time.sec, pclts.time.usec);
220 template <
typename Po
intT>
224 #if defined(HAVE_ROS_PCL) || defined(ROSCPP_TYPES_H) 225 time.
set_time(cloud->header.stamp.sec, cloud->header.stamp.nsec / 1000);
227 # if PCL_VERSION_COMPARE(>=, 1, 7, 0) 228 time.
set_time(cloud->header.stamp / 1000000U, cloud->header.stamp % 1000000);
230 PointCloudTimestamp pclts;
231 pclts.timestamp = cloud->header.stamp;
232 time.
set_time(pclts.time.sec, pclts.time.usec);
241 template <
typename Po
intT1,
typename Po
intT2>
246 to->header.stamp = from->header.stamp;
253 template <
typename Po
intT1,
typename Po
intT2>
258 to->header.stamp = from->header.stamp;
265 template <
typename Po
intT1,
typename Po
intT2>
269 to->header.stamp = from->header.stamp;
284 template <
typename T>
291 template <
typename Po
intT>
295 return boost::shared_ptr<pcl::PointCloud<PointT>>(*in, PointCloudNonDeleter());
298 template <
typename Po
intT>
302 return boost::shared_ptr<const pcl::PointCloud<PointT>>(*in, PointCloudNonDeleter());
uint64_t sec
seconds part of time
Fawkes library namespace.
virtual bool get_bool(const char *path)=0
Get value from configuration which is of type bool.
uint64_t timestamp
Access timestamp as number only.
A class for handling time.
Union to pack fawkes::Time into the pcl::PointCloud timestamp.
uint64_t usec
microseconds part of time
void operator()(T *t)
Delete operator that does nothing.
Helper struct to avoid deletion of PointClouds.
long get_sec() const
Get seconds.
long get_usec() const
Get microseconds.
RefPtr<> is a reference-counting shared smartpointer.
void set_time(const timeval *tv)
Sets the time.
long in_usec() const
Convert the stored time into micro-seconds.
Interface for configuration handling.