Robotics StackExchange | Archived questions

dynamic path names using xacro

Hello

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="http://www.ros.org/wiki/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"/>      
</robot>

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

<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/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"/>      
</robot>

Any ideas Greetings Markus

Asked by Markus Bader on 2014-06-11 02:26:03 UTC

Comments

Answers

Hi,

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...

Asked by evilBiber on 2014-06-12 02:21:26 UTC

Comments

Any idea how to solve the problem?

Asked by Markus Bader on 2014-06-17 14:09:06 UTC