ROS Resources: Documentation | Support | Discussion Forum | Service Status | Q&A answers.ros.org
Ask Your Question
6

Modeling URDF files using Blender and exporting to COLLADA format

asked 2012-01-19 18:40:40 -0500

updated 2012-03-04 21:19:46 -0500

I'm currently trying to get a nicer looking robot model by adding color to the geometry of a robot body in blender (2.61) and exporting to .dae (COLLADA) instead of plain .stl mesh. My first try was to do this not by adding textures, but setting the material of different parts of the model to be colored differently. I'm talking about the model for a single link only, and everything works fine if exporting to stl (but there's no color then, obviously).

Now, if I add the colors and export to collada using blender I get the following:

  • Reimport to Blender: Looks fine, exactly as exported
  • Open with Meshlab: Parts of the geometry are scaled by a factor of ~30. Some vertex coordinates are very wrong.
  • Open with g3viewer: The rotations between different parts of the model are off
  • Use in URDF/gazebo: Model is not recognizable at all, there are a few polygon here and there
  • Use in URDF/rviz: Geometry is fine, material seems be interpreted not quite correctly (too bright), but the color settings seem to work (a red part is a little bit red)

ROS version used is electric from .debs on Natty/64bit.

Any tips on how to improve the results are greatly appreciated.

/edit: Image of gazebo and rviz side by side (for gazebo on the left, the bounding box is on, which is based on the .stl mesh). Obviously, in gazebo only a small fraction of faces is visualized, while geometry in rviz is fine.

image description

/edit2: The above was done by selecting all different needed parts of the model in Blender and then exporting to .dae. If I instead first join all different parts inside Blender by selecting them and pressing CTRL+J and then export, the model looks much better. It works in Meshlab and g3viewer, only gazebo still gives severe problems as can be seen here (even if it looks better than before):

image description

This actually looks kind of similar to the Pelican model posted in this question.

/edit: Update with latest insights: So far it looks like Blender 2.61 Collada export is somewhat broken, at least for me on my 64 bit Natty system (I stated oneiric above before, was wrong due to working on too many different machines :) ).

/edit: As it turned out, this is related to gazebo not coping well with quad based polygons that get exported into COLLADA files by Blender 2.61. See my answer below for details.

By opening .stl or .dae generated from Blender and re-saving as .dae using meshlab one can also get get .dae files that look non-broken in gazebo. Unfortunately, the vertex materials defined in Blender seem to get lost in the process. Another example:

.dae exported from Blender: gazebo result

.dae by opening Blender export and resaving in meshlab: gazebo result

DimitriProsser confirmed that the Blender export does not work for versions > 2.49 here

/edit: Comparison: Blender 2.61 export, gazebo on the left, rviz ... (more)

edit retag flag offensive close merge delete

Comments

can you please post or provide a link for the mesh? I have some ideas why this might be happening in gazebo and would like to test it out. Thanks.
hsu gravatar imagehsu ( 2012-01-20 05:52:18 -0500 )edit
Hi John, the mesh (.stl and .dae versions) are available here: http://code.google.com/p/tu-darmstadt-ros-pkg/source/browse/#svn%2Ftrunk%2Fhector_quadrotor%2Fhector_quadrotor_urdf%2Fmeshes%2Fquadrotor I'll also update the original post. [Note: The meshes are corrected now and no more erroneous]
Stefan Kohlbrecher gravatar imageStefan Kohlbrecher ( 2012-01-20 19:22:55 -0500 )edit
Are some pictures couldn't be seen in your post?
sam gravatar imagesam ( 2012-02-09 00:12:22 -0500 )edit
For me, all images are visible. Which ones are missing for you?
Stefan Kohlbrecher gravatar imageStefan Kohlbrecher ( 2012-02-09 05:27:32 -0500 )edit
You have 6 pictures for me,and the first and second are disappeared. It says domain unregistered.
sam gravatar imagesam ( 2012-02-09 09:46:41 -0500 )edit

I reuploaded both, they should appear now.

Stefan Kohlbrecher gravatar imageStefan Kohlbrecher ( 2012-02-13 01:18:30 -0500 )edit

5 Answers

Sort by ยป oldest newest most voted
2

answered 2012-01-23 09:36:07 -0500

updated 2012-03-04 21:15:34 -0500

As noted here, .dae export does not work correctly for use of .dae meshes in gazebo since Blender versions > 2.49 . So everyone having problems like those described in my original posting should probably first check their Blender versions.

After playing around some more, it turns out that you have to convert your mesh data to triangles first for the Blender 2.61 .dae export (Select all, then CTRL+T). Apparently, quads will be saved to the COLLADA file otherwise, which gazebo cannot interpret correctly, leading to the polygon mess in the images I posted. The model occassionally still has it's backfacing polygons rendered for me though, as described with pictures in the original post. Update: In this case, a export to .stl, opening that file in meshlab, saving to stl again, and re-importing to blender usually fixes the issue. This doesn't hurt too much if one first models geometry, then checks it in gazebo, and only afterwards applies material and textures. OTOH, doing the materials and textures and finding out something with rendering is wrong afterwards can be pretty annoying.

edit flag offensive delete link more

Comments

