Add geom names to URDF parsing in MuJoCo.

Fixes #566

PiperOrigin-RevId: 500750288
Change-Id: I00f94ee37bb2f15be59df3933d0d4dba583f0921
This commit is contained in:
DeepMind
2023-01-09 10:33:40 -08:00
committed by Copybara-Service
parent 19b6c70e13
commit 703b33c064
6 changed files with 87 additions and 0 deletions
+3
View File
@@ -902,6 +902,9 @@ void mjXReader::Compiler(XMLElement* section, mjCModel* mod) {
if (MapValue(section, "exactmeshinertia", &n, bool_map, 2)){
mod->exactmeshinertia = (n==1);
}
if (MapValue(section, "geomnamesfromurdf", &n, bool_map, 2)) {
mod->geomnamesfromurdf = (n==1);
}
// lengthrange subelement
XMLElement* elem = FindSubElem(section, "lengthrange");
+10
View File
@@ -276,6 +276,11 @@ void mjXURDF::Body(XMLElement* body_elem) {
if (rgba[0]>=0) {
std::memcpy(pgeom->rgba, rgba, 4*sizeof(float));
}
// save name
if (model->geomnamesfromurdf) {
mjXUtil::ReadAttrTxt(elem, "name", pgeom->name);
}
}
}
@@ -287,6 +292,11 @@ void mjXURDF::Body(XMLElement* body_elem) {
if (rgba[0]>=0) {
std::memcpy(pgeom->rgba, rgba, 4*sizeof(float));
}
// save name
if (model->geomnamesfromurdf) {
mjXUtil::ReadAttrTxt(elem, "name", pgeom->name);
}
}
// advance