Ask Your Question
1

Python equivalent of xml built-in substitutions for launch files

asked 2020-06-29 00:19:54 -0600

Rufus gravatar image

What is the python equivalent of xml built-in substitutions such as find-pkg-share when using a python launch file?

e.g. if I need to reference a certain file of a certain package in my python based launch file,

from launch import LaunchDescription
from launch_ros.actions import Node

def generate_launch_description():
    return LaunchDescription([
        Node(
            package='my_package1',
            node_namespace='my_package1',
            node_executable='node',
            node_name='my_package1',
            parameters=[
                {"nav_graph_file", <find-pkg-share my_package2>/my_nav_file.yml}
            ]
        )
    ])
edit retag flag offensive close merge delete

Comments

Did you find any solution to this?

adsasine gravatar image adsasine  ( 2021-02-08 09:39:05 -0600 )edit
1

@adsasine yes, I've answered my question below

Rufus gravatar image Rufus  ( 2021-02-08 19:44:28 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-02-08 19:43:45 -0600

Rufus gravatar image

I think the equivalent is get_package_share_directory as used here

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

3 followers

Stats

Asked: 2020-06-29 00:19:54 -0600

Seen: 53 times

Last updated: Feb 08