Ask Your Question

roslaunch Python arg substitution finds wrong package folder path?

asked 2018-07-31 22:00:47 -0600

I've recently played around with Python expressions as substitution args in launch files (on 16.04 AMD64/Kinetic/current .debs). I encountered a curious problem during doing so.

When trying to generalize this line:

<param name="site_description" command="$(find xacro)/xacro --inorder '$(find wrs2018_scenario_description)/urdf/scenario.xacro'" />

the following expression works:

<param name="site_description" command="$(eval find('xacro') + '/ --inorder ' + find(scenario_name + '_description') + '/urdf/scenario.xacro')" />

However, it has to be noted that I have to use the deprecated here, as the xacro executable is not found. Investigating further I noted that

$(find xacro)

returns /opt/ros/kinetic/lib/xacro as a path, where also the xacro executable is located.

In contrast to this

$(eval find('xacro'))

returns /opt/ros/kinetic/share/xacro as a path, where only the executable is located.

My expectation was that both calls to find should work identically, but apparently, this is not the case. My questions hence are:

  • Is this expected behavior or a bug?
  • Is there some other way to get to the "right" folder with the xacro executable while using Python substitution args in roslaunch?
edit retag flag offensive close merge delete


This reads like a bug. If you have an easy to reproduce case, then I would suggest reporting it over at ros/xacro/issues. Robert is typically very responsive.

The eval version might be using the wrong find pkg functionality internally.

gvdhoorn gravatar image gvdhoorn  ( 2018-08-01 02:13:30 -0600 )edit

Wouldn't filing against ros_comm (containing roslaunch functionality) be more appropriate? While the issue popped up using xacro, the eval logic likely at fault is part of roslaunch, right?

Stefan Kohlbrecher gravatar image Stefan Kohlbrecher  ( 2018-08-01 15:43:56 -0600 )edit

That's true, but you encountered the issue while working with xacro. If/when the maintainers of that diagnose this as an issue with rospkg and/or roslaunch, then I believe they should either forward you to ros_comm or open an issue there themselves.

gvdhoorn gravatar image gvdhoorn  ( 2018-08-02 02:37:27 -0600 )edit

I don't yet see an advantage of using $(eval) vs. $(find) directly yet. Where is the generalization?

rhaschke gravatar image rhaschke  ( 2018-08-20 01:49:42 -0600 )edit

See the answer here. I want to use nested args. This would be possible in a somewhat clean way using Python substitution args.

Stefan Kohlbrecher gravatar image Stefan Kohlbrecher  ( 2018-08-20 08:34:59 -0600 )edit

1 Answer

Sort by » oldest newest most voted

answered 2018-08-17 10:06:19 -0600

rhaschke gravatar image

This is indeed expected behavior. To find binaries or scripts in various locations, $(find pkg)/file considers also the filename as context for the search:

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



Asked: 2018-07-31 22:00:47 -0600

Seen: 684 times

Last updated: Aug 17 '18