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

Xacro, ruby : SDF parametrization

asked 2015-12-24 08:49:48 -0500

AlexandreB gravatar image


I'm looking to control some parameters of my model through the ros launch file. I know that this used to be handle with xacro in urdf file and ruby allow some features in SDF but I not sure how to processed so that I can pass on the arguments from the launch file.

Also, would it be better to rather use urdf for my model?



edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2016-01-18 05:49:46 -0500

updated 2016-01-18 05:50:27 -0500

The URDF vs SDF discussion is something delicate. It is true that SDF is more flexible in terms of simulation as it solves some URDF problems, but URDF has much better integration with ROS and you can easily leverage ROS tools such as TF, etc. It really depends whether the URDF limitations affect your application.

Anyway, it is possible to give parameters to xacro from launchfiles as detailed in this answer. In short, you can write in your launchfile

<param name="robot_description" command="$(find xacro)/ '$(find my_robot_description)/urdf/my_robot.urdf.xacro' prefix:=$(arg ns)" />

and then use $(arg prefix) in your xacro file.

Note: As far as I know, there is a limitation with this solution that xacro default values cannot be given, which means that you always have to include your values when calling

edit flag offensive delete link more


Thanks for the clarification! I heard gazebo is heading towards SDF is that correct?

AlexandreB gravatar image AlexandreB  ( 2016-01-18 20:06:28 -0500 )edit

Kind of correct. SDF aims to be an unified format for simulators. Gazebo is not bound to ROS; while URDF is a ROS thing. Therefore, it would not make sense to use URDF if you are using Gazebo but not ROS.

Javier V. Gómez gravatar image Javier V. Gómez  ( 2016-01-19 14:03:13 -0500 )edit

Question Tools

1 follower


Asked: 2015-12-24 08:49:48 -0500

Seen: 655 times

Last updated: Jan 18 '16