[ros-users] Using a xacro parameter value in xacro macros

John Hsu johnhsu at willowgarage.com
Thu May 27 15:12:38 UTC 2010


Hi Adolfo,
I've updated to wiki to reflect your comment.  thank you.
John

2010/5/27 Adolfo Rodríguez Tsouroukdissian <
adolfo.rodriguez at pal-robotics.com>

>
>
> On Wed, May 26, 2010 at 8:32 PM, John Hsu <johnhsu at willowgarage.com>wrote:
>
>> seems xacro:parameter should be xacro:property, then things should work.
>> I'll update the wiki.
>>
>
> Yes,  xacro:property works. For the record, a xacro:property cannot be
> declared inside a xacro:macro.
>
> Adolfo
>
>
> John
>>
>> 2010/5/26 Adolfo Rodríguez Tsouroukdissian <
>> adolfo.rodriguez at pal-robotics.com>
>>
>>> Update.
>>>
>>> The problem seems to be more general in that I am unable to use
>>> xacro:param at all, which makes me think that I might be using it the wrong
>>> way. This code also errors out :
>>>
>>> <?xml version="1.0"?>
>>>
>>> <robot xmlns:xacro="http://www.ros.org/wiki/xacro"
>>>        xmlns:sensor="
>>> http://playerstage.sourceforge.net/gazebo/xmlschema/#sensor"
>>>        xmlns:controller="
>>> http://playerstage.sourceforge.net/gazebo/xmlschema/#controller"
>>>        xmlns:interface="
>>> http://playerstage.sourceforge.net/gazebo/xmlschema/#interface"
>>>        name="foo" >
>>>
>>>   <xacro:parameter name="the_param" value="/path/to/foo" />
>>>   <include filename="${the_param}" />
>>> </robot>
>>>
>>> Is there something obviously wrong here?. I tried grepping the ros
>>> codebase for xacro:param occurrences to compare against, but found none.
>>>
>>> Adolfo
>>>
>>> 2010/5/26 Adolfo Rodríguez Tsouroukdissian <dofo79 at gmail.com>
>>>
>>>  I'd like to ask whether using a xacro parameter value in xacro macros is
>>>> allowed, because it is not clear from the docs [
>>>> http://www.ros.org/wiki/xacro]. Consider a simplified version of my
>>>> file, which fails on ros-latest from binary packages:
>>>>
>>>> <xacro:parameter name="the_param" value="1" />
>>>>
>>>> <xacro:macro name="macro1" >
>>>>   <foo>${the_param}</foo>
>>>> </xacro:macro>
>>>>
>>>> <xacro:macro name="macro2" params="macro2_param" >
>>>>   <mechanicalReduction>${macro2_param}</mechanicalReduction>
>>>> </xacro:macro>
>>>>
>>>>
>>>> <xacro:macro1 />
>>>>   <!-- Fails -->
>>>> <xacro:macro2 macro2_param ="${the_param}" />  <!-- Fails -->
>>>>
>>>> The two above lines raise a XacroException that states " Property wasn't
>>>> defined: u'the_param' " when xacro is run. Is this expected behavior?.
>>>>
>>>> TIA,
>>>>
>>>> Adolfo
>>>>
>>>>
>>>> --
>>>> Adolfo Rodríguez Tsouroukdissian, Ph. D.
>>>>
>>>> Robotics engineer
>>>> PAL ROBOTICS S.L
>>>> http://www.pal-robotics.com
>>>> Tel. +34.93.414.53.47
>>>> Fax.+34.93.209.11.09
>>>> AVISO DE CONFIDENCIALIDAD: Este mensaje y sus documentos adjuntos,
>>>> pueden contener información privilegiada y/o confidencial que está dirigida
>>>> exclusivamente a su destinatario. Si usted recibe este mensaje y no es el
>>>> destinatario indicado, o el empleado encargado de su entrega a dicha
>>>> persona, por favor, notifíquelo inmediatamente y remita el mensaje original
>>>> a la dirección de correo electrónico indicada. Cualquier copia, uso o
>>>> distribución no autorizados de esta comunicación queda estrictamente
>>>> prohibida.
>>>>
>>>> CONFIDENTIALITY NOTICE: This e-mail and the accompanying document(s) may
>>>> contain confidential information which is privileged and intended only for
>>>> the individual or entity to whom they are addressed.  If you are not the
>>>> intended recipient, you are hereby notified that any disclosure, copying,
>>>> distribution or use of this e-mail and/or accompanying document(s) is
>>>> strictly prohibited.  If you have received this e-mail in error, please
>>>> immediately notify the sender at the above e-mail address.
>>>>
>>>
>>> _______________________________________________
>>> ros-users mailing list
>>> ros-users at code.ros.org
>>> https://code.ros.org/mailman/listinfo/ros-users
>>>
>>>
>>
>> _______________________________________________
>> ros-users mailing list
>> ros-users at code.ros.org
>> https://code.ros.org/mailman/listinfo/ros-users
>>
>>
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ros.org/pipermail/ros-users/attachments/20100527/051b1166/attachment-0003.html>


More information about the ros-users mailing list