Skip to content

Commit

Permalink
Minor fixups to lifecycle example
Browse files Browse the repository at this point in the history
  • Loading branch information
dhood committed Jun 15, 2018
1 parent 15ac0c3 commit b29224d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions launch_ros/examples/lifecycle_pub_sub_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def _on_transition_event(context):
package='lifecycle', node_executable='lifecycle_talker', output='screen')

# When the talker reaches the 'inactive' state, make it take the 'activate' transition.
event_handler_for_talker_reaching_inactive_state = launch.actions.RegisterEventHandler(
register_event_handler_for_talker_reaching_inactive_state = launch.actions.RegisterEventHandler(
launch_ros.event_handlers.OnStateTransition(
target_lifecycle_node=talker_node, goal_state='inactive',
entities=[
Expand All @@ -59,7 +59,7 @@ def _on_transition_event(context):
)

# When the talker node reaches the 'active' state, log a message and start the listener node.
event_handler_for_talker_reaching_active_state = launch.actions.RegisterEventHandler(
register_event_handler_for_talker_reaching_active_state = launch.actions.RegisterEventHandler(
launch_ros.event_handlers.OnStateTransition(
target_lifecycle_node=talker_node, goal_state='active',
entities=[
Expand All @@ -80,9 +80,10 @@ def _on_transition_event(context):
)
)

# Add the actions to the launch description all at once, because the order matters:
ld.add_action(event_handler_for_talker_reaching_inactive_state)
ld.add_action(event_handler_for_talker_reaching_active_state)
# Add the actions to the launch description.
# The order they are added reflects the order in which they will be executed.
ld.add_action(register_event_handler_for_talker_reaching_inactive_state)
ld.add_action(register_event_handler_for_talker_reaching_active_state)
ld.add_action(talker_node)
ld.add_action(emit_event_to_request_that_talker_does_configure_transition)

Expand Down

0 comments on commit b29224d

Please sign in to comment.