40 #include <pcl/io/io.h> 55 NODELET_ERROR (
"[%s::onInit] Need a 'search_radius' parameter to be set before continuing!",
getName ().c_str ());
60 NODELET_ERROR (
"[%s::onInit] Need a 'spatial_locator' parameter to be set before continuing!",
getName ().c_str ());
65 srv_ = boost::make_shared<dynamic_reconfigure::Server<MLSConfig> > (*pnh_);
67 srv_->setCallback (f);
72 NODELET_DEBUG (
"[%s::onInit] Nodelet successfully created with the following parameters:\n" 73 " - use_indices : %s",
144 output.header = cloud->header;
149 if (indices && !
isValid (indices,
"indices"))
152 output.header = cloud->header;
160 " - PointCloud with %d data points (%s), stamp %f, and frame %s on topic %s received.\n" 161 " - PointIndices with %zu values, stamp %f, and frame %s on topic %s received.",
166 NODELET_DEBUG (
"[%s::input_callback] PointCloud with %d data points, stamp %f, and frame %s on topic %s received.",
getName ().c_str (), cloud->width * cloud->height,
fromPCL(cloud->header).stamp.toSec (), cloud->header.frame_id.c_str (),
getMTPrivateNodeHandle ().
resolveName (
"input").c_str ());
170 impl_.setInputCloud (cloud);
174 indices_ptr.reset (
new std::vector<int> (indices->indices));
176 impl_.setIndices (indices_ptr);
185 output.header = cloud->header;
187 normals->header = cloud->header;
ros::Subscriber sub_input_
The input PointCloud subscriber.
pcl::PointCloud< PointIn > PointCloudIn
std::string getFieldsList(const sensor_msgs::PointCloud2 &cloud)
boost::shared_ptr< message_filters::Synchronizer< sync_policies::ExactTime< PointCloudIn, PointIndices > > > sync_input_indices_e_
Synchronized input, and indices.
#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
std::string resolveName(const std::string &name, bool remap=true) const
int polynomial_order_
The order of the polynomial to be fit.
const std::string & getName() const
double gaussian_parameter_
How 'flat' should the neighbor weighting gaussian be (the smaller, the more local the fit)...
message_filters::Subscriber< PointIndices > sub_indices_filter_
The message filter subscriber for PointIndices.
void config_callback(MLSConfig &config, uint32_t level)
Dynamic reconfigure callback.
pcl::MovingLeastSquares< PointIn, NormalOut > impl_
The PCL implementation used.
void input_indices_callback(const PointCloudInConstPtr &cloud, const PointIndicesConstPtr &indices)
Input point cloud callback.
int spatial_locator_type_
Parameter for the spatial locator tree. By convention, the values represent: 0: ANN (Approximate Near...
pcl_ros::MovingLeastSquares MovingLeastSquares
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 subscribe()
LazyNodelet connection routine.
ros::NodeHandle & getMTPrivateNodeHandle() const
void fromPCL(const pcl::uint64_t &pcl_stamp, ros::Time &stamp)
double search_radius_
The nearest neighbors search radius for each point.
PointCloudIn::ConstPtr PointCloudInConstPtr
bool use_polynomial_fit_
The number of K nearest neighbors to use for each point.
virtual void onInit()
Nodelet initialization routine.
MovingLeastSquares represents a nodelet using the MovingLeastSquares implementation. The type of the output is the same as the input, it only smooths the XYZ coordinates according to the parameters. Normals are estimated at each point as well and published on a separate topic.
boost::shared_ptr< dynamic_reconfigure::Server< MLSConfig > > srv_
Pointer to a dynamic reconfigure service.
boost::shared_ptr< message_filters::Synchronizer< sync_policies::ApproximateTime< PointCloudIn, PointIndices > > > sync_input_indices_a_
PLUGINLIB_EXPORT_CLASS(CropBox, nodelet::Nodelet)
uint32_t getNumSubscribers() const
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)
ros::Publisher pub_normals_
The output PointCloud (containing the normals) publisher.
bool approximate_sync_
True if we use an approximate time synchronizer versus an exact one (false by default).
int max_queue_size_
The maximum queue size (default: 3).
ros::Publisher pub_output_
The output PointCloud publisher.
virtual void unsubscribe()
#define NODELET_DEBUG(...)
bool use_indices_
Set to true if point indices are used.
PointIndices::ConstPtr PointIndicesConstPtr
pcl::PointCloud< NormalOut > NormalCloudOut
message_filters::Subscriber< PointCloud > sub_input_filter_
The message filter subscriber for PointCloud2.