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

Revision history [back]

click to hide/show revision 1
initial version

While not a perfect answer to my original question as it requires a one time adjustment to a launch file, this post (http://answers.ros.org/question/38956/pass-parameters-to-xacro-in-launch-file/) helped solve my problem pretty well by allowing me to pass an argument to the xacro, which can then be used in the xacro.

This allows the urdf/xacro to be oblivious to its location as the launch file will ensure it knows where to find the STL & DAE files I specify.

Added "meshDirectory" argument to the launch file

<launch>
    <arg name="model" default="$(find urdf_tutorial)/urdf/test2.xacro meshDirectory:=$(find urdf_tutorial)/urdf/" />

Used it like this in .xacro

<geometry>
    <mesh filename="file://$(arg meshDirectory)Assy_X-1.stl" />
</geometry>