Add assetdir compiler option.
PiperOrigin-RevId: 478117894 Change-Id: I4a93108e00558034aa02d22047da80adfa4232b2
This commit is contained in:
committed by
Copybara-Service
parent
8a8305d3ca
commit
cce35e1816
@@ -47,7 +47,7 @@ in the second column of the table have the following meaning:
|
||||
| | | +-------------------------+-------------------------+-------------------------+ |
|
||||
| | | | :at:`inertiafromgeom` | :at:`inertiagrouprange` | :at:`exactmeshinertia` | |
|
||||
| | | +-------------------------+-------------------------+-------------------------+ |
|
||||
| | | | :at:`autolimits` | | | |
|
||||
| | | | :at:`autolimits` | :at:`assetdir` | | |
|
||||
| | | +-------------------------+-------------------------+-------------------------+ |
|
||||
+--------------------------+----+------------------------------------------------------------------------------------+
|
||||
| |_2|:el:`lengthrange` | ? | .. table:: |
|
||||
@@ -1549,11 +1549,11 @@ any effect. The settings here are global and apply to the entire model.
|
||||
:ref:`mj_setTotalmass`.
|
||||
:at:`balanceinertia`: :at-val:`[false, true], "false"`
|
||||
A valid diagonal inertia matrix must satisfy A+B>=C for all permutations of the three diagonal elements. Some poorly
|
||||
designed models violate this constraint, which will normally result in compile error. If this attribute is set to
|
||||
designed models violate this constraint, which will normally result in a compile error. If this attribute is set to
|
||||
"true", the compiler will silently set all three diagonal elements to their average value whenever the above
|
||||
condition is violated.
|
||||
:at:`strippath`: :at-val:`[false, true], "false" for MJCF, "true" for URDF`
|
||||
The this attribute is "true", the parser will remove any path information in file names specified in the model. This
|
||||
When this attribute is "true", the parser will remove any path information in file names specified in the model. This
|
||||
is useful for loading models created on a different system using a different directory structure.
|
||||
:at:`coordinate`: :at-val:`[local, global], "local" for MJCF, always "local" for URDF`
|
||||
This attribute specifies whether the frame positions and orientations in the MJCF model are expressed in local or
|
||||
@@ -1585,6 +1585,9 @@ any effect. The settings here are global and apply to the entire model.
|
||||
:at:`texturedir`: :at-val:`string, optional`
|
||||
This attribute is used to instruct the compiler where to look for texture files. It works in the same way as meshdir
|
||||
above.
|
||||
:at:`assetdir`: :at-val:`string, optional`
|
||||
This attribute sets the values of both :at:`meshdir` and :at:`texturedir` above. Values in the latter attributes take
|
||||
precedence over :at:`assetdir`.
|
||||
:at:`discardvisual`: :at-val:`[false, true], "false" for MJCF, "true" for URDF`
|
||||
This attribute instructs the parser to discard "visual geoms", defined as geoms whose contype and conaffinity
|
||||
attributes are both set to 0. This functionality is useful for models that contain two sets of geoms, one for
|
||||
|
||||
@@ -47,6 +47,9 @@ General
|
||||
as global overrides. Note the new mechanism is currently undocumented except in code, as we test it internally.
|
||||
If you are interested in using the plugin mechanism, please get in touch first.
|
||||
|
||||
- Added :at:`assetdir` compiler option, which sets the values of both :at:`meshdir` and :at:`texturedir`. Values in
|
||||
the latter attributes take precedence over :at:`assetdir`.
|
||||
|
||||
Python bindings
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
|
||||
@@ -117,8 +117,8 @@ class mjCModel {
|
||||
|
||||
//------------------------ compiler settings
|
||||
bool autolimits; // infer "limited" attribute based on range
|
||||
double boundmass; // enfore minimum body mass
|
||||
double boundinertia; // enfore minimum body diagonal inertia
|
||||
double boundmass; // enforce minimum body mass
|
||||
double boundinertia; // enforce minimum body diagonal inertia
|
||||
double settotalmass; // rescale masses and inertias; <=0: ignore
|
||||
bool balanceinertia; // automatically impose A + B >= C rule
|
||||
bool strippath; // automatically strip paths from mesh files
|
||||
|
||||
@@ -79,10 +79,11 @@ static const int nMJCF = 183;
|
||||
static const char* MJCF[nMJCF][mjXATTRNUM] = {
|
||||
{"mujoco", "!", "1", "model"},
|
||||
{"<"},
|
||||
{"compiler", "*", "19", "autolimits", "boundmass", "boundinertia", "settotalmass",
|
||||
{"compiler", "*", "20", "autolimits", "boundmass", "boundinertia", "settotalmass",
|
||||
"balanceinertia", "strippath", "coordinate", "angle", "fitaabb", "eulerseq",
|
||||
"meshdir", "texturedir", "discardvisual", "convexhull", "usethread",
|
||||
"fusestatic", "inertiafromgeom", "inertiagrouprange", "exactmeshinertia"},
|
||||
"fusestatic", "inertiafromgeom", "inertiagrouprange", "exactmeshinertia",
|
||||
"assetdir"},
|
||||
{"<"},
|
||||
{"lengthrange", "?", "10", "mode", "useexisting", "uselimit",
|
||||
"accel", "maxforce", "timeconst", "timestep",
|
||||
@@ -853,6 +854,11 @@ void mjXReader::Compiler(XMLElement* section, mjCModel* mod) {
|
||||
}
|
||||
memcpy(mod->euler, text.c_str(), 3);
|
||||
}
|
||||
if (ReadAttrTxt(section, "assetdir", text)) {
|
||||
mod->meshdir = text;
|
||||
mod->texturedir = text;
|
||||
}
|
||||
// meshdir and texturedir take precedence over assetdir
|
||||
ReadAttrTxt(section, "meshdir", mod->meshdir);
|
||||
ReadAttrTxt(section, "texturedir", mod->texturedir);
|
||||
if (MapValue(section, "discardvisual", &n, bool_map, 2)) {
|
||||
|
||||
+1
-1
@@ -96,7 +96,7 @@ void mjXURDF::Parse(XMLElement* root) {
|
||||
}
|
||||
}
|
||||
|
||||
// enfore required compiler defaults for URDF
|
||||
// enforce required compiler defaults for URDF
|
||||
model->global = false;
|
||||
model->degree = false;
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
<mujoco>
|
||||
<compiler meshdir="textured_torus" texturedir="textured_torus"/>
|
||||
<compiler assetdir="textured_torus"/>
|
||||
<asset>
|
||||
<mesh name="torus" file="textured_torus.obj"/>
|
||||
<mesh name="flipped_torus" file="textured_torus.obj" scale="-1 1 1"/>
|
||||
|
||||
Reference in New Issue
Block a user