38 #include <pcl/io/io.h> 68 filter (input, indices, output);
70 PointCloud2::Ptr cloud_tf (
new PointCloud2 (output));
82 cloud_tf.reset (
new PointCloud2 (cloud_transformed));
95 cloud_tf.reset (
new PointCloud2 (cloud_transformed));
99 cloud_tf->header.stamp = input->header.stamp;
155 bool has_service =
false;
167 srv_ = boost::make_shared <dynamic_reconfigure::Server<pcl_ros::FilterConfig> > (*pnh_);
168 dynamic_reconfigure::Server<pcl_ros::FilterConfig>::CallbackType
f = boost::bind (&
Filter::config_callback,
this, _1, _2);
169 srv_->setCallback (f);
203 if (indices && !
isValid (indices))
212 " - PointCloud with %d data points (%s), stamp %f, and frame %s on topic %s received.\n" 213 " - PointIndices with %zu values, stamp %f, and frame %s on topic %s received.",
215 cloud->width * cloud->height,
pcl::getFieldsList (*cloud).c_str (), cloud->header.stamp.toSec (), cloud->header.frame_id.c_str (),
pnh_->resolveName (
"input").c_str (),
216 indices->indices.size (), indices->header.stamp.toSec (), indices->header.frame_id.c_str (),
pnh_->resolveName (
"indices").c_str ());
218 NODELET_DEBUG (
"[%s::input_indices_callback] PointCloud with %d data points and frame %s on topic %s received.",
getName ().c_str (), cloud->width * cloud->height, cloud->header.frame_id.c_str (),
pnh_->resolveName (
"input").c_str ());
223 PointCloud2::ConstPtr cloud_tf;
232 NODELET_ERROR (
"[%s::input_indices_callback] Error converting input dataset from %s to %s.",
getName ().c_str (), cloud->header.frame_id.c_str (),
tf_input_frame_.c_str ());
235 cloud_tf = boost::make_shared<PointCloud2> (cloud_transformed);
243 vindices.reset (
new std::vector<int> (indices->indices));
virtual void onInit()
Nodelet initialization routine.
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.
void publish(const boost::shared_ptr< M > &message) const
boost::shared_ptr< dynamic_reconfigure::Server< pcl_ros::FilterConfig > > srv_
Pointer to a dynamic reconfigure service.
virtual void config_callback(pcl_ros::FilterConfig &config, uint32_t level)
Dynamic reconfigure service callback.
boost::shared_ptr< message_filters::Synchronizer< sync_policies::ApproximateTime< PointCloud2, PointIndices > > > sync_input_indices_a_
std::string tf_input_frame_
The input TF frame the data should be transformed into, if input.header.frame_id is different...
std::string tf_output_frame_
The output TF frame the data should be transformed into, if input.header.frame_id is different...
const std::string & getName() const
message_filters::Subscriber< PointIndices > sub_indices_filter_
The message filter subscriber for PointIndices.
std::string tf_input_orig_frame_
The original data input TF frame.
virtual void unsubscribe()
Lazy transport unsubscribe routine.
sensor_msgs::PointCloud2 PointCloud2
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...
virtual void filter(const PointCloud2::ConstPtr &input, const IndicesPtr &indices, PointCloud2 &output)=0
Virtual abstract filter method. To be implemented by every child.
virtual bool child_init(ros::NodeHandle &nh, bool &has_service)
Child initialization routine.
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).
void input_indices_callback(const PointCloud2::ConstPtr &cloud, const PointIndicesConstPtr &indices)
PointCloud2 + Indices data callback.
message_filters::Subscriber< PointCloud2 > sub_input_filter_
int max_queue_size_
The maximum queue size (default: 3).
ros::Publisher pub_output_
The output PointCloud publisher.
boost::shared_ptr< message_filters::Synchronizer< sync_policies::ExactTime< PointCloud2, PointIndices > > > sync_input_indices_e_
Synchronized input, and indices.
#define NODELET_DEBUG(...)
void computePublish(const PointCloud2::ConstPtr &input, const IndicesPtr &indices)
Call the child filter () method, optionally transform the result, and publish it. ...
bool use_indices_
Set to true if point indices are used.
PointIndices::ConstPtr PointIndicesConstPtr
ros::Subscriber sub_input_
The input PointCloud subscriber.
virtual void subscribe()
Lazy transport subscribe routine.