from launch import LaunchDescription
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch_ros.substitutions import FindPackageShare
from launch.substitutions import PathJoinSubstitution

def generate_launch_description():

    mujoco_sim_pkg_share = FindPackageShare(package="mujoco_simulation")
    mujoco_sim_launch_path = PathJoinSubstitution(
        [mujoco_sim_pkg_share, "launch", "mujoco_simulation.launch.py"]
    )

    control_pkg_share = FindPackageShare(package="robot_control")
    control_launch_path = PathJoinSubstitution(
        [control_pkg_share, "launch", "robot_control.launch.py"]
    )

   
    include_simulation = IncludeLaunchDescription(
        PythonLaunchDescriptionSource(mujoco_sim_launch_path),
    )

    include_control = IncludeLaunchDescription(
        PythonLaunchDescriptionSource(control_launch_path),
    )

    return LaunchDescription([
        include_simulation,  # 启动仿真子launch
        
        include_control      # 启动控制子launch
    ])
