"""Autonomous Mode Launcher (Issue #482)"""
from launch import LaunchDescription
from launch_ros.actions import Node
from launch_ros.substitutions import FindPackageShare
from launch.substitutions import PathJoinSubstitution

def generate_launch_description():
    saltybot_bringup_dir = FindPackageShare("saltybot_bringup")
    bt_xml_dir = PathJoinSubstitution([saltybot_bringup_dir, "behavior_trees"])
    return LaunchDescription([
        Node(package="saltybot_bt_executor", executable="behavior_tree_executor", name="autonomous_coordinator",
             parameters=[{"bt_xml_filename": PathJoinSubstitution([bt_xml_dir, "autonomous_coordinator.xml"])}]),
        Node(package="saltybot_battery_monitor", executable="battery_monitor_node", name="battery_monitor"),
        Node(package="saltybot_perception", executable="person_detector", name="person_detector"),
        Node(package="saltybot_lidar_avoidance", executable="obstacle_monitor", name="obstacle_monitor"),
        Node(package="saltybot_follower", executable="person_follower", name="person_follower"),
        Node(package="saltybot_curiosity", executable="curiosity_explorer", name="curiosity_explorer"),
        Node(package="saltybot_emergency_stop", executable="emergency_stop_monitor", name="emergency_stop_monitor"),
    ])
