Skip to content

Commit

Permalink
Create a separate launch script for emitting lifecycle.
Browse files Browse the repository at this point in the history
Temporary workaround for ros2/launch_ros#41
  • Loading branch information
knatsuki committed May 29, 2020
1 parent bd0cf7a commit ba04faa
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import launch
import launch_ros
import lifecycle_msgs.msg


def generate_launch_description():
Expand All @@ -14,8 +15,10 @@ def generate_launch_description():
launch_ros.descriptions.ComposableNode(
package='wiimote',
node_plugin='WiimoteNode',
node_name='wiimote'
node_name='wiimote',
node_namespace=''
)
]
)

return launch.LaunchDescription([set_tty_launch_config_action, container])
20 changes: 20 additions & 0 deletions wiimote/launch/wiimote_lifecycle.launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import launch
import launch_ros
import lifecycle_msgs.msg


def generate_launch_description():
set_tty_launch_config_action = launch.actions.SetLaunchConfiguration("emulate_tty", "true")
wiimote_node = launch_ros.actions.LifecycleNode(
package='wiimote',
node_executable='wiimote_node',
node_namespace='',
node_name='wiimote',
output='screen',
arguments=['__log_level:=debug']
)
configure_trans_event = launch.actions.EmitEvent(event=launch_ros.events.lifecycle.ChangeState(
lifecycle_node_matcher=launch_ros.events.lifecycle.matches_node_name('/wiimote'),
transition_id=lifecycle_msgs.msg.Transition.TRANSITION_CONFIGURE
))
return launch.LaunchDescription([set_tty_launch_config_action, wiimote_node, configure_trans_event])

0 comments on commit ba04faa

Please sign in to comment.