0
$\begingroup$

Rosanswers logo

I am new to ROS and I have been using SolidWorks Exporter for generating URDF for my robot. Things didn't go well adding transmissions and controller plugins, Gazebo crashes if I spawn the urdf with controller plugins and transmissions, so I started studying other robots in ROS in detail (for example universal-robot) and all of them had Xacro files. Should I also use Xacro? Or the URDF generated by SolidWorks should work fine with transmissions and controller plugins? If I should use xacro, how do I generate a Xacro?

Thanks for your attention.


Originally posted by Oguz on ROS Answers with karma: 121 on 2015-01-31

Post score: 3

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Xacro is just a scripting mechanism that allows more modularity and code re-use when defining a URDF model. When using it, what is actually uploaded to the parameter servers (per default as the "robot_description" parameter) actually is a URDF, as that gets generated from the xacro file in the launch file (by expanding the xacro macros used).

As an example, say you have a "robot.urdf.xacro" file. You can run

rosrun xacro xacro.py robot.urdf.xacro > robot.urdf

and that gives you the URDF generated from your xacro file. The same approach is commonly used in launch files when a xacro-based robot_description is uploaded.

Xacro is just another way of defining a URDF, not an alternative to it. It makes certain things easier, for instance you can generate a "wheel" macro and instantiate that 6 times with different parameters to put 6 wheels on your robot, as opposed to copying and pasting the same code six times manually.


Originally posted by Stefan Kohlbrecher with karma: 24361 on 2015-01-31

This answer was ACCEPTED on the original site

Post score: 15


Original comments

Comment by Oguz on 2015-01-31:
Thanks, then I will stick to my SolidWorks Exporter generated URDF.

Comment by Yanhao Zhu on 2019-08-17:
Also new to urdf and have a similar confusion. Really a good answer!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.