From 9ca0241b185a7f72a0109ee2632fcc5ecea15ba3 Mon Sep 17 00:00:00 2001 From: Kenji Miyake Date: Fri, 7 May 2021 17:30:44 +0900 Subject: [PATCH] Expose lifecycle_node Signed-off-by: Kenji Miyake --- launch_ros/launch_ros/actions/lifecycle_node.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/launch_ros/launch_ros/actions/lifecycle_node.py b/launch_ros/launch_ros/actions/lifecycle_node.py index dd5cb46b..1bc933ae 100644 --- a/launch_ros/launch_ros/actions/lifecycle_node.py +++ b/launch_ros/launch_ros/actions/lifecycle_node.py @@ -23,6 +23,9 @@ import launch from launch import SomeSubstitutionsType from launch.action import Action +from launch.frontend import Entity +from launch.frontend import expose_action +from launch.frontend import Parser import launch.logging import lifecycle_msgs.msg @@ -35,6 +38,7 @@ from ..ros_adapters import get_ros_node +@expose_action('lifecycle_node') class LifecycleNode(Node): """Action that executes a ROS lifecycle node.""" @@ -78,6 +82,13 @@ def __init__( self.__current_state = \ ChangeState.valid_states[lifecycle_msgs.msg.State.PRIMARY_STATE_UNKNOWN] + @classmethod + def parse(cls, entity: Entity, parser: Parser): + """Return `LifecycleNode` action and kwargs for constructing it.""" + _, kwargs = super().parse(entity, parser) + + return cls, kwargs + def _on_transition_event(self, context, msg): try: event = StateTransition(action=self, msg=msg)