Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using custom mesh with texture #39

Open
hanmmmmm opened this issue Feb 26, 2021 · 4 comments
Open

Using custom mesh with texture #39

hanmmmmm opened this issue Feb 26, 2021 · 4 comments

Comments

@hanmmmmm
Copy link

hanmmmmm commented Feb 26, 2021

Hi! How can I use my custom mesh with texture in urdfsim?

The "mesh" tag in "settings.json" needs the 'type' and 'location' parameters.
I tried to put an obj mesh file in the "location", with stl_ascii type, then unreal says this file has no endsolid when clicking the play button. Indeed, an obj file does not have 'endsolid'.

So could I use an obj/dae mesh file by just modifying "settings.json"?
if not, could I make these files into uasset files, and import them as "mesh" in "settings.json"?

Thank you!

@hanmmmmm
Copy link
Author

Okay, I tried to make fbx mesh file with texture, and import them into unreal as 'static mesh'. Like the picture.

Screenshot (62)

Then make change in the urdf .XML file :

<mesh type="unreal_mesh" location="StaticMesh'/Game/mesh/box.box'" reverse_normals="false" scale_factor="0.1"/>
<!--material name="rubber"/-->

Now the robot has my custom mesh and custom texture. But I still need to figure out the link pose coordinates and collision because the robot flies randomly when starting play.

Screenshot (66)

@mitchellspryn
Copy link
Owner

Regarding your first question - obj mesh is not supported for reading from a text file, only stl ascii.

If you are comfortable with the unreal workflow, importing the mesh into unreal and creating a .uasset is definitely the way to go. You'll get better lighting (it can be pre-baked), as well as the ability to better optimize the geometry with the included tools (e.g. PHAT).

It looks like you've just swapped out your mesh with the central mesh of the lunabot? The physics constraints are probably going crazy, which is why the bot is falling over. I'd try removing all of the other elements in the URDF, and only importing your box. Then, if you have more meshes, build it up slowly piece by piece.

@hanmmmmm
Copy link
Author

hanmmmmm commented Feb 26, 2021

Thank you for replying! Yeah, I replaced a part of lunabot with my simple box. So the physics would be not working properly. I will try to build a robot from scratch.

My other question is what does the CollisionBlacklist do, for example, this part in the lunabot json file:

"CollisionBlacklist": [ { "BotMesh": "front_right_wheel", "ExternalActorRegex": "Ground" }, { "BotMesh": "back_right_wheel", "ExternalActorRegex": "Ground" }, { "BotMesh": "front_left_wheel", "ExternalActorRegex": "Ground" }, { "BotMesh": "back_left_wheel", "ExternalActorRegex": "Ground" } ],

@mitchellspryn
Copy link
Owner

The framework will generate a collision event whenever one of your meshes collides with another one (that is not connected via a physics constraint). However, considering that your robot is on the ground, you will likely be continuously generating collision events between the bottom of your bot and the ground. In addition to being annoying, this is a performance issue.

This blacklist allows you to filter out collision events. Here, it's saying to ignore collisions between the wheels and each member matching "Ground".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants