import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch_ros.actions import Node
from launch_ros.parameter_descriptions import ParameterValue
from launch.substitutions import Command


def generate_launch_description():
    urdf_path = os.path.join(
        get_package_share_directory('origincar_description'),
        'urdf', 'origincar.urdf')
    
    robot_description = ParameterValue(
        Command(['xacro ', urdf_path]), value_type=str)

    robot_state_publisher = Node(
        package='robot_state_publisher',
        executable='robot_state_publisher',
        name='robot_state_publisher',
        parameters=[{'robot_description': robot_description,
                     'publish_frequency': 15.0}],
    )

    ld = LaunchDescription()
    ld.add_action(robot_state_publisher)
    return ld
