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

Revision history [back]

click to hide/show revision 1
initial version

Perhaps I'm not interpreting your question correctly, but if you wanted to be able to load your urdf in a real-robot situation, you could use the line:

<param name="robot_description" command="$(find xacro)/xacro.py '$(find my_robot_description)/urdf/my_robot.urdf.xacro'" />

or something similar. What I've always seen done is that there are two main files: one urdf that describes only the solid bodies of the robot (named with the .urdf.xacro extension), and one with only the controller descriptions (named with the .gazebo.xacro extension). You then provide two separate wrapper urdf files to be included in your launch files.

<param name="robot_description" command="$(find xacro)/xacro.py '$(find my_robot_description)/urdf/robot_real_world.urdf.xacro'" />

or

<param name="robot_description" command="$(find xacro)/xacro.py '$(find my_robot_description)/urdf/robot_simulator.urdf.xacro'" />

The file "robot_real_world.urdf.xacro would look like this:

<robot name="robot"
       xmlns:xacro="http://www.ros.org/wiki/xacro"
       xmlns:xi="http://www.w3.org/2001/XInclude">
  <include filename="$(find my_robot_description)/urdf/body.urdf.xacro" />
</robot>

And the file "robot_simulator.urdf.xacro" would look like this:

<robot name="robot"
       xmlns:xacro="http://www.ros.org/wiki/xacro"
       xmlns:xi="http://www.w3.org/2001/XInclude">
  <include filename="$(find my_robot_description)/urdf/body.urdf.xacro" />
  <include filename="$(find my_robot_description)/urdf/body_controllers.gazebo.xacro" />
</robot>

If you have all of these urdf files in a separate package, your real world robot doesn't need to depend on gazebo at all. You can just reference these files by name, regardless of whether that package is built or not.

Perhaps I'm not interpreting your question correctly, but if you wanted to be able to load your urdf in a real-robot situation, you could use the line:

<param name="robot_description" command="$(find xacro)/xacro.py '$(find my_robot_description)/urdf/my_robot.urdf.xacro'" />

or something similar. What I've always seen done is that there are two main files: one urdf that describes only the solid bodies of the robot (named with the .urdf.xacro extension), and one with only the controller descriptions (named with the .gazebo.xacro extension). You then provide two separate wrapper urdf files to be included in your launch files.

<param name="robot_description" command="$(find xacro)/xacro.py '$(find my_robot_description)/urdf/robot_real_world.urdf.xacro'" />

or

<param name="robot_description" command="$(find xacro)/xacro.py '$(find my_robot_description)/urdf/robot_simulator.urdf.xacro'" />

The file "robot_real_world.urdf.xacro would look like this:

<robot name="robot"
       xmlns:xacro="http://www.ros.org/wiki/xacro"
       xmlns:xi="http://www.w3.org/2001/XInclude">
  <include filename="$(find my_robot_description)/urdf/body.urdf.xacro" />
</robot>

And the file "robot_simulator.urdf.xacro" would look like this:

<robot name="robot"
       xmlns:xacro="http://www.ros.org/wiki/xacro"
       xmlns:xi="http://www.w3.org/2001/XInclude">
  <include filename="$(find my_robot_description)/urdf/body.urdf.xacro" />
  <include filename="$(find my_robot_description)/urdf/body_controllers.gazebo.xacro" />
</robot>

If you have all of these urdf files in a separate package, your real world robot doesn't need to depend on gazebo at all. You can just reference these files by name, regardless of whether that package is built or not.

EDIT:

If you want to avoid large dependencies, you don't have to depend on "{}_description" packages. They don't get built, so there's no point in having them as a dependency. It will throw a run-time error if the package doesn't exist though. That's your only problem.