* change misleading warning message, making it more correct and informative
Signed-off-by: Peter Mitrano (AR) <peter.mitrano@agile-robots.com>
* Fix compile error. Needed to also build rcl from source.
Signed-off-by: Peter Mitrano (AR) <peter.mitrano@agile-robots.com>
* explicitely initialize pointer as null, to adhere to best practice
Signed-off-by: Peter Mitrano (AR) <peter.mitrano@agile-robots.com>
---------
Signed-off-by: Peter Mitrano (AR) <peter.mitrano@agile-robots.com>
The function that may not complete successfully is
`rcl_lifecycle_state_fini()`, not `rcl_lifecycle_transition_fini()`.
Signed-off-by: Christophe Bedard <christophe.bedard@apex.ai>
* 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>
* 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>
* 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>
* Add support for logging service.
* Update to not modify interfaces and not change time_source
* Use unique_ptr for NodeBuiltinExecutorImpl
* Use user thread to run logger service
* Update code for lifecycle_node
Signed-off-by: Barry Xu <barry.xu@sony.com>
Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>
* add clock type to node_options and change node/lifecycle_node constructor accordingly
Signed-off-by: Jeffery Hsu <jefferyyjhsu@gmail.com>
* Modify TimeSource::NodeState class to work with different clock types. Add test cases.
Signed-off-by: Jeffery Hsu <jefferyyjhsu@gmail.com>
* Change on_parameter_event to output RCLCPP_ERROR and check
ros_time_active_ in ClocksState::attachClock()
Signed-off-by: Jeffery Hsu <jefferyyjhsu@gmail.com>
* Remove a redundant include
Signed-off-by: Jeffery Hsu <jefferyyjhsu@gmail.com>
* Disallow setting use_sim_time to true if a clock_type can't support it.
Following the reasoning in c54a6f1cd2, on_set_parameters doesn't try to enforce use_sim_time to be of boolean type explicitly.
Signed-off-by: Jeffery Hsu <jefferyyjhsu@gmail.com>
* minior style change
Signed-off-by: Jeffery Hsu <jefferyyjhsu@gmail.com>
* remove reason string for successful result
Signed-off-by: Jeffery Hsu <jefferyyjhsu@gmail.com>
Signed-off-by: Jeffery Hsu <jefferyyjhsu@gmail.com>
* protect state_machine_ with mutex lock.
protect state_handle_ with mutex lock.
reconsider mutex lock scope.
remove mutex lock from constructors.
lock just once during initialization of LifecycleNodeInterfaceImpl.
Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
* Move updating of current_state to right after initialization.
This is slightly more correct in the case that registering one
of the services fails.
Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
Co-authored-by: Chris Lalancette <clalancette@openrobotics.org>
We should only need to update the current state when it changes,
so we do that in the change_state method (which is not const).
Then we can just return the current_state_ object in
get_current_state, and then mark it as const.
Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
* Split lifecycle_node_interface_impl into header and implementation.
There is no reason it should all be in the header file. No
functional change.
* Mark LifecycleNodeInterfaceImpl as final.
* Update documentation about return codes.
* Mark a bunch of LifecycleNodeInterfaceImpl methods as const.
* Make most of LifecycleNodeInterfaceImpl private.
* Mark some LifecycleNode methods as const.
* Disable copies on LifecycleNodeInterfaceImpl.
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>
* Support add_pre_set_parameter and add_post_set_parameter callbacks in addition to add_on_set_parameter_callback in Node API
Signed-off-by: deepanshu <deepanshubansal01@gmail.com>
* 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>
Callers should change to using for_each_callback_group(), or
store the callback groups they need internally.
Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
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>
* added tear-down of node sub-interfaces in reverse order of their creation (#1469)
Signed-off-by: Colin MacKenzie <colin@flyingeinstein.com>
* added name of service to log message for leak detection. Previously it gave no indication of what node is causing the memory leak (#1469)
Signed-off-by: Colin MacKenzie <colin@flyingeinstein.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>
* Reserve vector capacities and use emplace_back for constructing vectors
Signed-off-by: Stephen Brawner <brawner@gmail.com>
* Use resize instead of reserve
Signed-off-by: Stephen Brawner <brawner@gmail.com>
* Remove push_back
Signed-off-by: Stephen Brawner <brawner@gmail.com>
* Change uint8_t iterator variables to size_t
Signed-off-by: Stephen Brawner <brawner@gmail.com>
* Change to unsigned int
Signed-off-by: Stephen Brawner <brawner@gmail.com>
* Catch potential exception in destructor and log
Signed-off-by: Stephen Brawner <brawner@gmail.com>
* Remove thrown error from reset and mark it no except
Signed-off-by: Stephen Brawner <brawner@gmail.com>
* Remove unused private function
Signed-off-by: Stephen Brawner <brawner@gmail.com>
* Remove group_in_node from rclcpp::Node
Signed-off-by: Stephen Brawner <brawner@gmail.com>