Renamed mjmModel to mjSpec.
PiperOrigin-RevId: 613516063 Change-Id: I09e360d3eba2accba2e260ec4754b0879b12892f
This commit is contained in:
committed by
Copybara-Service
parent
22cd96fbbc
commit
ef3cb7ec2e
+59
-59
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
|
|
||||||
// create model
|
// create model
|
||||||
mjmModel* mjm_createModel() {
|
mjSpec* mjm_createModel() {
|
||||||
mjCModel* modelC = new mjCModel;
|
mjCModel* modelC = new mjCModel;
|
||||||
return &modelC->spec;
|
return &modelC->spec;
|
||||||
}
|
}
|
||||||
@@ -35,40 +35,40 @@ mjmModel* mjm_createModel() {
|
|||||||
|
|
||||||
|
|
||||||
// copy back model
|
// copy back model
|
||||||
void mjm_copyBack(mjmModel* model, const mjModel* m) {
|
void mjm_copyBack(mjSpec* s, const mjModel* m) {
|
||||||
mjCModel* modelC = reinterpret_cast<mjCModel*>(model->element);
|
mjCModel* modelC = reinterpret_cast<mjCModel*>(s->element);
|
||||||
modelC->CopyBack(m);
|
modelC->CopyBack(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// compile model
|
// compile model
|
||||||
mjModel* mjm_compileModel(mjmModel* model, const mjVFS* vfs) {
|
mjModel* mjm_compileModel(mjSpec* s, const mjVFS* vfs) {
|
||||||
mjCModel* modelC = reinterpret_cast<mjCModel*>(model->element);
|
mjCModel* modelC = reinterpret_cast<mjCModel*>(s->element);
|
||||||
return modelC->Compile(vfs);
|
return modelC->Compile(vfs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// get error message from model
|
// get error message from model
|
||||||
const char* mjm_getError(mjmModel* model) {
|
const char* mjm_getError(mjSpec* s) {
|
||||||
mjCModel* modelC = reinterpret_cast<mjCModel*>(model->element);
|
mjCModel* modelC = reinterpret_cast<mjCModel*>(s->element);
|
||||||
return modelC->GetError().message;
|
return modelC->GetError().message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// check if model has warnings
|
// check if model has warnings
|
||||||
int mjm_isWarning(mjmModel* model) {
|
int mjm_isWarning(mjSpec* s) {
|
||||||
mjCModel* modelC = reinterpret_cast<mjCModel*>(model->element);
|
mjCModel* modelC = reinterpret_cast<mjCModel*>(s->element);
|
||||||
return modelC->GetError().warning;
|
return modelC->GetError().warning;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// delete model
|
// delete model
|
||||||
void mjm_deleteModel(mjmModel* modelspec) {
|
void mjm_deleteModel(mjSpec* s) {
|
||||||
mjCModel* model = reinterpret_cast<mjCModel*>(modelspec->element);
|
mjCModel* model = reinterpret_cast<mjCModel*>(s->element);
|
||||||
delete model;
|
delete model;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,8 +143,8 @@ mjmLight* mjm_addLight(mjmBody* bodyspec, mjmDefault* defspec) {
|
|||||||
|
|
||||||
|
|
||||||
// add flex to model
|
// add flex to model
|
||||||
mjmFlex* mjm_addFlex(mjmModel* model) {
|
mjmFlex* mjm_addFlex(mjSpec* s) {
|
||||||
mjCModel* modelC = reinterpret_cast<mjCModel*>(model->element);
|
mjCModel* modelC = reinterpret_cast<mjCModel*>(s->element);
|
||||||
mjCFlex* flex = modelC->AddFlex();
|
mjCFlex* flex = modelC->AddFlex();
|
||||||
return &flex->spec;
|
return &flex->spec;
|
||||||
}
|
}
|
||||||
@@ -165,9 +165,9 @@ mjmFrame* mjm_addFrame(mjmBody* bodyspec, mjmFrame* parentframe) {
|
|||||||
|
|
||||||
|
|
||||||
// add mesh to model
|
// add mesh to model
|
||||||
mjmMesh* mjm_addMesh(mjmModel* model, mjmDefault* defspec) {
|
mjmMesh* mjm_addMesh(mjSpec* s, mjmDefault* defspec) {
|
||||||
mjCDef* def = defspec ? reinterpret_cast<mjCDef*>(defspec->element) : 0;
|
mjCDef* def = defspec ? reinterpret_cast<mjCDef*>(defspec->element) : 0;
|
||||||
mjCModel* modelC = reinterpret_cast<mjCModel*>(model->element);
|
mjCModel* modelC = reinterpret_cast<mjCModel*>(s->element);
|
||||||
mjCMesh* mesh = modelC->AddMesh(def);
|
mjCMesh* mesh = modelC->AddMesh(def);
|
||||||
return &mesh->spec;
|
return &mesh->spec;
|
||||||
}
|
}
|
||||||
@@ -175,8 +175,8 @@ mjmMesh* mjm_addMesh(mjmModel* model, mjmDefault* defspec) {
|
|||||||
|
|
||||||
|
|
||||||
// add height field to model
|
// add height field to model
|
||||||
mjmHField* mjm_addHField(mjmModel* model) {
|
mjmHField* mjm_addHField(mjSpec* s) {
|
||||||
mjCModel* modelC = reinterpret_cast<mjCModel*>(model->element);
|
mjCModel* modelC = reinterpret_cast<mjCModel*>(s->element);
|
||||||
mjCHField* heightField = modelC->AddHField();
|
mjCHField* heightField = modelC->AddHField();
|
||||||
return &heightField->spec;
|
return &heightField->spec;
|
||||||
}
|
}
|
||||||
@@ -184,8 +184,8 @@ mjmHField* mjm_addHField(mjmModel* model) {
|
|||||||
|
|
||||||
|
|
||||||
// add skin to model
|
// add skin to model
|
||||||
mjmSkin* mjm_addSkin(mjmModel* model) {
|
mjmSkin* mjm_addSkin(mjSpec* s) {
|
||||||
mjCModel* modelC = reinterpret_cast<mjCModel*>(model->element);
|
mjCModel* modelC = reinterpret_cast<mjCModel*>(s->element);
|
||||||
mjCSkin* skin = modelC->AddSkin();
|
mjCSkin* skin = modelC->AddSkin();
|
||||||
return &skin->spec;
|
return &skin->spec;
|
||||||
}
|
}
|
||||||
@@ -193,8 +193,8 @@ mjmSkin* mjm_addSkin(mjmModel* model) {
|
|||||||
|
|
||||||
|
|
||||||
// add texture to model
|
// add texture to model
|
||||||
mjmTexture* mjm_addTexture(mjmModel* model) {
|
mjmTexture* mjm_addTexture(mjSpec* s) {
|
||||||
mjCModel* modelC = reinterpret_cast<mjCModel*>(model->element);
|
mjCModel* modelC = reinterpret_cast<mjCModel*>(s->element);
|
||||||
mjCTexture* texture = modelC->AddTexture();
|
mjCTexture* texture = modelC->AddTexture();
|
||||||
return &texture->spec;
|
return &texture->spec;
|
||||||
}
|
}
|
||||||
@@ -202,8 +202,8 @@ mjmTexture* mjm_addTexture(mjmModel* model) {
|
|||||||
|
|
||||||
|
|
||||||
// add material to model
|
// add material to model
|
||||||
mjmMaterial* mjm_addMaterial(mjmModel* model, mjmDefault* defspec) {
|
mjmMaterial* mjm_addMaterial(mjSpec* s, mjmDefault* defspec) {
|
||||||
mjCModel* modelC = reinterpret_cast<mjCModel*>(model->element);
|
mjCModel* modelC = reinterpret_cast<mjCModel*>(s->element);
|
||||||
mjCDef* def = defspec ? reinterpret_cast<mjCDef*>(defspec->element) : 0;
|
mjCDef* def = defspec ? reinterpret_cast<mjCDef*>(defspec->element) : 0;
|
||||||
mjCMaterial* material = modelC->AddMaterial(def);
|
mjCMaterial* material = modelC->AddMaterial(def);
|
||||||
return &material->spec;
|
return &material->spec;
|
||||||
@@ -212,8 +212,8 @@ mjmMaterial* mjm_addMaterial(mjmModel* model, mjmDefault* defspec) {
|
|||||||
|
|
||||||
|
|
||||||
// add pair to model
|
// add pair to model
|
||||||
mjmPair* mjm_addPair(mjmModel* model, mjmDefault* defspec) {
|
mjmPair* mjm_addPair(mjSpec* s, mjmDefault* defspec) {
|
||||||
mjCModel* modelC = reinterpret_cast<mjCModel*>(model->element);
|
mjCModel* modelC = reinterpret_cast<mjCModel*>(s->element);
|
||||||
mjCDef* def = defspec ? reinterpret_cast<mjCDef*>(defspec->element) : 0;
|
mjCDef* def = defspec ? reinterpret_cast<mjCDef*>(defspec->element) : 0;
|
||||||
mjCPair* pair = modelC->AddPair(def);
|
mjCPair* pair = modelC->AddPair(def);
|
||||||
return &pair->spec;
|
return &pair->spec;
|
||||||
@@ -222,8 +222,8 @@ mjmPair* mjm_addPair(mjmModel* model, mjmDefault* defspec) {
|
|||||||
|
|
||||||
|
|
||||||
// add pair exclusion to model
|
// add pair exclusion to model
|
||||||
mjmExclude* mjm_addExclude(mjmModel* model) {
|
mjmExclude* mjm_addExclude(mjSpec* s) {
|
||||||
mjCModel* modelC = reinterpret_cast<mjCModel*>(model->element);
|
mjCModel* modelC = reinterpret_cast<mjCModel*>(s->element);
|
||||||
mjCBodyPair* bodypair = modelC->AddExclude();
|
mjCBodyPair* bodypair = modelC->AddExclude();
|
||||||
return &bodypair->spec;
|
return &bodypair->spec;
|
||||||
}
|
}
|
||||||
@@ -231,8 +231,8 @@ mjmExclude* mjm_addExclude(mjmModel* model) {
|
|||||||
|
|
||||||
|
|
||||||
// add equality to model
|
// add equality to model
|
||||||
mjmEquality* mjm_addEquality(mjmModel* model, mjmDefault* defspec) {
|
mjmEquality* mjm_addEquality(mjSpec* s, mjmDefault* defspec) {
|
||||||
mjCModel* modelC = reinterpret_cast<mjCModel*>(model->element);
|
mjCModel* modelC = reinterpret_cast<mjCModel*>(s->element);
|
||||||
mjCDef* def = defspec ? reinterpret_cast<mjCDef*>(defspec->element) : 0;
|
mjCDef* def = defspec ? reinterpret_cast<mjCDef*>(defspec->element) : 0;
|
||||||
mjCEquality* equality = modelC->AddEquality(def);
|
mjCEquality* equality = modelC->AddEquality(def);
|
||||||
return &equality->spec;
|
return &equality->spec;
|
||||||
@@ -241,8 +241,8 @@ mjmEquality* mjm_addEquality(mjmModel* model, mjmDefault* defspec) {
|
|||||||
|
|
||||||
|
|
||||||
// add tendon to model
|
// add tendon to model
|
||||||
mjmTendon* mjm_addTendon(mjmModel* model, mjmDefault* defspec) {
|
mjmTendon* mjm_addTendon(mjSpec* s, mjmDefault* defspec) {
|
||||||
mjCModel* modelC = reinterpret_cast<mjCModel*>(model->element);
|
mjCModel* modelC = reinterpret_cast<mjCModel*>(s->element);
|
||||||
mjCDef* def = defspec ? reinterpret_cast<mjCDef*>(defspec->element) : 0;
|
mjCDef* def = defspec ? reinterpret_cast<mjCDef*>(defspec->element) : 0;
|
||||||
mjCTendon* tendon = modelC->AddTendon(def);
|
mjCTendon* tendon = modelC->AddTendon(def);
|
||||||
return &tendon->spec;
|
return &tendon->spec;
|
||||||
@@ -287,8 +287,8 @@ mjmWrap* mjm_wrapPulley(mjmTendon* tendonspec, double divisor) {
|
|||||||
|
|
||||||
|
|
||||||
// add actuator to model
|
// add actuator to model
|
||||||
mjmActuator* mjm_addActuator(mjmModel* model, mjmDefault* defspec) {
|
mjmActuator* mjm_addActuator(mjSpec* s, mjmDefault* defspec) {
|
||||||
mjCModel* modelC = reinterpret_cast<mjCModel*>(model->element);
|
mjCModel* modelC = reinterpret_cast<mjCModel*>(s->element);
|
||||||
mjCDef* def = defspec ? reinterpret_cast<mjCDef*>(defspec->element) : 0;
|
mjCDef* def = defspec ? reinterpret_cast<mjCDef*>(defspec->element) : 0;
|
||||||
mjCActuator* actuator = modelC->AddActuator(def);
|
mjCActuator* actuator = modelC->AddActuator(def);
|
||||||
return &actuator->spec;
|
return &actuator->spec;
|
||||||
@@ -297,8 +297,8 @@ mjmActuator* mjm_addActuator(mjmModel* model, mjmDefault* defspec) {
|
|||||||
|
|
||||||
|
|
||||||
// add sensor to model
|
// add sensor to model
|
||||||
mjmSensor* mjm_addSensor(mjmModel* model) {
|
mjmSensor* mjm_addSensor(mjSpec* s) {
|
||||||
mjCModel* modelC = reinterpret_cast<mjCModel*>(model->element);
|
mjCModel* modelC = reinterpret_cast<mjCModel*>(s->element);
|
||||||
mjCSensor* sensor = modelC->AddSensor();
|
mjCSensor* sensor = modelC->AddSensor();
|
||||||
return &sensor->spec;
|
return &sensor->spec;
|
||||||
}
|
}
|
||||||
@@ -306,8 +306,8 @@ mjmSensor* mjm_addSensor(mjmModel* model) {
|
|||||||
|
|
||||||
|
|
||||||
// add numeric to model
|
// add numeric to model
|
||||||
mjmNumeric* mjm_addNumeric(mjmModel* model) {
|
mjmNumeric* mjm_addNumeric(mjSpec* s) {
|
||||||
mjCModel* modelC = reinterpret_cast<mjCModel*>(model->element);
|
mjCModel* modelC = reinterpret_cast<mjCModel*>(s->element);
|
||||||
mjCNumeric* numeric = modelC->AddNumeric();
|
mjCNumeric* numeric = modelC->AddNumeric();
|
||||||
return &numeric->spec;
|
return &numeric->spec;
|
||||||
}
|
}
|
||||||
@@ -315,8 +315,8 @@ mjmNumeric* mjm_addNumeric(mjmModel* model) {
|
|||||||
|
|
||||||
|
|
||||||
// add text to model
|
// add text to model
|
||||||
mjmText* mjm_addText(mjmModel* model) {
|
mjmText* mjm_addText(mjSpec* s) {
|
||||||
mjCModel* modelC = reinterpret_cast<mjCModel*>(model->element);
|
mjCModel* modelC = reinterpret_cast<mjCModel*>(s->element);
|
||||||
mjCText* text = modelC->AddText();
|
mjCText* text = modelC->AddText();
|
||||||
return &text->spec;
|
return &text->spec;
|
||||||
}
|
}
|
||||||
@@ -324,8 +324,8 @@ mjmText* mjm_addText(mjmModel* model) {
|
|||||||
|
|
||||||
|
|
||||||
// add tuple to model
|
// add tuple to model
|
||||||
mjmTuple* mjm_addTuple(mjmModel* model) {
|
mjmTuple* mjm_addTuple(mjSpec* s) {
|
||||||
mjCModel* modelC = reinterpret_cast<mjCModel*>(model->element);
|
mjCModel* modelC = reinterpret_cast<mjCModel*>(s->element);
|
||||||
mjCTuple* tuple = modelC->AddTuple();
|
mjCTuple* tuple = modelC->AddTuple();
|
||||||
return &tuple->spec;
|
return &tuple->spec;
|
||||||
}
|
}
|
||||||
@@ -333,8 +333,8 @@ mjmTuple* mjm_addTuple(mjmModel* model) {
|
|||||||
|
|
||||||
|
|
||||||
// add keyframe to model
|
// add keyframe to model
|
||||||
mjmKey* mjm_addKey(mjmModel* model) {
|
mjmKey* mjm_addKey(mjSpec* s) {
|
||||||
mjCModel* modelC = reinterpret_cast<mjCModel*>(model->element);
|
mjCModel* modelC = reinterpret_cast<mjCModel*>(s->element);
|
||||||
mjCKey* key = modelC->AddKey();
|
mjCKey* key = modelC->AddKey();
|
||||||
return &key->spec;
|
return &key->spec;
|
||||||
}
|
}
|
||||||
@@ -342,8 +342,8 @@ mjmKey* mjm_addKey(mjmModel* model) {
|
|||||||
|
|
||||||
|
|
||||||
// add plugin to model
|
// add plugin to model
|
||||||
mjmPlugin* mjm_addPlugin(mjmModel* model) {
|
mjmPlugin* mjm_addPlugin(mjSpec* s) {
|
||||||
mjCModel* modelC = reinterpret_cast<mjCModel*>(model->element);
|
mjCModel* modelC = reinterpret_cast<mjCModel*>(s->element);
|
||||||
mjCPlugin* plugin = modelC->AddPlugin();
|
mjCPlugin* plugin = modelC->AddPlugin();
|
||||||
plugin->spec.instance = (mjElement)plugin;
|
plugin->spec.instance = (mjElement)plugin;
|
||||||
return &plugin->spec;
|
return &plugin->spec;
|
||||||
@@ -352,8 +352,8 @@ mjmPlugin* mjm_addPlugin(mjmModel* model) {
|
|||||||
|
|
||||||
|
|
||||||
// add default to model
|
// add default to model
|
||||||
mjmDefault* mjm_addDefault(mjmModel* model, const char* classname, int parentid, int* id) {
|
mjmDefault* mjm_addDefault(mjSpec* s, const char* classname, int parentid, int* id) {
|
||||||
mjCModel* modelC = reinterpret_cast<mjCModel*>(model->element);
|
mjCModel* modelC = reinterpret_cast<mjCModel*>(s->element);
|
||||||
*id = (int)modelC->defaults.size();
|
*id = (int)modelC->defaults.size();
|
||||||
mjCDef* def = modelC->AddDef(classname, parentid);
|
mjCDef* def = modelC->AddDef(classname, parentid);
|
||||||
if (def) {
|
if (def) {
|
||||||
@@ -366,8 +366,8 @@ mjmDefault* mjm_addDefault(mjmModel* model, const char* classname, int parentid,
|
|||||||
|
|
||||||
|
|
||||||
// get objects
|
// get objects
|
||||||
mjmModel* mjm_getModel(mjmBody* bodyspec) {
|
mjSpec* mjm_getSpec(mjmBody* body) {
|
||||||
return &(reinterpret_cast<mjCBody*>(bodyspec->element)->model->spec);
|
return &(reinterpret_cast<mjCBody*>(body->element)->model->spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -380,8 +380,8 @@ mjmDefault* mjm_getDefault(mjElement element) {
|
|||||||
|
|
||||||
|
|
||||||
// Find default with given name in model.
|
// Find default with given name in model.
|
||||||
mjmDefault* mjm_findDefault(mjmModel* model, const char* classname) {
|
mjmDefault* mjm_findDefault(mjSpec* s, const char* classname) {
|
||||||
mjCModel* modelC = reinterpret_cast<mjCModel*>(model->element);
|
mjCModel* modelC = reinterpret_cast<mjCModel*>(s->element);
|
||||||
mjCDef* cdef = modelC->FindDef(classname);
|
mjCDef* cdef = modelC->FindDef(classname);
|
||||||
if (!cdef) {
|
if (!cdef) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@@ -392,8 +392,8 @@ mjmDefault* mjm_findDefault(mjmModel* model, const char* classname) {
|
|||||||
|
|
||||||
|
|
||||||
// get default[0] from model
|
// get default[0] from model
|
||||||
mjmDefault* mjm_getModelDefault(mjmModel* model) {
|
mjmDefault* mjm_getModelDefault(mjSpec* s) {
|
||||||
mjCModel* modelC = reinterpret_cast<mjCModel*>(model->element);
|
mjCModel* modelC = reinterpret_cast<mjCModel*>(s->element);
|
||||||
mjCDef* def = modelC->defaults[0];
|
mjCDef* def = modelC->defaults[0];
|
||||||
if (!def) {
|
if (!def) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@@ -404,8 +404,8 @@ mjmDefault* mjm_getModelDefault(mjmModel* model) {
|
|||||||
|
|
||||||
|
|
||||||
// find body in model by name
|
// find body in model by name
|
||||||
mjmBody* mjm_findBody(mjmModel* modelspec, const char* name) {
|
mjmBody* mjm_findBody(mjSpec* s, const char* name) {
|
||||||
mjCModel* model = reinterpret_cast<mjCModel*>(modelspec->element);
|
mjCModel* model = reinterpret_cast<mjCModel*>(s->element);
|
||||||
mjCBase* body = model->FindObject(mjOBJ_BODY, std::string(name));
|
mjCBase* body = model->FindObject(mjOBJ_BODY, std::string(name));
|
||||||
if (!body) {
|
if (!body) {
|
||||||
return 0;
|
return 0;
|
||||||
@@ -428,8 +428,8 @@ mjmBody* mjm_findChild(mjmBody* bodyspec, const char* name) {
|
|||||||
|
|
||||||
|
|
||||||
// find mesh by name
|
// find mesh by name
|
||||||
mjmMesh* mjm_findMesh(mjmModel* modelspec, const char* name) {
|
mjmMesh* mjm_findMesh(mjSpec* s, const char* name) {
|
||||||
mjCModel* model = reinterpret_cast<mjCModel*>(modelspec->element);
|
mjCModel* model = reinterpret_cast<mjCModel*>(s->element);
|
||||||
mjCMesh* mesh = (mjCMesh*)model->FindObject(mjOBJ_MESH, std::string(name));
|
mjCMesh* mesh = (mjCMesh*)model->FindObject(mjOBJ_MESH, std::string(name));
|
||||||
if (!mesh) {
|
if (!mesh) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@@ -585,8 +585,8 @@ void mjm_setPluginAttributes(mjmPlugin* plugin, void* attributes) {
|
|||||||
|
|
||||||
|
|
||||||
// Set active plugins.
|
// Set active plugins.
|
||||||
void mjm_setActivePlugins(mjmModel* model, void* activeplugins) {
|
void mjm_setActivePlugins(mjSpec* s, void* activeplugins) {
|
||||||
mjCModel* modelC = reinterpret_cast<mjCModel*>(model->element);
|
mjCModel* modelC = reinterpret_cast<mjCModel*>(s->element);
|
||||||
std::vector<std::pair<const mjpPlugin*, int>>* active_plugins =
|
std::vector<std::pair<const mjpPlugin*, int>>* active_plugins =
|
||||||
reinterpret_cast<std::vector<std::pair<const mjpPlugin*, int>>*>(activeplugins);
|
reinterpret_cast<std::vector<std::pair<const mjpPlugin*, int>>*>(activeplugins);
|
||||||
modelC->active_plugins = std::move(*active_plugins);
|
modelC->active_plugins = std::move(*active_plugins);
|
||||||
|
|||||||
+34
-34
@@ -79,7 +79,7 @@ typedef enum _mjtInertiaFromGeom {
|
|||||||
|
|
||||||
//---------------------------------- attribute structs (mjm) ---------------------------------------
|
//---------------------------------- attribute structs (mjm) ---------------------------------------
|
||||||
|
|
||||||
typedef struct _mjmModel { // model specification
|
typedef struct _mjSpec { // model specification
|
||||||
mjElement element; // internal, do not modify
|
mjElement element; // internal, do not modify
|
||||||
mjStatistic stat; // statistics override (if defined)
|
mjStatistic stat; // statistics override (if defined)
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ typedef struct _mjmModel { // model specification
|
|||||||
|
|
||||||
// other
|
// other
|
||||||
bool hasImplicitPluginElem; // already encountered an implicit plugin sensor/actuator
|
bool hasImplicitPluginElem; // already encountered an implicit plugin sensor/actuator
|
||||||
} mjmModel;
|
} mjSpec;
|
||||||
|
|
||||||
|
|
||||||
typedef struct _mjmOrientation { // alternative orientation specifiers
|
typedef struct _mjmOrientation { // alternative orientation specifiers
|
||||||
@@ -727,22 +727,22 @@ typedef struct _mjmDefault { // default specification
|
|||||||
//---------------------------------- API functions -------------------------------------------------
|
//---------------------------------- API functions -------------------------------------------------
|
||||||
|
|
||||||
// Create model.
|
// Create model.
|
||||||
MJAPI mjmModel* mjm_createModel();
|
MJAPI mjSpec* mjm_createModel();
|
||||||
|
|
||||||
// Copy back model.
|
// Copy back model.
|
||||||
MJAPI void mjm_copyBack(mjmModel* model, const mjModel* m);
|
MJAPI void mjm_copyBack(mjSpec* s, const mjModel* m);
|
||||||
|
|
||||||
// Compile model.
|
// Compile model.
|
||||||
MJAPI mjModel* mjm_compileModel(mjmModel* model, const mjVFS* vfs);
|
MJAPI mjModel* mjm_compileModel(mjSpec* s, const mjVFS* vfs);
|
||||||
|
|
||||||
// Get error message from model.
|
// Get error message from model.
|
||||||
MJAPI const char* mjm_getError(mjmModel* model);
|
MJAPI const char* mjm_getError(mjSpec* s);
|
||||||
|
|
||||||
// Return 1 if model has warnings.
|
// Return 1 if model has warnings.
|
||||||
MJAPI int mjm_isWarning(mjmModel* model);
|
MJAPI int mjm_isWarning(mjSpec* s);
|
||||||
|
|
||||||
// Delete model.
|
// Delete model.
|
||||||
MJAPI void mjm_deleteModel(mjmModel* modelspec);
|
MJAPI void mjm_deleteModel(mjSpec* s);
|
||||||
|
|
||||||
// Add child body to body, return child spec.
|
// Add child body to body, return child spec.
|
||||||
MJAPI mjmBody* mjm_addBody(mjmBody* body, mjmDefault* def);
|
MJAPI mjmBody* mjm_addBody(mjmBody* body, mjmDefault* def);
|
||||||
@@ -769,34 +769,34 @@ MJAPI mjmLight* mjm_addLight(mjmBody* body, mjmDefault* def);
|
|||||||
MJAPI mjmFrame* mjm_addFrame(mjmBody* body, mjmFrame* parentframe);
|
MJAPI mjmFrame* mjm_addFrame(mjmBody* body, mjmFrame* parentframe);
|
||||||
|
|
||||||
// Add flex to model.
|
// Add flex to model.
|
||||||
MJAPI mjmFlex* mjm_addFlex(mjmModel* model);
|
MJAPI mjmFlex* mjm_addFlex(mjSpec* s);
|
||||||
|
|
||||||
// Add mesh to model.
|
// Add mesh to model.
|
||||||
MJAPI mjmMesh* mjm_addMesh(mjmModel* model, mjmDefault* def);
|
MJAPI mjmMesh* mjm_addMesh(mjSpec* s, mjmDefault* def);
|
||||||
|
|
||||||
// Add height field to model.
|
// Add height field to model.
|
||||||
MJAPI mjmHField* mjm_addHField(mjmModel* model);
|
MJAPI mjmHField* mjm_addHField(mjSpec* s);
|
||||||
|
|
||||||
// Add skin to model.
|
// Add skin to model.
|
||||||
MJAPI mjmSkin* mjm_addSkin(mjmModel* model);
|
MJAPI mjmSkin* mjm_addSkin(mjSpec* s);
|
||||||
|
|
||||||
// Add texture to model.
|
// Add texture to model.
|
||||||
MJAPI mjmTexture* mjm_addTexture(mjmModel* model);
|
MJAPI mjmTexture* mjm_addTexture(mjSpec* s);
|
||||||
|
|
||||||
// Add material to model.
|
// Add material to model.
|
||||||
MJAPI mjmMaterial* mjm_addMaterial(mjmModel* model, mjmDefault* def);
|
MJAPI mjmMaterial* mjm_addMaterial(mjSpec* s, mjmDefault* def);
|
||||||
|
|
||||||
// Add pair to model.
|
// Add pair to model.
|
||||||
MJAPI mjmPair* mjm_addPair(mjmModel* model, mjmDefault* def);
|
MJAPI mjmPair* mjm_addPair(mjSpec* s, mjmDefault* def);
|
||||||
|
|
||||||
// Add excluded body pair to model.
|
// Add excluded body pair to model.
|
||||||
MJAPI mjmExclude* mjm_addExclude(mjmModel *model);
|
MJAPI mjmExclude* mjm_addExclude(mjSpec *model);
|
||||||
|
|
||||||
// Add equality to model.
|
// Add equality to model.
|
||||||
MJAPI mjmEquality* mjm_addEquality(mjmModel* model, mjmDefault* def);
|
MJAPI mjmEquality* mjm_addEquality(mjSpec* s, mjmDefault* def);
|
||||||
|
|
||||||
// Add tendon to model.
|
// Add tendon to model.
|
||||||
MJAPI mjmTendon* mjm_addTendon(mjmModel* model, mjmDefault* def);
|
MJAPI mjmTendon* mjm_addTendon(mjSpec* s, mjmDefault* def);
|
||||||
|
|
||||||
// Wrap site using tendon.
|
// Wrap site using tendon.
|
||||||
MJAPI mjmWrap* mjm_wrapSite(mjmTendon* tendon, const char* name);
|
MJAPI mjmWrap* mjm_wrapSite(mjmTendon* tendon, const char* name);
|
||||||
@@ -811,49 +811,49 @@ MJAPI mjmWrap* mjm_wrapJoint(mjmTendon* tendon, const char* name, double coef);
|
|||||||
MJAPI mjmWrap* mjm_wrapPulley(mjmTendon* tendon, double divisor);
|
MJAPI mjmWrap* mjm_wrapPulley(mjmTendon* tendon, double divisor);
|
||||||
|
|
||||||
// Add actuator to model.
|
// Add actuator to model.
|
||||||
MJAPI mjmActuator* mjm_addActuator(mjmModel* model, mjmDefault* def);
|
MJAPI mjmActuator* mjm_addActuator(mjSpec* s, mjmDefault* def);
|
||||||
|
|
||||||
// Add sensor to model.
|
// Add sensor to model.
|
||||||
MJAPI mjmSensor* mjm_addSensor(mjmModel* model);
|
MJAPI mjmSensor* mjm_addSensor(mjSpec* s);
|
||||||
|
|
||||||
// Add numeric to model.
|
// Add numeric to model.
|
||||||
MJAPI mjmNumeric* mjm_addNumeric(mjmModel* model);
|
MJAPI mjmNumeric* mjm_addNumeric(mjSpec* s);
|
||||||
|
|
||||||
// Add text to model.
|
// Add text to model.
|
||||||
MJAPI mjmText* mjm_addText(mjmModel* model);
|
MJAPI mjmText* mjm_addText(mjSpec* s);
|
||||||
|
|
||||||
// Add tuple to model.
|
// Add tuple to model.
|
||||||
MJAPI mjmTuple* mjm_addTuple(mjmModel* model);
|
MJAPI mjmTuple* mjm_addTuple(mjSpec* s);
|
||||||
|
|
||||||
// Add keyframe to model.
|
// Add keyframe to model.
|
||||||
MJAPI mjmKey* mjm_addKey(mjmModel* model);
|
MJAPI mjmKey* mjm_addKey(mjSpec* s);
|
||||||
|
|
||||||
// Add plugin to model.
|
// Add plugin to model.
|
||||||
MJAPI mjmPlugin* mjm_addPlugin(mjmModel* model);
|
MJAPI mjmPlugin* mjm_addPlugin(mjSpec* s);
|
||||||
|
|
||||||
// Add default to model.
|
// Add default to model.
|
||||||
MJAPI mjmDefault* mjm_addDefault(mjmModel* model, const char* classname, int parentid, int* id);
|
MJAPI mjmDefault* mjm_addDefault(mjSpec* s, const char* classname, int parentid, int* id);
|
||||||
|
|
||||||
// Get model from body.
|
// Get model spec from body.
|
||||||
MJAPI mjmModel* mjm_getModel(mjmBody* body);
|
MJAPI mjSpec* mjm_getSpec(mjmBody* body);
|
||||||
|
|
||||||
// Get default corresponding to an mjElement.
|
// Get default corresponding to an mjElement.
|
||||||
MJAPI mjmDefault* mjm_getDefault(mjElement element);
|
MJAPI mjmDefault* mjm_getDefault(mjElement element);
|
||||||
|
|
||||||
// Find default in model by class name.
|
// Find default in model by class name.
|
||||||
MJAPI mjmDefault* mjm_findDefault(mjmModel* model, const char* classname);
|
MJAPI mjmDefault* mjm_findDefault(mjSpec* s, const char* classname);
|
||||||
|
|
||||||
// Get global default from model.
|
// Get global default from model.
|
||||||
MJAPI mjmDefault* mjm_getModelDefault(mjmModel* model);
|
MJAPI mjmDefault* mjm_getModelDefault(mjSpec* s);
|
||||||
|
|
||||||
// Find body in model by name.
|
// Find body in model by name.
|
||||||
MJAPI mjmBody* mjm_findBody(mjmModel* model, const char* name);
|
MJAPI mjmBody* mjm_findBody(mjSpec* s, const char* name);
|
||||||
|
|
||||||
// Find child body by name.
|
// Find child body by name.
|
||||||
MJAPI mjmBody* mjm_findChild(mjmBody* body, const char* name);
|
MJAPI mjmBody* mjm_findChild(mjmBody* body, const char* name);
|
||||||
|
|
||||||
// Find mesh by name.
|
// Find mesh by name.
|
||||||
MJAPI mjmMesh* mjm_findMesh(mjmModel* model, const char* name);
|
MJAPI mjmMesh* mjm_findMesh(mjSpec* s, const char* name);
|
||||||
|
|
||||||
// Get element id.
|
// Get element id.
|
||||||
MJAPI int mjm_getId(mjElement element);
|
MJAPI int mjm_getId(mjElement element);
|
||||||
@@ -895,7 +895,7 @@ MJAPI const double* mjm_getDouble(mjDoubleVec source, int* size);
|
|||||||
MJAPI void mjm_setPluginAttributes(mjmPlugin* plugin, void* attributes);
|
MJAPI void mjm_setPluginAttributes(mjmPlugin* plugin, void* attributes);
|
||||||
|
|
||||||
// Set active plugins.
|
// Set active plugins.
|
||||||
MJAPI void mjm_setActivePlugins(mjmModel* model, void* activeplugins);
|
MJAPI void mjm_setActivePlugins(mjSpec* s, void* activeplugins);
|
||||||
|
|
||||||
// Set default.
|
// Set default.
|
||||||
MJAPI void mjm_setDefault(mjElement element, mjmDefault* def);
|
MJAPI void mjm_setDefault(mjElement element, mjmDefault* def);
|
||||||
@@ -910,7 +910,7 @@ MJAPI const char* mjm_setFullInertia(mjmBody* body, double quat[4], double inert
|
|||||||
//---------------------------------- Initialization functions --------------------------------------
|
//---------------------------------- Initialization functions --------------------------------------
|
||||||
|
|
||||||
// Default model attributes.
|
// Default model attributes.
|
||||||
MJAPI void mjm_defaultModel(mjmModel& model);
|
MJAPI void mjm_defaultModel(mjSpec& model);
|
||||||
|
|
||||||
// Default body attributes.
|
// Default body attributes.
|
||||||
MJAPI void mjm_defaultBody(mjmBody& body);
|
MJAPI void mjm_defaultBody(mjmBody& body);
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ void mjCComposite::SetDefault(void) {
|
|||||||
|
|
||||||
|
|
||||||
// make composite object
|
// make composite object
|
||||||
bool mjCComposite::Make(mjmModel* modelspec, mjmBody* body, char* error, int error_sz) {
|
bool mjCComposite::Make(mjSpec* modelspec, mjmBody* body, char* error, int error_sz) {
|
||||||
mjCModel* model = (mjCModel*)modelspec->element;
|
mjCModel* model = (mjCModel*)modelspec->element;
|
||||||
|
|
||||||
// check geom type
|
// check geom type
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ class mjCComposite {
|
|||||||
bool AddDefaultJoint(char* error = NULL, int error_sz = 0);
|
bool AddDefaultJoint(char* error = NULL, int error_sz = 0);
|
||||||
void AdjustSoft(mjtNum* solref, mjtNum* solimp, int level);
|
void AdjustSoft(mjtNum* solref, mjtNum* solimp, int level);
|
||||||
|
|
||||||
bool Make(mjmModel* modelspec, mjmBody* body, char* error, int error_sz);
|
bool Make(mjSpec* modelspec, mjmBody* body, char* error, int error_sz);
|
||||||
|
|
||||||
bool MakeParticle(mjCModel* model, mjmBody* body, char* error, int error_sz);
|
bool MakeParticle(mjCModel* model, mjmBody* body, char* error, int error_sz);
|
||||||
bool MakeGrid(mjCModel* model, mjmBody* body, char* error, int error_sz);
|
bool MakeGrid(mjCModel* model, mjmBody* body, char* error, int error_sz);
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ mjCFlexcomp::mjCFlexcomp(void) {
|
|||||||
|
|
||||||
|
|
||||||
// make flexcomp object
|
// make flexcomp object
|
||||||
bool mjCFlexcomp::Make(mjmModel* modelspec, mjmBody* body, char* error, int error_sz) {
|
bool mjCFlexcomp::Make(mjSpec* modelspec, mjmBody* body, char* error, int error_sz) {
|
||||||
mjCModel* model = (mjCModel*)modelspec->element;
|
mjCModel* model = (mjCModel*)modelspec->element;
|
||||||
mjmFlex* dflex = def.spec.flex;
|
mjmFlex* dflex = def.spec.flex;
|
||||||
int dim = dflex->dim;
|
int dim = dflex->dim;
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ typedef enum _mjtFcompType {
|
|||||||
class mjCFlexcomp {
|
class mjCFlexcomp {
|
||||||
public:
|
public:
|
||||||
mjCFlexcomp(void);
|
mjCFlexcomp(void);
|
||||||
bool Make(mjmModel* modelspec, mjmBody* body, char* error, int error_sz);
|
bool Make(mjSpec* modelspec, mjmBody* body, char* error, int error_sz);
|
||||||
|
|
||||||
bool MakeGrid(char* error, int error_sz);
|
bool MakeGrid(char* error, int error_sz);
|
||||||
bool MakeBox(char* error, int error_sz);
|
bool MakeBox(char* error, int error_sz);
|
||||||
|
|||||||
@@ -22,8 +22,8 @@
|
|||||||
|
|
||||||
|
|
||||||
// default model attributes
|
// default model attributes
|
||||||
void mjm_defaultModel(mjmModel& model) {
|
void mjm_defaultModel(mjSpec& model) {
|
||||||
memset(&model, 0, sizeof(mjmModel));
|
memset(&model, 0, sizeof(mjSpec));
|
||||||
|
|
||||||
// default statistics
|
// default statistics
|
||||||
model.stat.meaninertia = mjNAN;
|
model.stat.meaninertia = mjNAN;
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ void mjCModel::PointToLocal() {
|
|||||||
|
|
||||||
|
|
||||||
void mjCModel::CopyFromSpec() {
|
void mjCModel::CopyFromSpec() {
|
||||||
*static_cast<mjmModel*>(this) = spec;
|
*static_cast<mjSpec*>(this) = spec;
|
||||||
comment_ = spec_comment_;
|
comment_ = spec_comment_;
|
||||||
modelfiledir_ = spec_modelfiledir_;
|
modelfiledir_ = spec_modelfiledir_;
|
||||||
modelname_ = spec_modelname_;
|
modelname_ = spec_modelname_;
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ typedef std::array<mjKeyMap, mjNOBJECT> mjListKeyMap;
|
|||||||
// by loading an XML file via mjCXML. Once an mjCModel object is
|
// by loading an XML file via mjCXML. Once an mjCModel object is
|
||||||
// constructed, 'Compile' can be called to generate the corresponding mjModel object
|
// constructed, 'Compile' can be called to generate the corresponding mjModel object
|
||||||
// (which is the low-level model). The mjCModel object can then be deleted.
|
// (which is the low-level model). The mjCModel object can then be deleted.
|
||||||
class mjCModel : private mjmModel {
|
class mjCModel : private mjSpec {
|
||||||
friend class mjCBody;
|
friend class mjCBody;
|
||||||
friend class mjCCamera;
|
friend class mjCCamera;
|
||||||
friend class mjCGeom;
|
friend class mjCGeom;
|
||||||
@@ -66,7 +66,7 @@ class mjCModel : private mjmModel {
|
|||||||
void CopyFromSpec(); // copy spec to private attributes
|
void CopyFromSpec(); // copy spec to private attributes
|
||||||
void PointToLocal();
|
void PointToLocal();
|
||||||
|
|
||||||
mjmModel spec;
|
mjSpec spec;
|
||||||
|
|
||||||
mjModel* Compile(const mjVFS* vfs = nullptr); // construct mjModel
|
mjModel* Compile(const mjVFS* vfs = nullptr); // construct mjModel
|
||||||
bool CopyBack(const mjModel*); // DECOMPILER: copy numeric back
|
bool CopyBack(const mjModel*); // DECOMPILER: copy numeric back
|
||||||
|
|||||||
+3
-3
@@ -99,7 +99,7 @@ class LocaleOverride {
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
// Main writer function - calls mjXWrite
|
// Main writer function - calls mjXWrite
|
||||||
std::string mjWriteXML(mjmModel* model, char* error, int error_sz) {
|
std::string mjWriteXML(mjSpec* model, char* error, int error_sz) {
|
||||||
LocaleOverride locale_override;
|
LocaleOverride locale_override;
|
||||||
|
|
||||||
// check for empty model
|
// check for empty model
|
||||||
@@ -272,7 +272,7 @@ static void mjIncludeXML(mjXReader& reader, XMLElement* elem,
|
|||||||
|
|
||||||
|
|
||||||
// Main parser function
|
// Main parser function
|
||||||
mjmModel* mjParseXML(const char* filename, const mjVFS* vfs,
|
mjSpec* mjParseXML(const char* filename, const mjVFS* vfs,
|
||||||
char* error, int error_sz) {
|
char* error, int error_sz) {
|
||||||
LocaleOverride locale_override;
|
LocaleOverride locale_override;
|
||||||
|
|
||||||
@@ -285,7 +285,7 @@ mjmModel* mjParseXML(const char* filename, const mjVFS* vfs,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// clear
|
// clear
|
||||||
mjmModel* model = nullptr;
|
mjSpec* model = nullptr;
|
||||||
if (error) {
|
if (error) {
|
||||||
error[0] = '\0';
|
error[0] = '\0';
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -24,10 +24,10 @@
|
|||||||
// Top level API
|
// Top level API
|
||||||
|
|
||||||
// Main writer function
|
// Main writer function
|
||||||
std::string mjWriteXML(mjmModel* model, char* error, int error_sz);
|
std::string mjWriteXML(mjSpec* model, char* error, int error_sz);
|
||||||
|
|
||||||
// Main parser function
|
// Main parser function
|
||||||
MJAPI mjmModel* mjParseXML(const char* filename, const mjVFS* vfs, char* error, int error_sz);
|
MJAPI mjSpec* mjParseXML(const char* filename, const mjVFS* vfs, char* error, int error_sz);
|
||||||
|
|
||||||
|
|
||||||
#endif // MUJOCO_SRC_XML_XML_H_
|
#endif // MUJOCO_SRC_XML_XML_H_
|
||||||
|
|||||||
+5
-5
@@ -37,7 +37,7 @@
|
|||||||
class GlobalModel {
|
class GlobalModel {
|
||||||
public:
|
public:
|
||||||
// deletes current model and takes ownership of model
|
// deletes current model and takes ownership of model
|
||||||
void Set(mjmModel* model = nullptr);
|
void Set(mjSpec* model = nullptr);
|
||||||
|
|
||||||
// writes XML to string
|
// writes XML to string
|
||||||
std::optional<std::string> ToXML(const mjModel* m, char* error,
|
std::optional<std::string> ToXML(const mjModel* m, char* error,
|
||||||
@@ -46,7 +46,7 @@ class GlobalModel {
|
|||||||
private:
|
private:
|
||||||
// using raw pointers as GlobalModel needs to be trivially destructible
|
// using raw pointers as GlobalModel needs to be trivially destructible
|
||||||
std::mutex* mutex_ = new std::mutex();
|
std::mutex* mutex_ = new std::mutex();
|
||||||
mjmModel* model_ = nullptr;
|
mjSpec* model_ = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::optional<std::string> GlobalModel::ToXML(const mjModel* m, char* error,
|
std::optional<std::string> GlobalModel::ToXML(const mjModel* m, char* error,
|
||||||
@@ -64,7 +64,7 @@ std::optional<std::string> GlobalModel::ToXML(const mjModel* m, char* error,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlobalModel::Set(mjmModel* model) {
|
void GlobalModel::Set(mjSpec* model) {
|
||||||
std::lock_guard<std::mutex> lock(*mutex_);
|
std::lock_guard<std::mutex> lock(*mutex_);
|
||||||
if (model_ != nullptr) {
|
if (model_ != nullptr) {
|
||||||
mjm_deleteModel(model_);
|
mjm_deleteModel(model_);
|
||||||
@@ -91,9 +91,9 @@ mjModel* mj_loadXML(const char* filename, const mjVFS* vfs,
|
|||||||
char* error, int error_sz) {
|
char* error, int error_sz) {
|
||||||
|
|
||||||
// parse new model
|
// parse new model
|
||||||
std::unique_ptr<mjmModel, std::function<void(mjmModel*)>> model(
|
std::unique_ptr<mjSpec, std::function<void(mjSpec*)>> model(
|
||||||
mjParseXML(filename, vfs, error, error_sz),
|
mjParseXML(filename, vfs, error, error_sz),
|
||||||
[](mjmModel* m) { mjm_deleteModel(m); });
|
[](mjSpec* m) { mjm_deleteModel(m); });
|
||||||
if (!model) {
|
if (!model) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -44,7 +44,7 @@ mjXBase::mjXBase() {
|
|||||||
|
|
||||||
|
|
||||||
// set model field
|
// set model field
|
||||||
void mjXBase::SetModel(mjmModel* _model) {
|
void mjXBase::SetModel(mjSpec* _model) {
|
||||||
model = _model;
|
model = _model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -87,13 +87,13 @@ class mjXBase : public mjXUtil {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// set the model allocated externally
|
// set the model allocated externally
|
||||||
virtual void SetModel(mjmModel*);
|
virtual void SetModel(mjSpec*);
|
||||||
|
|
||||||
// read alternative orientation specification
|
// read alternative orientation specification
|
||||||
static int ReadAlternative(tinyxml2::XMLElement* elem, mjmOrientation& alt);
|
static int ReadAlternative(tinyxml2::XMLElement* elem, mjmOrientation& alt);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
mjmModel* model; // internally-allocated model
|
mjSpec* model; // internally-allocated model
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MUJOCO_SRC_XML_XML_BASE_H_
|
#endif // MUJOCO_SRC_XML_XML_BASE_H_
|
||||||
|
|||||||
@@ -913,7 +913,7 @@ void mjXReader::Parse(XMLElement* root) {
|
|||||||
|
|
||||||
|
|
||||||
// compiler section parser
|
// compiler section parser
|
||||||
void mjXReader::Compiler(XMLElement* section, mjmModel* mod) {
|
void mjXReader::Compiler(XMLElement* section, mjSpec* mod) {
|
||||||
string text;
|
string text;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
@@ -1100,7 +1100,7 @@ void mjXReader::Option(XMLElement* section, mjOption* opt) {
|
|||||||
|
|
||||||
|
|
||||||
// size section parser
|
// size section parser
|
||||||
void mjXReader::Size(XMLElement* section, mjmModel* mod) {
|
void mjXReader::Size(XMLElement* section, mjSpec* mod) {
|
||||||
// read memory bytes
|
// read memory bytes
|
||||||
{
|
{
|
||||||
constexpr char err_msg[] =
|
constexpr char err_msg[] =
|
||||||
|
|||||||
@@ -42,9 +42,9 @@ class mjXReader : public mjXBase {
|
|||||||
void SetTextureDir(std::string texturedir);
|
void SetTextureDir(std::string texturedir);
|
||||||
|
|
||||||
// XML sections embedded in all formats
|
// XML sections embedded in all formats
|
||||||
static void Compiler(tinyxml2::XMLElement* section, mjmModel* mod); // compiler section
|
static void Compiler(tinyxml2::XMLElement* section, mjSpec* mod); // compiler section
|
||||||
static void Option(tinyxml2::XMLElement* section, mjOption* opt); // option section
|
static void Option(tinyxml2::XMLElement* section, mjOption* opt); // option section
|
||||||
static void Size(tinyxml2::XMLElement* section, mjmModel* mod); // size section
|
static void Size(tinyxml2::XMLElement* section, mjSpec* mod); // size section
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// XML section specific to MJCF
|
// XML section specific to MJCF
|
||||||
|
|||||||
@@ -765,7 +765,7 @@ mjXWriter::mjXWriter(void) {
|
|||||||
|
|
||||||
|
|
||||||
// cast model
|
// cast model
|
||||||
void mjXWriter::SetModel(mjmModel* modelspec) {
|
void mjXWriter::SetModel(mjSpec* modelspec) {
|
||||||
if (modelspec) {
|
if (modelspec) {
|
||||||
model = (mjCModel*)modelspec->element;
|
model = (mjCModel*)modelspec->element;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class mjXWriter : public mjXBase {
|
|||||||
public:
|
public:
|
||||||
mjXWriter(); // constructor
|
mjXWriter(); // constructor
|
||||||
virtual ~mjXWriter() = default; // destructor
|
virtual ~mjXWriter() = default; // destructor
|
||||||
void SetModel(mjmModel* modelspec);
|
void SetModel(mjSpec* modelspec);
|
||||||
|
|
||||||
// write XML document to string
|
// write XML document to string
|
||||||
std::string Write(char *error, std::size_t error_sz);
|
std::string Write(char *error, std::size_t error_sz);
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ using ::testing::NotNull;
|
|||||||
// ----------------------------- test set/get --------------------------------
|
// ----------------------------- test set/get --------------------------------
|
||||||
|
|
||||||
TEST_F(MujocoTest, ReadWriteData) {
|
TEST_F(MujocoTest, ReadWriteData) {
|
||||||
mjmModel* model = mjm_createModel();
|
mjSpec* model = mjm_createModel();
|
||||||
mjmBody* world = mjm_findBody(model, "world");
|
mjmBody* world = mjm_findBody(model, "world");
|
||||||
mjmBody* body = mjm_addBody(world, 0);
|
mjmBody* body = mjm_addBody(world, 0);
|
||||||
mjmSite* site = mjm_addSite(body, 0);
|
mjmSite* site = mjm_addSite(body, 0);
|
||||||
@@ -86,7 +86,7 @@ TEST_F(PluginTest, RecompileCompare) {
|
|||||||
|
|
||||||
// load model
|
// load model
|
||||||
std::array<char, 1000> error;
|
std::array<char, 1000> error;
|
||||||
mjmModel* model =
|
mjSpec* model =
|
||||||
mjParseXML(xml.c_str(), nullptr, error.data(), error.size());
|
mjParseXML(xml.c_str(), nullptr, error.data(), error.size());
|
||||||
|
|
||||||
// compile twice
|
// compile twice
|
||||||
|
|||||||
Reference in New Issue
Block a user