diff --git a/examples/Importers/ImportMJCFDemo/BulletMJCFImporter.cpp b/examples/Importers/ImportMJCFDemo/BulletMJCFImporter.cpp index 78c2745da..f4d6d231d 100644 --- a/examples/Importers/ImportMJCFDemo/BulletMJCFImporter.cpp +++ b/examples/Importers/ImportMJCFDemo/BulletMJCFImporter.cpp @@ -143,6 +143,7 @@ struct BulletMJCFImporterInternalData // std::string m_meshDir; std::string m_textureDir; + std::string m_angleUnits; int m_activeModel; @@ -213,6 +214,8 @@ struct BulletMJCFImporterInternalData { m_textureDir = textureDirStr; } + const char* angle = root_xml->Attribute("angle"); + m_angleUnits = angle ? angle : "degree"; // degrees by default, http://www.mujoco.org/book/modeling.html#compiler #if 0 for (TiXmlElement* child_xml = root_xml->FirstChildElement() ; child_xml ; child_xml = child_xml->NextSiblingElement()) { @@ -406,7 +409,7 @@ struct BulletMJCFImporterInternalData isLimited = true; //parse the 'range' field btArray pieces; - btArray sizes; + btArray limits; btAlignedObjectArray strArray; urdfIsAnyOf(" ", strArray); urdfStringSplit(pieces, rangeStr, strArray); @@ -414,17 +417,28 @@ struct BulletMJCFImporterInternalData { if (!pieces[i].empty()) { - sizes.push_back(urdfLexicalCast(pieces[i].c_str())); + limits.push_back(urdfLexicalCast(pieces[i].c_str())); } } - if (sizes.size()==2) + bool success = false; + if (limits.size()==2) { - // TODO angle units are in " - range[0] = sizes[0] * B3_PI / 180; - range[1] = sizes[1] * B3_PI / 180; - } else + if (m_angleUnits=="degree") + { + range[0] = limits[0] * B3_PI / 180; + range[1] = limits[1] * B3_PI / 180; + success = true; + } + else if (m_angleUnits=="radian") + { + range[0] = limits[0]; + range[1] = limits[1]; + success = true; + } + } + if (!success) { - logger->reportWarning("Expected range[2] in joint with limits"); + logger->reportWarning( (sourceFileLocation(link_xml) + ": cannot parse 'range' attribute (units='" + m_angleUnits + "'')").c_str() ); } } diff --git a/examples/SharedMemory/PhysicsServerCommandProcessor.cpp b/examples/SharedMemory/PhysicsServerCommandProcessor.cpp index 614dc8da5..33cc39096 100644 --- a/examples/SharedMemory/PhysicsServerCommandProcessor.cpp +++ b/examples/SharedMemory/PhysicsServerCommandProcessor.cpp @@ -1398,8 +1398,8 @@ bool PhysicsServerCommandProcessor::processImportedObjects(const char* fileName, //todo: move these internal API called inside the 'ConvertURDF2Bullet' call, hidden from the user - int rootLinkIndex = u2b.getRootLinkIndex(); - b3Printf("urdf root link index = %d\n",rootLinkIndex); + //int rootLinkIndex = u2b.getRootLinkIndex(); + //b3Printf("urdf root link index = %d\n",rootLinkIndex); MyMultiBodyCreator creation(m_data->m_guiHelper); u2b.getRootTransformInWorld(rootTrans); diff --git a/examples/SharedMemory/TinyRendererVisualShapeConverter.cpp b/examples/SharedMemory/TinyRendererVisualShapeConverter.cpp index 520ca6710..0ecacd81e 100644 --- a/examples/SharedMemory/TinyRendererVisualShapeConverter.cpp +++ b/examples/SharedMemory/TinyRendererVisualShapeConverter.cpp @@ -414,6 +414,11 @@ void convertURDFToVisualShape(const UrdfShape* visual, const char* urdfPathPrefi break; } // case mesh + case URDF_GEOM_PLANE: + // TODO: plane in tiny renderer + // TODO: export visualShapeOut for external render + break; + default: { b3Warning("TinyRenderer: unknown visual geometry type %i\n", visual->m_geometry.m_type);