launch file ROS2

This commit is contained in:
acki
2025-11-12 18:33:29 +01:00
parent 3d7bfca61e
commit b35c445214

View File

@@ -41,15 +41,15 @@ def generate_launch_description():
output='screen' output='screen'
) )
# Register a restart handler that re-creates both node + handler # Instead of recursion at definition time, we delay the re-creation using a lambda
restart_handler = RegisterEventHandler( restart_handler = RegisterEventHandler(
OnProcessExit( OnProcessExit(
target_action=lidar_node, target_action=lidar_node,
on_exit=[ on_exit=[
LogInfo(msg="[Launch] RPLIDAR crashed — restarting in 2s..."), LogInfo(msg='[Launch] RPLIDAR crashed — restarting in 2s...'),
TimerAction( TimerAction(
period=2.0, period=2.0,
actions=create_lidar_with_restart() # recursive: spawns new node + handler actions=[OpaqueFunction(function=lambda *_: create_lidar_with_restart())]
) )
] ]
) )