asked 2012-02-08 06:39:44 -0500
Most complex URDF models use quite a few gazebo plugins. This often means that a dependency to "gazebo_plugins" (or other plugins) exists in the manifest.xml, which in turn means the inclusion of gazebo itself as a dependency. On a real robot or any setup that never simulates the robot model, this is a quite needless and heavyweight dependency. Are there any best practices for working around this in a systematic fashion, so one has a basic URDF model without gazebo dependencies, as well as a simulation version with all gazebo controllers?
I have a few ideas involving two packages, using ENV tags in xacro files and so on, but that seems rather cumbersome to me.
/edit: So here's the scenario that motivated my question: I have a vehicle model in the hector_ugv_description package. This contains the basic urdf file. For this model, I want to pull the low poly hokuyo UTM-30LX urdf model from the hector_sensors_description package. I also want to use a sonar sensor from another package on the vehicle, which uses a custom plugin (that has to be built for the sensor to work in gazebo). So from what I gather, I have to make 6 packages:
Not depending on anything gazebo, for use on real robot (only urdf/xacro and containing gazebo tags):
Depending on gazebo for use in simulation (so plugins are properly built when building with rosmake)
hector_ugv_gazebo (depends on needed plugins, hector_ugv_description, hector_sensors_gazebo and hector sonar_gazebo)
hector_sensors_gazebo (depends on needed plugins and hector_sensors_description)
hector_sonar_gazebo (depends on needed plugins and hector_sonar_description)
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.
As an example of another possible way to setup, note that pr2_description by default exports the robot URDF as well as XML extensions for simulation plugins and mechanism controls. But pr2_description does not depend on any of the robot/simulation/mechanism packages.
In effect, we are not interpreting package/stack dependencies based on XML dependencies (i.e. pr2_description export <gazebo> extensions but do not depend on gazebo. Similarly, pr2_description exports <transmission> extensions used by pr2_mechanism stack, but do not depend on it).
Therefore, for the PR2 there two main stacks, one for real-robot and the other for simulation:
Alternatively, if you want to keep the real-robot and simulation XML's separate, I imagine the following package structure/dependency might work too,:
<includes> and xacro as Dimitri suggested).Asked: 2012-02-08 06:39:44 -0500
Seen: 745 times
Last updated: Feb 09 '12
What driver should I use for my USB camera?
Using version control git for ROS development
Rosbag: Recording configurations or regenerate later?
Can a single git repository release multiple ROS stacks?
Replacing wrapper ROS package for external library - best practices?
Best practices for launching ROS on startup
What is the manifest.xml convention for dependencies of launch files?
ROS Answers is licensed under Creative Commons Attribution 3.0 Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.