Support lifecycle node#304
Support lifecycle node#304Benjamin-Tan wants to merge 17 commits intoros-perception:rollingfrom Benjamin-Tan:rolling
Conversation
…ransport free function, subscriber filter, transport hints
ahcorde
left a comment
There was a problem hiding this comment.
Thank you for your contribution and for pushing this idea (again)
I have some concerns:
- We need to deprecated current constructors and add the new ones. To avod breaking other users
- Instead of adding two constructors one for
Nodeand another one forLifecycleNodewe should usetemplate<typename NodeT>. You can take a look toros2/message_filters/include/message_filters/subscriber.h
…mpatibility, according to the PR review.
… to the initial implementation
|
I have changed it to the template approach as per your suggestion. |
ahcorde
left a comment
There was a problem hiding this comment.
I tried to compile this with clang and I get the following errors:
/usr/bin/ld: libimage_transport.so: undefined reference to `image_transport::CameraSubscriber<rclcpp::Node>::CameraSubscriber(std::__1::shared_ptr<rclcpp::Node>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::function<void (std::__1::shared_ptr<sensor_msgs::msg::Image_<std::__1::allocator<void> > const> const&, std::__1::shared_ptr<sensor_msgs::msg::CameraInfo_<std::__1::allocator<void> > const> const&)> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, rmw_qos_profile_s)'
/usr/bin/ld: libimage_transport.so: undefined reference to `image_transport::Subscriber<rclcpp_lifecycle::LifecycleNode>::Subscriber(std::__1::shared_ptr<rclcpp_lifecycle::LifecycleNode>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::function<void (std::__1::shared_ptr<sensor_msgs::msg::Image_<std::__1::allocator<void> > const> const&)> const&, std::__1::shared_ptr<pluginlib::ClassLoader<image_transport::SubscriberPlugin<rclcpp_lifecycle::LifecycleNode> > >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, rmw_qos_profile_s, rclcpp::SubscriptionOptionsWithAllocator<std::__1::allocator<void> >)'
/usr/bin/ld: libimage_transport.so: undefined reference to `image_transport::CameraSubscriber<rclcpp_lifecycle::LifecycleNode>::CameraSubscriber(std::__1::shared_ptr<rclcpp_lifecycle::LifecycleNode>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::function<void (std::__1::shared_ptr<sensor_msgs::msg::Image_<std::__1::allocator<void> > const> const&, std::__1::shared_ptr<sensor_msgs::msg::CameraInfo_<std::__1::allocator<void> > const> const&)> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, rmw_qos_profile_s)'
/usr/bin/ld: libimage_transport.so: undefined reference to `image_transport::Subscriber<rclcpp::Node>::Subscriber(std::__1::shared_ptr<rclcpp::Node>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::function<void (std::__1::shared_ptr<sensor_msgs::msg::Image_<std::__1::allocator<void> > const> const&)> const&, std::__1::shared_ptr<pluginlib::ClassLoader<image_transport::SubscriberPlugin<rclcpp::Node> > >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, rmw_qos_profile_s, rclcpp::SubscriptionOptionsWithAllocator<std::__1::allocator<void> >)'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[2]: *** [CMakeFiles/list_transports.dir/build.make:202: list_transports] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:197: CMakeFiles/list_transports.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
--- stderr: image_transport
/usr/bin/ld: libimage_transport.so: undefined reference to `image_transport::CameraSubscriber<rclcpp::Node>::CameraSubscriber(std::__1::shared_ptr<rclcpp::Node>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::function<void (std::__1::shared_ptr<sensor_msgs::msg::Image_<std::__1::allocator<void> > const> const&, std::__1::shared_ptr<sensor_msgs::msg::CameraInfo_<std::__1::allocator<void> > const> const&)> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, rmw_qos_profile_s)'
/usr/bin/ld: libimage_transport.so: undefined reference to `image_transport::Subscriber<rclcpp_lifecycle::LifecycleNode>::Subscriber(std::__1::shared_ptr<rclcpp_lifecycle::LifecycleNode>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::function<void (std::__1::shared_ptr<sensor_msgs::msg::Image_<std::__1::allocator<void> > const> const&)> const&, std::__1::shared_ptr<pluginlib::ClassLoader<image_transport::SubscriberPlugin<rclcpp_lifecycle::LifecycleNode> > >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, rmw_qos_profile_s, rclcpp::SubscriptionOptionsWithAllocator<std::__1::allocator<void> >)'
/usr/bin/ld: libimage_transport.so: undefined reference to `image_transport::CameraSubscriber<rclcpp_lifecycle::LifecycleNode>::CameraSubscriber(std::__1::shared_ptr<rclcpp_lifecycle::LifecycleNode>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::function<void (std::__1::shared_ptr<sensor_msgs::msg::Image_<std::__1::allocator<void> > const> const&, std::__1::shared_ptr<sensor_msgs::msg::CameraInfo_<std::__1::allocator<void> > const> const&)> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, rmw_qos_profile_s)'
/usr/bin/ld: libimage_transport.so: undefined reference to `image_transport::Subscriber<rclcpp::Node>::Subscriber(std::__1::shared_ptr<rclcpp::Node>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::function<void (std::__1::shared_ptr<sensor_msgs::msg::Image_<std::__1::allocator<void> > const> const&)> const&, std::__1::shared_ptr<pluginlib::ClassLoader<image_transport::SubscriberPlugin<rclcpp::Node> > >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, rmw_qos_profile_s, rclcpp::SubscriptionOptionsWithAllocator<std::__1::allocator<void> >)'Do you mind to take a look ? you just need to add this --mixin clang-libcxx to your colcon command
Another question: These changes require also to modify the image_transport_plugins?
ahcorde
left a comment
There was a problem hiding this comment.
These changes should fix the issue
Had the same issue when recompiling with clang, I have fix those and pushed it. On your question about the need to modify |
ahcorde
left a comment
There was a problem hiding this comment.
You broke API, there are two possible solutions:
- Modify
image_transport_pluginsand only include this changes onrolling - If you need this backported to
jazzy, don't break API and redo some work here
|
To be backported, is the following acceptable? By using the templating approach for the rest, except for the base class for publisher and subscriber plugin.hpp? I think this would keep the API the same, but go against your initial concern of having |
|
Thanks for the implementation effort, finally a solution to the rather old issue #108 is in sight! As a side note regarding the refactoring mentioned for a continuation of #167: Switching to the NodeInterfaces made it also necessary to adapt the message filters code, leading to the following (still open) PR. This PR was also the main reason for losing the interest in pushing the other two forks further. |
| } | ||
|
|
||
| /* | ||
| TEST_F(MessagePassingTestingLifecycle, stress_message_passing) |
There was a problem hiding this comment.
I was simply referencing from test_message_passing.cpp, shall this be removed entirely?
|
This PR is quite big, @mikeferguson do you mind to take a look ? |
ahcorde
left a comment
There was a problem hiding this comment.
there are some conflicts, by the way I'm not able to compile the plugins
| } | ||
| } | ||
|
|
||
| std::shared_ptr<NodeType> node_; |
There was a problem hiding this comment.
by holding a reference to the Node here, are we going to end up with some sort of hanging reference where the node never goes out of scope?\
There was a problem hiding this comment.
I'll change them into weak pointers, does that sound good to you? I would think that smart pointers are preferred over the raw pointers.
| image_received_ = info_received_ = both_received_ = 0; | ||
| } | ||
|
|
||
| std::shared_ptr<NodeType> node_; |
There was a problem hiding this comment.
by holding a reference to the Node here, are we going to end up with some sort of hanging reference where the node never goes out of scope?
| } | ||
| if constexpr (std::is_same_v<NodeType, rclcpp_lifecycle::LifecycleNode>) { | ||
| return Publisher(node, base_topic, kImpl_lifecycle->pub_loader_, custom_qos, options); | ||
| } |
There was a problem hiding this comment.
I wonder if this would be clearer by instead just having two fully specialized functions and avoiding the std::is_same_v
There was a problem hiding this comment.
The initial implementation of the PR was two specialized functions. I changed it based on #304 (review) , I'm happy to change it back as well.
Yeah I think after this PR has been reviewed, I would open a corresponding PR on the image_transport_plugins as well to update the implementation. |
|
Any update on this? we want to use lifecycle nodes in our package, but still blocked by image_transport component. |
|
It has been awhile since, I am still waiting for the reviewers to comment and feedback on how to move this forward. |
|
@mikeferguson do you mind to take a look here? |
ahcorde
left a comment
There was a problem hiding this comment.
Do you mind to merge with rolling? This PR is some PR behind.
I tried to compile the image_transport plugins and some other packages in image_pipeline and build is broken. Do you mind also to take a look?
ahcorde
left a comment
There was a problem hiding this comment.
sorry the late response, I was taking a look to this suggestion made by @methylDragon in geometry2 ros2/geometry2#698
and I think we should use rclcpp::node_interfaces::NodeInterfaces instead of templates.
Let me know if you have some time to work on this otherwise I will try to push this forward.
|
This latest commit still has some test failure that has yet to be fixed. I agree that we should use the node interfaces, as mentioned upon opening this PR, I recalled the need to have a major refactoring. If node interfaces and refactoring are preferred, I would think a separate PR will serve a better one than this. |
|
#352 is merged |
To close #108,
Had a try with the templating approach similar to #167, but that did not go well without some major refactoring. The current implementation overloads the constructor with LifecycleNode instead, with minimal change to the design/architecture.
Others: