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

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
18

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

updated 2021-03-04 02:52:59 -0500

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

xacro 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 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 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 image Pi 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 image circusmonkey  ( 2018-07-09 20:09:18 -0500 )edit

Thanks @circusmonkey, I've updated my answer!

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

A 2020 update would be nice ; ) . --inorder became default since Melodic, it can be dropped

Oscar Lima gravatar image Oscar Lima  ( 2021-03-01 00:04:02 -0500 )edit

Ok, I've dropped --inorder.

Martin Günther gravatar image Martin Günther  ( 2021-03-04 02:53:35 -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 image 130s  ( 2018-03-02 01:26:09 -0500 )edit

Question Tools

1 follower

Stats

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

Seen: 13,706 times

Last updated: Mar 04 '21