refactor: convert SelfFilterNode to LifecycleNode#7
Open
Lakshya-04 wants to merge 1 commit into
Open
Conversation
Production patches for HIL / sim-time deployments: - Convert rclcpp::Node to rclcpp_lifecycle::LifecycleNode so the filter can be (de)activated in sync with the rest of the lifecycle-managed perception stack (nvblox, etc.) - Move TF buffer + listener creation from on_configure back into the constructor. On sim-time deployments with slow clock startup, creating them inside on_configure misses early TF messages and causes a race on the first dock cycle — constructor creation accumulates transforms from node start. - Change default use_sim_time from true to false (the wrong default for most non-Gazebo deployments; sim users can flip via param). - Add rclcpp_lifecycle to CMakeLists + package.xml. - Bump cmake_minimum_required to 3.22 (aligns with ROS 2 Humble minimum and simplifies target properties). - Logs restructured under on_configure with clearer startup message.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Converts
SelfFilterNodefromrclcpp::Nodetorclcpp_lifecycle::LifecycleNodeso the filter can integrate with lifecycle-managed perception stacks. Changes gathered from production deployments on mobile manipulators where the self-filter needs to start/stop coordinated with an upstream perception pipeline.Changes
1. LifecycleNode conversion (
src/self_filter.cpp)rclcpp_lifecycle::LifecycleNodeinstead ofrclcpp::Node.on_configure.2. TF buffer created in constructor, not
on_configureOn sim-time / HIL deployments, the ROS clock ticks slowly at startup and there's a warm-up window where TF messages arrive before
on_configurefires. Creating the TF buffer + listener in the constructor ensures early TF history is accumulated:This eliminated a race where the first dock cycle on sim-time could fail because no TF history was available yet.
3.
use_sim_timedefault:true→falseThe original default targeted simulation workflows. Most real deployments run with wall-clock time; simulation users can still flip via parameter. Matches the default convention for ROS 2 nodes.
4. Build system updates
package.xml: addrclcpp_lifecycleto build and exec deps.CMakeLists.txt: addrclcpp_lifecycletofind_package, bumpcmake_minimum_requiredto 3.22 (aligns with ROS 2 Humble's CMake minimum), minor reordering.Backwards compatibility
LifecycleNodeis a superset ofNodein message handling but requires explicit configure/activate transitions. Existing callers that launchedself_filteras a plain node will now start in theUNCONFIGUREDstate and need to trigger the transitions explicitly (viaros2 lifecycle set /self_filter_node configure activateor a lifecycle_manager).If this is a concern, one option is to add a "classic node" build mode guarded by a CMake flag — happy to add that if preferred.
Testing
Deployed for several months on a mobile manipulator (UR10e + custom base + Livox LiDAR) as part of a dock → nvblox → planner pipeline. The TF warm-up fix specifically addressed intermittent first-cycle failures that only reproduced on sim-time.
Happy to split into smaller commits or separate PRs if preferred. Thanks for maintaining this package!