-
Notifications
You must be signed in to change notification settings - Fork 245
Support lifecycle node - NodeInterfaces #352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 11 commits
3de255d
946582a
547f3e9
7c3840c
19ba989
1f0fdec
8db6316
98ac725
a98d28e
7a4d930
9ebcb2a
6bf7d3d
d89185d
aaa464c
a8f9810
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,6 +38,7 @@ | |
|
|
||
| #include "image_transport/camera_publisher.hpp" | ||
| #include "image_transport/camera_subscriber.hpp" | ||
| #include "image_transport/node_interfaces.hpp" | ||
| #include "image_transport/publisher.hpp" | ||
| #include "image_transport/subscriber.hpp" | ||
| #include "image_transport/transport_hints.hpp" | ||
|
|
@@ -46,16 +47,20 @@ | |
| namespace image_transport | ||
| { | ||
|
|
||
| /*! | ||
| * \brief Advertise an image topic, free function version. | ||
| */ | ||
| IMAGE_TRANSPORT_PUBLIC | ||
| Publisher create_publisher( | ||
| rclcpp::Node * node, | ||
| const std::string & base_topic, | ||
| rmw_qos_profile_t custom_qos = rmw_qos_profile_default, | ||
| rclcpp::PublisherOptions options = rclcpp::PublisherOptions()); | ||
|
|
||
| IMAGE_TRANSPORT_PUBLIC | ||
| Publisher create_publisher( | ||
| RequiredInterfaces node_interfaces, | ||
| const std::string & base_topic, | ||
| rmw_qos_profile_t custom_qos = rmw_qos_profile_default, | ||
| rclcpp::PublisherOptions options = rclcpp::PublisherOptions()); | ||
|
|
||
| /** | ||
| * \brief Subscribe to an image topic, free function version. | ||
| */ | ||
|
|
@@ -68,6 +73,18 @@ Subscriber create_subscription( | |
| rmw_qos_profile_t custom_qos = rmw_qos_profile_default, | ||
| rclcpp::SubscriptionOptions options = rclcpp::SubscriptionOptions()); | ||
|
|
||
| /** | ||
| * \brief Subscribe to an image topic, free function version. | ||
| */ | ||
| IMAGE_TRANSPORT_PUBLIC | ||
| Subscriber create_subscription( | ||
| RequiredInterfaces node_interfaces, | ||
| const std::string & base_topic, | ||
| const Subscriber::Callback & callback, | ||
| const std::string & transport, | ||
| rmw_qos_profile_t custom_qos = rmw_qos_profile_default, | ||
| rclcpp::SubscriptionOptions options = rclcpp::SubscriptionOptions()); | ||
|
|
||
| /*! | ||
| * \brief Advertise a camera, free function version. | ||
| */ | ||
|
|
@@ -78,6 +95,16 @@ CameraPublisher create_camera_publisher( | |
| rmw_qos_profile_t custom_qos = rmw_qos_profile_default, | ||
| rclcpp::PublisherOptions pub_options = rclcpp::PublisherOptions()); | ||
|
|
||
| /*! | ||
| * \brief Advertise a camera, free function version. | ||
| */ | ||
| IMAGE_TRANSPORT_PUBLIC | ||
| CameraPublisher create_camera_publisher( | ||
| RequiredInterfaces node_interfaces, | ||
| const std::string & base_topic, | ||
| rmw_qos_profile_t custom_qos = rmw_qos_profile_default, | ||
| rclcpp::PublisherOptions pub_options = rclcpp::PublisherOptions()); | ||
|
|
||
| /*! | ||
| * \brief Subscribe to a camera, free function version. | ||
| */ | ||
|
|
@@ -89,6 +116,17 @@ CameraSubscriber create_camera_subscription( | |
| const std::string & transport, | ||
| rmw_qos_profile_t custom_qos = rmw_qos_profile_default); | ||
|
|
||
| /*! | ||
| * \brief Subscribe to a camera, free function version. | ||
| */ | ||
| IMAGE_TRANSPORT_PUBLIC | ||
| CameraSubscriber create_camera_subscription( | ||
| RequiredInterfaces node_interfaces, | ||
| const std::string & base_topic, | ||
| const CameraSubscriber::Callback & callback, | ||
| const std::string & transport, | ||
| rmw_qos_profile_t custom_qos = rmw_qos_profile_default); | ||
|
|
||
| IMAGE_TRANSPORT_PUBLIC | ||
| std::vector<std::string> getDeclaredTransports(); | ||
|
|
||
|
|
@@ -112,6 +150,9 @@ class ImageTransport | |
| IMAGE_TRANSPORT_PUBLIC | ||
| explicit ImageTransport(rclcpp::Node::SharedPtr node); | ||
|
|
||
| IMAGE_TRANSPORT_PUBLIC | ||
| explicit ImageTransport(RequiredInterfaces node_interfaces); | ||
|
|
||
| IMAGE_TRANSPORT_PUBLIC | ||
| ImageTransport(const ImageTransport & other); | ||
|
|
||
|
|
@@ -372,7 +413,7 @@ class ImageTransport | |
|
|
||
| struct ImageTransport::Impl | ||
| { | ||
| rclcpp::Node::SharedPtr node_; | ||
| RequiredInterfaces required_interfaces_; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
EDIT: Did the first version which kept the old pointer even work with the unmodified rolling state of the plugins for you? Even though it compiles I would expect runtime problems, since the plugins (e.g. for compressed image transport) explicitly override |
||
| }; | ||
|
|
||
| } // namespace image_transport | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| // Copyright (c) 2025, Open Source Robotics Foundation, Inc. | ||
| // | ||
| // Redistribution and use in source and binary forms, with or without | ||
| // modification, are permitted provided that the following conditions are met: | ||
| // | ||
| // * Redistributions of source code must retain the above copyright | ||
| // notice, this list of conditions and the following disclaimer. | ||
| // | ||
| // * Redistributions in binary form must reproduce the above copyright | ||
| // notice, this list of conditions and the following disclaimer in the | ||
| // documentation and/or other materials provided with the distribution. | ||
| // | ||
| // * Neither the name of the Willow Garage nor the names of its | ||
| // contributors may be used to endorse or promote products derived from | ||
| // this software without specific prior written permission. | ||
| // | ||
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
| // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
| // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
| // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
| // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
| // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
| // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| // POSSIBILITY OF SUCH DAMAGE. | ||
|
|
||
| #ifndef IMAGE_TRANSPORT__NODE_INTERFACES_HPP_ | ||
| #define IMAGE_TRANSPORT__NODE_INTERFACES_HPP_ | ||
|
|
||
| #include <rclcpp/node_interfaces/node_interfaces.hpp> | ||
|
|
||
| #include <rclcpp/node_interfaces/node_base_interface.hpp> | ||
| #include <rclcpp/node_interfaces/node_logging_interface.hpp> | ||
| #include <rclcpp/node_interfaces/node_parameters_interface.hpp> | ||
| #include <rclcpp/node_interfaces/node_timers_interface.hpp> | ||
| #include <rclcpp/node_interfaces/node_topics_interface.hpp> | ||
|
|
||
| namespace image_transport | ||
| { | ||
| using NodeBaseInterface = rclcpp::node_interfaces::NodeBaseInterface; | ||
| using NodeParametersInterface = rclcpp::node_interfaces::NodeParametersInterface; | ||
| using NodeLoggingInterface = rclcpp::node_interfaces::NodeLoggingInterface; | ||
| using NodeTimersInterface = rclcpp::node_interfaces::NodeTimersInterface; | ||
| using NodeTopicsInterface = rclcpp::node_interfaces::NodeTopicsInterface; | ||
|
|
||
| using RequiredInterfaces = rclcpp::node_interfaces::NodeInterfaces< | ||
| NodeBaseInterface, | ||
| NodeParametersInterface, | ||
| NodeLoggingInterface, | ||
| NodeTimersInterface, | ||
| NodeTopicsInterface>; | ||
| } // namespace image_transport | ||
|
|
||
| #endif // IMAGE_TRANSPORT__NODE_INTERFACES_HPP_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has compilation error:
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had no build problems on my machine, could it be that you are using an older version of the message filter package? The PR adapting the interface to
rclcpp::NodeInterfaces(this commit) has just been merged a few days ago, thus, you'll likely need the current rolling branch for compatibility.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right. It is good when I build message_filters from source since the binary is not released just yet.