ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

launch file find with current pkg name

asked 2016-08-19 08:24:22 -0500

Markus Bader gravatar image

updated 2016-08-19 08:25:30 -0500

Hi

Is there a way to resolve the current pkg folder name related to a launch file? My launch files uses the

$(find current_pkg)/my_file.xy

substitution to find and resolve a file in my current package. Every time I am renaming my pkg or if have to check all the finds. Is there a more common way such as

$(CURRENT_PKG)/my_file.xy

Greetings Markus

edit retag flag offensive close merge delete

Comments

Is there anything new on this?

Markus Bader gravatar image Markus Bader  ( 2020-11-10 05:02:12 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2016-08-19 10:40:15 -0500

ElizabethA gravatar image

If you can set a system-wide environment variable for CURRENT_PKG (might need to put it in ~/.bashrc file), you can swap the $(find current_pkg) part with $(env CURRENT_PKG).

edit flag offensive delete link more

Comments

nice idea, but i have multiple such packages.

Markus Bader gravatar image Markus Bader  ( 2016-11-13 00:40:24 -0500 )edit

Is there anything new on this?

Markus Bader gravatar image Markus Bader  ( 2020-11-10 05:02:03 -0500 )edit

@Markus Bader: posting comments on an answered question from 2016 is not the most visible way to ask for updates.

I happened to notice as I'm watching this question, but without that, your comment would be almost invisible.

gvdhoorn gravatar image gvdhoorn  ( 2020-11-10 05:32:51 -0500 )edit
0

answered 2020-11-10 05:31:55 -0500

gvdhoorn gravatar image

updated 2020-11-10 05:34:18 -0500

Perhaps the dirname substitution argument can do what you are looking for:

$(dirname) returns the absolute path to the directory of the launch file in which it appears. This can be used in conjunction with eval and if/unless to modify behaviour based on the installation path, or simply as a convenience for referencing launch or yaml files relative to the current file rather than relative to a package root (as with $(find PKG)). For example:

<include file="$(dirname)/other.launch" />

Will expect to find other.launch in the same directory as the launch file which it appears in.

This does not make it relative to the package, but relative to the .launch file in which this substitution is used.

edit flag offensive delete link more

Question Tools

3 followers

Stats

Asked: 2016-08-19 08:24:22 -0500

Seen: 556 times

Last updated: Nov 10 '20