input xacro name in xacro file

asked 2018-07-11 09:54:07 -0500

muttidrhummer gravatar image

hi, i want to implement this :

<?xml version="1.0" ?>
  <robot name="robot1" xmlns:xacro="http://ros.org/wiki/xacro">
   <xacro:arg name="robot" default="error"/>
   <xacro:include filename="robots/$(arg robot)_macro.xacro"/>
   <xacro:${arg robot} prefix="robot1_"/>
</robot>

this of course won't work cause ${arg robot} as xacro:name is not recognized.
Any way to implement this way? with the robot name as an argument?
Thanks

edit retag flag offensive close merge delete

Comments

well, i have no idea if this could work, but for argument substitution you need regular braces, not curly ones, like you did in the include: $(arg robot). Have you tried with that?

mgruhler gravatar image mgruhler  ( 2018-07-12 00:55:49 -0500 )edit

The code you have written is not self explanatory, it is not obvious what you want to achieve here. In any case here is a ros answer with some discussion on passing arguments to xacro https://answers.ros.org/question/38956

Reamees gravatar image Reamees  ( 2018-07-12 02:40:37 -0500 )edit