55 srv_ = boost::make_shared <dynamic_reconfigure::Server<ExtractPolygonalPrismDataConfig> > (*pnh_);
57 srv_->setCallback (f);
117 double height_min, height_max;
118 impl_.getHeightLimits (height_min, height_max);
119 if (height_min != config.height_min)
121 height_min = config.height_min;
122 NODELET_DEBUG (
"[%s::config_callback] Setting new minimum height to the planar model to: %f.",
getName ().c_str (), height_min);
123 impl_.setHeightLimits (height_min, height_max);
125 if (height_max != config.height_max)
127 height_max = config.height_max;
128 NODELET_DEBUG (
"[%s::config_callback] Setting new maximum height to the planar model to: %f.",
getName ().c_str (), height_max);
129 impl_.setHeightLimits (height_min, height_max);
145 pcl_msgs::PointIndices inliers;
146 inliers.header =
fromPCL(cloud->header);
156 if (indices && !
isValid (indices))
166 " - PointCloud with %d data points (%s), stamp %f, and frame %s on topic %s received.\n" 167 " - PointCloud with %d data points (%s), stamp %f, and frame %s on topic %s received.\n" 168 " - PointIndices with %zu values, stamp %f, and frame %s on topic %s received.",
170 cloud->width * cloud->height,
pcl::getFieldsList (*cloud).c_str (),
fromPCL(cloud->header).stamp.toSec (), cloud->header.frame_id.c_str (),
pnh_->resolveName (
"input").c_str (),
171 hull->width * hull->height,
pcl::getFieldsList (*hull).c_str (),
fromPCL(hull->header).stamp.toSec (), hull->header.frame_id.c_str (),
pnh_->resolveName (
"planar_hull").c_str (),
172 indices->indices.size (), indices->header.stamp.toSec (), indices->header.frame_id.c_str (),
pnh_->resolveName (
"indices").c_str ());
175 " - PointCloud with %d data points (%s), stamp %f, and frame %s on topic %s received.\n" 176 " - PointCloud with %d data points (%s), stamp %f, and frame %s on topic %s received.",
178 cloud->width * cloud->height,
pcl::getFieldsList (*cloud).c_str (),
fromPCL(cloud->header).stamp.toSec (), cloud->header.frame_id.c_str (),
pnh_->resolveName (
"input").c_str (),
179 hull->width * hull->height,
pcl::getFieldsList (*hull).c_str (),
fromPCL(hull->header).stamp.toSec (), hull->header.frame_id.c_str (),
pnh_->resolveName (
"planar_hull").c_str ());
182 if (cloud->header.frame_id != hull->header.frame_id)
184 NODELET_DEBUG (
"[%s::input_hull_callback] Planar hull has a different TF frame (%s) than the input point cloud (%s)! Using TF to transform.",
getName ().c_str (), hull->header.frame_id.c_str (), cloud->header.frame_id.c_str ());
192 impl_.setInputPlanarHull (
pcl_ptr(planar_hull.makeShared ()));
198 if (indices && !indices->header.frame_id.empty ())
199 indices_ptr.reset (
new std::vector<int> (indices->indices));
202 impl_.setIndices (indices_ptr);
205 if (!cloud->points.empty ()) {
206 pcl::PointIndices pcl_inliers;
208 impl_.segment (pcl_inliers);
212 inliers.header =
fromPCL(cloud->header);
214 NODELET_DEBUG (
"[%s::input_hull_callback] Publishing %zu indices.",
getName ().c_str (), inliers.indices.size ());
std::string getFieldsList(const sensor_msgs::PointCloud2 &cloud)
#define NODELET_ERROR(...)
virtual void onInit()
Nodelet initialization routine. Reads in global parameters used by all nodelets.
message_filters::Subscriber< PointIndices > sub_indices_filter_
The message filter subscriber for PointIndices.
bool isValid(const PointCloud2::ConstPtr &cloud, const std::string &topic_name="input")
Test whether a given PointCloud message is "valid" (i.e., has points, and width and height are non-ze...
const std::string & getName() const
void publish(const boost::shared_ptr< M > &message) const
pcl::PointCloud< pcl::PointXYZ > PointCloud
tf::TransformListener tf_listener_
TF listener object.
void subscribe(ros::NodeHandle &nh, const std::string &topic, uint32_t queue_size, const ros::TransportHints &transport_hints=ros::TransportHints(), ros::CallbackQueueInterface *callback_queue=0)
void transformPointCloud(const pcl::PointCloud< PointT > &cloud_in, pcl::PointCloud< PointT > &cloud_out, const tf::Transform &transform)
Apply a rigid transform defined by a 3D offset and a quaternion.
bool approximate_sync_
True if we use an approximate time synchronizer versus an exact one (false by default).
pcl::IndicesPtr IndicesPtr
int max_queue_size_
The maximum queue size (default: 3).
void moveFromPCL(pcl::PCLImage &pcl_image, sensor_msgs::Image &image)
void fromPCL(const std::uint64_t &pcl_stamp, ros::Time &stamp)
uint32_t getNumSubscribers() const
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)
boost::shared_ptr< T > pcl_ptr(const boost::shared_ptr< T > &p)
#define NODELET_DEBUG(...)
bool use_indices_
Set to true if point indices are used.
void moveToPCL(sensor_msgs::Image &image, pcl::PCLImage &pcl_image)
PointIndices::ConstPtr PointIndicesConstPtr
message_filters::Subscriber< PointCloud > sub_input_filter_
The message filter subscriber for PointCloud2.
Connection registerCallback(const C &callback)