Chapter 9: Advanced Modeling with SDF and USD
9.1 In-depth Look at SDF (Simulation Description Format)
The Simulation Description Format (SDF) is an XML-based format designed specifically for describing robots, static and dynamic environments, and other objects in simulation. It is the primary format used by the Gazebo simulator, but its capabilities extend beyond single robot descriptions, making it more powerful than URDF for complex simulation scenarios.
SDF Overview: Designed for Full Simulation Environments
Unlike URDF, which focuses on a single robot, SDF can describe entire worlds. This includes:
- Multiple Robots: Define and place multiple robots within a single SDF file.
- Environments: Describe static objects (e.g., walls, tables), terrains, and lighting.
- Sensors: Detailed description of sensor properties (e.g., cameras, LiDARs) and their placement.
- Physics Properties: Fine-grained control over physical properties beyond simple mass and inertia (e.g., friction coefficients, damping).
Differences from URDF
- World Description: SDF can describe worlds, not just robots.
- Closed Loops: Supports closed kinematic loops naturally, which URDF struggles with.
- Sensors & Plugins: More expressive for integrating sensors and simulator plugins.
- Default Values: SDF often defines default values for many parameters, reducing verbosity.
XML Structure and Key Elements
SDF files typically begin with a <sdf> root element, followed by a <world> element that contains all scene objects.
Key elements include:
<world>: Contains the simulation environment, models, lights, and scenes.<model>: Describes a robot or an object. Can contain<link>,<joint>,<visual>,<collision>,<inertial>, similar to URDF but with more options.<light>: Defines light sources.<gui>: Configures the graphical user interface for the simulator.<plugin>: Allows extending Gazebo's functionality with custom code.
Example: Simple SDF Model
<!-- TODO: Add a simple SDF XML example for a model (e.g., a table) -->
<!-- Refer to specs/001-robot-modeling/contracts/content-style-guide.md for guidelines. -->
<sdf version="1.7">
<model name="simple_table">
<link name="table_top">
<inertial><mass>1.0</mass></inertial>
<visual name="visual">
<geometry><box><size>1 0.5 0.03</size></box></geometry>
<material><diffuse>0.8 0.4 0.1 1</diffuse></material>
</visual>
<collision name="collision">
<geometry><box><size>1 0.5 0.03</size></box></geometry>
</collision>
</link>
</model>
</sdf>
Diagram: SDF World Example
9.2 In-depth Look at USD (Universal Scene Description)
Universal Scene Description (USD) is a powerful, open-source 3D scene description format developed by Pixar. While not initially designed for robotics, its extensibility, scalability, and ability to compose complex scenes make it increasingly relevant for high-fidelity robotics simulation, digital twins, and large-scale visualization.
USD Overview: Pixar's Extensible Scene Description Format
USD is a system for authoring, composing, and interchanging 3D scene data. It's designed to handle complex data like:
- Geometry: Shapes and meshes.
- Materials: Physically based rendering (PBR) materials.
- Lighting: Light sources and environments.
- Animations: Keyframes, skeletal animation.
- Physics: Integration with physics engines (e.g., OmniPhysics).
Strengths: Large-Scale Scenes, Rich Materials, Animations, Physics Integration
- Scalability: Efficiently handles scenes with millions of polygons and thousands of objects.
- Composability: Allows for non-destructive layering and referencing of assets, enabling collaborative workflows.
- Richness: Supports advanced rendering features, realistic materials, and complex animations.
- Extensibility: Users can define custom schemas to extend USD for specific domains like robotics.
USD for Robotics: Asset Description, Simulation, Digital Twins
USD is gaining traction in robotics for:
- High-fidelity Simulation: Creating visually stunning and physically accurate simulation environments.
- Digital Twins: Building virtual replicas of physical robots and their environments for testing and optimization.
- Asset Management: Managing robot models, environments, and other simulation assets in a standardized, scalable way.
- Interoperability: Facilitating data exchange between different design, simulation, and visualization tools.
Diagram: USD Scene Graph / Layering Concept
9.3 Conversion Between URDF, SDF, and USD
In a multi-tool robotics ecosystem, the ability to convert robot and world models between different formats is crucial. While each format has its strengths, interoperability ensures that models can be used across various simulation, visualization, and design tools.
Tools and Workflows for Converting Between These Formats
- URDF to SDF:
urdfdomprovides parsing capabilities, andros_gz_bridgecan facilitate this indirectly. Many simulators (like Gazebo) have built-in importers that convert URDF to their internal SDF representation on the fly. - SDF to URDF: Generally more difficult and often involves manual simplification or loss of information, as SDF can describe more complex scenarios (e.g., closed loops, environmental elements) than URDF.
- URDF/SDF to USD: Tools like
usd_from_urdfor Omniverse extensions can facilitate this conversion, especially for high-fidelity visualization in USD-native environments. - USD to URDF/SDF: Also challenging due to the richness of USD. Typically, a subset of USD information relevant to physics and kinematics is extracted.
Challenges and Data Loss Considerations During Conversion
- Feature Parity: Not all features in one format have direct equivalents in another (e.g., SDF's
worldelements, USD's rich materials). - Semantic Interpretation: Different tools might interpret certain tags or properties differently.
- Loss of Information: Converting from a richer format (USD, SDF) to a simpler one (URDF) often results in losing details.
9.4 Modeling Considerations for Humanoid Robots
Humanoid robots present unique modeling challenges due to their complex kinematics, dynamics, and interaction capabilities. Accurate and efficient models are critical for simulating their behavior and developing control strategies.
Specific Challenges: Balance, Complex Kinematics, Contact Points
- Balance: Humanoids are inherently unstable. Models need to accurately represent mass distribution and foot-ground interaction for balance control.
- Complex Kinematics: High degrees of freedom (DOFs) in arms, legs, and torso lead to complex kinematic chains.
- Contact Points: Precise modeling of feet, hands, and other body parts that make contact with the environment is essential for realistic interaction.
Representing Humanoid-Specific Features in URDF/SDF/USD
- Multiple Sensors: Humanoids typically have many sensors (cameras, force-torque sensors, IMUs).
- Actuated Hands: Detailed finger models are often required.
- Closed Kinematic Chains: Humanoid legs during double support create closed loops, requiring careful handling in formats or solvers.
9.5 Importing CAD Models into Simulation Environments
Most robots are initially designed in CAD (Computer-Aided Design) software. Importing these detailed CAD models into simulation environments is a common workflow, but it requires careful preparation to ensure efficiency and accuracy.
Workflow: CAD software to Robot Description Formats
- Export from CAD: Export the robot components as mesh files (e.g.,
.stl,.dae,.obj). - Conversion/Simplification: Use tools to simplify meshes and ensure consistent units and coordinate systems.
- Assemble in URDF/SDF: Define links, joints, and other properties, referencing the prepared meshes.
Simplifying Models for Simulation Performance
CAD models are often overly detailed for real-time simulation, leading to performance issues.
- Decimation: Reducing the number of polygons in meshes.
- Convex Decomposition: Breaking down complex collision meshes into simpler convex shapes.
- Remove Internal Details: Only model surfaces that are relevant for physics or visualization.
9.6 Best Practices for Optimized Robot Description Files
Creating efficient and accurate robot description files is an art. Following best practices ensures that your models are not only correct but also perform well in simulations and are easy to maintain.
Minimizing Complexity, Using Meshes Efficiently
- Keep it Simple: Only include necessary details.
- Low-Poly Collision Meshes: Use simplified meshes for collision geometry, separate from visual meshes.
- Reuse Meshes: If parts are identical, reuse the same mesh file.
Consistent Coordinate Frames
- Standard Conventions: Follow a consistent right-handed coordinate system (e.g., ROS convention: X forward, Y left, Z up).
- Clear Hierarchy: Ensure parent-child relationships are intuitive.
Modular Design
xacrofor URDF: Usexacroto create modular URDF components that can be reused and easily modified.- USD Layers: Leverage USD's layering system for non-destructive modifications and composition.
Validation
check_urdf: For URDF files, always validate for syntax and consistency.- Simulators: Load models into simulation (e.g., Gazebo) to visually inspect and test physics.