feat(lifecycle): implement ROS 2 managed node lifecycle#121
Open
YuanYuYuan wants to merge 13 commits intomainfrom
Open
feat(lifecycle): implement ROS 2 managed node lifecycle#121YuanYuYuan wants to merge 13 commits intomainfrom
YuanYuYuan wants to merge 13 commits intomainfrom
Conversation
… machine - ZLifecycleNode with full 4-state / 7-transition ROS 2 state machine - 5 lifecycle management services (change_state, get_state, get_available_states, get_available_transitions, get_transition_graph) - ~/transition_event publisher on every state change - ZLifecyclePublisher: gated publisher that silently drops when inactive, warns once per deactivation cycle - ManagedEntity trait for bulk activate/deactivate of publishers - Inline lifecycle wire types in lifecycle/msgs.rs to avoid circular dep with ros-z-msgs - create_publisher() immediately activates if node is already Active
Tests cover state machine transitions, callback return values (Success, Failure, Error), publisher gating, bulk activate/deactivate, and late publisher registration. Example demonstrates the full configure → activate → publish → deactivate → shutdown flow.
- New book chapter covering state machine diagram, all transitions, callbacks, lifecycle publishers, CLI interface, and all 5 services - Wired into SUMMARY.md under Core Concepts - check-local.nu: build now includes --examples to catch example compilation errors - check-local.nu: fix Nushell parse error in plural summary message
|
Replace PID-derived port allocation with TcpListener::bind("0") so the
OS picks a guaranteed-free port. PID % 10000 caused collisions when
multiple test binaries ran in parallel on the same CI runner.
Async client wrapping the four lifecycle management services (change_state, get_state, get_available_states, get_available_transitions). Provides high-level helpers for configure/activate/deactivate/cleanup/shutdown transitions and a low-level trigger() for arbitrary TransitionId values.
…ook docs - 7 new integration tests for ZLifecycleClient (get_state, full cycle, shutdown, available states/transitions, invalid transition) - 1 new test for disable_communication_interface - lifecycle_bringup example showing orchestrator pattern - Book chapter section on ZLifecycleClient with code snippets
…lake The test was publishing only 10 messages at 100ms intervals (1s total) while schema discovery via create_dyn_sub_auto can take several seconds under CI load. Switch to a cancellable loop that publishes until the subscriber has received what it needs, matching the pattern used in the other type_description tests.
Replaces fixed 2s sleep with a 15s retry loop so the test does not fail when the server takes longer than expected to register its queryable (observed on kilted under CI load).
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
Implements the ROS 2 managed node lifecycle as defined in REP-2006. Lifecycle nodes expose explicit state transitions (configure, activate, deactivate, cleanup, shutdown) so system orchestrators can safely sequence bringup and teardown of complex robot software.
Key Changes
ZLifecycleNode: full 4-state / 7-transition state machine with configurable callbacks (on_configure,on_activate,on_deactivate,on_cleanup,on_shutdown,on_error)ZLifecyclePublisher: gated publisher that silently drops messages when the node is not Active; registered publishers activate/deactivate in bulk with the node~/change_state,~/get_state,~/get_available_states,~/get_available_transitions,~/get_transition_graph) and~/transition_eventtopic — compatible withros2 lifecycleCLIlifecycle/msgs.rsto avoid circular dependency withros-z-msgslifecycle_msgs.msg/.srvassets added to codegen and always generated (alongsidebuiltin_interfaces)lifecycle_talkerexample and book chapter under Core Conceptscheck-local.nu: build step now includes--examplesto catch example compilation regressionsBreaking Changes
None