Migrate extract_indices filter (#394)

* - migrate extract_indices filter
- add test to check if filter node/component output result

Signed-off-by: Daisuke Sato <daisukes@cmu.edu>

* add test_depend to package.xml

Signed-off-by: Daisuke Sato <daisukes@cmu.edu>

* add launch_testing_ros as test_depend too

Signed-off-by: Daisuke Sato <daisukes@cmu.edu>

* fixed test not to depend on ros2cli

Signed-off-by: Daisuke Sato <daisukes@cmu.edu>

---------

Signed-off-by: Daisuke Sato <daisukes@cmu.edu>
This commit is contained in:
Daisuke Sato
2023-01-27 18:50:45 -05:00
committed by GitHub
parent 3b0cfd8529
commit 0c8e7dafce
8 changed files with 358 additions and 42 deletions
@@ -40,9 +40,9 @@
// PCL includes
#include <pcl/filters/extract_indices.h>
#include <mutex>
#include <vector>
#include "pcl_ros/filters/filter.hpp"
#include "pcl_ros/ExtractIndicesConfig.hpp"
namespace pcl_ros
{
@@ -53,9 +53,6 @@ namespace pcl_ros
class ExtractIndices : public Filter
{
protected:
/** \brief Pointer to a dynamic reconfigure service. */
boost::shared_ptr<dynamic_reconfigure::Server<pcl_ros::ExtractIndicesConfig>> srv_;
/** \brief Call the actual filter.
* \param input the input point cloud dataset
* \param indices the input set of indices to use from \a input
@@ -63,10 +60,10 @@ protected:
*/
inline void
filter(
const PointCloud2::ConstPtr & input, const IndicesPtr & indices,
const PointCloud2::ConstSharedPtr & input, const IndicesPtr & indices,
PointCloud2 & output)
{
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);
@@ -76,16 +73,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
*/
virtual 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. */
void
config_callback(pcl_ros::ExtractIndicesConfig & config, uint32_t level);
OnSetParametersCallbackHandle::SharedPtr callback_handle_;
private:
/** \brief The PCL filter implementation used. */
@@ -93,6 +87,8 @@ private:
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
explicit ExtractIndices(const rclcpp::NodeOptions & options);
};
} // namespace pcl_ros