Closed jjyyxx closed 1 month ago
@saran-t @quagla In fact, while being handy already, MjSpec is quite broken under many edge cases. Currently, I do not have time to submit issue for each of them, just list below:
weld
equality, which references body name (body1
, body2
) defined inside replicate
, does not expand to a full list of weld
s as contact/exclude
or actuator/general
do, but silently disappears in the output xml.asset/model
+ attach
is very broken.
(a) the output xml contains two levels of nameless <default>
, leading to error when loaded back;
(b) MjSpec loading raises error if the parent model contains plugin
definition;
(c) the output xml is full of asset path inconsistencies (this may be harder to deal with)Thanks. I solved the original issue with plugins.
I take note to add a warning for your point 1, which is a behavior I am aware of (it should work if both bodies are inside replicate, right?)
Could you provide minimal examples for 2a, 2b or 2c by opening other issues when you have time?
@quagla Created issue #2162
Intro
Hi!
I am a graduate student at HKU, I use MuJoCo for my research on robotic manipulation.
My setup
Mujoco 3.2.4, C or Python (Mujoco 3.2.3 is not affected)
What's happening? What did you expect?
Use MjSpec on document with plugin & replicate leads to segfault in Mujoco 3.2.4
Backtrace
Code
Problem source backtrace
Code
When
this
andother
points to the same model, copyingother.active_plugins_
intothis->active_plugins_
makes theactive_plugins_
size grow exponentially (in fact, inserting while iterating the same vector is already very close to buggy code, but STL seems to realloc successfully for smaller reallocations, so small replication count does not break code.)Besides, many other copies in this function might be vulnerable to such cases as well, but I do not fully understand the intention of
mjs_attachFrame
add-assigning the full model, so no further comment.Steps for reproduction
Run the snippet below. Process segfaults at
spec.to_xml
.Minimal model for reproduction
(Embedded in code)
Code required for reproduction
Confirmations