-
Notifications
You must be signed in to change notification settings - Fork 998
Implement Lifecycle Node Support for EKF and UKF nodes #959
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
base: rolling-devel
Are you sure you want to change the base?
Implement Lifecycle Node Support for EKF and UKF nodes #959
Conversation
- Add ROS 2 managed lifecycle support (LifecycleNode pattern) - Introduce lifecycle_managed_node parameter (default: false for backward compatibility) - Implement lifecycle callbacks: on_configure, on_activate, on_deactivate, on_cleanup, on_shutdown - Update CMakeLists.txt and package.xml with rclcpp_lifecycle dependency - Update launch files (ekf.launch.py, ukf.launch.py) to expose lifecycle_managed_node parameter - Add comprehensive documentation in doc/lifecycle_support.rst - Update CHANGELOG.rst with feature summary Closes cra-ros-pkg#958
SteveMacenski
left a comment
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.
Good first stab - in general lets not change unrelated things like declaring parameters lambdas
| //! @brief Whether the node requires external lifecycle management | ||
| //! | ||
| //! When false (default), the node auto-transitions through configure and activate | ||
| //! on startup, maintaining backward compatibility. When true, external lifecycle | ||
| //! management via ros2 lifecycle commands is required. | ||
| bool lifecycle_managed_node_; |
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 think it should always be a managed node and have no auto-transition like this. There are ways to do this via the launch file instead.
launch/ekf.launch.py
Outdated
|
|
||
| return LaunchDescription([ | ||
| lifecycle_managed_param, | ||
| launch_ros.actions.Node( |
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.
If you use the LifecycleNode then there's an autostart param in rolling + newer that'll auto transition if desired
| default_value='false', | ||
| description='Enable lifecycle management for the UKF node') | ||
|
|
||
| return LaunchDescription([ |
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.
Ditto, and then remove this launch configuration for the lifecycle_managed_node
src/ekf_node.cpp
Outdated
| void sigintHandler(int signum) | ||
| { | ||
| static_cast<void>(signum); | ||
| g_sigint_requested.store(true); | ||
| } |
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.
This should also be removed from all nodes
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.
In general many of the changes here are not necessary if not lifecycle_managed_node
src/ros_filter.cpp
Outdated
| template<typename T> | ||
| void RosFilter<T>::loadParams() | ||
| { | ||
| auto declare_parameter_if_not_declared = |
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.
Remove this lambda
src/ros_filter.cpp
Outdated
| @@ -2077,6 +2299,11 @@ void RosFilter<T>::poseCallback( | |||
| template<typename T> | |||
| void RosFilter<T>::initialize() | |||
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.
If we're doing lifecyckle, this method should be removed and its implementation should be happening on configure / activate as appropriate
Changes
Adds ROS 2 managed lifecycle support for EKF/UKF state estimation nodes.
rclcpp_lifecycle::LifecycleNodelifecycle_managed_nodeparameter (default: false)false: nodes auto-configure/activate (backward compatible)true: nodes require external lifecycle management viaros2 lifecyclecommandsrclcpp_lifecycledependency to CMakeLists.txt and package.xmlTesting
Closes #958