* LifecycleNode base class resource needs to be reset via dtor.
Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
* add debug notice that prints LifecycleNode is not shutdown in dtor.
Currently it is user application responsibility to manage the all state control.
See more details for https://github.com/ros2/rclcpp/issues/2520.
Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
* add test cases to call shutdown from each primary state.
Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
* address review comments.
Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
---------
Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
The current
`TestLifecycleServiceClient.get_service_names_and_types_by_node` test
was using `LifecycleServiceClient`, which is just a normal
`rclcpp::Node` with some `rclcpp::Client`s, to test
`NodeGraph::get_service_names_and_types_by_node()`. However,
`NodeGraph::get_service_names_and_types_by_node()` is for service
servers, not clients. The test just ended up checking the built-in
services of an `rclcpp::Node`, since it wasn't actually checking the
names of the services, and not checking the clients of the
`LifecycleServiceClient` or the built-in services of a
`rclcpp_lifecycle::LifecycleNode`. I believe this was probably not the
intention, since this is an `rclcpp_lifecycle` test.
Instead, use an actual `rclcpp_lifecycle::LifecycleNode` and check its
service servers by calling
`NodeGraph::get_service_names_and_types_by_node()` through
`LifecycleNode::get_service_names_and_types_by_node()`.
Signed-off-by: Christophe Bedard <christophe.bedard@apex.ai>
* Fix the lifecycle tests on RHEL-9.
The full explanation is in the comment, but basically since
RHEL doesn't support mocking_utils::inject_on_return, we have
to split out certain tests to make sure resources within a
process don't collide.
Signed-off-by: Chris Lalancette <clalancette@gmail.com>
Co-authored-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
* Revert "LifecycleNode shutdown on dtor only with valid context. (#2545)"
This reverts commit d8d83a0ee6.
Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
* Revert "call shutdown in LifecycleNode dtor to avoid leaving the device in unknown state (2nd) (#2528)"
This reverts commit 3bc364a10b.
Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
---------
Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
* Revert "Revert "call shutdown in LifecycleNode dtor to avoid leaving the device in un… (#2450)" (#2522)"
This reverts commit 42b0b5775b.
Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
* lifecycle node dtor shutdown should be called only in primary state.
Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
* adjust warning message if the node is still in transition state in dtor.
Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
---------
Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
* call shutdown in LifecycleNode dtor to avoid leaving the device in unknown state.
Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
* add test to verify LifecycleNode::shutdown is called on destructor.
Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
---------
Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
* Stop using constref signature of benchmark DoNotOptimize.
Newer versions of google benchmark (1.8.2 in my case) warn
that the compiler may optimize away the DoNotOptimize calls
when using the constref version. Get away from that here
by explicitly *not* calling the constref version, casting
where necessary.
Signed-off-by: Chris Lalancette <clalancette@gmail.com>
* TypeDescriptions interface with readonly param configuration
* Add parameter descriptor, to make read only
* example of spinning in thread for get_type_description service
* Add a basic test for the new interface
* Fix tests with new parameter
* Add comments about builtin parameters
Signed-off-by: Emerson Knapp <emerson.b.knapp@gmail.com>
Signed-off-by: William Woodall <william@osrfoundation.org>
This does 2 separate things:
* Adds (void)unused_variable things where needed.
* Stops doing some checks on moved-from items in tests.
With this in place, most of the remaining clang static analysis
warnings are gone.
Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
That is, make sure they are all listed in package.xml, found
in the CMakeLists.txt, and properly included where they are
used.
Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
* Automatically transition LifecyclePublisher(s) between activated and inactive
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
* Fix: Add created publishers to the managed entities vector
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
* enabled_ -> activated_
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
* Continue setting should_log_ as before
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
* Fix visibility attributes so it works on Windows
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
clang static analysis complains that there are dead stores in
most of the benchmark tests, which is technically correct.
We use an idiom like:
for (auto _ : state) {
}
And never access _. Silence clang here by doing (void)_;
all of the places this is seen.
Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
* Deprecated `shared_ptr<MessageT>` sub callbacks
Addresses #1619.
Signed-off-by: Abrar Rahman Protyasha <abrar@openrobotics.org>
* Resolve deprecated subscription callbacks in tests
Specifically, `void shared_ptr<MessageT>` subscription callbacks have
been migrated to `void shared_ptr<const MessageT>` subscription
callbacks.
This change has been performed only on the test files that do
not actually house unit tests for the `AnySubscriptionCallback` class.
For unit tests that actually target the deprecated `set` functions,
the deprecation warnings have to be avoided. This patch will be
introduced in a separate commit.
Signed-off-by: Abrar Rahman Protyasha <abrar@openrobotics.org>
* Suppress deprecation warnings in unit tests
This commit specifically introduces suppression of the deprecation
warnings produced while compiling unit tests for the
`AnySubscriptionCallback` class.
The macro mechanics to conditionally include the `deprecated` attribute
is not ideal, but the diagnostic pragma solution (`# pragma GCC
diagnostic ignored`) did not work for these unit tests, possibly because
of the way gtest is initializing the necessary `InstanceContext`
objects.
A `TODO` directive has been left to figure out a better way to address
this warning suppression.
Signed-off-by: Abrar Rahman Protyasha <abrar@openrobotics.org>
* Fix shared ptr callback in wait_for_message
Moving away from deprecated signatures.
Signed-off-by: Abrar Rahman Protyasha <abrar@openrobotics.org>
* `rclcpp_action`: Fix deprecated subscr. callbacks
Signed-off-by: Abrar Rahman Protyasha <abrar@openrobotics.org>
* `rclcpp_lifecycle`: Fix deprecated sub callbacks
Signed-off-by: Abrar Rahman Protyasha <abrar@openrobotics.org>
* Revert "Revert "Updating client API to be able to remove pending requests (#1728)" (#1733)"
This reverts commit d5f3d35fbe.
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
* Address peer review comments
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
* Fix tests in rclcpp_components, rclcpp_lifecycle
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
The main reason to add this method in is to make accesses to the
callback_groups_ vector thread-safe. By having a
callback_groups_for_each that accepts a std::function, we can
just have the callers give us the callback they are interested
in, and we can take care of the locking.
The rest of this fairly large PR is cleaning up all of the places
that use get_callback_groups() to instead use
callback_groups_for_each().
Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
Apparently, the topics and services that LifecycleNode provides are not
available immediately after creating a node.
Fix flaky tests by accounting for some delay between the LifecycleNode
constructor and queries about its topics and services.
Signed-off-by: Jacob Perron <jacob@openrobotics.org>
* Replace stale reference to Connext
* Restore exceptions for ros2/rmw_connext to ease transition to rticommunity/rmw_connextdds
Signed-off-by: Andrea Sorbini <asorbini@rti.com>
Co-authored-by: Chris Lalancette <clalancette@gmail.com>
* add LifecycleNode::get_transition_graph along with service.
Signed-off-by: Tomoya.Fujita <Tomoya.Fujita@sony.com>
* add concrete test cases for get_available_transitions with each primary state.
Signed-off-by: Tomoya.Fujita <Tomoya.Fujita@sony.com>
* Increase test timeouts of slow running tests with rmw_connext_cpp
Signed-off-by: Stephen Brawner <brawner@gmail.com>
* Fix other issues with connext
Signed-off-by: Stephen Brawner <brawner@gmail.com>
* Increase test coverage of rclcpp_lifecycle to 96%
Signed-off-by: Stephen Brawner <brawner@gmail.com>
* PR Fixup
Signed-off-by: Stephen Brawner <brawner@gmail.com>
* test_depend
Signed-off-by: Stephen Brawner <brawner@gmail.com>
* rcutils test_depend
Signed-off-by: Stephen Brawner <brawner@gmail.com>
* More windows warnings
Signed-off-by: Stephen Brawner <brawner@gmail.com>