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

xacro load yaml file with rospack

asked 2015-08-07 08:33:16 -0500

thebyohazard gravatar image

I'm using xacro's new ability to load a yaml file into a property in order to update a URDF with new calibration data.

The file in the example is local. Is there any way to hook this up to rospack so I can include this xacro file in another one? I tried an inner $( ) but it didn't work.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2015-08-19 13:21:07 -0500

thebyohazard gravatar image

updated 2015-09-04 12:04:37 -0500

You apparently only need one set of ${} per property. So rather than trying to double up with

<xacro:property name="filename" value="$(find package)/file.yaml"/>
<xacro:property name="dictionary" value="${load_yaml(${filename})}"/>

or

<xacro:property name="dictionary" value="${load_yaml($(find package)/filename.yaml)}"/>

like I tried to do, use two different properties, like so:

<xacro:property name="filename" value="$(find package)/file.yaml"/>
<xacro:property name="dictionary" value="${load_yaml(filename)}"/>

The filename will be substituted already since it's already in curly brackets. You don't need two sets.

Thanks to [Robert Haschke] for this answer.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-08-07 08:33:16 -0500

Seen: 2,460 times

Last updated: Sep 04 '15