Home | Tutorials | Wiki | Issues
Ask Your Question
0

dynamic path names using xacro

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

Markus Bader gravatar image

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

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

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

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

edit flag offensive delete link more

Comments

Any idea how to solve the problem?

Markus Bader gravatar imageMarkus Bader ( 2014-06-17 14:09:06 -0500 )edit
Login/Signup to Answer

Question Tools

Stats

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

Seen: 497 times

Last updated: Jun 12 '14