Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
8d494e1
Don't go back further than a freshly booted host in the steady clock …
mjcarroll Nov 24, 2026
3d91c3b
Make Service::send_response take a const response (#3400)
fujitatomoya Nov 24, 2026
d2759e4
fix(scheduler): always wakeup worker threads for ready entities in re…
skyegalaxy Nov 24, 2026
0c8d39f
perf: look up EventsCBGExecutor timers by an id instead of weak_ptr (…
skyegalaxy Nov 25, 2026
dd1a4f4
Remove deprecated NodeParameters::CallbacksContainerType (#3442)
christophebedard Nov 27, 2026
585664e
Pass --ros-args before remap rules in node interface tests (#3443)
christophebedard Nov 27, 2026
2e2d11e
Remove deprecated component_container_{mt,isolated,event} (#3447)
christophebedard Nov 27, 2026
e4e9ad1
Remove deprecated free spin_some() and spin_all() functions (#3448)
christophebedard Nov 28, 2026
3dbfe9d
Remove deprecated MemoryStrategy and AllocatorMemoryStrategy (#3444)
christophebedard Nov 28, 2026
8e5259b
test_qos_event: declare event counters before the entities that call …
mjcarroll Nov 28, 2026
9d08482
Keep the introspection clock alive for the lifetime of the service/cl…
mjcarroll Nov 28, 2026
551cb6b
test_node_graph: release arrays when the mocked fini fails
mjcarroll Nov 28, 2026
5fa8995
Release wait sets and clients that the tests leak
mjcarroll Nov 28, 2026
919bfa0
Fix non-const shared_ptr callback deprecation warnings with GCC (#3450)
christophebedard Nov 29, 2026
7a4be04
Remove public _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS definition (#3457)
christophebedard Nov 29, 2026
a1ef7f4
Call the real fini function in tests that inject a fini error
mjcarroll Nov 29, 2026
d0d0b7f
Merge branch 'fix-introspection-clock-lifetime' into combined-leak-fixes
mjcarroll Nov 29, 2026
139dd78
Merge branch 'fix-qos-event-test-counters' into combined-leak-fixes
mjcarroll Nov 29, 2026
3dc2fc1
Merge branch 'fix-node-graph-test-leaks' into combined-leak-fixes
mjcarroll Nov 29, 2026
81180aa
Merge branch 'fix-test-wait-set-leaks' into combined-leak-fixes
mjcarroll Nov 29, 2026
d26f959
Merge branch 'fix-test-fini-leaks' into combined-leak-fixes
mjcarroll Nov 29, 2026
edb721b
Wrap the introspection clock comment to 100 columns
mjcarroll Nov 30, 2026
f148a59
Merge branch 'fix-introspection-clock-lifetime' into combined-leak-fixes
mjcarroll Nov 30, 2026
7551fc9
Keep patch_and_return for rcl_action_client_fini; inject_on_return cr…
mjcarroll Nov 30, 2026
ac1034d
Merge branch 'fix-test-wait-set-leaks' into combined-leak-fixes
mjcarroll Nov 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions rclcpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ set(${PROJECT_NAME}_SRCS
src/rclcpp/log_directory.cpp
src/rclcpp/logger.cpp
src/rclcpp/logging_mutex.cpp
src/rclcpp/memory_strategy.cpp
src/rclcpp/message_info.cpp
src/rclcpp/network_flow_endpoint.cpp
src/rclcpp/node.cpp
Expand Down Expand Up @@ -188,10 +187,6 @@ foreach(interface_file ${interface_files})
endforeach()

add_library(${PROJECT_NAME} ${${PROJECT_NAME}_SRCS})
# TODO(wjwwood): address all deprecation warnings and then remove this
if(WIN32)
target_compile_definitions(${PROJECT_NAME} PUBLIC "_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS")
endif()
target_include_directories(${PROJECT_NAME} PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>"
Expand Down
72 changes: 5 additions & 67 deletions rclcpp/include/rclcpp/any_subscription_callback.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ struct AnySubscriptionCallbackPossibleTypes
const std::shared_ptr<const rclcpp::SerializedMessage> &,
const rclcpp::MessageInfo &)>;

// TODO(christophebedard): remove after Makoa
// Deprecated signatures:
using SharedPtrCallback =
std::function<void (std::shared_ptr<SubscribedType>)>;
Expand Down Expand Up @@ -378,9 +379,9 @@ class AnySubscriptionCallback

/// Generic function for setting the callback.
/**
* There are specializations that overload this in order to deprecate some
* callback signatures, and also to fix ambiguity between shared_ptr and
* unique_ptr callback signatures when using them with lambda functions.
* There are specializations that overload this in order to fix ambiguity
* between shared_ptr and unique_ptr callback signatures when using them with
* lambda functions.
*/
template<typename CallbackT>
AnySubscriptionCallback<MessageT, AllocatorT>
Expand All @@ -392,77 +393,14 @@ class AnySubscriptionCallback
// converted to one another, e.g. shared_ptr and unique_ptr.
using scbth = detail::SubscriptionCallbackTypeHelper<MessageT, CallbackT>;

// Determine if the given CallbackT is a deprecated signature or not.
constexpr auto is_deprecated =
rclcpp::function_traits::same_arguments<
typename scbth::callback_type,
std::function<void(std::shared_ptr<SubscribedType>)>
>::value ||
rclcpp::function_traits::same_arguments<
typename scbth::callback_type,
std::function<void(std::shared_ptr<SubscribedType>, const rclcpp::MessageInfo &)>
>::value ||
rclcpp::function_traits::same_arguments<
typename scbth::callback_type,
std::function<void(std::shared_ptr<ROSMessageType>)>
>::value ||
rclcpp::function_traits::same_arguments<
typename scbth::callback_type,
std::function<void(std::shared_ptr<ROSMessageType>, const rclcpp::MessageInfo &)>
>::value ||
rclcpp::function_traits::same_arguments<
typename scbth::callback_type,
std::function<void(std::shared_ptr<rclcpp::SerializedMessage>)>
>::value ||
rclcpp::function_traits::same_arguments<
typename scbth::callback_type,
std::function<void(std::shared_ptr<rclcpp::SerializedMessage>, const rclcpp::MessageInfo &)>
>::value;

// Use the discovered type to force the type of callback when assigning
// into the variant.
if constexpr (is_deprecated) {
// If deprecated, call sub-routine that is deprecated.
set_deprecated(static_cast<typename scbth::callback_type>(callback));
} else {
// Otherwise just assign it.
callback_variant_ = static_cast<typename scbth::callback_type>(callback);
}
callback_variant_ = static_cast<typename scbth::callback_type>(callback);

// Return copy of self for easier testing, normally will be compiled out.
return *this;
}

/// Function for shared_ptr to non-const MessageT, which is deprecated.
template<typename SetT>
// *INDENT-OFF*
#if !defined(RCLCPP_AVOID_DEPRECATIONS_FOR_UNIT_TESTS)
// suppress deprecation warnings in `test_any_subscription_callback.cpp`
[[deprecated("use 'void(std::shared_ptr<const MessageT>)' instead")]]
#endif
// *INDENT-ON*
void
set_deprecated(std::function<void(std::shared_ptr<SetT>)> callback)
{
callback_variant_ = callback;
}

/// Function for shared_ptr to non-const MessageT with MessageInfo, which is deprecated.
template<typename SetT>
// *INDENT-OFF*
#if !defined(RCLCPP_AVOID_DEPRECATIONS_FOR_UNIT_TESTS)
// suppress deprecation warnings in `test_any_subscription_callback.cpp`
[[deprecated(
"use 'void(std::shared_ptr<const MessageT>, const rclcpp::MessageInfo &)' instead"
)]]
#endif
// *INDENT-ON*
void
set_deprecated(std::function<void(std::shared_ptr<SetT>, const rclcpp::MessageInfo &)> callback)
{
callback_variant_ = callback;
}

/// Disable the callback from being called during dispatch.
void disable()
{
Expand Down
6 changes: 6 additions & 0 deletions rclcpp/include/rclcpp/client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,10 @@ class ClientBase
std::shared_ptr<rclcpp::Context> context_;
rclcpp::Logger node_logger_;

// The introspection publisher keeps a raw pointer to this clock's rcl handle and uses it while
// finalizing the client. Keep the clock alive until client_handle_ (declared below) is finalized.
rclcpp::Clock::SharedPtr introspection_clock_;

std::recursive_mutex callback_mutex_;
// It is important to declare on_new_response_callback_ before
// client_handle_, so on destruction the client is
Expand Down Expand Up @@ -759,6 +763,8 @@ class Client : public ClientBase
if (RCL_RET_OK != ret) {
rclcpp::exceptions::throw_from_rcl_error(ret, "failed to configure client introspection");
}

introspection_clock_ = clock;
}

protected:
Expand Down
88 changes: 68 additions & 20 deletions rclcpp/include/rclcpp/create_generic_subscription.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include "rcl/subscription.h"
#include "rclcpp/any_subscription_callback.hpp"
#include "rclcpp/detail/subscription_callback_type_helper.hpp"
#include "rclcpp/generic_subscription.hpp"
#include "rclcpp/node_interfaces/node_topics_interface.hpp"
#include "rclcpp/qos.hpp"
Expand All @@ -32,33 +33,18 @@
namespace rclcpp
{

/// Create and return a GenericSubscription.
/**
* The returned pointer will never be empty, but this function can throw various exceptions, for
* instance when the message's package can not be found on the AMENT_PREFIX_PATH.
*
* \param topics_interface NodeTopicsInterface pointer used in parts of the setup.
* \param topic_name Topic name
* \param topic_type Topic type
* \param qos %QoS settings
* \param callback Callback for new messages of serialized form
* \param options %Publisher options.
* Not all publisher options are currently respected, the only relevant options for this
* publisher are `event_callbacks`, `use_default_callbacks`, and `%callback_group`.
*/
namespace detail
{
template<
typename CallbackT,
typename AllocatorT = std::allocator<void>>
typename AllocatorT>
std::shared_ptr<GenericSubscription> create_generic_subscription(
rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr topics_interface,
const rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr & topics_interface,
const std::string & topic_name,
const std::string & topic_type,
const rclcpp::QoS & qos,
CallbackT && callback,
const rclcpp::SubscriptionOptionsWithAllocator<AllocatorT> & options = (
rclcpp::SubscriptionOptionsWithAllocator<AllocatorT>()
)
)
const rclcpp::SubscriptionOptionsWithAllocator<AllocatorT> & options)
{
auto ts_lib = rclcpp::get_typesupport_library(
topic_type, "rosidl_typesupport_cpp");
Expand All @@ -83,6 +69,68 @@ std::shared_ptr<GenericSubscription> create_generic_subscription(

return subscription;
}
} // namespace detail

/// Create and return a GenericSubscription.
/**
* The returned pointer will never be empty, but this function can throw various exceptions, for
* instance when the message's package can not be found on the AMENT_PREFIX_PATH.
*
* \param topics_interface NodeTopicsInterface pointer used in parts of the setup.
* \param topic_name Topic name
* \param topic_type Topic type
* \param qos %QoS settings
* \param callback Callback for new messages of serialized form
* \param options %Publisher options.
* Not all publisher options are currently respected, the only relevant options for this
* publisher are `event_callbacks`, `use_default_callbacks`, and `%callback_group`.
*/
template<
typename CallbackT,
typename AllocatorT = std::allocator<void>>
std::shared_ptr<GenericSubscription> create_generic_subscription(
rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr topics_interface,
const std::string & topic_name,
const std::string & topic_type,
const rclcpp::QoS & qos,
CallbackT && callback,
const rclcpp::SubscriptionOptionsWithAllocator<AllocatorT> & options = (
rclcpp::SubscriptionOptionsWithAllocator<AllocatorT>()
)
)
{
return rclcpp::detail::create_generic_subscription(
topics_interface, topic_name, topic_type, qos, std::forward<CallbackT>(callback), options);
}

// TODO(christophebedard): remove after Makoa
/// Create and return a GenericSubscription.
/**
* \deprecated Subscription callbacks taking a std::shared_ptr to a non-const
* rclcpp::SerializedMessage are deprecated, use
* std::shared_ptr<const rclcpp::SerializedMessage> instead.
*/
template<
typename CallbackT,
typename AllocatorT = std::allocator<void>>
requires rclcpp::detail::deprecated_subscription_callback<CallbackT, rclcpp::SerializedMessage>
[[deprecated(
"subscription callbacks taking a std::shared_ptr to a non-const message are deprecated, "
"use std::shared_ptr<const MessageT> instead")]]
std::shared_ptr<GenericSubscription> create_generic_subscription(
rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr topics_interface,
const std::string & topic_name,
const std::string & topic_type,
const rclcpp::QoS & qos,
CallbackT && callback,
const rclcpp::SubscriptionOptionsWithAllocator<AllocatorT> & options = (
rclcpp::SubscriptionOptionsWithAllocator<AllocatorT>()
)
)
{
return rclcpp::detail::create_generic_subscription(
topics_interface, topic_name, topic_type, qos, std::forward<CallbackT>(callback), options);
}

} // namespace rclcpp

Expand Down
74 changes: 74 additions & 0 deletions rclcpp/include/rclcpp/create_subscription.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <utility>

#include "rclcpp/detail/qos_parameters.hpp"
#include "rclcpp/detail/subscription_callback_type_helper.hpp"
#include "rclcpp/node_interfaces/get_node_topics_interface.hpp"
#include "rclcpp/node_interfaces/node_parameters_interface.hpp"
#include "rclcpp/node_interfaces/node_topics_interface.hpp"
Expand Down Expand Up @@ -135,6 +136,42 @@ create_subscription(
node, node, topic_name, qos, std::forward<CallbackT>(callback), options, msg_mem_strat);
}

// TODO(christophebedard): remove after Makoa
/// Create and return a subscription of the given MessageT type.
/**
* \deprecated Subscription callbacks taking a std::shared_ptr to a non-const message are
* deprecated, use std::shared_ptr<const MessageT> instead.
*/
template<
typename MessageT,
typename CallbackT,
typename AllocatorT = std::allocator<void>,
typename SubscriptionT = rclcpp::Subscription<MessageT, AllocatorT>,
typename MessageMemoryStrategyT = typename SubscriptionT::MessageMemoryStrategyType,
typename NodeT>
requires rclcpp::detail::deprecated_subscription_callback<CallbackT, MessageT>
[[deprecated(
"subscription callbacks taking a std::shared_ptr to a non-const message are deprecated, "
"use std::shared_ptr<const MessageT> instead")]]
typename std::shared_ptr<SubscriptionT>
create_subscription(
NodeT & node,
const std::string & topic_name,
const rclcpp::QoS & qos,
CallbackT && callback,
const rclcpp::SubscriptionOptionsWithAllocator<AllocatorT> & options = (
rclcpp::SubscriptionOptionsWithAllocator<AllocatorT>()
),
typename MessageMemoryStrategyT::SharedPtr msg_mem_strat = (
MessageMemoryStrategyT::create_default()
)
)
{
return rclcpp::detail::create_subscription<
MessageT, CallbackT, AllocatorT, SubscriptionT, MessageMemoryStrategyT>(
node, node, topic_name, qos, std::forward<CallbackT>(callback), options, msg_mem_strat);
}

/// Create and return a subscription of the given MessageT type.
/**
* See \ref create_subscription().
Expand Down Expand Up @@ -166,6 +203,43 @@ create_subscription(
std::forward<CallbackT>(callback), options, msg_mem_strat);
}

// TODO(christophebedard): remove after Makoa
/// Create and return a subscription of the given MessageT type.
/**
* \deprecated Subscription callbacks taking a std::shared_ptr to a non-const message are
* deprecated, use std::shared_ptr<const MessageT> instead.
*/
template<
typename MessageT,
typename CallbackT,
typename AllocatorT = std::allocator<void>,
typename SubscriptionT = rclcpp::Subscription<MessageT, AllocatorT>,
typename MessageMemoryStrategyT = typename SubscriptionT::MessageMemoryStrategyType>
requires rclcpp::detail::deprecated_subscription_callback<CallbackT, MessageT>
[[deprecated(
"subscription callbacks taking a std::shared_ptr to a non-const message are deprecated, "
"use std::shared_ptr<const MessageT> instead")]]
typename std::shared_ptr<SubscriptionT>
create_subscription(
rclcpp::node_interfaces::NodeParametersInterface::SharedPtr & node_parameters,
rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr & node_topics,
const std::string & topic_name,
const rclcpp::QoS & qos,
CallbackT && callback,
const rclcpp::SubscriptionOptionsWithAllocator<AllocatorT> & options = (
rclcpp::SubscriptionOptionsWithAllocator<AllocatorT>()
),
typename MessageMemoryStrategyT::SharedPtr msg_mem_strat = (
MessageMemoryStrategyT::create_default()
)
)
{
return rclcpp::detail::create_subscription<
MessageT, CallbackT, AllocatorT, SubscriptionT, MessageMemoryStrategyT>(
node_parameters, node_topics, topic_name, qos,
std::forward<CallbackT>(callback), options, msg_mem_strat);
}

} // namespace rclcpp

#endif // RCLCPP__CREATE_SUBSCRIPTION_HPP_
Loading