import os

from launch import LaunchDescription
from launch_ros.actions import Node
from launch_ros.substitutions import FindPackageShare

def generate_launch_description():
    package_name = 'gen_locations_on_mesh'
    mesh_file = 'sirius_scene_floor_and_objs.ply'

    # файл карты для загрузки
    pkg_share = FindPackageShare(package=package_name).find(package_name)
    mesh_path = os.path.join(pkg_share, 'share', mesh_file)

    start_gen_location_on_mesh_cmd = Node(
      name='gen_locations_on_mesh',
      package='gen_locations_on_mesh',
      executable='gen_locations_on_mesh',
      parameters=[{'mesh_filename': mesh_path,
                   'init_number_of_points': 20,
                   'max_z_coord': 2.}])

    # создать описание запуска
    ld = LaunchDescription()
    ld.add_action(start_gen_location_on_mesh_cmd)
    # завершить создание
    return ld
