Migrate the ROS1 pcl_ros::CropBox filter to ROS2 (#401)

* Add squashed commit for CropBox filter

* Lint
This commit is contained in:
Andrew Symington
2023-02-21 12:51:13 -08:00
committed by GitHub
parent de15639154
commit bb871ac7f0
4 changed files with 207 additions and 84 deletions
+11 -20
View File
@@ -41,11 +41,9 @@
// PCL includes
#include <pcl/filters/crop_box.h>
#include <vector>
#include "pcl_ros/filters/filter.hpp"
// Dynamic reconfigure
#include "pcl_ros/CropBoxConfig.hpp"
namespace pcl_ros
{
/** \brief @b CropBox is a filter that allows the user to filter all the data inside of a given box.
@@ -57,9 +55,6 @@ namespace pcl_ros
class CropBox : public Filter
{
protected:
/** \brief Pointer to a dynamic reconfigure service. */
boost::shared_ptr<dynamic_reconfigure::Server<pcl_ros::CropBoxConfig>> srv_; // TODO(xxx)
/** \brief Call the actual filter.
* \param input the input point cloud dataset
* \param indices the input set of indices to use from \a input
@@ -67,10 +62,10 @@ protected:
*/
inline void
filter(
const PointCloud2::ConstPtr & input, const IndicesPtr & indices,
PointCloud2 & output)
const PointCloud2::ConstSharedPtr & input, const IndicesPtr & indices,
PointCloud2 & output) override
{
boost::mutex::scoped_lock lock(mutex_);
std::lock_guard<std::mutex> lock(mutex_);
pcl::PCLPointCloud2::Ptr pcl_input(new pcl::PCLPointCloud2);
pcl_conversions::toPCL(*(input), *(pcl_input));
impl_.setInputCloud(pcl_input);
@@ -80,19 +75,13 @@ protected:
pcl_conversions::moveFromPCL(pcl_output, output);
}
/** \brief Child initialization routine.
* \param nh ROS node handle
* \param has_service set to true if the child has a Dynamic Reconfigure service
/** \brief Parameter callback
* \param params parameter values to set
*/
bool
child_init(ros::NodeHandle & nh, bool & has_service);
rcl_interfaces::msg::SetParametersResult
config_callback(const std::vector<rclcpp::Parameter> & params);
/** \brief Dynamic reconfigure service callback.
* \param config the dynamic reconfigure CropBoxConfig object
* \param level the dynamic reconfigure level
*/
void
config_callback(pcl_ros::CropBoxConfig & config, uint32_t level);
OnSetParametersCallbackHandle::SharedPtr callback_handle_;
private:
/** \brief The PCL filter implementation used. */
@@ -100,6 +89,8 @@ private:
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
explicit CropBox(const rclcpp::NodeOptions & options);
};
} // namespace pcl_ros