calling xacro:macro from within xacro:macro
can I include and call an xacro:macro from within an xacro:macro?
alternatively, can I pass a variable to an xacro if it is not an xacro:macro?
ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
can I include and call an xacro:macro from within an xacro:macro?
alternatively, can I pass a variable to an xacro if it is not an xacro:macro?
For question 1, yes you can. Recursive macros are allowed.
To answer my own question #1 - Yes, macros can be recursive. My error was that I put the includes for the referenced xacro files under the xacro:macro name="..." line.
The correct way is:
<robot xmlns:xacro="http://ros.org/wiki/xacro">
<include filename="$(find abb_common)/urdf/irb_5400_macro.xacro" />
<xacro:macro name="generate_robot" params="robot_name" >
<xacro:irb_5400 prefix="${robot_name}"/>
Make sure all the includes are above the macro declaration!
Asked: 2012-05-11 11:11:56 -0500
Seen: 1,503 times
Last updated: May 11 '12
'#pragma once' equivalent for urdf/xacro files
Hector sonar implementation on a Pioneer 3DX [closed]
Redundant locations in URDF for joint position/effort/velocity limits
How to set params to hokuyo_utm30lx in hector_models?
Problem in adding two Schunk arms plus a simple shape (e.g. cylinder) into .urdf.xacro
Error: Joint is missing a parent and/or child -> No TF data
Unable to see urdf.xacro file in Gazebo or use it in Moveit!
For question2, if it is not a xacro:macro, what is it?
xacro:macro refers to an xacro that contains a macro. In my answer below, I include an xacro file "irb_5400_macro.xacro" that contains the macro "irb_5400". Then I call that xacro:macro from THIS file. An xacro file can also just contain a set of commands, or even constants (like an include file).