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

What is the best way to import a Fusion360 model? #317

Closed
DinoDany opened this issue Jun 1, 2022 · 16 comments
Closed

What is the best way to import a Fusion360 model? #317

DinoDany opened this issue Jun 1, 2022 · 16 comments
Labels
question Request for help or information Unity Unity plug-in

Comments

@DinoDany
Copy link

DinoDany commented Jun 1, 2022

My end goal is rendering and controlling a robot in Unity using mujoco physics. The robot was designed on Fusion360. My question is: What would be the best practice? Importing the model to mujoco first and importing the mujoco scene into unity? or importing the model directly to unity and adding the scripts from the unity engine? In case I have to import first to mujoco, is there an established pipeline to convert the model to a mujoco-friendly format?

Thank you so much.

@DinoDany DinoDany added the question Request for help or information label Jun 1, 2022
@erez-tom
Copy link
Collaborator

erez-tom commented Jun 1, 2022

I am not familiar with any Fusion360 importer for MuJoCo. If you can find a URDF exporter that produces a reasonable result for your robot, you can load the URDF in MuJoCo's native visualizer, and if nothing broke you can save as MJCF and load it in Unity. Or, if there's an SDF exporter, you can experiment with the SDF/MJCF converter (still under development).
Alternatively, if you can load your model (or the URDF) in Unity and get a reasonable-looking model, writing a script that converts the relevant components to their MuJoCo counterparts should be doable (up to a few edge cases of real incompatibility). If you choose this route, I'd be happy to advise on mapping between PhysX and MuJoCo.
I leave this issue open for now -- please let us know how it's going!

@erez-tom erez-tom added the Unity Unity plug-in label Jun 1, 2022
@DinoDany
Copy link
Author

DinoDany commented Jun 1, 2022

Thank you for your reply, I have a fusion360 to URDF converter that works for my models. I can't load them to the native visualizer but I can get a very reasonable-looking model in Unity. I'm more inclined to use that route and map the counterparts between PhysX and Mujoco. I would really appreciate the advise following this method.

Thank you so much,

@kevinzakka
Copy link
Collaborator

kevinzakka commented Jun 1, 2022

@DinoDany Drive by comment, what are the issues you get when you try to load the URDF into the native visualizer? I can try to help since I've done a few conversions in the last few weeks. Alternatively, if you have a URDF you would like to share as a zip file, I can try taking a look this weekend.

@DinoDany
Copy link
Author

DinoDany commented Jun 1, 2022

@kevinzakka Thank you! Well, I'm using this repo that I forked and edited a little bit so it can your with really little inertia moments: https://github.com/ElysiumRobotics/fusion2urdf . It creates a URDF super specific for gazebo, it works for Unity but when I try to drop into the simulate.cc it says the .stl file is missing. Do you know a better repo for the conversions?

@kevinzakka
Copy link
Collaborator

@DinoDany A zip file to debug would be great!

@DinoDany
Copy link
Author

DinoDany commented Jun 2, 2022

@kevinzakka Right, here it is. It is just a small test. Thank you so much
Test_0_descriptionv1.zip

@kevinzakka
Copy link
Collaborator

Hi @DinoDany, I was able to load it into the MuJoCo simulate app by doing the following:

  1. Adding a <mujoco><compiler discardvisual="false" meshdir="../meshes/"/></mujoco> clause right after the <robot>.
  2. Changing all absolute mesh paths to just be relative to meshes.

It loads fine now but there's some jittering. Here's a zip file containing the URDF: Test_0.urdf.zip

@DinoDany
Copy link
Author

DinoDany commented Jun 2, 2022

@kevinzakka wow, thank you so much. You are a life saver, why do you think it is jittering?

@DinoDany
Copy link
Author

DinoDany commented Jun 2, 2022

@erez-tom Do you have any resources that I can read to learn more about the mapping between MuJoCo and PhysX? Thank yoooouuu :)

@kevinzakka
Copy link
Collaborator

@DinoDany You have 2 geoms intersecting + the collisions being used are the meshes themselves. I colored them differently to make this easier to see (note the blue thing is the joint).

Screen Shot 2022-06-02 at 10 29 26 AM

I wonder if the second body was supposed to be offset by some z amount?

@DinoDany
Copy link
Author

DinoDany commented Jun 2, 2022

@kevinzakka I see. ME team just gave me that model to test the conversions from Fusion-MuJoCo-Unity but it was just a quick test so maybe that-s why they are intersecting. Im going to try with the actual models and I will let you know how it went. :D

@DinoDany
Copy link
Author

DinoDany commented Jun 6, 2022

@kevinzakka So, my more complex models don't work >( I get a segmentation fault (core dumped). Do you know why this happens? I attached the file in case you need to debug. Thank you so much for all your help :)
Kinematic_description.zip

@kevinzakka
Copy link
Collaborator

@DinoDany Is there an actual URDF file I can debug with?

@DinoDany
Copy link
Author

Hello! Yes. So the MjTest.zip is the URDF file and the Test_description.zip file is the whole model.
MjTest..zip
Test_description.zip

Thank you so much

@kevinzakka
Copy link
Collaborator

kevinzakka commented Jun 13, 2022

@DinoDany So your joint type "Ball" is an invalid URDF joint type, which caused the program to crash. This is actually a bug, we shouldn't be crashing and should in fact be warning you that the joint type is invalid. Thanks for catching this!

@yuvaltassa There is a segmentation fault that occurs because we do not check that the joint type returned is -1, see here. I'll submit a PR!

@DinoDany
Copy link
Author

Woow! This is the first bug I catch ever. Thank you so much for all your help :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Request for help or information Unity Unity plug-in
Projects
None yet
Development

No branches or pull requests

3 participants