@@ -145,6 +145,7 @@ def execute(self, context: launch.LaunchContext) -> Optional[List[Action]]:
145145 self ._perform_substitutions (context ) # ensure self.node_name is expanded
146146 if '<node_name_unspecified>' in self .node_name :
147147 raise RuntimeError ('node_name unexpectedly incomplete for lifecycle node' )
148+ < << << << HEAD
148149 node = get_ros_node (context )
149150 # Create a subscription to monitor the state changes of the subprocess.
150151 self .__rclpy_subscription = node .create_subscription (
@@ -161,5 +162,22 @@ def execute(self, context: launch.LaunchContext) -> Optional[List[Action]]:
161162 matcher = lambda event : isinstance (event , ChangeState ),
162163 entities = [launch .actions .OpaqueFunction (function = self ._on_change_state_event )],
163164 ))
165+ == == == =
166+
167+ self .__lifecycle_event_manager = LifecycleEventManager (self )
168+ self .__lifecycle_event_manager .setup_lifecycle_manager (context )
169+
170+ # If autostart is enabled, transition to the 'active' state.
171+ autostart_actions = None
172+ if self .node_autostart :
173+ autostart_actions = [
174+ LifecycleTransition (
175+ lifecycle_node_names = [self .node_name ],
176+ transition_ids = [lifecycle_msgs .msg .Transition .TRANSITION_CONFIGURE ,
177+ lifecycle_msgs .msg .Transition .TRANSITION_ACTIVATE ]
178+ ),
179+ ]
180+
181+ > >> >> >> 98952 b5 (Fixing lifecycle node autostart issue #445 (#449))
164182 # Delegate execution to Node and ExecuteProcess.
165183 return super ().execute (context )
0 commit comments