HoangGiang93 / urdf_importer

Add-on for Blender, provides importing robots from URDF format
MIT License
27 stars 12 forks source link

Bone-Strucutre not imported correctly to Blender #6

Open brean opened 1 month ago

brean commented 1 month ago

The imported bone structure is not setup for using with the ChaosVehicle plugin of Unreal Engine. After importing we had to re-rig it based on this toutorial: https://www.youtube.com/watch?v=0lwKWxBeFcQ However I think this library should import the robot with an armature that can be exported directly.

HoangGiang93 commented 1 month ago

I can see the reason, the armature I exported I normalize the rotation axis as z axis. I think in Blender, the primary axis of the bone is y. At the moment, I don't have plans to work with ChaosVehicle, and I'm also implementing another parser from USD to FBX and I will consider taking the y-axis instead of z. Hope it could help.

HoangGiang93 commented 1 month ago

And the reason why I chose z-axis is because it's more common in robotics.

brean commented 1 month ago

I think its not the axis but the missing armature modifiers. I will investigate myself and maybe create a pull request if I find the time.

brean commented 1 month ago

When I import the model using the URDF-importer it looks like this (and not working): Screenshot from 2024-07-11 12-34-16

However following the tutorial I posted in my first post it ends up looking like this (and is working nicely): Screenshot from 2024-07-11 12-44-42

so the code is not linking the strucutre the same way I would do following the tutorial. (note that the bones from the import script for UE4 vehicles are on a slightly different model so the names are a bit different, however the point is that the structure is different: When I move one joint in the hand-made armature the connected part moves, if I try to move something in the urdf-importer generated model the whole robot moves - so its not just ChaosVehicle but the armature import in general that has a bug)

brean commented 1 month ago

I experimented a bit more, the UE4 vehicle plugin switches to pose mode in the end, I was in Edit mode with the urdf_importer plugin, so when I was moving stuff it just moved in edit mode. The Plugin creates a vertex group, I am not sure if that's really needed, the only other differences I see is that it just has one root node on the y-axis while the urdf has the joint on the y-axis as you wrote, so maybe that is the issue here. (I also think its helpful to show the names and axes of the bones, which could easily be achived by setting it on the root_armature):

        arm.show_names = True
        arm.show_axes = True

Screenshot from 2024-07-13 11-11-10