Call xacro macros using parameters

Is it possible to call a macro using other xacro parameters?

I have a file called inertial_properties.xacro where I have inertial properties defined in a macro for each link.

When I call the macro using <xacro:base_link_inertia /> it works as expected.
When I call the macro using <xacro:${name}${suffix}_inertia />, it doesn’t work. Is it possible to do this in any way?

image

you would have to call this macro like

<xacro:gazebo_link name="SOMENAME" suffiix="SOMESUFFIX" rel_joint="JOINTNAME" pose="POSE" />

thought

Thank you for responding! Although, it’s actually the macro inside the joint that I’m referring to… In the screenshot, it’s written as “xacro:${name}${suffix}_inertia

Basically, I have macros called
joint_1_inertia
joint_2_inertia
joint_3_inertia
etc

So I’d ike to call each macro using the name of the joint like xacro:${joint_name}_inertia/ but the curly braces are not allowed… I’m wondering if there is another way to do this?

not sure but I would think that is not the use of macros.

maybe someone else knows differently

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.