Gazebo | Ignition | Community
Ask Your Question
0

Visualization of a custom model does not work as expected

asked 2023-04-17 08:13:11 -0600

Joe Dinius gravatar image

updated 2023-04-22 12:30:54 -0600

I have built a custom model of a simplified fixed-wing aircraft using Blender. See here for a screenshot showing a representative view of the model in Blender.

When I export the model as a Collada file (with .dae extension), and set up a Gazebo model (see this SDF file, the visualization I see in Gazebo is not what I would expect. Not all faces of the object are visible and the faces that are visible are a function of the viewing angle. I have tried changing the material thickness in Blender and adding a texture (in meshlab), but the same problem persists. What am I missing here? I couldn't find much online to help me with this issue, so I am hoping that the Gazebo community will have some valuable insights to share, perhaps there are some links/project references that I have missed thus far.

I'm using the gazebo sim I apt-installed for Ubuntu 22.04. Here is the python file I used to generate the meshes.

Thanks!

edit retag flag offensive close merge delete

Comments

The image links seem broken. Other than that: maybe try to open the file in some other program, e.g. Meshlab and see if that works fine. And/or try as an .obj file instead of collada?

jrtg gravatar imagejrtg ( 2023-04-17 15:07:32 -0600 )edit

Is there any warning/error showing if you run gazebo with verbose option? My guess now (since I can't see the images as mentioned above) is to check the face orientation and triangulation. Right-click on the model in Gazebo and view the wireframe to see if the triangulation looks correct or not. In Blender you can show the normal of the faces. Make sure they are pointing outside since Gazebo loads the visuals single-faced by default.

Veerachart gravatar imageVeerachart ( 2023-04-17 21:48:48 -0600 )edit

I have updated the image files and have verified they are as I would expect. Thanks for catching this @jrtg.

@Veerachart, the screen cap with verbose output doesn't flag any warnings or errors when I load the model. Looking at the wireframe shows that, indeed, the triangulation is not what I expect. What could be causing this? I built the mesh using the Blender python API.

Thanks for your help with this!

Joe Dinius gravatar imageJoe Dinius ( 2023-04-19 08:04:28 -0600 )edit

Thanks for the update. I'm not using .dae files that much, so I'm not sure how the triangulation may work on that. The model looks too simple to be messed up by Gazebo auto triangulation though. It should not have problem with quads. Exporting file to .obj format has the option to triangulate faces. Maybe there is something similar for .dae format exporter.

Veerachart gravatar imageVeerachart ( 2023-04-19 20:28:19 -0600 )edit

I've tried with both .obj and .dae and the outcomes were the same. I selected "Triangulate faces" for both export processes and the wireframes in Gazebo are still incorrect. I have attached the python file I used to create the meshes just in case I did something incorrect there. Anything else I should try? Is there a better approach I should be using to create such a simple object?

Joe Dinius gravatar imageJoe Dinius ( 2023-04-22 12:33:29 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2023-04-28 17:08:52 -0600

Joe Dinius gravatar image

Thanks @Veerachart, your last answer pointed me in the right direction. I was able to get to the menu you show, but from there I checked the "Face Orientation" box, and this led me to the answer, and it had to do with the ordering of the vertices in my face definition and the right-hand rule. When the ordering of vertices was counter-clockwise, the normals were in the correct (outward) direction, which is in agreement with the right-hand rule. Once I changed the ordering of all the face vertices to be counter-clockwise, all of the normals were in the correct direction. I then added duplicate faces for the tail, wing, and tailwing to get double-sided normals. I was then able to follow the same export steps as before and the model in Gazebo looks correct:

C:\fakepath\fixed-airplane.png

Here's the updated Python script for completeness' sake:

C:\fakepath\mav_model.py

edit flag offensive delete link more

Comments

Glad to here that it helped.

Veerachart gravatar imageVeerachart ( 2023-05-07 21:01:34 -0600 )edit
0

answered 2023-04-23 23:49:00 -0600

Veerachart gravatar image

After getting the script used to create the mesh, I found that the normals of some faces are not pointing outwards, so we don't see those faces correctly. You can check the normal direction by clicking the right square at the bottom of this menu and change the size as needed.

image description

For the plane's body, I see this

image description

You may want to change the python script to generate this properly, or you can just change the normals of the generated model. Or if you want the mesh to be rendered double-faced (seeing the face from both sides), you can add

  cull_hardware none
  cull_software none

inside your material's pass in the material script.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2023-04-17 08:12:32 -0600

Seen: 276 times

Last updated: Apr 28 '23