This commit is contained in:
acki
2025-05-29 08:50:57 -04:00
parent ed7770bc3f
commit ccf06397e5
2 changed files with 20 additions and 16 deletions

View File

@@ -30,9 +30,10 @@ def generate_launch_description():
with_com = LaunchConfiguration('with_com')
with_strat = LaunchConfiguration('with_strat')
def launch_rplidar_restart_if_needed(context, *args, **kwargs):
if context.launch_configurations.get('with_rplidar') == 'true':
rplidar_node = Node(
def launch_rplidar_restart_if_needed(context, *args, **kwargs):
if context.launch_configurations.get('with_rplidar') == 'true':
def create_rplidar_node():
return Node(
package='rplidar_ros',
executable='rplidar_node',
name='rplidar_node',
@@ -47,19 +48,22 @@ def generate_launch_description():
output='screen'
)
restart_handler = RegisterEventHandler(
OnProcessExit(
target_action=rplidar_node,
on_exit=[
TimerAction(
period=5.0, # Delay before restarting (in seconds)
actions=[rplidar_node] # Restart the rplidar_node
)
]
)
rplidar_node = create_rplidar_node()
restart_handler = RegisterEventHandler(
OnProcessExit(
target_action=rplidar_node,
on_exit=[
TimerAction(
period=5.0,
actions=[create_rplidar_node()] # ✅ créer un NOUVEAU Node
)
]
)
return [rplidar_node, restart_handler]
return []
)
return [rplidar_node, restart_handler]
return []
# Function to launch GUI and shutdown handler

View File

@@ -9,7 +9,7 @@
<min_move_threshold_mm>50</min_move_threshold_mm>
<refresh_rate>0.5</refresh_rate>
<max_stationary_time_s>5</max_stationary_time_s>
<min_emergency_distance_mm>500</min_emergency_distance_mm>
<min_emergency_distance_mm>50</min_emergency_distance_mm>
<margin_detection_table_mm>50</margin_detection_table_mm>
</detection>
<factor_close_enemy>-0.3</factor_close_enemy>