Skip to content
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

Expose lifecycle_node #327

Open
wants to merge 1 commit into
base: rolling
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions launch_ros/launch_ros/actions/lifecycle_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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."""

Expand Down Expand Up @@ -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)
Expand Down