Refactor PCLNode with Variadic Templates
The purpose of this PR is to centralize the ROS-related interfaces in the PCLNode class.
Previously, operations like subscribing, publishing with message filters, transforming clouds, and so on, were centralized in the Filter class.
However, to extend this package with the development of new nodes (e.g. SACSegmentation), requires the duplication of some boilerplate code, as evident in https://github.com/ros-perception/perception_pcl/pull/510.
This PR allows contributors to create new pcl_ros nodes as simple as
class MyPclNode : public PCLNode<Input<MyInput1, MyInput2>, Output<MyOutput1>> { private: pcl::MyPCLImplementation<> impl_;
virtual rcl_interfaces::msg::SetParametersResult onParamsChanged( const std::vectorrclcpp::Parameter & params) override;
public: explicit MyPclNode(const rclcpp::NodeOptions & options); virtual void compute(const MyInput1 & in1, MyInput2 & in2, MyOutput1 & out1) override; };
Happy to get your feedback and eventually improve / adapt the code
Hi, thank you for this PR.
It is quite big, so at the moment I can't forsee the consequences for merging this regarging to API/ABI breaking. It will take a bit of time. Maybe somebody could help here.
Furthermore, a lot of tests are still failing.
Hi @Rayman, Thank you for taking your time to review it. This MR is part of a bigger refactor I've worked on at @PALRobotics. Here you can find the full implementation of this work, along with an extensive documentation explaining the reasons for this refactor.
Basically, composing multiple PCL algorithms is very expensive if done through ROS 2 Components.
In fact, each component in the pipeline needs to deserialize the data from ROS messages to PCL structure, perform the logic, and serialize the message back to a ROS message.
The refactor allows users to compose PCL Algorithms as plugins (with pluginlib), where each plugin directly shares PCL pointers with the others and doesn't need to continuously serialize/deserialize messages.
This introduced a new concept of PCL Pipeline, which loads as many plugins as needed and implements the input/output interface. This way, also if a certain pipeline is composed of several PCL algorithms, the serialization/deserialization happens just once.