ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

How can I use arg to add a node to a urdf.xacro?

asked 2015-06-30 01:42:18 -0500

NEngelhard gravatar image

I use the $(arg foo) syntax to change some values in a urdf.xacro file to adapt the urdf to different robots. This works fine if I just want to replace a string like a position (e.g.

<origin xyz="-0.05 -0.20 -0.038" rpy="($arg rpy_joint_1)/>

but I also want to be able to a a full xml node. I'd like to have a urdf.xacro that looks like

<link name="link_foo" />
$(arg bla)
<link name="link_bar" />

If an additional link is present, 'bar' would contain the whole link definition (maybe also with a joint definition), otherwise it would just be empty. Unfortunately, xacro ignores args that are not already within an xml-node (other than <robot>)

Has anyone managed to get this done?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-06-30 11:08:49 -0500

thebyohazard gravatar image

The $(arg bla) syntax is actually part of rospack. That's fine to use in a xacro file, but xacro has many more tools available than that. Look at the xacro:macro commands and the xacro conditionals at http://wiki.ros.org/xacro

edit flag offensive delete link more

Comments

I had a look at the docu, but so far, I have seen no syntax with which I could create a new node.

NEngelhard gravatar image NEngelhard  ( 2015-06-30 11:54:50 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2015-06-30 01:42:18 -0500

Seen: 467 times

Last updated: Jun 30 '15