-
Notifications
You must be signed in to change notification settings - Fork 0
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
Update rclcpp functionality to use new interfaces #4
Changes from 6 commits
7591bcf
e82080f
d10432e
fb3a01f
a898edf
c1ffa39
6ff6907
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 |
---|---|---|
|
@@ -139,24 +139,84 @@ class Node : public std::enable_shared_from_this<Node> | |
const std::vector<rclcpp::callback_group::CallbackGroup::WeakPtr> & | ||
get_callback_groups() const; | ||
|
||
/// Create and return a Publisher. | ||
/// Create and return a Publisher. Note: This constructor is deprecated | ||
/** | ||
* \param[in] topic_name The topic for this publisher to publish on. | ||
* \param[in] group The callback group for this publisher. NULL for no callback group. | ||
* \param[in] options Additional options to control creation of the publisher. | ||
* \return Shared pointer to the created publisher. | ||
*/ | ||
template< | ||
typename MessageT, typename Alloc = std::allocator<void>, | ||
typename PublisherT = ::rclcpp::Publisher<MessageT, Alloc>> | ||
std::shared_ptr<PublisherT> | ||
create_publisher( | ||
const std::string & topic_name, | ||
size_t qos_history_depth, | ||
std::shared_ptr<Alloc> allocator = nullptr); | ||
|
||
/// Create and return a Publisher. Note: this constructor is deprecated | ||
/** | ||
* \param[in] topic_name The topic for this publisher to publish on. | ||
* \param[in] qos_profile The quality of service profile to pass on to the rmw implementation. | ||
* \param[in] allocator Optional custom allocator. | ||
* \return Shared pointer to the created publisher. | ||
*/ | ||
template< | ||
typename MessageT, typename Alloc = std::allocator<void>, | ||
typename PublisherT = ::rclcpp::Publisher<MessageT, Alloc>> | ||
std::shared_ptr<PublisherT> | ||
create_publisher( | ||
const std::string & topic_name, | ||
const rmw_qos_profile_t & qos_profile = rmw_qos_profile_default, | ||
std::shared_ptr<Alloc> allocator = nullptr); | ||
|
||
/// Create and return a Publisher. | ||
/** | ||
* \param[in] topic_name The topic for this publisher to publish on. | ||
* \param[in] options Additional options for the created Publisher | ||
* \return Shared pointer to the created publisher. | ||
*/ | ||
template< | ||
typename MessageT, | ||
typename Alloc = std::allocator<void>, | ||
typename PublisherT = ::rclcpp::Publisher<MessageT, Alloc>> | ||
std::shared_ptr<PublisherT> | ||
create_publisher( | ||
const std::string & topic_name, | ||
const PublisherOptions<Alloc> & options, | ||
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. We decided to make options non-optional? 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. Correct - otherwise this function is ambiguous with preexisting interfaces. Once the old interfaces have been removed, then we can give this argument a default value. However for now, it is expected that the function signature being called when you only specify a topic_name is the old function |
||
rclcpp::callback_group::CallbackGroup::SharedPtr callback_group = nullptr); | ||
|
||
/// Create and return a Subscription. Note: this constructor is deprecated | ||
/** | ||
* \param[in] topic_name The topic to subscribe on. | ||
* \param[in] callback The user-defined callback function. | ||
* \param[in] qos_profile The quality of service profile to pass on to the rmw implementation. | ||
* \param[in] group The callback group for this subscription. NULL for no callback group. | ||
* \param[in] ignore_local_publications True to ignore local publications. | ||
* \param[in] msg_mem_strat The message memory strategy to use for allocating messages. | ||
* \param[in] allocator Optional custom allocator. | ||
* \return Shared pointer to the created subscription. | ||
*/ | ||
/* TODO(jacquelinekay): | ||
Windows build breaks when static member function passed as default | ||
argument to msg_mem_strat, nullptr is a workaround. | ||
*/ | ||
template< | ||
typename MessageT, | ||
typename CallbackT, | ||
typename Alloc = std::allocator<void>, | ||
typename SubscriptionT = rclcpp::Subscription< | ||
typename rclcpp::subscription_traits::has_message_type<CallbackT>::type, Alloc>> | ||
std::shared_ptr<SubscriptionT> | ||
create_subscription( | ||
const std::string & topic_name, | ||
CallbackT && callback, | ||
const rmw_qos_profile_t & qos_profile = rmw_qos_profile_default, | ||
rclcpp::callback_group::CallbackGroup::SharedPtr group = nullptr, | ||
const PublisherOptions<Alloc> & options = PublisherOptions<Alloc>()); | ||
|
||
/// Create and return a Subscription. | ||
/// Create and return a Subscription. Note: this constructor is deprecated | ||
/** | ||
* \param[in] topic_name The topic to subscribe on. | ||
* \param[in] callback The user-defined callback function. | ||
|
@@ -185,6 +245,34 @@ class Node : public std::enable_shared_from_this<Node> | |
typename rclcpp::subscription_traits::has_message_type<CallbackT>::type, Alloc>::SharedPtr | ||
msg_mem_strat = nullptr); | ||
|
||
/// Create and return a Subscription. | ||
/** | ||
* \param[in] topic_name The topic to subscribe on. | ||
* \param[in] callback The user-defined callback function to receive a message | ||
* \param[in] options Additional options for the creation of the Subscription | ||
* \param[in] msg_mem_strat The message memory strategy to use for allocating messages. | ||
* \return Shared pointer to the created subscription. | ||
*/ | ||
/* TODO(jacquelinekay): | ||
Windows build breaks when static member function passed as default | ||
argument to msg_mem_strat, nullptr is a workaround. | ||
*/ | ||
template< | ||
typename MessageT, | ||
typename CallbackT, | ||
typename Alloc = std::allocator<void>, | ||
typename SubscriptionT = rclcpp::Subscription< | ||
typename rclcpp::subscription_traits::has_message_type<CallbackT>::type, Alloc>> | ||
std::shared_ptr<SubscriptionT> | ||
create_subscription( | ||
const std::string & topic_name, | ||
CallbackT && callback, | ||
const SubscriptionOptions<Alloc> & options, | ||
rclcpp::callback_group::CallbackGroup::SharedPtr callback_group = nullptr, | ||
typename rclcpp::message_memory_strategy::MessageMemoryStrategy< | ||
typename rclcpp::subscription_traits::has_message_type<CallbackT>::type, Alloc>::SharedPtr | ||
msg_mem_strat = nullptr); | ||
|
||
/// Create a timer. | ||
/** | ||
* \param[in] period Time interval between triggers of the callback. | ||
|
@@ -549,13 +637,11 @@ class Node : public std::enable_shared_from_this<Node> | |
const NodeOptions & | ||
get_node_options() const; | ||
|
||
|
||
/// Manually assert that this Node is alive (for RMW_QOS_POLICY_MANUAL_BY_NODE) | ||
/** | ||
* If the rmw Liveliness policy is set to RMW_QOS_POLICY_MANUAL_BY_NODE, the creator of this | ||
* node must manually call `assert_liveliness` on a regular basis to signal to the rest of the | ||
* system that this Node is still alive. | ||
* This function must be called at least as often as the qos_profile's liveliness_lease_duration | ||
* Node must manually call `assert_liveliness` periodically to signal that this Node | ||
* is still alive. Must be called at least as often as qos_profile's Liveliness lease_duration | ||
*/ | ||
RCLCPP_PUBLIC | ||
void | ||
|
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.
Why not use the deprecated tag?
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.
ros2#673 is the right place for that discussion - I am not opposed but I am concerned that it introduces warnings to existing core code, causing yellow unstable builds across the board, which may not be the desired thing at this time