xacro properties
I'm trying to use the mesh from the realsense camera in my .urdf.xacro file and getting name 'd435_cam_height' is not defined
or similar.
This is a MWE to show the issue:
<?xml version="1.0" ?>
<robot name="test" xmlns:xacro="http://www.ros.org/wiki/xacro">
<!-- sensors -->
<xacro:include filename="$(find realsense2_camera)/urdf/_d435.urdf.xacro"/>
<xacro:sensor_d435 parent="base_link">
<origin xyz="0 ${(0.355-d435_cam_height)/2} 0.0445" rpy="0 0 ${pi/2}"/>
</xacro:sensor_d435>
<link name="base_link">
<visual>
<geometry>
<box size="0.483 0.355 0.089"/>
</geometry>
<origin xyz="0 0 0"/>
</visual>
<collision>
<geometry>
<box size="0.483 0.355 0.089"/>
</geometry>
<origin xyz="0 0 0"/>
</collision>
<intertial>
<mass value="7"/>
<inertia ixx="0.0781351666667" ixy="0" ixz="0" iyy="0.140705833333" iyz="0" izz="0.140705833333"/>
</intertial>
</link>
</robot>
They define the property I'm trying to use with the following snippet:
<?xml version="1.0"?>
<robot name="sensor_d435" xmlns:xacro="http://ros.org/wiki/xacro">
<xacro:macro name="sensor_d435" params="parent *origin">
...
<xacro:property name="d435_cam_height" value="0.025"/>
...
<!-- camera body, with origin at bottom screw mount -->
<joint name="camera_joint" type="fixed">
<xacro:insert_block name="origin" />
<parent link="${parent}"/>
<child link="camera_link" />
</joint>
...
</xacro:macro>
</robot>
Is it not possible to use properties defined inside a macro in another xacro file? I tried with namespaces, I tried to search for similar questions and I did the tutorial and looked for similar robots with no luck. Of course using 0.025 directly solves the issue, it's beside the point of using properties then.
Asked by aPonza on 2018-09-17 06:11:49 UTC
Comments
With the "new xacro" (ie: Jade and up), that property is most likely local to the
sensor_d435
macro, so not exposed to parent scopes.What did you "try with namespaces"?
Asked by gvdhoorn on 2018-09-17 07:15:57 UTC
sensor_d435.d435_cam_height
andxacro:sensor_d435.d435_cam_height
both to no avail, of course. So the only solution is to go ask nicely if Intel can put the properties outside the macro? It wouldn't change anything to them, right?Asked by aPonza on 2018-09-17 07:19:10 UTC