Gazebo | Ignition | Community
Ask Your Question

dynamic path names using xacro

asked 2014-06-11 02:26:03 -0500

Markus Bader gravatar image


I am using xacro to generate sdf and urd files for ros and gazebo. And I like to have my robot describtion as modular as possible but I have an issue with relative path names. The following example shows a working xacro example:

<?xml version="1.0"?>
<robot xmlns:xacro="" name="dsa" >
  <xacro:include filename="$(find dsa_gazebo)/xacro/tricycle/tricycle_body.xacro"/>
  <xacro:tricycle_body name="chassis" parent="base_link" meshes="package://dsa_gazebo/meshes/tricycle"/>      

but I like to put the ros package name into a variable which does NOT work

<?xml version="1.0"?>
<robot xmlns:xacro="" name="dsa" >
  <property name="CURRENT_PKG" value="dsa_gazebo" />  <!-- variable for the current pkg --> 
  <xacro:include filename="$(find ${CURRENT_PKG})/xacro/tricycle/tricycle_body.xacro"/>  <!-- solving find with a xacro varaible does not work :-( --> 
  <xacro:tricycle_body name="chassis" parent="base_link" meshes="package://${CURRENT_PKG}/meshes/tricycle"/>      

Any ideas Greetings Markus

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-06-12 02:21:26 -0500


I tried to reproduce this and xacro threw the follwoing error:

roslaunch.substitution_args.SubstitutionException: Dollar signs '$' cannot be inside of substitution args [$(find ${pkg})]

It seems like xacro forbids properties as part of calls like find...

edit flag offensive delete link more


Any idea how to solve the problem?

Markus Bader gravatar imageMarkus Bader ( 2014-06-17 14:09:06 -0500 )edit

Question Tools


Asked: 2014-06-11 02:26:03 -0500

Seen: 998 times

Last updated: Jun 12 '14