"""
Launch file for past_control — racing control stack.

Launches 3 nodes (a_star_planner removed — Nav2 planner_server handles global planning):
  1. lane_follower_node     — visual lane centering
  2. obstacle_detector_node — DNN obstacle perception
  3. racing_orchestrator    — task FSM + PID following (/plan from Nav2) + cmd_vel arbitration

Usage:
  ros2 launch past_control past_control.launch.py
"""

import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch_ros.actions import Node


def generate_launch_description():

    pkg_dir = get_package_share_directory("past_control")
    config_path = os.path.join(pkg_dir, "config", "past_control.yaml")

    lane_follower = Node(
        package="past_control",
        executable="lane_follower_node",
        name="lane_follower_node",
        output="screen",
        parameters=[config_path],
    )

    obstacle_detector = Node(
        package="past_control",
        executable="obstacle_detector_node",
        name="obstacle_detector_node",
        output="screen",
        parameters=[config_path],
    )

    racing_orchestrator = Node(
        package="past_control",
        executable="racing_orchestrator",
        name="racing_orchestrator",
        output="screen",
        parameters=[config_path],
    )

    return LaunchDescription([
        lane_follower,
        obstacle_detector,
        racing_orchestrator,
    ])
