3.0 KiB
3.0 KiB
Blender Models in Gazebo
Import 3D models from Blender into the ARG simulation.
Workflow
Blender (.blend) → Export COLLADA (.dae) → Gazebo Model → World
Step 1: Create Model in Blender
- Create your 3D model
- Apply all transforms:
Ctrl+A→ All Transforms - Set origin to geometry center
Step 2: Export from Blender
- File → Export → COLLADA (.dae)
- Settings:
- Selection Only (if needed)
- Include Armatures: OFF
- Include Animations: OFF
- Triangulate: ON
- Save as
model.dae
Step 3: Create Gazebo Model
gazebo/models/my_model/
├── model.config
├── model.sdf
├── meshes/
│ └── model.dae
└── materials/
└── textures/
└── texture.png
model.config
<?xml version="1.0"?>
<model>
<name>My Model</name>
<version>1.0</version>
<sdf version="1.9">model.sdf</sdf>
<description>Custom Blender model</description>
</model>
model.sdf
<?xml version="1.0"?>
<sdf version="1.9">
<model name="my_model">
<static>true</static>
<link name="link">
<collision name="collision">
<geometry>
<mesh>
<uri>meshes/model.dae</uri>
<scale>1 1 1</scale>
</mesh>
</geometry>
</collision>
<visual name="visual">
<geometry>
<mesh>
<uri>meshes/model.dae</uri>
<scale>1 1 1</scale>
</mesh>
</geometry>
</visual>
</link>
</model>
</sdf>
Step 4: Add to World
<include>
<uri>model://my_model</uri>
<name>my_model_instance</name>
<pose>5 3 0 0 0 0</pose>
</include>
Step 5: Set Model Path
export GZ_SIM_RESOURCE_PATH=$PWD/gazebo/models:$GZ_SIM_RESOURCE_PATH
Common Issues
Model Not Found
export GZ_SIM_RESOURCE_PATH=/full/path/to/gazebo/models:$GZ_SIM_RESOURCE_PATH
Scale Wrong
In Blender, check unit settings: Properties → Scene → Units
Adjust in SDF:
<scale>0.01 0.01 0.01</scale>
Textures Not Showing
Put textures in materials/textures/ and reference in DAE file.
Or add material in SDF:
<visual name="visual">
<geometry>
<mesh><uri>meshes/model.dae</uri></mesh>
</geometry>
<material>
<diffuse>0.8 0.2 0.2 1</diffuse>
</material>
</visual>
Model Orientation Wrong
Blender uses Z-up, Gazebo uses Z-up. Should match.
If rotated, fix in Blender or use pose:
<pose>0 0 0 1.5708 0 0</pose>
Simplified Collision
For complex meshes, use simple collision:
<collision name="collision">
<geometry>
<box><size>2 2 3</size></box>
</geometry>
</collision>
<visual name="visual">
<geometry>
<mesh><uri>meshes/complex_model.dae</uri></mesh>
</geometry>
</visual>
Template
Copy the template:
cp -r gazebo/models/custom_object gazebo/models/my_model
Then:
- Edit
model.configwith your name - Edit
model.sdfwith your model name - Put your
model.daeinmeshes/
Test Model
gz sim -v4 gazebo/worlds/custom_landing.sdf