Convert xacro to sdf when catkin_make is used

asked 2019-01-12 03:15:17 -0600

bliss2006 gravatar image

updated 2019-01-12 03:16:18 -0600

Hi all,

I have a model defined in xacro file with gazebo extension, similar to files rrbot.xacro and rrbot.gazebo as described in this tutorial. In my project I sometimes want to use urdf and sometimes sdf, which I generate using the following commands:

rosrun xacro xacro --inorder -o rrbot.urdf rrbot.xacro
gz sdf -p rrbot.urdf > rrbot.sdf

The problem is that mesh paths in sdf are absolute. This is inconvenient if I want to share my package. Is there a way to automatically convert rrbot.xacro to rrbot.sdf, for example when I build all packages using catkin_make?

edit retag flag offensive close merge delete

Comments

1

The problem is that mesh paths in sdf are absolute.

Even though this is more a Gazebo problem (and would be best posted on Gazebo Answers): that's not really/necessarily true.

See How to include uri relatively? fi.

gvdhoorn gravatar image gvdhoorn  ( 2019-01-12 04:46:44 -0600 )edit

That's what I did, but the relative path is converted to absolute by rosrun .... However, the following path definition model://low_poly_paddle.stl stays relative even after conversion. I think this is a good enough solution for me!

bliss2006 gravatar image bliss2006  ( 2019-01-12 05:54:08 -0600 )edit