Support capsules in URDF import.

PiperOrigin-RevId: 489980760
Change-Id: I1c21e736a86f6637a00e2062727d2e6fd5694c42
This commit is contained in:
Alessio Quaglino
2022-11-21 07:58:11 -08:00
committed by Copybara-Service
parent 45b3af78a0
commit 638c9a6994
3 changed files with 62 additions and 0 deletions
+8
View File
@@ -470,6 +470,14 @@ mjCGeom* mjXURDF::Geom(XMLElement* geom_elem, mjCBody* pbody, bool collision) {
ReadAttr(temp, "radius", 1, pgeom->size, text, true, true);
}
// capsule
else if ((temp = FindSubElem(elem, "capsule"))) {
pgeom->type = mjGEOM_CAPSULE;
ReadAttr(temp, "radius", 1, pgeom->size, text, true, true);
ReadAttr(temp, "length", 1, pgeom->size+1, text, true, true);
pgeom->size[1] /= 2; // MuJoCo uses half-length
}
// mesh
else if ((temp = FindSubElem(elem, "mesh"))) {
// set geom type and read mesh attributes