missing steps :)
Closed this issue · 11 comments
Hello,
Congrats, this is a great project!
Looking at your example, I'm trying to understand (I'm new to MJCF but I know Blender).
I tried to export it as MJCF but the xml is pretty empty. No body or joint were exported.
I also tried to redo your demo. I can add a joint, but I don't get how to populate the custom properties sk_joint_child, sk_joint_parent
and others.
Even after adding Child BODY (but no parent?), the Build MJCF Kinematic Tree
function throws:
Python: [ERROR] mpfb.init ..............................: Unhandled crash
File "/home/pm/.config/blender/3.2/scripts/addons/export_mjcf.py", line 254, in execute
build_kinematic_tree(self, context)
File "/home/pm/.config/blender/3.2/scripts/addons/export_mjcf.py", line 237, in build_kinematic_tree
print_tf_tree(root, 0)
File "/home/pm/.config/blender/3.2/scripts/addons/export_mjcf.py", line 124, in print_tf_tree
for i, child in obj['tf_tree_children'].items():
'NoneType' object is not subscriptable
Traceback (most recent call last):
File "/home/pm/.config/blender/3.2/scripts/addons/export_mjcf.py", line 254, in execute
build_kinematic_tree(self, context)
File "/home/pm/.config/blender/3.2/scripts/addons/export_mjcf.py", line 237, in build_kinematic_tree
print_tf_tree(root, 0)
File "/home/pm/.config/blender/3.2/scripts/addons/export_mjcf.py", line 124, in print_tf_tree
for i, child in obj['tf_tree_children'].items():
TypeError: 'NoneType' object is not subscriptable
I'm sure I missed a step somewhere 😸
Any idea?
I missed to install export_urdf
and I finally found your video.
But it replaces mjcf?
Made a new quick (not showing full features, but covering getting to the first export) tutorial video, let me know if this clears things up. https://youtu.be/8DWTrB8DnS0
Indeed, the MJCF/URDF/SDF export scripts should not be installed at the same time. For code/project history reasons.. in the end I just use the MJCF script, so that's what gets my attention and I don't currently have an incentive to make a combined script.
The print_tf_tree() tree errors are potentially misleading since that's not the kinematic representation that's actually used to perform the export. I created a new issue (#13) to allow all the display stuff to be disabled before the first successful export, since I consider the tf display feature still experimental.
As I said on YT: You made THE editor for MJCF.
Thank you very much!
Video is perfect to get the steps.
I'm also focused on MJCF to learn it :)
Everything fixed for me, closing this issue!
Hello @jay-j
Do you have any plan to add rope and loop in your add-on?
If not, would you please help me to implement it?
Development of this has been "add features as I discover I need them". So the "plan" is very short term, but composite
objects (including rope, loop, cloth, etc.) are not in it right now.
I'd be happy to accept a PR if you want to tackle it. The 'guts of the mjcf export script' aspect isn't too hard.. a new composite
enum_sk_type
and enum_composite_type
subtype. Add a section to SimpleKinematicsJointPanel.draw()
to draw the GUI aspects, a section to export_entity()
to call some new export_composite()
function.
Really the sticking point is how to draw/interact with this in Blender.. my instinct is an array modifier of an empty representing the geom to be replicated, but empties can't have modifiers. An alternative that comes to mind right now is to have a single-vertex mesh object with array modifier used as the composite
entity, and use dupliverts to show the empty geom replicated. But this would not work well for the cylinder and ellipsoid composite types... maybe the add-on should edit the mesh itself?
(clarification for others: loop
is MuJoCo's term for a macro that defines a rope
where the ends connect. This add-on already does support making kinematic closed loops via the equality
system (which is what loop
does under the hood at macro expansion))
Thank you very much.
I'll have a look and try. If I get something usable, I'll PR.
OK, I re-installed my OS (Ubuntu PopOS 21 to 22) and it seems faster.
I jumped to blender 3.3.0 alpha (snap) for future upgrades (LTS).
This add-on already does support making kinematic closed loops via the equality system
I see different types + solref + solimp. As I don't know enough of MJCF, I'm wondering what would be needed for a basic loop rope.
I see different types + solref + solimp. As I don't know enough of MJCF, I'm wondering what would be needed for a basic loop rope.
The MuJoCo types composite/rope
and composite/loop
are macros; fake types that the MJCF reader expands into 'real' types (bodies, geoms, joints, and equalities).
To model a piece of string (something a human might call a rope, regardless of what MuJoCo calls it) there are a few options:
- Use the appropriate
composite/
XML tags. This exporter does not currently support this tag, so you'd have to add this feature (as discussed above) or after export edit the MJCF file. - "Expand the macro by hand" - model every body/geom/joint/equality to represent the string by hand. Here, if you wanted a string that connected to itself, you'd use an equality constraint, likely the ball joint type. This approach is already supported by this exporter. In fact, I worked on a tank tread project a few months ago and used this approach.
Hello @jay-j
Finally get some time to continue to learn your plugin and Mujoco.
I made a rope using only bodies and joints and noticed that the bodies in Mujoco only collide with N-2 and initial body, but not with N-1. You have to manually move the bodies to notice.
Here's my blend, it's a rope for now, not a loop, file name is for the future.
Would you please let me know if you have the same issue?
loop1.blend.zip
@j2l That is MuJoCo's intended behavior. See Collision Detection > Selection > Filtering > 3 in the manual: https://mujoco.readthedocs.io/en/latest/computation.html#selection. Bodies adjacent in the TF tree are ignored by collision detection by default; body N won't collide with N+1 or N-1. I recommend you stick with this default and instead use joint range of motion limits to govern collisions between adjacent bodies. Given all that, your file works as I'd expect.