Ask Your Question
2

How to check xacro syntax like check_urdf?

asked 2011-02-25 05:59:09 -0500

Pi Robot gravatar image

Hello!

I would like to do a command line syntax check of an Xacro robot model similar to the one used for non-xacro files which is:

$ rosrun urdf check_urdf model.urdf

I know I can generate a temporary URDF file from my Xacro file using:

$ rosrun xacro xacro.py model.urdf.xacro > tmp.urdf

and then run 'rosrun urdf check_urdf' on that file. But for some reason I can't figure out how to simply pipe the two commands together into one command. Can it be done?

Thanks! patrick

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
8

answered 2011-02-26 21:17:01 -0500

updated 2018-07-10 04:52:28 -0500

Unfortunately, this is not possible at the moment. It would be nice if one could do something like:

xacro --inorder model.urdf.xacro | check_urdf -

... and have check_urdf read stdin instead of a file, but tinyxml (which is used internally by check_urdf) expects a filename, and nothing can be done about that without changing the code of tinyxml (which would be quite easy). Of course you could just write your two lines into one, but that would be cheating, wouldn't it? :-)

xacro --inorder model.urdf.xacro > tmp.urdf && check_urdf tmp.urdf && rm tmp.urdf

Update 07/2018: Since people still seem to be reading this question 7 years later, here's a nicer way to do it in one line:

check_urdf <(xacro --inorder model.urdf.xacro)
edit flag offensive delete link more

Comments

Thanks Martin. It's at least good to know that I wasn't just forgetting how to do pipes correctly! I submitted a feature request ticket on ros.org to enable piping or to create a separate check_xacro node https://code.ros.org/trac/ros-pkg/ticket/4829
Pi Robot gravatar imagePi Robot ( 2011-02-27 01:13:50 -0500 )edit

Newbie here: I modified your command a little to suit later versions of ROS: xacro --inorder model.urdf.xacro > tmp.urdf && check_urdf tmp.urdf

circusmonkey gravatar imagecircusmonkey ( 2018-07-09 20:09:18 -0500 )edit

Thanks @circusmonkey, I've updated my answer!

Martin Günther gravatar imageMartin Günther ( 2018-07-10 04:42:13 -0500 )edit
1

answered 2015-02-01 09:29:51 -0500

ReedHedges gravatar image

note that has of recent ROS versions (since hydro? not sure.) check_urdf is runnable directly, not via rosrun, so just use check_urdf tmp.urdf in the above command.

edit flag offensive delete link more

Comments

130s gravatar image130s ( 2018-03-02 01:26:09 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2011-02-25 05:59:09 -0500

Seen: 4,988 times

Last updated: Jul 10 '18