mirror of
https://github.com/modelec/modelec-marcel-ROS.git
synced 2026-01-19 00:57:37 +01:00
launch
This commit is contained in:
@@ -30,40 +30,40 @@ 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':
|
||||
def create_rplidar_node():
|
||||
return Node(
|
||||
package='rplidar_ros',
|
||||
executable='rplidar_node',
|
||||
name='rplidar_node',
|
||||
parameters=[{
|
||||
'channel_type': channel_type,
|
||||
'serial_port': serial_port,
|
||||
'serial_baudrate': serial_baudrate,
|
||||
'frame_id': frame_id,
|
||||
'inverted': inverted,
|
||||
'angle_compensate': angle_compensate
|
||||
}],
|
||||
output='screen'
|
||||
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',
|
||||
parameters=[{
|
||||
'channel_type': channel_type,
|
||||
'serial_port': serial_port,
|
||||
'serial_baudrate': serial_baudrate,
|
||||
'frame_id': frame_id,
|
||||
'inverted': inverted,
|
||||
'angle_compensate': angle_compensate
|
||||
}],
|
||||
output='screen'
|
||||
)
|
||||
|
||||
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
|
||||
)
|
||||
]
|
||||
)
|
||||
)
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user