good to know. Can you file a ticket for quads support on trac (https://kforge.ros.org/gazebo/trac)? Thanks!
hsu gravatar imagehsu ( 2012-01-27 04:09:40 -0500 )edit
@John: Done, see https://code.ros.org/trac/ros-pkg/ticket/5360 Thanks for looking into it.
Stefan Kohlbrecher gravatar imageStefan Kohlbrecher ( 2012-01-27 07:01:14 -0500 )edit
Oops, just noted I'm on the wrong trac(k) ;) Should I recreate the ticket on kforge?
Stefan Kohlbrecher gravatar imageStefan Kohlbrecher ( 2012-01-27 23:33:48 -0500 )edit
Recreated on the Gazebo KForge trac here: https://kforge.ros.org/gazebo/trac/ticket/40 Closed the one on code.ros.org as a duplicate.
Stefan Kohlbrecher gravatar imageStefan Kohlbrecher ( 2012-01-27 23:53:51 -0500 )edit
3

answered 2012-01-19 19:07:49 -0500

Stefan Osswald gravatar image

URDF/rviz: There is a bug in RViz that replaces the ambient color of Collada materials by light gray if at least one component of the specified ambient color is 0.0 (see Ticket #5237). According to the changelog, this bug is fixed in robot_model 1.6.4, which seems to be not in the electric .deb repository yet.

edit flag offensive delete link more

Comments

That's good news, so I guess I can wait this one out. So there's only the gazebo problem left (which might also disappear with the new version in Fuerte, but that's still some time away).
Stefan Kohlbrecher gravatar imageStefan Kohlbrecher ( 2012-01-20 01:47:51 -0500 )edit
2

answered 2012-01-23 04:23:45 -0500

hsu gravatar image

updated 2012-01-23 05:45:12 -0500

I opened hector_quadrotor_urdf/meshes/quadrotor/quadrotor_base.stl with meshlab and simply re-saving it seems to have fixed some issues.image description

as for the dae file, I had to open it with meshlab and invert all normals for shading to appear. image description

Here are the links to the modified meshes: stl dae

For dae, add scale tag to scale correctly:

<mesh filename="package://hector_quadrotor_urdf/meshes/quadrotor/quadrotor_base.dae" scale="0.01 0.01 0.01"/>
edit flag offensive delete link more

Comments

Thanks for the fast reply John. The .dae you provided indeed looks nice (has shading), but for me the scale is suddenly off by quite a huge amount (factor 10 or more). The model also lost color information. Is using materials for color supported by gazebo, or should I use textures?
Stefan Kohlbrecher gravatar imageStefan Kohlbrecher ( 2012-01-23 05:23:48 -0500 )edit
Too large scale: http://img718.imageshack.us/img718/8412/quadrotordaescale.png The green box is the bounding volume from the .stl (only set visual to use the .dae file, while collision comes from the correctly scaled .stl).
Stefan Kohlbrecher gravatar imageStefan Kohlbrecher ( 2012-01-23 05:40:34 -0500 )edit
@Stefan I updated the comment to scale the dae mesh. If dae is textured with belnder, wings3d or other tools, it should work with gazebo.
hsu gravatar imagehsu ( 2012-01-23 05:48:39 -0500 )edit
Ok, scale seems to be some non-power of 10 though. I found that I can easily get a correctly scaled .dae by opening my original .stl and saving to .dae using meshlab though. Weird that exporting to .dae directly from Blender gives so many problems.
Stefan Kohlbrecher gravatar imageStefan Kohlbrecher ( 2012-01-23 06:28:01 -0500 )edit
I updated the original post and added the blender source file, in case this is of interest to you, John.
Stefan Kohlbrecher gravatar imageStefan Kohlbrecher ( 2012-01-23 09:08:20 -0500 )edit
One more update to the original post. Getting closer to working around Blender (2.61) and gazebo not working together, but not quite there yet. There's a very strange rendering problem, as described at the bottom of the original question.
Stefan Kohlbrecher gravatar imageStefan Kohlbrecher ( 2012-01-26 02:16:00 -0500 )edit
0

answered 2012-01-23 01:13:22 -0500

Penny gravatar image

I have the problem you had in the beginning, I made my model in blender, and exported it to Collada, but the model is not recognizable at all, there are a few polygon here and there as you said. My model is only one part so I do not have the chance of improvement as you had in edit2. Have you fixed your problem with gazebo?What can I do?

edit flag offensive delete link more

Comments

The two options I see so far are: -Wait for John if he finds a fix (see comment below original post) -Wait for the new gazebo in Fuerte and hope that fully working COLLADA support is among the various improvements. :)
Stefan Kohlbrecher gravatar imageStefan Kohlbrecher ( 2012-01-23 01:38:57 -0500 )edit
0

answered 2012-08-23 18:03:50 -0500

jocaps gravatar image

Have you tried Blender 2.49b? You can still download it from their website.

Im not much into ROS but I am into Blender so I thought I give an answer too. Since after 2.49b Blender has rewritten it's API all anew. Which meant that all fan-made exporter/importer had to be rewritten as well. This resulted into some exporter/importer to be removed from the system or to be incomplete. Though I'd like to know why you want to use the .dae format? Is there a particular reason? You can also group and texture perfectly fine with .obj (Lightwave obj) and .mtl that comes with it. The format even supports curves and vertex grouping (not only object grouping like collada does) and it's more supported by other 3D softwares than collada is (even to this date when collada is becoming "trendy"). I do believe the latest version of Blender does fully support .obj format (at least with less bugs than the collada or wrl formats).

If you insist in using .dae and Blender 2.6x (or if ROS supports this much more than other 3D formats), then I would suggest that you convert the .dae into obj using the old blender 2.49b which might work, or using meshlab (but this is not also gauranteed as I also know that meshlab works and converts .obj and .mtl better than it does .wrl or .dae) and then try to open the .obj file in Blender 2.6x (if you insist in using Blender 2.6x).

Jose

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2012-01-19 18:40:40 -0500

Seen: 9,224 times

Last updated: Aug 23 '12