Update subscriber filter#126
Conversation
|
I think this should modify the existing subscriber filter, not add a new one, no? |
It adds a new one with slight changes on the old one:
|
|
Should we rid of the existing subscriber filter? 🤔 |
|
I think this should be applied to the existing filter so we only have a diff of the changes needed rather than a whole new implementation :-) Those changes seem pretty minimal to me to not just update the existing implementation |
Got it! :) |
Done! |
Signed-off-by: elsayedelsheikh <elsayed.elsheikh97@gmail.com>
Signed-off-by: elsayedelsheikh <elsayed.elsheikh97@gmail.com>
Signed-off-by: elsayedelsheikh <elsayed.elsheikh97@gmail.com>
Signed-off-by: elsayedelsheikh <elsayed.elsheikh97@gmail.com>
Signed-off-by: elsayedelsheikh <elsayed.elsheikh97@gmail.com>
0762c9b to
da90eff
Compare
|
We're ready for review here :) @ahcorde |
Signed-off-by: elsayedelsheikh <elsayed.elsheikh97@gmail.com>
Signed-off-by: elsayedelsheikh <elsayed.elsheikh97@gmail.com>
|
|
||
| template<typename NodeT = rclcpp::Node::SharedPtr> | ||
| POINT_CLOUD_TRANSPORT_PUBLIC | ||
| SubscriberFilter( |
There was a problem hiding this comment.
I think this could remove the previous 2x constructors in this class. The NodeT will be deduced automatically since its a direct constructor argument, so you both don't actually need to specify a default and it'll automatically deduce it at compile time :-)
Also, we should have some default for the QoS - what's the default used if not specified by the base class?
There was a problem hiding this comment.
Added a default QoS and removed the old constructor.
As for the node_interfaces constructor, I think we should keep this one preserving the general style followed in point_cloud_transport, no?
There was a problem hiding this comment.
is there any chance to deprecate old constructors?
There was a problem hiding this comment.
I think rclcpp::Node constructor would work here so there's no need to deprecate it, right? -> Should remove it
The one that should be deprecated is the node_interfaces constructor if you're ok with it😀
| template<typename NodeT = rclcpp::Node::SharedPtr> | ||
| POINT_CLOUD_TRANSPORT_PUBLIC | ||
| void subscribe( | ||
| NodeT node, |
There was a problem hiding this comment.
Ditto, now that its templated the previous method for rclcpp node is not required - rclcpp::Node's will just automatically work here
|
|
||
| private: | ||
| //! Don't use this method | ||
| void subscribe( |
There was a problem hiding this comment.
Then remove if it shouldn't be used? 😆
There was a problem hiding this comment.
- About inheriting from SubscriberBase , We need to override these 2 functions but our subscriber needs more
node_interfacesso I left them empty and shouldn't be usedvoid subscribe( RequiredInterfaces /*node_interfaces*/, const std::string & /*topic*/, const rclcpp::QoS & /*qos*/) override {} void subscribe( RequiredInterfaces /*node_interfaces*/, const std::string & /*topic*/, const rclcpp::QoS & /*qos*/, rclcpp::SubscriptionOptions /*options*/) override {}
Won't be able to create a class object if not implemented, Check this
So that I put them under private so no one uses them :D
There was a problem hiding this comment.
Ugh. I think that should be reverted too with the subscribe function similarly templated by NodeT that can be auto-deduced. Before I think it was a pain because the entire class was templated rather than just the method that can autodeduce the type from the arguments.
@ahcorde what do you think?
There was a problem hiding this comment.
Exposing the RequiredInterfaces to the application code is super nasty and can be populated internally to the message filter from the argument provided NodeT. I think merging this in March was not the best solution ros2/message_filters#113. Using RequiredInterfaces as an input if the method is templated will still work as a NodeT as long as it provides the same get_X_base_interface() method. That appears to be the case https://github.com/ros2/rclcpp/blob/rolling/rclcpp/include/rclcpp/node_interfaces/node_interfaces.hpp#L108-L110
There was a problem hiding this comment.
This is very nice documented issue ros2/geometry2#698 why we shouldn't use templates and why we should use rclcpp::node_interfaces::NodeInterfaces
There is a ppt too https://docs.google.com/presentation/d/1bdXOOZPhR9yAnyGNxoLhuO_bU4RW5IjnzvCtrVlpe_g/edit?slide=id.g24afec4abf4_0_0#slide=id.g24afec4abf4_0_0
Maybe we can still improve something in message filter, but I prefer rclcpp::node_interfaces::NodeInterfaces instead of NodeT
There was a problem hiding this comment.
Would we need to update message filters too?
There was a problem hiding this comment.
I think I'm lost here... 🤔
So you guys are proposing to use f(*NodeT) for implicit conversion to node_interfaces, similar to
https://github.com/ros2/message_filters/blob/4f17c17813e7b84e34cc287143ddf70471c78d6c/include/message_filters/subscriber.hpp#L168-L173
Then, Would it be ok to leave SubscriberBase pure virtual methods under private without implementation { }?
There was a problem hiding this comment.
Let me create the PR with my suggestions, and we can move forward from there
There was a problem hiding this comment.
Here my suggestions #129 @SteveMacenski @elsayedelsheikh
There was a problem hiding this comment.
That looks good to me! I think after rebasing onto that, whatever changes are still required for aligning with message filters are still related but simplifies things quite a bit in the best ways.
Just to check, all this works with a rclcpp_lifecycle::LifecycleNode or even a nav2::LifecycleNode in auto-populating that interfaces objcet, correct? All the docs make me think that's the case, but just verifying since I still see the specialized rclcpp::Node constructors in your PR. Couldn't those be removed?
|
@SteveMacenski Hey Steve, any update? |
|
|
||
| template<typename NodeT = rclcpp::Node::SharedPtr> | ||
| POINT_CLOUD_TRANSPORT_PUBLIC | ||
| SubscriberFilter( |
There was a problem hiding this comment.
is there any chance to deprecate old constructors?
|
Please check the current implementation! |
| /// \param options Subscriber options | ||
| /// | ||
| POINT_CLOUD_TRANSPORT_PUBLIC | ||
| void subscribe( |
|
|
||
| private: | ||
| //! Don't use this method | ||
| void subscribe( |
There was a problem hiding this comment.
Ugh. I think that should be reverted too with the subscribe function similarly templated by NodeT that can be auto-deduced. Before I think it was a pain because the entire class was templated rather than just the method that can autodeduce the type from the arguments.
@ahcorde what do you think?
Signed-off-by: ElSayed ElSheikh <elsayed.elsheikh97@gmail.com>
ahcorde
left a comment
There was a problem hiding this comment.
Do you mind to fix the conflicts ?
Working on it 😁 |
Signed-off-by: ElSayed ElSheikh <elsayed.elsheikh97@gmail.com>
Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
|
Pulls: #126 |
|
@ahcorde I'd like to add one more thing before we merge |
Signed-off-by: ElSayed ElSheikh <elsayed.elsheikh97@gmail.com>
|
Related to #124
Work Description
Initially, New
FullSubscriberFilterclass inherited frommessage_filters::SubscriberBaseandmessage_filters::SimpleFilter<sensor_msgs::msg::PointCloud2>then I thought why not inherit from existing implementation SubscriberFilter and avoid repeatition.So I've changed a few things in the original
SubscriberFilterand voila newFullSubscriberFilterI'm also suggesting renaming classes to change the old
SubscriberFiltername toSimpleSubscriberFilterand the new one fromFullSubscriberFiltertoSubscriberFilterAbout inheriting from SubscriberBase , We need to override these 2 functions but our subscriber needs more
node_interfacesso I left them empty and shouldn't be usedvoid subscribe( RequiredInterfaces /*node_interfaces*/, const std::string & /*topic*/, const rclcpp::QoS & /*qos*/) override {} void subscribe( RequiredInterfaces /*node_interfaces*/, const std::string & /*topic*/, const rclcpp::QoS & /*qos*/, rclcpp::SubscriptionOptions /*options*/) override {}Edit:
Updated the existing
SubscriberFilter:message_filters::SubscriberBaseas well asmessage_filters::SimpleFilterNodeor/LifecycleNodesubscriber(...)that acceptsNodeor/LifecycleNodesubscibe()method to re-subscribe if this subscriber has previously been initialized.Example Usage
FYI @ahcorde @SteveMacenski