-
Notifications
You must be signed in to change notification settings - Fork 101
[bug] Ignored lifecycle state Event/EventHandler in launch file #1303
Description
(Please add appropriate labels)
- Windows: (Version)
- Linux: (Dist/Version)
- ROS 1: Dist
- ROS 2: Dist
<Version of the plugin>
v0.9.2
<Copy the Version information from the Help | About menu>
Version: 1.95.3
Commit: f1a4fb101478ce6ec82fe9627c43efbf9e98c813
Date: 2024-11-13T14:50:04.152Z
Electron: 32.2.1
ElectronBuildId: 10427718
Chromium: 128.0.6613.186
Node.js: 20.18.0
V8: 12.8.374.38-electron.0
OS: Linux x64 6.8.0-48-generic snap
what is the bug
When debugging in the case of a ros Lifecycle node, I want to activate my node from a lauch file, via launch.actions.EmitEvent and launch_ros.events.lifecycle.ChangeState, but it look like the EmitEvent is not done. Event if I change the state manually via ros2 lifecycle <node_name> <state>, the EventHandler of the launch file do not work.
Minimal example launch example:
from launch.actions import Shutdown
from launch_ros.actions import LifecycleNode
from launch_ros.actions import Node
from launch.actions import DeclareLaunchArgument, EmitEvent, RegisterEventHandler, LogInfo
from launch_ros.event_handlers import OnStateTransition
from launch_ros.events.lifecycle import ChangeState
import launch
from lifecycle_msgs.msg import Transition
def generate_launch_description():
node = LifecycleNode(package='lifecycle', executable='lifecycle_talker',
name='lc_talker', namespace='', output='screen')
# THIS DO NOT WORK in Launch Debugging
configure_event = EmitEvent(
event=ChangeState(
lifecycle_node_matcher=launch.events.matches_action(
node),
transition_id=Transition.TRANSITION_CONFIGURE,
))
# THIS DO NOT WORK in Launch Debugging
state_handler = RegisterEventHandler(
OnStateTransition(
target_lifecycle_node=node,
goal_state='inactive',
entities=[
# Log
LogInfo(
msg="RegisterEventHandler worked")]))
return LaunchDescription([
configure_event, node, state_handler
# Node(package='lifecycle', executable='lifecycle_listener', output='screen'),
# Node(package='lifecycle', executable='lifecycle_service_client', output='screen',
# on_exit=Shutdown()),My final goal is perfrom something similar to this example.. But all the lifecycle node state dependencies doesn't seem to be handle correctly in the debugger.
Repro steps
<how to reproduce the bug. Please attach sample files or github repo if appropriate.>
I made a minimal example using the ros lifecycle demo code, only modifying the launch file:
- clone this repo
- compile the lifecycle package
- launch debugin on the lauch package
expected behavior
<what you would expect to happen>
The behavior should be similar as when the launch file is run without debugger :
- signal are emitted
- handler are called
- and in the proivided example, we should have the LogInfo message
additional context
<any additional information would be helpful for a better understanding>