file_path
stringlengths
21
224
content
stringlengths
0
80.8M
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/plugins/import/ImportHelpers.h
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #pragma once // clang-format off #include "../UsdPCH.h" // clang-format on #include "../parse/UrdfParser.h" #include "KinematicChain.h" #include "../math/core/maths.h" #include "../UrdfTypes.h" namespace omni { namespace importer { namespace urdf { Quat indexedRotation(int axis, float s, float c); Vec3 Diagonalize(const Matrix33& m, Quat& massFrame); void inertiaToUrdf(const Matrix33& inertia, UrdfInertia& urdfInertia); void urdfToInertia(const UrdfInertia& urdfInertia, Matrix33& inertia); void mergeFixedChildLinks(const KinematicChain::Node& parentNode, UrdfRobot& robot); bool collapseFixedJoints(UrdfRobot& robot); Vec3 urdfAxisToVec(const UrdfAxis& axis); std::string resolveXrefPath(const std::string& assetRoot, const std::string& urdfPath, const std::string& xrefpath); bool IsUsdFile(const std::string& filename); // Make a path name that is not already used. std::string GetNewSdfPathString(pxr::UsdStageWeakPtr stage, std::string path, int nameClashNum = -1); bool addVisualMeshToCollision(UrdfRobot& robot); } } }
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/plugins/import/ImportHelpers.cpp
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include "ImportHelpers.h" #include "../core/PathUtils.h" #include <carb/logging/Log.h> #include <boost/algorithm/string.hpp> namespace omni { namespace importer { namespace urdf { Quat indexedRotation(int axis, float s, float c) { float v[3] = { 0, 0, 0 }; v[axis] = s; return Quat(v[0], v[1], v[2], c); } Vec3 Diagonalize(const Matrix33& m, Quat& massFrame) { const int MAX_ITERS = 24; Quat q = Quat(); Matrix33 d; for (int i = 0; i < MAX_ITERS; i++) { Matrix33 axes; quat2Mat(q, axes); d = Transpose(axes) * m * axes; float d0 = fabs(d(1, 2)), d1 = fabs(d(0, 2)), d2 = fabs(d(0, 1)); // rotation axis index, from largest off-diagonal element int a = int(d0 > d1 && d0 > d2 ? 0 : d1 > d2 ? 1 : 2); int a1 = (a + 1 + (a >> 1)) & 3, a2 = (a1 + 1 + (a1 >> 1)) & 3; if (d(a1, a2) == 0.0f || fabs(d(a1, a1) - d(a2, a2)) > 2e6f * fabs(2.0f * d(a1, a2))) break; // cot(2 * phi), where phi is the rotation angle float w = (d(a1, a1) - d(a2, a2)) / (2.0f * d(a1, a2)); float absw = fabs(w); Quat r; if (absw > 1000) { // h will be very close to 1, so use small angle approx instead r = indexedRotation(a, 1 / (4 * w), 1.f); } else { float t = 1 / (absw + Sqrt(w * w + 1)); // absolute value of tan phi float h = 1 / Sqrt(t * t + 1); // absolute value of cos phi assert(h != 1); // |w|<1000 guarantees this with typical IEEE754 machine eps (approx 6e-8) r = indexedRotation(a, Sqrt((1 - h) / 2) * Sign(w), Sqrt((1 + h) / 2)); } q = Normalize(q * r); } massFrame = q; return Vec3(d.cols[0].x, d.cols[1].y, d.cols[2].z); } void inertiaToUrdf(const Matrix33& inertia, UrdfInertia& urdfInertia) { urdfInertia.ixx = inertia.cols[0].x; urdfInertia.ixy = inertia.cols[0].y; urdfInertia.ixz = inertia.cols[0].z; urdfInertia.iyy = inertia.cols[1].y; urdfInertia.iyz = inertia.cols[1].z; urdfInertia.izz = inertia.cols[2].z; } void urdfToInertia(const UrdfInertia& urdfInertia, Matrix33& inertia) { inertia.cols[0].x = urdfInertia.ixx; inertia.cols[0].y = urdfInertia.ixy; inertia.cols[0].z = urdfInertia.ixz; inertia.cols[1].x = urdfInertia.ixy; inertia.cols[1].y = urdfInertia.iyy; inertia.cols[1].z = urdfInertia.iyz; inertia.cols[2].x = urdfInertia.ixz; inertia.cols[2].y = urdfInertia.iyz; inertia.cols[2].z = urdfInertia.izz; } void mergeFixedChildLinks(const KinematicChain::Node& parentNode, UrdfRobot& robot) { // Child contribution to inertia for (auto& childNode : parentNode.childNodes_) { // Depth first mergeFixedChildLinks(*childNode, robot); if (robot.joints.at(childNode->parentJointName_).type == UrdfJointType::FIXED && !robot.joints.at(childNode->parentJointName_).dontCollapse) { auto& urdfParentLink = robot.links.at(parentNode.linkName_); auto& urdfChildLink = robot.links.at(childNode->linkName_); // The pose of the child with respect to the parent is defined at the joint connecting them Transform poseChildToParent = robot.joints.at(childNode->parentJointName_).origin; //Add a reference to the merged link urdfParentLink.mergedChildren[childNode->linkName_] = poseChildToParent; // At least one of the link masses has to be defined if ((urdfParentLink.inertial.hasMass || urdfChildLink.inertial.hasMass) && (urdfParentLink.inertial.mass > 0.0f || urdfChildLink.inertial.mass > 0.0f)) { // Move inertial parameters to parent Transform parentInertialInParentFrame = urdfParentLink.inertial.origin; Transform childInertialInParentFrame = poseChildToParent * urdfChildLink.inertial.origin; float totMass = urdfParentLink.inertial.mass + urdfChildLink.inertial.mass; Vec3 com = (urdfParentLink.inertial.mass * parentInertialInParentFrame.p + urdfChildLink.inertial.mass * childInertialInParentFrame.p) / totMass; Vec3 deltaParent = parentInertialInParentFrame.p - com; Vec3 deltaChild = childInertialInParentFrame.p - com; Matrix33 rotParentOrigin(parentInertialInParentFrame.q); Matrix33 rotChildOrigin(childInertialInParentFrame.q); Matrix33 parentInertia; Matrix33 childInertia; urdfToInertia(urdfParentLink.inertial.inertia, parentInertia); urdfToInertia(urdfChildLink.inertial.inertia, childInertia); Matrix33 inertiaParent = rotParentOrigin * parentInertia * Transpose(rotParentOrigin) + urdfParentLink.inertial.mass * (LengthSq(deltaParent) * Matrix33::Identity() - Outer(deltaParent, deltaParent)); Matrix33 inertiaChild = rotChildOrigin * childInertia * Transpose(rotChildOrigin) + urdfChildLink.inertial.mass * (LengthSq(deltaChild) * Matrix33::Identity() - Outer(deltaChild, deltaChild)); Matrix33 inertia = Transpose(rotParentOrigin) * (inertiaParent + inertiaChild) * rotParentOrigin; urdfParentLink.inertial.origin.p.x = com.x; urdfParentLink.inertial.origin.p.y = com.y; urdfParentLink.inertial.origin.p.z = com.z; urdfParentLink.inertial.mass = totMass; inertiaToUrdf(inertia, urdfParentLink.inertial.inertia); urdfParentLink.inertial.hasMass = true; urdfParentLink.inertial.hasInertia = true; urdfParentLink.inertial.hasOrigin = true; } // Move collisions to parent for (auto& collision : urdfChildLink.collisions) { collision.origin = poseChildToParent * collision.origin; urdfParentLink.collisions.push_back(collision); } urdfChildLink.collisions.clear(); // Move visuals to parent for (auto& visual : urdfChildLink.visuals) { visual.origin = poseChildToParent * visual.origin; urdfParentLink.visuals.push_back(visual); } urdfChildLink.visuals.clear(); for (auto& joint : robot.joints) { if (joint.second.parentLinkName == childNode->linkName_) { joint.second.parentLinkName = parentNode.linkName_; joint.second.origin = poseChildToParent * joint.second.origin; } } // Remove this link and parent joint // if (!urdfChildLink.softs.size()) // { robot.links.erase(childNode->linkName_); robot.joints.erase(childNode->parentJointName_); // } } } } bool collapseFixedJoints(UrdfRobot& robot) { KinematicChain chain; if (!chain.computeKinematicChain(robot)) { return false; } auto& parentNode = chain.baseNode; if (!parentNode->childNodes_.empty()) { mergeFixedChildLinks(*parentNode, robot); } return true; } Vec3 urdfAxisToVec(const UrdfAxis& axis) { return { axis.x, axis.y, axis.z }; } std::string resolveXrefPath(const std::string& assetRoot, const std::string& urdfPath, const std::string& xrefpath) { // Remove the package prefix if it exists std::string xrefPath = xrefpath; if (xrefPath.find("omniverse://") != std::string::npos) { CARB_LOG_INFO("Path is on nucleus server, will assume that it is fully resolved already"); return xrefPath; } // removal of any prefix ending with "://" std::size_t p = xrefPath.find("://"); if (p != std::string::npos) { xrefPath = xrefPath.substr(p + 3); // +3 to remove "://" } if (isAbsolutePath(xrefPath.c_str())) { if (testPath(xrefPath.c_str()) == PathType::eFile) { return xrefPath; } else { // xref not found return std::string(); } } std::string rootPath; if (isAbsolutePath(urdfPath.c_str())) { rootPath = urdfPath; } else { rootPath = pathJoin(assetRoot, urdfPath); } auto s = rootPath.find_last_of("/\\"); while (s != std::string::npos && s > 0) { auto basePath = rootPath.substr(0, s + 1); auto path = pathJoin(basePath, xrefPath); CARB_LOG_INFO("trying '%s' (%d)\n", path.c_str(), int(testPath(path.c_str()))); if (testPath(path.c_str()) == PathType::eFile) { return path; } // if (strncmp(basePath.c_str(), assetRoot.c_str(), s) == 0) // { // // don't search upwards of assetRoot // break; // } s = rootPath.find_last_of("/\\", s - 1); } // hmmm, should we accept pure relative paths? if (testPath(xrefPath.c_str()) == PathType::eFile) { return xrefPath; } // Check if ROS_PACKAGE_PATH is defined and if so go through all searching for the package char* exists = getenv("ROS_PACKAGE_PATH"); if (exists != NULL) { std::string rosPackagePath = std::string(exists); if (rosPackagePath.size()) { std::vector<std::string> results; boost::split(results, rosPackagePath, [](char c) { return c == ':'; }); for (size_t i = 0; i < results.size(); i++) { std::string path = results[i]; if (path.size() > 0) { auto packagePath = pathJoin(path, xrefPath); CARB_LOG_INFO("Testing ROS Package path '%s' (%d)\n", packagePath.c_str(), int(testPath(packagePath.c_str()))); if (testPath(packagePath.c_str()) == PathType::eFile) { return packagePath; } } } } } else { CARB_LOG_WARN("ROS_PACKAGE_PATH not defined, will skip checking ROS packages"); } CARB_LOG_WARN("Path: %s not found", xrefpath.c_str()); // if we got here, we failed to resolve the path return std::string(); } bool IsUsdFile(const std::string& filename) { std::vector<std::string> types = { ".usd", ".usda" }; for (auto& t : types) { if (t.size() > filename.size()) continue; if (std::equal(t.rbegin(), t.rend(), filename.rbegin())) { return true; } } return false; } // Make a path name that is not already used. std::string GetNewSdfPathString(pxr::UsdStageWeakPtr stage, std::string path, int nameClashNum) { bool appendedNumber = false; int numberAppended = std::max<int>(nameClashNum, 0); size_t indexOfNumber = 0; if (stage->GetPrimAtPath(pxr::SdfPath(path))) { appendedNumber = true; std::string name = pxr::SdfPath(path).GetName(); size_t last_ = name.find_last_of('_'); indexOfNumber = path.length() + 1; if (last_ == std::string::npos) { // no '_' found, so just tack on the end. path += "_" + std::to_string(numberAppended); } else { // There was a _, if the last part of that is a number // then replace that number with one higher or nameClashNum, // or just tack on the number if it is last character. if (last_ == name.length() - 1) { path += "_" + std::to_string(numberAppended); } else { char* p; std::string after_ = name.substr(last_ + 1, name.length()); long converted = strtol(after_.c_str(), &p, 10); if (*p) { // not a number path += "_" + std::to_string(numberAppended); } else { numberAppended = nameClashNum == -1 ? converted + 1 : nameClashNum; indexOfNumber = path.length() - name.length() + last_ + 1; path = path.substr(0, indexOfNumber); path += std::to_string(numberAppended); } } } } if (appendedNumber) { // we just added a number, so we have to make sure the new path is unique. while (stage->GetPrimAtPath(pxr::SdfPath(path))) { path = path.substr(0, indexOfNumber); numberAppended += 1; path += std::to_string(numberAppended); } } #if 0 else { while (stage->GetPrimAtPath(pxr::SdfPath(path))) path += ":" + std::to_string(nameClashNum); } #endif return path; } bool addVisualMeshToCollision(UrdfRobot& robot) { for (auto& link : robot.links) { if (!link.second.visuals.empty() && link.second.collisions.empty()) { for (auto& visual : link.second.visuals) { UrdfCollision collision{ visual.name, visual.origin, visual.geometry }; link.second.collisions.push_back(collision); } } } return true; } } } }
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/plugins/import/MeshImporter.cpp
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include "MeshImporter.h" #include <carb/logging/Log.h> #include "../core/PathUtils.h" #include "ImportHelpers.h" #include "assimp/Importer.hpp" #include "assimp/postprocess.h" #if __has_include(<filesystem>) #include <filesystem> #elif __has_include(<experimental/filesystem>) #include <experimental/filesystem> #else error "Missing the <filesystem> header." #endif #include "../utils/Path.h" #include <OmniClient.h> #include <cmath> #include <set> #include <stack> #include <unordered_set> namespace omni { namespace importer { namespace urdf { using namespace omni::importer::utils::path; const static size_t INVALID_MATERIAL_INDEX = SIZE_MAX; struct ImportTransform { pxr::GfMatrix4d matrix; pxr::GfVec3f translation; pxr::GfVec3f eulerAngles; // XYZ order pxr::GfVec3f scale; }; struct MeshGeomSubset { pxr::VtArray<int> faceIndices; size_t materialIndex = INVALID_MATERIAL_INDEX; }; struct Mesh { std::string name; pxr::VtArray<pxr::GfVec3f> points; pxr::VtArray<int> faceVertexCounts; pxr::VtArray<int> faceVertexIndices; pxr::VtArray<pxr::GfVec3f> normals; // Face varing normals pxr::VtArray<pxr::VtArray<pxr::GfVec2f>> uvs; // Face varing uvs pxr::VtArray<pxr::VtArray<pxr::GfVec3f>> colors; // Face varing colors std::vector<MeshGeomSubset> meshSubsets; }; // static pxr::GfMatrix4d AiMatrixToGfMatrix(const aiMatrix4x4& matrix) // { // return pxr::GfMatrix4d(matrix.a1, matrix.b1, matrix.c1, matrix.d1, matrix.a2, matrix.b2, matrix.c2, matrix.d2, // matrix.a3, matrix.b3, matrix.c3, matrix.d3, matrix.a4, matrix.b4, matrix.c4, matrix.d4); // } static pxr::GfVec3f AiVector3dToGfVector3f(const aiVector3D& vector) { return pxr::GfVec3f(vector.x, vector.y, vector.z); } static pxr::GfVec2f AiVector3dToGfVector2f(const aiVector3D& vector) { return pxr::GfVec2f(vector.x, vector.y); } // static pxr::GfVec3h AiVector3dToGfVector3h(const aiVector3D& vector) // { // return pxr::GfVec3h(vector.x, vector.y, vector.z); // } // static pxr::GfQuatf AiQuatToGfVector(const aiQuaternion& quat) // { // return pxr::GfQuatf(quat.w, quat.x, quat.y, quat.z); // } // static pxr::GfQuath AiQuatToGfVectorh(const aiQuaternion& quat) // { // return pxr::GfQuath(quat.w, quat.x, quat.y, quat.z); // } // static pxr::GfVec3f AiColor3DToGfVector3f(const aiColor3D& color) // { // return pxr::GfVec3f(color.r, color.g, color.b); // } // static ImportTransform AiMatrixToTransform(const aiMatrix4x4& matrix) // { // ImportTransform transform; // transform.matrix = // pxr::GfMatrix4d(matrix.a1, matrix.b1, matrix.c1, matrix.d1, matrix.a2, matrix.b2, matrix.c2, matrix.d2, // matrix.a3, matrix.b3, matrix.c3, matrix.d3, matrix.a4, matrix.b4, matrix.c4, matrix.d4); // aiVector3D translation, rotation, scale; // matrix.Decompose(scale, rotation, translation); // transform.translation = AiVector3dToGfVector3f(translation); // transform.eulerAngles = AiVector3dToGfVector3f( // aiVector3D(AI_RAD_TO_DEG(rotation.x), AI_RAD_TO_DEG(rotation.y), AI_RAD_TO_DEG(rotation.z))); // transform.scale = AiVector3dToGfVector3f(scale); // return transform; // } pxr::GfVec3f AiColor4DToGfVector3f(const aiColor4D& color) { return pxr::GfVec3f(color.r, color.g, color.b); } struct MeshMaterial { std::string name; std::string texturePaths[5]; bool has_diffuse; aiColor3D diffuse; bool has_emissive; aiColor3D emissive; bool has_metallic; float metallic{ 0 }; bool has_specular; float specular{ 0 }; aiTextureType textures[5] = { aiTextureType_DIFFUSE, aiTextureType_HEIGHT, aiTextureType_REFLECTION, aiTextureType_EMISSIVE, aiTextureType_SHININESS }; const char* props[5] = { "diffuse_texture", "normalmap_texture", "metallic_texture", "emissive_mask_texture", "reflectionroughness_texture", }; MeshMaterial(aiMaterial* m) { name = std::string(m->GetName().C_Str()); std::array<aiTextureMapMode, 2> modes; aiString path; for (int i = 0; i < 5; i++) { if (m->GetTexture(textures[i], 0, &path, nullptr, nullptr, nullptr, nullptr, modes.data()) == aiReturn_SUCCESS) { texturePaths[i] = std::string(path.C_Str()); } } has_diffuse = (m->Get(AI_MATKEY_COLOR_DIFFUSE, diffuse) == aiReturn_SUCCESS); has_metallic = (m->Get(AI_MATKEY_METALLIC_FACTOR, metallic) == aiReturn_SUCCESS); has_specular = (m->Get(AI_MATKEY_SPECULAR_FACTOR, specular) == aiReturn_SUCCESS); has_emissive = (m->Get(AI_MATKEY_COLOR_EMISSIVE, emissive) == aiReturn_SUCCESS); } std::string get_hash() { std::ostringstream ss; ss << name; for (int i = 0; i < 5; i++) { if (texturePaths[i] != "") { ss << std::string(props[i]) + texturePaths[i]; } } ss << std::string("D") << diffuse.r << diffuse.g << diffuse.b; ss << std::string("M") << metallic; ss << std::string("S") << specular; ss << std::string("E") << emissive.r << emissive.g << emissive.g; return ss.str(); } }; std::string ReplaceBackwardSlash(std::string in) { for (auto& c : in) { if (c == '\\') { c = '/'; } } return in; } static aiMatrix4x4 GetLocalTransform(const aiNode* node) { aiMatrix4x4 transform = node->mTransformation; auto parent = node->mParent; while (parent) { std::string name = parent->mName.data; // only take scale from root transform, if the parent has a parent then its not a root node if (parent->mParent) { // parent has a parent, not a root note, use full transform transform = parent->mTransformation * transform; parent = parent->mParent; } else { // this is a root node, only take scale aiVector3D pos, scale; aiQuaternion rot; parent->mTransformation.Decompose(scale, rot, pos); aiMatrix4x4 scale_mat; transform = aiMatrix4x4::Scaling(scale, scale_mat) * transform; break; } } return transform; } std::string copyTexture(std::string usdStageIdentifier, std::string texturePath) { // switch any windows-style path into linux backwards slash (omniclient handles windows paths) usdStageIdentifier = ReplaceBackwardSlash(usdStageIdentifier); texturePath = ReplaceBackwardSlash(texturePath); // Assumes the folder structure has already been created. int path_idx = (int)usdStageIdentifier.rfind('/'); std::string parent_folder = usdStageIdentifier.substr(0, path_idx); int basename_idx = (int)texturePath.rfind('/'); std::string textureName = texturePath.substr(basename_idx + 1); std::string out = (parent_folder + "/materials/" + textureName); omniClientWait(omniClientCopy(texturePath.c_str(), out.c_str(), {}, {})); return out; } pxr::SdfPath SimpleImport(pxr::UsdStageRefPtr usdStage, std::string path, const aiScene* mScene, const std::string meshPath, std::map<pxr::TfToken, std::string>& materialsList, const bool loadMaterials, const bool flipVisuals, const char* subdivisionScheme, const bool instanceable) { std::vector<Mesh> mMeshPrims; std::vector<aiNode*> nodesToProcess; std::vector<std::pair<int, aiMatrix4x4>> meshTransforms; // Traverse tree and get all of the meshes and the full transform for that node nodesToProcess.push_back(mScene->mRootNode); std::string mesh_path = ReplaceBackwardSlash(meshPath); int basename_idx = (int)mesh_path.rfind('/'); std::string base_path = mesh_path.substr(0, basename_idx); while (nodesToProcess.size() > 0) { // remove the node aiNode* node = nodesToProcess.back(); if (!node) { // printf("INVALID NODE\n"); continue; } nodesToProcess.pop_back(); aiMatrix4x4 transform = GetLocalTransform(node); for (size_t i = 0; i < node->mNumMeshes; i++) { // if (flipVisuals) // { // aiMatrix4x4 flip; // flip[0][0] = 1.0; // flip[2][1] = 1.0; // flip[1][2] = -1.0; // flip[3][3] = 1.0f; // transform = transform * flip; // } meshTransforms.push_back(std::pair<int, aiMatrix4x4>(node->mMeshes[i], transform)); } // process any meshes in this node: for (size_t i = 0; i < node->mNumChildren; i++) { nodesToProcess.push_back(node->mChildren[i]); } } // printf("%s TOTAL MESHES: %d\n", path.c_str(), meshTransforms.size()); mMeshPrims.resize(meshTransforms.size()); // for (size_t i = 0; i < mScene->mNumMaterials; i++) // { // auto material = mScene->mMaterials[i]; // // printf("AA %d %s \n", i, material->GetName().C_Str()); // } for (size_t i = 0; i < meshTransforms.size(); i++) { auto transformedMesh = meshTransforms[i]; auto assimpMesh = mScene->mMeshes[transformedMesh.first]; // printf("material index: %d \n", assimpMesh->mMaterialIndex); // Gather all mesh points information to sort std::vector<Mesh> meshImported; for (size_t j = 0; j < assimpMesh->mNumVertices; j++) { auto vertex = assimpMesh->mVertices[j]; vertex *= transformedMesh.second; mMeshPrims[i].points.push_back(AiVector3dToGfVector3f(vertex)); } for (size_t j = 0; j < assimpMesh->mNumFaces; j++) { const aiFace& face = assimpMesh->mFaces[j]; if (face.mNumIndices >= 3) { for (size_t k = 0; k < face.mNumIndices; k++) { mMeshPrims[i].faceVertexIndices.push_back(face.mIndices[k]); } } } mMeshPrims[i].uvs.resize(assimpMesh->GetNumUVChannels()); mMeshPrims[i].colors.resize(assimpMesh->GetNumColorChannels()); for (size_t j = 0; j < assimpMesh->mNumFaces; j++) { const aiFace& face = assimpMesh->mFaces[j]; if (face.mNumIndices >= 3) { for (size_t k = 0; k < face.mNumIndices; k++) { if (assimpMesh->mNormals) { mMeshPrims[i].normals.push_back(AiVector3dToGfVector3f(assimpMesh->mNormals[face.mIndices[k]])); } for (size_t m = 0; m < mMeshPrims[i].uvs.size(); m++) { mMeshPrims[i].uvs[m].push_back( AiVector3dToGfVector2f(assimpMesh->mTextureCoords[m][face.mIndices[k]])); } for (size_t m = 0; m < mMeshPrims[i].colors.size(); m++) { mMeshPrims[i].colors[m].push_back(AiColor4DToGfVector3f(assimpMesh->mColors[m][face.mIndices[k]])); } } mMeshPrims[i].faceVertexCounts.push_back(face.mNumIndices); } } } auto usdMesh = pxr::UsdGeomMesh::Define(usdStage, pxr::SdfPath(omni::importer::urdf::GetNewSdfPathString(usdStage, path))); pxr::VtArray<pxr::GfVec3f> allPoints; pxr::VtArray<int> allFaceVertexCounts; pxr::VtArray<int> allFaceVertexIndices; pxr::VtArray<pxr::GfVec3f> allNormals; pxr::VtArray<pxr::VtArray<pxr::GfVec2f>> uvs; pxr::VtArray<pxr::VtArray<pxr::GfVec3f>> allColors; size_t indexOffset = 0; size_t vertexOffset = 0; std::map<int, pxr::VtArray<int>> materialMap; for (size_t m = 0; m < meshTransforms.size(); m++) { auto transformedMesh = meshTransforms[m]; auto mesh = mScene->mMeshes[transformedMesh.first]; auto& meshPrim = mMeshPrims[m]; for (size_t k = 0; k < meshPrim.uvs.size(); k++) { uvs.push_back(meshPrim.uvs[k]); } for (size_t i = 0; i < meshPrim.points.size(); i++) { allPoints.push_back(meshPrim.points[i]); } for (size_t i = 0; i < meshPrim.faceVertexCounts.size(); i++) { allFaceVertexCounts.push_back(meshPrim.faceVertexCounts[i]); } for (size_t i = 0; i < meshPrim.faceVertexIndices.size(); i++) { allFaceVertexIndices.push_back(static_cast<int>(meshPrim.faceVertexIndices[i] + indexOffset)); } for (size_t i = vertexOffset; i < vertexOffset + meshPrim.faceVertexCounts.size(); i++) { materialMap[mesh->mMaterialIndex].push_back(static_cast<int>(i)); } // printf("faceVertexOffset %d %d %d %d\n", indexOffset, points.size(), vertexOffset, faceVertexCounts.size()); indexOffset = indexOffset + meshPrim.points.size(); vertexOffset = vertexOffset + meshPrim.faceVertexCounts.size(); for (size_t i = 0; i < meshPrim.normals.size(); i++) { allNormals.push_back(meshPrim.normals[i]); } } usdMesh.CreatePointsAttr(pxr::VtValue(allPoints)); usdMesh.CreateFaceVertexCountsAttr(pxr::VtValue(allFaceVertexCounts)); usdMesh.CreateFaceVertexIndicesAttr(pxr::VtValue(allFaceVertexIndices)); pxr::VtArray<pxr::GfVec3f> Extent; pxr::UsdGeomPointBased::ComputeExtent(allPoints, &Extent); usdMesh.CreateExtentAttr().Set(Extent); // Normals if (!allNormals.empty()) { usdMesh.CreateNormalsAttr(pxr::VtValue(allNormals)); usdMesh.SetNormalsInterpolation(pxr::UsdGeomTokens->faceVarying); } // Texture UV for (size_t j = 0; j < uvs.size(); j++) { pxr::TfToken stName; if (j == 0) { stName = pxr::TfToken("st"); } else { stName = pxr::TfToken("st_" + std::to_string(j)); } pxr::UsdGeomPrimvarsAPI primvarsAPI(usdMesh); pxr::UsdGeomPrimvar Primvar = primvarsAPI.CreatePrimvar(stName, pxr::SdfValueTypeNames->TexCoord2fArray, pxr::UsdGeomTokens->faceVarying); Primvar.Set(uvs[j]); } usdMesh.CreateSubdivisionSchemeAttr(pxr::VtValue(pxr::TfToken(subdivisionScheme))); if (loadMaterials) { std::string prefix_path; if (instanceable) { prefix_path = pxr::SdfPath(path).GetParentPath().GetString(); // body category root } else { prefix_path = pxr::SdfPath(path).GetParentPath().GetParentPath().GetString(); // Robot root } // For each material, store the face indices and create GeomSubsets usdStage->DefinePrim(pxr::SdfPath(prefix_path + "/Looks"), pxr::TfToken("Scope")); for (auto const& mat : materialMap) { MeshMaterial material(mScene->mMaterials[mat.first]); // printf("materials: %s\n", name.c_str()); pxr::TfToken mat_token(material.get_hash()); // if (std::find(materialsList.begin(), materialsList.end(),mat_token) == materialsList.end()) if (materialsList.find(mat_token) == materialsList.end()) { pxr::UsdPrim prim; pxr::UsdShadeMaterial matPrim; std::string mat_path(prefix_path + "/Looks/" + makeValidUSDIdentifier("material_" + material.name)); prim = usdStage->GetPrimAtPath(pxr::SdfPath(mat_path)); int counter = 0; while (prim) { mat_path = std::string( prefix_path + "/Looks/" + makeValidUSDIdentifier("material_" + material.name + "_" + std::to_string(++counter))); printf("%s \n", mat_path.c_str()); prim = usdStage->GetPrimAtPath(pxr::SdfPath(mat_path)); } materialsList[mat_token] = mat_path; matPrim = pxr::UsdShadeMaterial::Define(usdStage, pxr::SdfPath(mat_path)); pxr::UsdShadeShader pbrShader = pxr::UsdShadeShader::Define(usdStage, pxr::SdfPath(mat_path + "/Shader")); pbrShader.CreateIdAttr(pxr::VtValue(pxr::UsdImagingTokens->UsdPreviewSurface)); auto shader_out = pbrShader.CreateOutput(pxr::TfToken("out"), pxr::SdfValueTypeNames->Token); matPrim.CreateSurfaceOutput(pxr::TfToken("mdl")).ConnectToSource(shader_out); matPrim.CreateVolumeOutput(pxr::TfToken("mdl")).ConnectToSource(shader_out); matPrim.CreateDisplacementOutput(pxr::TfToken("mdl")).ConnectToSource(shader_out); pbrShader.GetImplementationSourceAttr().Set(pxr::UsdShadeTokens->sourceAsset); pbrShader.SetSourceAsset(pxr::SdfAssetPath("OmniPBR.mdl"), pxr::TfToken("mdl")); pbrShader.SetSourceAssetSubIdentifier(pxr::TfToken("OmniPBR"), pxr::TfToken("mdl")); bool has_emissive_map = false; for (int i = 0; i < 5; i++) { if (material.texturePaths[i] != "") { if (!usdStage->GetRootLayer()->IsAnonymous()) { auto texture_path = copyTexture(usdStage->GetRootLayer()->GetIdentifier(), resolve_absolute(base_path, material.texturePaths[i])); int basename_idx = (int)texture_path.rfind('/'); std::string filename = texture_path.substr(basename_idx + 1); std::string texture_relative_path = "materials/" + filename; pbrShader.CreateInput(pxr::TfToken(material.props[i]), pxr::SdfValueTypeNames->Asset) .Set(pxr::SdfAssetPath(texture_relative_path)); if (material.textures[i] == aiTextureType_EMISSIVE) { pbrShader.CreateInput(pxr::TfToken("emissive_color"), pxr::SdfValueTypeNames->Color3f) .Set(pxr::GfVec3f(1.0f, 1.0f, 1.0f)); pbrShader.CreateInput(pxr::TfToken("enable_emission"), pxr::SdfValueTypeNames->Bool) .Set(true); pbrShader.CreateInput(pxr::TfToken("emissive_intensity"), pxr::SdfValueTypeNames->Float) .Set(10000.0f); has_emissive_map = true; } } else { CARB_LOG_WARN( "Material %s has an image texture, but it won't be imported since the asset is being loaded on memory. Please import it into a destination folder to get all textures.", material.name.c_str()); } } } if (material.has_diffuse) { pbrShader.CreateInput(pxr::TfToken("diffuse_color_constant"), pxr::SdfValueTypeNames->Color3f) .Set(pxr::GfVec3f(material.diffuse.r, material.diffuse.g, material.diffuse.b)); } if (material.has_metallic) { pbrShader.CreateInput(pxr::TfToken("metallic_constant"), pxr::SdfValueTypeNames->Float) .Set(material.metallic); } if (material.has_specular) { pbrShader.CreateInput(pxr::TfToken("specular_level"), pxr::SdfValueTypeNames->Float) .Set(material.specular); } if (!has_emissive_map && material.has_emissive) { pbrShader.CreateInput(pxr::TfToken("emissive_color"), pxr::SdfValueTypeNames->Color3f) .Set(pxr::GfVec3f(material.emissive.r, material.emissive.g, material.emissive.b)); } // auto output = matPrim.CreateSurfaceOutput(); // output.ConnectToSource(pbrShader, pxr::TfToken("surface")); } pxr::UsdShadeMaterial matPrim = pxr::UsdShadeMaterial(usdStage->GetPrimAtPath(pxr::SdfPath(materialsList[mat_token]))); if (materialMap.size() > 1) { auto geomSubset = pxr::UsdGeomSubset::Define( usdStage, pxr::SdfPath(usdMesh.GetPath().GetString() + "/material_" + std::to_string(mat.first))); geomSubset.CreateElementTypeAttr(pxr::VtValue(pxr::TfToken("face"))); geomSubset.CreateFamilyNameAttr(pxr::VtValue(pxr::TfToken("materialBind"))); geomSubset.CreateIndicesAttr(pxr::VtValue(mat.second)); if (matPrim) { pxr::UsdShadeMaterialBindingAPI mbi(geomSubset); mbi.Bind(matPrim); } } else { if (matPrim) { pxr::UsdShadeMaterialBindingAPI mbi(usdMesh); mbi.Bind(matPrim); } } } } return usdMesh.GetPath(); } } } }
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/plugins/import/UrdfImporter.cpp
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include "UrdfImporter.h" #include "../core/PathUtils.h" #include "UrdfImporter.h" // #include "../../GymJoint.h" // #include "../../helpers.h" #include "assimp/Importer.hpp" #include "assimp/cfileio.h" #include "assimp/cimport.h" #include "assimp/postprocess.h" #include "assimp/scene.h" #include "ImportHelpers.h" #include <carb/logging/Log.h> #include <physicsSchemaTools/UsdTools.h> #include <physxSchema/jointStateAPI.h> #include <physxSchema/physxArticulationAPI.h> #include <physxSchema/physxCollisionAPI.h> #include <physxSchema/physxJointAPI.h> #include <physxSchema/physxTendonAxisRootAPI.h> #include <physxSchema/physxTendonAxisAPI.h> #include <physxSchema/physxSceneAPI.h> #include <pxr/usd/usdPhysics/articulationRootAPI.h> #include <pxr/usd/usdPhysics/collisionAPI.h> #include <pxr/usd/usdPhysics/driveAPI.h> #include <pxr/usd/usdPhysics/fixedJoint.h> #include <pxr/usd/usdPhysics/joint.h> #include <pxr/usd/usdPhysics/limitAPI.h> #include <pxr/usd/usdPhysics/massAPI.h> #include <pxr/usd/usdPhysics/meshCollisionAPI.h> #include <pxr/usd/usdPhysics/prismaticJoint.h> #include <pxr/usd/usdPhysics/revoluteJoint.h> #include <pxr/usd/usdPhysics/rigidBodyAPI.h> #include <pxr/usd/usdPhysics/scene.h> #include <pxr/usd/usdPhysics/sphericalJoint.h> namespace omni { namespace importer { namespace urdf { UrdfRobot UrdfImporter::createAsset() { UrdfRobot robot; if (!parseUrdf(assetRoot_, urdfPath_, robot)) { CARB_LOG_ERROR("Failed to parse URDF file '%s'", urdfPath_.c_str()); return robot; } if (config.mergeFixedJoints) { collapseFixedJoints(robot); } if (config.collisionFromVisuals) { addVisualMeshToCollision(robot); } return robot; } const char* subdivisionschemes[4] = { "catmullClark", "loop", "bilinear", "none" }; pxr::UsdPrim addMesh(pxr::UsdStageWeakPtr stage, UrdfGeometry geometry, std::string assetRoot, std::string urdfPath, std::string name, Transform origin, const bool loadMaterials, const double distanceScale, const bool flipVisuals, std::map<pxr::TfToken, std::string>& materialsList, const char* subdivisionScheme, const bool instanceable = false, const bool replaceCylindersWithCapsules = false) { pxr::SdfPath path; if (geometry.type == UrdfGeometryType::MESH) { std::string meshUri = geometry.meshFilePath; std::string meshPath = resolveXrefPath(assetRoot, urdfPath, meshUri); // pxr::GfMatrix4d meshMat; if (meshPath.empty()) { CARB_LOG_WARN("Failed to resolve mesh '%s'", meshUri.c_str()); return pxr::UsdPrim(); // move to next shape } // mesh is a usd file, add as a reference directly to a new xform else if (IsUsdFile(meshPath)) { CARB_LOG_INFO("Adding Usd reference '%s'", meshPath.c_str()); path = pxr::SdfPath(omni::importer::urdf::GetNewSdfPathString(stage, name)); pxr::UsdGeomXform usdXform = pxr::UsdGeomXform::Define(stage, path); usdXform.GetPrim().GetReferences().AddReference(meshPath); } else { CARB_LOG_INFO("Found Mesh At: %s", meshPath.c_str()); auto assimpScene = aiImportFile(meshPath.c_str(), aiProcess_GenSmoothNormals | aiProcess_OptimizeMeshes | aiProcess_RemoveRedundantMaterials | aiProcess_GlobalScale); static auto sceneDeleter = [](const aiScene* scene) { if (scene) { aiReleaseImport(scene); } }; auto sceneRAII = std::shared_ptr<const aiScene>(assimpScene, sceneDeleter); // Add visuals if (!sceneRAII || !sceneRAII->mRootNode) { CARB_LOG_WARN("Asset convert failed as asset file is broken."); } else if (sceneRAII->mRootNode->mNumChildren == 0) { CARB_LOG_WARN("Asset convert failed as asset cannot be loaded."); } else { path = SimpleImport(stage, name, sceneRAII.get(), meshPath, materialsList, loadMaterials, flipVisuals, subdivisionScheme, instanceable); } } } else if (geometry.type == UrdfGeometryType::SPHERE) { pxr::UsdGeomSphere gprim = pxr::UsdGeomSphere::Define(stage, pxr::SdfPath(name)); pxr::VtVec3fArray extentArray(2); gprim.ComputeExtent(geometry.radius, &extentArray); gprim.GetExtentAttr().Set(extentArray); gprim.GetRadiusAttr().Set(double(geometry.radius)); path = pxr::SdfPath(name); } else if (geometry.type == UrdfGeometryType::BOX) { pxr::UsdGeomCube gprim = pxr::UsdGeomCube::Define(stage, pxr::SdfPath(name)); pxr::VtVec3fArray extentArray(2); extentArray[1] = pxr::GfVec3f(geometry.size_x * 0.5f, geometry.size_y * 0.5f, geometry.size_z * 0.5f); extentArray[0] = -extentArray[1]; gprim.GetExtentAttr().Set(extentArray); gprim.GetSizeAttr().Set(1.0); path = pxr::SdfPath(name); } else if (geometry.type == UrdfGeometryType::CYLINDER && !replaceCylindersWithCapsules) { pxr::UsdGeomCylinder gprim = pxr::UsdGeomCylinder::Define(stage, pxr::SdfPath(name)); pxr::VtVec3fArray extentArray(2); gprim.ComputeExtent(geometry.length, geometry.radius, pxr::UsdGeomTokens->x, &extentArray); gprim.GetAxisAttr().Set(pxr::UsdGeomTokens->z); gprim.GetExtentAttr().Set(extentArray); gprim.GetHeightAttr().Set(double(geometry.length)); gprim.GetRadiusAttr().Set(double(geometry.radius)); path = pxr::SdfPath(name); } else if (geometry.type == UrdfGeometryType::CAPSULE || (geometry.type == UrdfGeometryType::CYLINDER && replaceCylindersWithCapsules)) { pxr::UsdGeomCapsule gprim = pxr::UsdGeomCapsule::Define(stage, pxr::SdfPath(name)); pxr::VtVec3fArray extentArray(2); gprim.ComputeExtent(geometry.length, geometry.radius, pxr::UsdGeomTokens->x, &extentArray); gprim.GetAxisAttr().Set(pxr::UsdGeomTokens->z); gprim.GetExtentAttr().Set(extentArray); gprim.GetHeightAttr().Set(double(geometry.length)); gprim.GetRadiusAttr().Set(double(geometry.radius)); path = pxr::SdfPath(name); } pxr::UsdPrim prim = stage->GetPrimAtPath(path); if (prim) { Transform transform = origin; pxr::GfVec3d scale; if (geometry.type == UrdfGeometryType::MESH) { scale = pxr::GfVec3d(geometry.scale_x, geometry.scale_y, geometry.scale_z); } else if (geometry.type == UrdfGeometryType::BOX) { scale = pxr::GfVec3d(geometry.size_x, geometry.size_y, geometry.size_z); } else { scale = pxr::GfVec3d(1, 1, 1); } pxr::UsdGeomXformable gprim = pxr::UsdGeomXformable(prim); gprim.ClearXformOpOrder(); gprim.AddTranslateOp(pxr::UsdGeomXformOp::PrecisionDouble) .Set(distanceScale * pxr::GfVec3d(transform.p.x, transform.p.y, transform.p.z)); gprim.AddOrientOp(pxr::UsdGeomXformOp::PrecisionDouble) .Set(pxr::GfQuatd(transform.q.w, transform.q.x, transform.q.y, transform.q.z)); gprim.AddScaleOp(pxr::UsdGeomXformOp::PrecisionDouble).Set(distanceScale * scale); } return prim; } void UrdfImporter::buildInstanceableStage(pxr::UsdStageRefPtr stage, const KinematicChain::Node* parentNode, const std::string& robotBasePath, const UrdfRobot& urdfRobot) { if (parentNode->parentJointName_ == "") { const UrdfLink& urdfLink = urdfRobot.links.at(parentNode->linkName_); addInstanceableMeshes(stage, urdfLink, robotBasePath, urdfRobot); } if (!parentNode->childNodes_.empty()) { for (const auto& childNode : parentNode->childNodes_) { if (urdfRobot.joints.find(childNode->parentJointName_) != urdfRobot.joints.end()) { if (urdfRobot.links.find(childNode->linkName_) != urdfRobot.links.end()) { const UrdfLink& childLink = urdfRobot.links.at(childNode->linkName_); addInstanceableMeshes(stage, childLink, robotBasePath, urdfRobot); // Recurse through the links children buildInstanceableStage(stage, childNode.get(), robotBasePath, urdfRobot); } } } } } void UrdfImporter::addInstanceableMeshes(pxr::UsdStageRefPtr stage, const UrdfLink& link, const std::string& robotBasePath, const UrdfRobot& robot) { std::map<std::string, std::string> linkMatPrimPaths; std::map<pxr::TfToken, std::string> linkMaterialList; // Add visuals for (size_t i = 0; i < link.visuals.size(); i++) { std::string meshName; std::string name = "mesh_" + std::to_string(i); if (link.visuals[i].name.size() > 0) { name = link.visuals[i].name; } meshName = robotBasePath + link.name + "/visuals/" + name; bool loadMaterial = true; auto mat = link.visuals[i].material; auto urdfMatIter = robot.materials.find(link.visuals[i].material.name); if (urdfMatIter != robot.materials.end()) { mat = urdfMatIter->second; } auto& color = mat.color; if (color.r >= 0 && color.g >= 0 && color.b >= 0) { loadMaterial = false; } pxr::UsdPrim prim = addMesh(stage, link.visuals[i].geometry, assetRoot_, urdfPath_, meshName, link.visuals[i].origin, loadMaterial, config.distanceScale, false, linkMaterialList, subdivisionschemes[(int)config.subdivisionScheme], true); if (prim) { if (loadMaterial == false) { // This Material was already created for this link, reuse auto urdfMatIter = linkMatPrimPaths.find(link.visuals[i].material.name); if (urdfMatIter != linkMatPrimPaths.end()) { std::string path = linkMatPrimPaths[link.visuals[i].material.name]; auto matPrim = stage->GetPrimAtPath(pxr::SdfPath(path)); if (matPrim) { auto shadePrim = pxr::UsdShadeMaterial(matPrim); if (shadePrim) { pxr::UsdShadeMaterialBindingAPI mbi(prim); mbi.Bind(shadePrim); } } } else { auto& color = link.visuals[i].material.color; std::stringstream ss; ss << std::uppercase << std::hex << (int)(256 * color.r) << std::uppercase << std::hex << (int)(256 * color.g) << std::uppercase << std::hex << (int)(256 * color.b); std::pair<std::string, UrdfMaterial> mat_pair(ss.str(), link.visuals[i].material); pxr::UsdShadeMaterial matPrim = addMaterial(stage, mat_pair, prim.GetPath().GetParentPath()); std::string matName = link.visuals[i].material.name; std::string matPrimName = matName == "" ? mat_pair.first : matName; linkMatPrimPaths[matName] = prim.GetPath() .GetParentPath() .AppendPath(pxr::SdfPath("Looks/" + makeValidUSDIdentifier("material_" + name))) .GetString(); if (matPrim) { pxr::UsdShadeMaterialBindingAPI mbi(prim); mbi.Bind(matPrim); } } } } else { CARB_LOG_WARN("Prim %s not created", meshName.c_str()); } } // Add collisions CARB_LOG_INFO("Add collisions: %s", link.name.c_str()); for (size_t i = 0; i < link.collisions.size(); i++) { std::string meshName; std::string name = "mesh_" + std::to_string(i); if (link.collisions[i].name.size() > 0) { name = link.collisions[i].name; } meshName = robotBasePath + link.name + "/collisions/" + name; pxr::UsdPrim prim = addMesh(stage, link.collisions[i].geometry, assetRoot_, urdfPath_, meshName, link.collisions[i].origin, false, config.distanceScale, false, materialsList, subdivisionschemes[(int)config.subdivisionScheme], false, config.replaceCylindersWithCapsules); // Enable collisions on prim if (prim) { pxr::UsdPhysicsCollisionAPI::Apply(prim); if (link.collisions[i].geometry.type == UrdfGeometryType::SPHERE) { pxr::UsdPhysicsCollisionAPI::Apply(prim); } else if (link.collisions[i].geometry.type == UrdfGeometryType::BOX) { pxr::UsdPhysicsCollisionAPI::Apply(prim); } else if (link.collisions[i].geometry.type == UrdfGeometryType::CYLINDER) { pxr::UsdPhysicsCollisionAPI::Apply(prim); } else if (link.collisions[i].geometry.type == UrdfGeometryType::CAPSULE) { pxr::UsdPhysicsCollisionAPI::Apply(prim); } else { pxr::UsdPhysicsMeshCollisionAPI physicsMeshAPI = pxr::UsdPhysicsMeshCollisionAPI::Apply(prim); if (config.convexDecomp == true) { physicsMeshAPI.CreateApproximationAttr().Set(pxr::UsdPhysicsTokens.Get()->convexDecomposition); } else { physicsMeshAPI.CreateApproximationAttr().Set(pxr::UsdPhysicsTokens.Get()->convexHull); } } pxr::UsdGeomMesh(prim).CreatePurposeAttr().Set(pxr::UsdGeomTokens->guide); } else { CARB_LOG_WARN("Prim %s not created", meshName.c_str()); } } } void UrdfImporter::addRigidBody(pxr::UsdStageWeakPtr stage, const UrdfLink& link, const Transform& poseBodyToWorld, pxr::UsdGeomXform robotPrim, const UrdfRobot& robot) { std::string robotBasePath = robotPrim.GetPath().GetString() + "/"; CARB_LOG_INFO("Add Rigid Body: %s", link.name.c_str()); // Create Link Prim auto linkPrim = pxr::UsdGeomXform::Define(stage, pxr::SdfPath(robotBasePath + link.name)); if (linkPrim) { Transform transform = poseBodyToWorld; // urdfOriginToTransform(link.inertial.origin); linkPrim.ClearXformOpOrder(); linkPrim.AddTranslateOp(pxr::UsdGeomXformOp::PrecisionDouble) .Set(config.distanceScale * pxr::GfVec3d(transform.p.x, transform.p.y, transform.p.z)); linkPrim.AddOrientOp(pxr::UsdGeomXformOp::PrecisionDouble) .Set(pxr::GfQuatd(transform.q.w, transform.q.x, transform.q.y, transform.q.z)); linkPrim.AddScaleOp(pxr::UsdGeomXformOp::PrecisionDouble).Set(pxr::GfVec3d(1, 1, 1)); for (const auto& pair : link.mergedChildren) { auto childXform = pxr::UsdGeomXform::Define(stage, linkPrim.GetPath().AppendPath(pxr::SdfPath(pair.first))); if (childXform) { childXform.ClearXformOpOrder(); childXform.AddTranslateOp(pxr::UsdGeomXformOp::PrecisionDouble) .Set(config.distanceScale * pxr::GfVec3d(pair.second.p.x, pair.second.p.y, pair.second.p.z)); childXform.AddOrientOp(pxr::UsdGeomXformOp::PrecisionDouble) .Set(pxr::GfQuatd(pair.second.q.w, pair.second.q.x, pair.second.q.y, pair.second.q.z)); childXform.AddScaleOp(pxr::UsdGeomXformOp::PrecisionDouble).Set(pxr::GfVec3d(1, 1, 1)); } } pxr::UsdPhysicsRigidBodyAPI physicsAPI = pxr::UsdPhysicsRigidBodyAPI::Apply(linkPrim.GetPrim()); pxr::UsdPhysicsMassAPI massAPI = pxr::UsdPhysicsMassAPI::Apply(linkPrim.GetPrim()); if (link.inertial.hasMass) { massAPI.CreateMassAttr().Set(link.inertial.mass); } else if (config.density > 0) { // scale from kg/m^2 to specified units massAPI.CreateDensityAttr().Set(config.density); } if (link.inertial.hasInertia && config.importInertiaTensor) { Matrix33 inertiaMatrix; inertiaMatrix.cols[0] = Vec3(link.inertial.inertia.ixx, link.inertial.inertia.ixy, link.inertial.inertia.ixz); inertiaMatrix.cols[1] = Vec3(link.inertial.inertia.ixy, link.inertial.inertia.iyy, link.inertial.inertia.iyz); inertiaMatrix.cols[2] = Vec3(link.inertial.inertia.ixz, link.inertial.inertia.iyz, link.inertial.inertia.izz); Quat principalAxes; Vec3 diaginertia = Diagonalize(inertiaMatrix, principalAxes); // input is meters, but convert to kit units massAPI.CreateDiagonalInertiaAttr().Set(config.distanceScale * config.distanceScale * pxr::GfVec3f(diaginertia.x, diaginertia.y, diaginertia.z)); massAPI.CreatePrincipalAxesAttr().Set( pxr::GfQuatf(principalAxes.w, principalAxes.x, principalAxes.y, principalAxes.z)); } if (link.inertial.hasOrigin) { massAPI.CreateCenterOfMassAttr().Set(pxr::GfVec3f(float(config.distanceScale * link.inertial.origin.p.x), float(config.distanceScale * link.inertial.origin.p.y), float(config.distanceScale * link.inertial.origin.p.z))); } } else { CARB_LOG_WARN("linkPrim %s not created", link.name.c_str()); return; } // Add visuals if (config.makeInstanceable && link.visuals.size() > 0) { pxr::SdfPath visualPrimPath = pxr::SdfPath(robotBasePath + link.name + "/visuals"); pxr::UsdPrim visualPrim = stage->DefinePrim(visualPrimPath); visualPrim.GetReferences().AddReference(config.instanceableMeshUsdPath, visualPrimPath); visualPrim.SetInstanceable(true); } else { for (size_t i = 0; i < link.visuals.size(); i++) { std::string meshName; if (link.visuals.size() > 1) { std::string name = "mesh_" + std::to_string(i); if (link.visuals[i].name.size() > 0) { name = link.visuals[i].name; } meshName = robotBasePath + link.name + "/visuals/" + name; } else { meshName = robotBasePath + link.name + "/visuals"; } bool loadMaterial = true; auto mat = link.visuals[i].material; auto urdfMatIter = robot.materials.find(link.visuals[i].material.name); if (urdfMatIter != robot.materials.end()) { mat = urdfMatIter->second; } auto& color = mat.color; if (color.r >= 0 && color.g >= 0 && color.b >= 0) { loadMaterial = false; } pxr::UsdPrim prim = addMesh(stage, link.visuals[i].geometry, assetRoot_, urdfPath_, meshName, link.visuals[i].origin, loadMaterial, config.distanceScale, false, materialsList, subdivisionschemes[(int)config.subdivisionScheme]); if (prim) { if (loadMaterial == false) { // This Material was in the master list, reuse auto urdfMatIter = robot.materials.find(link.visuals[i].material.name); if (urdfMatIter != robot.materials.end()) { std::string path = matPrimPaths[link.visuals[i].material.name]; auto matPrim = stage->GetPrimAtPath(pxr::SdfPath(path)); if (matPrim) { auto shadePrim = pxr::UsdShadeMaterial(matPrim); if (shadePrim) { pxr::UsdShadeMaterialBindingAPI mbi(prim); mbi.Bind(shadePrim); } } } else { auto& color = link.visuals[i].material.color; std::stringstream ss; ss << std::uppercase << std::hex << (int)(256 * color.r) << std::uppercase << std::hex << (int)(256 * color.g) << std::uppercase << std::hex << (int)(256 * color.b); std::pair<std::string, UrdfMaterial> mat_pair(ss.str(), link.visuals[i].material); pxr::UsdShadeMaterial matPrim = addMaterial(stage, mat_pair, prim.GetPath().GetParentPath().GetParentPath()); if (matPrim) { pxr::UsdShadeMaterialBindingAPI mbi(prim); mbi.Bind(matPrim); } } } } else { CARB_LOG_WARN("Prim %s not created", meshName.c_str()); } } } // Add collisions CARB_LOG_INFO("Add collisions: %s", link.name.c_str()); if (config.makeInstanceable && link.collisions.size() > 0) { pxr::SdfPath collisionPrimPath = pxr::SdfPath(robotBasePath + link.name + "/collisions"); pxr::UsdPrim collisionPrim = stage->DefinePrim(collisionPrimPath); collisionPrim.GetReferences().AddReference(config.instanceableMeshUsdPath, collisionPrimPath); collisionPrim.SetInstanceable(true); } else { for (size_t i = 0; i < link.collisions.size(); i++) { std::string meshName; if (link.collisions.size() > 1 || config.makeInstanceable) { std::string name = "mesh_" + std::to_string(i); if (link.collisions[i].name.size() > 0) { name = link.collisions[i].name; } meshName = robotBasePath + link.name + "/collisions/" + name; } else { meshName = robotBasePath + link.name + "/collisions"; } pxr::UsdPrim prim = addMesh(stage, link.collisions[i].geometry, assetRoot_, urdfPath_, meshName, link.collisions[i].origin, false, config.distanceScale, false, materialsList, subdivisionschemes[(int)config.subdivisionScheme], false, config.replaceCylindersWithCapsules); // Enable collisions on prim if (prim) { pxr::UsdPhysicsCollisionAPI::Apply(prim); if (link.collisions[i].geometry.type == UrdfGeometryType::SPHERE) { pxr::UsdPhysicsCollisionAPI::Apply(prim); } else if (link.collisions[i].geometry.type == UrdfGeometryType::BOX) { pxr::UsdPhysicsCollisionAPI::Apply(prim); } else if (link.collisions[i].geometry.type == UrdfGeometryType::CYLINDER) { pxr::UsdPhysicsCollisionAPI::Apply(prim); } else if (link.collisions[i].geometry.type == UrdfGeometryType::CAPSULE) { pxr::UsdPhysicsCollisionAPI::Apply(prim); } else { pxr::UsdPhysicsMeshCollisionAPI physicsMeshAPI = pxr::UsdPhysicsMeshCollisionAPI::Apply(prim); if (config.convexDecomp == true) { physicsMeshAPI.CreateApproximationAttr().Set(pxr::UsdPhysicsTokens.Get()->convexDecomposition); } else { physicsMeshAPI.CreateApproximationAttr().Set(pxr::UsdPhysicsTokens.Get()->convexHull); } } pxr::UsdGeomMesh(prim).CreatePurposeAttr().Set(pxr::UsdGeomTokens->guide); } else { CARB_LOG_WARN("Prim %s not created", meshName.c_str()); } } } } template <class T> void AddSingleJoint(const UrdfJoint& joint, pxr::UsdStageWeakPtr stage, const pxr::SdfPath& jointPath, pxr::UsdPhysicsJoint& jointPrimBase, const float distanceScale) { T jointPrim = T::Define(stage, pxr::SdfPath(jointPath)); jointPrimBase = jointPrim; jointPrim.CreateAxisAttr().Set(pxr::TfToken("X")); // Set the limits if the joint is anything except a continuous joint if (joint.type != UrdfJointType::CONTINUOUS) { // Angular limits are in degrees so scale accordingly float scale = 180.0f / static_cast<float>(M_PI); if (joint.type == UrdfJointType::PRISMATIC) { scale = distanceScale; } jointPrim.CreateLowerLimitAttr().Set(scale * joint.limit.lower); jointPrim.CreateUpperLimitAttr().Set(scale * joint.limit.upper); } pxr::PhysxSchemaPhysxJointAPI physxJoint = pxr::PhysxSchemaPhysxJointAPI::Apply(jointPrim.GetPrim()); physxJoint.CreateJointFrictionAttr().Set(joint.dynamics.friction); if (joint.type == UrdfJointType::PRISMATIC) { pxr::PhysxSchemaJointStateAPI::Apply(jointPrim.GetPrim(), pxr::TfToken("linear")); if (joint.mimic.joint == "") { pxr::UsdPhysicsDriveAPI driveAPI = pxr::UsdPhysicsDriveAPI::Apply(jointPrim.GetPrim(), pxr::TfToken("linear")); // convert kg*m/s^2 to kg * cm /s^2 driveAPI.CreateMaxForceAttr().Set(joint.limit.effort > 0.0f ? joint.limit.effort * distanceScale : FLT_MAX); // change drive type if (joint.drive.driveType == UrdfJointDriveType::FORCE) { driveAPI.CreateTypeAttr().Set(pxr::TfToken("force")); } else { driveAPI.CreateTypeAttr().Set(pxr::TfToken("acceleration")); } // change drive target type if (joint.drive.targetType == UrdfJointTargetType::POSITION) { driveAPI.CreateTargetPositionAttr().Set(joint.drive.target); } else if (joint.drive.targetType == UrdfJointTargetType::VELOCITY) { driveAPI.CreateTargetVelocityAttr().Set(joint.drive.target); } // change drive stiffness and damping if (joint.drive.targetType != UrdfJointTargetType::NONE) { driveAPI.CreateDampingAttr().Set(joint.dynamics.damping); driveAPI.CreateStiffnessAttr().Set(joint.dynamics.stiffness); } else { driveAPI.CreateDampingAttr().Set(0.0f); driveAPI.CreateStiffnessAttr().Set(0.0f); } } // Prismatic joint velocity should be scaled to stage units, but not revolute physxJoint.CreateMaxJointVelocityAttr().Set( joint.limit.velocity > 0.0f ? static_cast<float>(joint.limit.velocity * distanceScale) : FLT_MAX); } // continuous and revolute are identical except for setting limits else if (joint.type == UrdfJointType::REVOLUTE || joint.type == UrdfJointType::CONTINUOUS) { pxr::PhysxSchemaJointStateAPI::Apply(jointPrim.GetPrim(), pxr::TfToken("angular")); if (joint.mimic.joint == "") { pxr::UsdPhysicsDriveAPI driveAPI = pxr::UsdPhysicsDriveAPI::Apply(jointPrim.GetPrim(), pxr::TfToken("angular")); // convert kg*m/s^2 * m to kg * cm /s^2 * cm driveAPI.CreateMaxForceAttr().Set( joint.limit.effort > 0.0f ? joint.limit.effort * distanceScale * distanceScale : FLT_MAX); // change drive type if (joint.drive.driveType == UrdfJointDriveType::FORCE) { driveAPI.CreateTypeAttr().Set(pxr::TfToken("force")); } else { driveAPI.CreateTypeAttr().Set(pxr::TfToken("acceleration")); } // change drive target type if (joint.drive.targetType == UrdfJointTargetType::POSITION) { driveAPI.CreateTargetPositionAttr().Set(joint.drive.target); } else if (joint.drive.targetType == UrdfJointTargetType::VELOCITY) { driveAPI.CreateTargetVelocityAttr().Set(joint.drive.target); } // change drive stiffness and damping if (joint.drive.targetType != UrdfJointTargetType::NONE) { driveAPI.CreateDampingAttr().Set(joint.dynamics.damping); driveAPI.CreateStiffnessAttr().Set(joint.dynamics.stiffness); } else { driveAPI.CreateDampingAttr().Set(0.0f); driveAPI.CreateStiffnessAttr().Set(0.0f); } } // Convert revolute joint velocity limit to deg/s physxJoint.CreateMaxJointVelocityAttr().Set( joint.limit.velocity > 0.0f ? static_cast<float>(180.0f / M_PI * joint.limit.velocity) : FLT_MAX); } for (auto &mimic : joint.mimicChildren) { auto tendonRoot = pxr::PhysxSchemaPhysxTendonAxisRootAPI::Apply(jointPrim.GetPrim(), pxr::TfToken(mimic.first)); tendonRoot.CreateStiffnessAttr().Set(1.e5f); tendonRoot.CreateDampingAttr().Set(10.0); float scale = 180.0f / static_cast<float>(M_PI); if (joint.type == UrdfJointType::PRISMATIC) { scale = distanceScale; } auto offset = scale*mimic.second; tendonRoot.CreateOffsetAttr().Set(offset); // Manually setting the coefficients to avoid adding an extra API that makes it messy. std::string attrName1 = "physxTendon:"+mimic.first+":forceCoefficient"; auto attr1 = tendonRoot.GetPrim().CreateAttribute( pxr::TfToken(attrName1.c_str()), pxr::SdfValueTypeNames->FloatArray, false); std::string attrName2 = "physxTendon:"+mimic.first+":gearing"; auto attr2 = tendonRoot.GetPrim().CreateAttribute( pxr::TfToken(attrName2.c_str()), pxr::SdfValueTypeNames->FloatArray, false); pxr::VtArray<float> forceattr; pxr::VtArray<float> gearing; forceattr.push_back(-1.0f); gearing.push_back(-1.0f); attr1.Set(forceattr); attr2.Set(gearing); } if (joint.mimic.joint != "") { auto tendon = pxr::PhysxSchemaPhysxTendonAxisAPI::Apply(jointPrim.GetPrim(), pxr::TfToken(joint.name)); pxr::VtArray<float> forceattr; pxr::VtArray<float> gearing; forceattr.push_back(joint.mimic.multiplier>0?1:-1); // Tendon Gear ratio is the inverse of the mimic multiplier gearing.push_back(1.0f/joint.mimic.multiplier); tendon.CreateForceCoefficientAttr().Set(forceattr); tendon.CreateGearingAttr().Set(gearing); } } void UrdfImporter::addJoint(pxr::UsdStageWeakPtr stage, pxr::UsdGeomXform robotPrim, const UrdfJoint& joint, const Transform& poseJointToParentBody) { std::string parentLinkPath = robotPrim.GetPath().GetString() + "/" + joint.parentLinkName; std::string childLinkPath = robotPrim.GetPath().GetString() + "/" + joint.childLinkName; std::string jointPath = parentLinkPath + "/" + joint.name; if (!pxr::SdfPath::IsValidPathString(jointPath)) { // jn->getName starts with a number which is not valid for usd path, so prefix it with "joint" jointPath = parentLinkPath + "/joint" + joint.name; } pxr::UsdPhysicsJoint jointPrim; if (joint.type == UrdfJointType::FIXED) { jointPrim = pxr::UsdPhysicsFixedJoint::Define(stage, pxr::SdfPath(jointPath)); } else if (joint.type == UrdfJointType::PRISMATIC) { AddSingleJoint<pxr::UsdPhysicsPrismaticJoint>( joint, stage, pxr::SdfPath(jointPath), jointPrim, float(config.distanceScale)); } // else if (joint.type == UrdfJointType::SPHERICAL) // { // AddSingleJoint<PhysicsSchemaSphericalJoint>(jn, stage, SdfPath(jointPath), jointPrim, skel, // distanceScale); // } else if (joint.type == UrdfJointType::REVOLUTE || joint.type == UrdfJointType::CONTINUOUS) { AddSingleJoint<pxr::UsdPhysicsRevoluteJoint>( joint, stage, pxr::SdfPath(jointPath), jointPrim, float(config.distanceScale)); } else if (joint.type == UrdfJointType::FLOATING) { // There is no joint, skip return; } pxr::SdfPathVector val0{ pxr::SdfPath(parentLinkPath) }; pxr::SdfPathVector val1{ pxr::SdfPath(childLinkPath) }; if (parentLinkPath != "") { jointPrim.CreateBody0Rel().SetTargets(val0); } pxr::GfVec3f localPos0 = config.distanceScale * pxr::GfVec3f(poseJointToParentBody.p.x, poseJointToParentBody.p.y, poseJointToParentBody.p.z); pxr::GfQuatf localRot0 = pxr::GfQuatf( poseJointToParentBody.q.w, poseJointToParentBody.q.x, poseJointToParentBody.q.y, poseJointToParentBody.q.z); pxr::GfVec3f localPos1 = config.distanceScale * pxr::GfVec3f(0, 0, 0); pxr::GfQuatf localRot1 = pxr::GfQuatf(1, 0, 0, 0); // Need to rotate the joint frame to match the urdf defined axis // convert joint axis to angle-axis representation Vec3 jointAxisRotAxis = -Cross(urdfAxisToVec(joint.axis), Vec3(1.0f, 0.0f, 0.0f)); float jointAxisRotAngle = acos(joint.axis.x); // this is equal to acos(Dot(joint.axis, Vec3(1.0f, 0.0f, 0.0f))) if (Dot(jointAxisRotAxis, jointAxisRotAxis) < 1e-5f) { // for axis along x we define an arbitrary perpendicular rotAxis (along y). // In that case the angle is 0 or 180deg jointAxisRotAxis = Vec3(0.0f, 1.0f, 0.0f); } // normalize jointAxisRotAxis jointAxisRotAxis /= sqrtf(Dot(jointAxisRotAxis, jointAxisRotAxis)); // rotate the parent frame by the axis Quat jointAxisRotQuat = QuatFromAxisAngle(jointAxisRotAxis, jointAxisRotAngle); // apply transforms jointPrim.CreateLocalPos0Attr().Set(localPos0); jointPrim.CreateLocalRot0Attr().Set(localRot0 * pxr::GfQuatf(jointAxisRotQuat.w, jointAxisRotQuat.x, jointAxisRotQuat.y, jointAxisRotQuat.z)); if (childLinkPath != "") { jointPrim.CreateBody1Rel().SetTargets(val1); } jointPrim.CreateLocalPos1Attr().Set(localPos1); jointPrim.CreateLocalRot1Attr().Set(localRot1 * pxr::GfQuatf(jointAxisRotQuat.w, jointAxisRotQuat.x, jointAxisRotQuat.y, jointAxisRotQuat.z)); jointPrim.CreateBreakForceAttr().Set(FLT_MAX); jointPrim.CreateBreakTorqueAttr().Set(FLT_MAX); // TODO: FIx? // auto linkAPI = pxr::UsdPhysicsJoint::Apply(stage->GetPrimAtPath(pxr::SdfPath(jointPath))); // linkAPI.CreateArticulationTypeAttr().Set(pxr::TfToken("articulatedJoint")); } void UrdfImporter::addLinksAndJoints(pxr::UsdStageWeakPtr stage, const Transform& poseParentToWorld, const KinematicChain::Node* parentNode, const UrdfRobot& robot, pxr::UsdGeomXform robotPrim) { // Create root joint only once if (parentNode->parentJointName_ == "") { const UrdfLink& urdfLink = robot.links.at(parentNode->linkName_); addRigidBody(stage, urdfLink, poseParentToWorld, robotPrim, robot); if (config.fixBase) { std::string rootJointPath = robotPrim.GetPath().GetString() + "/root_joint"; pxr::UsdPhysicsFixedJoint rootJoint = pxr::UsdPhysicsFixedJoint::Define(stage, pxr::SdfPath(rootJointPath)); pxr::SdfPathVector val1{ pxr::SdfPath(robotPrim.GetPath().GetString() + "/" + urdfLink.name) }; rootJoint.CreateBody1Rel().SetTargets(val1); } } if (!parentNode->childNodes_.empty()) { for (const auto& childNode : parentNode->childNodes_) { if (robot.joints.find(childNode->parentJointName_) != robot.joints.end()) { if (robot.links.find(childNode->linkName_) != robot.links.end()) { const UrdfJoint urdfJoint = robot.joints.at(childNode->parentJointName_); const UrdfLink& childLink = robot.links.at(childNode->linkName_); // const UrdfLink& parentLink = robot.links.at(parentNode->linkName_); Transform poseJointToLink = urdfJoint.origin; // According to URDF spec, the frame of a link coincides with its parent joint frame Transform poseLinkToWorld = poseParentToWorld * poseJointToLink; // if (!parentLink.softs.size() && !childLink.softs.size()) // rigid parent, rigid child { addRigidBody(stage, childLink, poseLinkToWorld, robotPrim, robot); addJoint(stage, robotPrim, urdfJoint, poseJointToLink); // RigidBodyTopo bodyTopo; // bodyTopo.bodyIndex = asset->bodyLookup.at(childNode->linkName_); // bodyTopo.parentIndex = asset->bodyLookup.at(parentNode->linkName_); // bodyTopo.jointIndex = asset->jointLookup.at(childNode->parentJointName_); // bodyTopo.jointSpecStart = asset->jointLookup.at(childNode->parentJointName_); // // URDF only has 1 DOF joints // bodyTopo.jointSpecCount = 1; // asset->rigidBodyHierarchy.push_back(bodyTopo); } // Recurse through the links children addLinksAndJoints(stage, poseLinkToWorld, childNode.get(), robot, robotPrim); } else { CARB_LOG_ERROR("Failed to Create Joint <%s>: Child link <%s> not found", childNode->parentJointName_.c_str(), childNode->linkName_.c_str()); } } else { CARB_LOG_WARN("Joint <%s> is undefined", childNode->parentJointName_.c_str()); } } } } void UrdfImporter::addMaterials(pxr::UsdStageWeakPtr stage, const UrdfRobot& robot, const pxr::SdfPath& prefixPath) { stage->DefinePrim(pxr::SdfPath(prefixPath.GetString() + "/Looks"), pxr::TfToken("Scope")); for (auto& mat : robot.materials) { addMaterial(stage, mat, prefixPath); } } pxr::UsdShadeMaterial UrdfImporter::addMaterial(pxr::UsdStageWeakPtr stage, const std::pair<std::string, UrdfMaterial>& mat, const pxr::SdfPath& prefixPath) { auto& color = mat.second.color; std::string name = mat.second.name; if (name == "") { name = mat.first; } if (color.r >= 0 && color.g >= 0 && color.b >= 0) { pxr::SdfPath shaderPath = prefixPath.AppendPath(pxr::SdfPath("Looks/" + makeValidUSDIdentifier("material_" + name))); pxr::UsdShadeMaterial matPrim = pxr::UsdShadeMaterial::Define(stage, shaderPath); if (matPrim) { pxr::UsdShadeShader pbrShader = pxr::UsdShadeShader::Define(stage, shaderPath.AppendPath(pxr::SdfPath("Shader"))); if (pbrShader) { auto shader_out = pbrShader.CreateOutput(pxr::TfToken("out"), pxr::SdfValueTypeNames->Token); matPrim.CreateSurfaceOutput(pxr::TfToken("mdl")).ConnectToSource(shader_out); matPrim.CreateVolumeOutput(pxr::TfToken("mdl")).ConnectToSource(shader_out); matPrim.CreateDisplacementOutput(pxr::TfToken("mdl")).ConnectToSource(shader_out); pbrShader.GetImplementationSourceAttr().Set(pxr::UsdShadeTokens->sourceAsset); pbrShader.SetSourceAsset(pxr::SdfAssetPath("OmniPBR.mdl"), pxr::TfToken("mdl")); pbrShader.SetSourceAssetSubIdentifier(pxr::TfToken("OmniPBR"), pxr::TfToken("mdl")); pbrShader.CreateInput(pxr::TfToken("diffuse_color_constant"), pxr::SdfValueTypeNames->Color3f) .Set(pxr::GfVec3f(color.r, color.g, color.b)); matPrimPaths[name] = shaderPath.GetString(); return matPrim; } else { CARB_LOG_WARN("Couldn't create shader at: %s", shaderPath.GetString().c_str()); } } else { CARB_LOG_WARN("Couldn't create material at: %s", shaderPath.GetString().c_str()); } } return pxr::UsdShadeMaterial(); } std::string UrdfImporter::addToStage(pxr::UsdStageWeakPtr stage, const UrdfRobot& urdfRobot) { if (urdfRobot.links.size() == 0) { CARB_LOG_WARN("Cannot add robot to stage, number of links is zero"); return ""; } // The limit for links is now a 32bit index so this shouldn't be needed anymore // if (urdfRobot.links.size() >= 64) // { // CARB_LOG_WARN( // "URDF cannot have more than 63 links to be imported as a physx articulation. Try enabling the merge fixed // joints option to reduce the number of links."); // CARB_LOG_WARN("URDF has %d links", static_cast<int>(urdfRobot.links.size())); // return ""; // } if (config.createPhysicsScene) { bool sceneExists = false; pxr::UsdPrimRange range = stage->Traverse(); for (pxr::UsdPrimRange::iterator iter = range.begin(); iter != range.end(); ++iter) { pxr::UsdPrim prim = *iter; if (prim.IsA<pxr::UsdPhysicsScene>()) { sceneExists = true; } } if (!sceneExists) { // Create physics scene pxr::UsdPhysicsScene scene = pxr::UsdPhysicsScene::Define(stage, pxr::SdfPath("/physicsScene")); scene.CreateGravityDirectionAttr().Set(pxr::GfVec3f(0.0f, 0.0f, -1.0)); scene.CreateGravityMagnitudeAttr().Set(9.81f * config.distanceScale); pxr::PhysxSchemaPhysxSceneAPI physxSceneAPI = pxr::PhysxSchemaPhysxSceneAPI::Apply(stage->GetPrimAtPath(pxr::SdfPath("/physicsScene"))); physxSceneAPI.CreateEnableCCDAttr().Set(true); physxSceneAPI.CreateEnableStabilizationAttr().Set(true); physxSceneAPI.CreateEnableGPUDynamicsAttr().Set(false); physxSceneAPI.CreateBroadphaseTypeAttr().Set(pxr::TfToken("MBP")); physxSceneAPI.CreateSolverTypeAttr().Set(pxr::TfToken("TGS")); } } pxr::SdfPath primPath = pxr::SdfPath(GetNewSdfPathString(stage, stage->GetDefaultPrim().GetPath().GetString() + "/" + makeValidUSDIdentifier(std::string(urdfRobot.name)))); if (config.makeDefaultPrim) primPath = pxr::SdfPath(GetNewSdfPathString(stage, "/" + makeValidUSDIdentifier(std::string(urdfRobot.name)))); // // Remove the prim we are about to add in case it exists // if (stage->GetPrimAtPath(primPath)) // { // stage->RemovePrim(primPath); // } pxr::UsdGeomXform robotPrim = pxr::UsdGeomXform::Define(stage, primPath); pxr::UsdGeomXformable gprim = pxr::UsdGeomXformable(robotPrim); gprim.ClearXformOpOrder(); gprim.AddTranslateOp(pxr::UsdGeomXformOp::PrecisionDouble).Set(pxr::GfVec3d(0, 0, 0)); gprim.AddOrientOp(pxr::UsdGeomXformOp::PrecisionDouble).Set(pxr::GfQuatd(1, 0, 0, 0)); gprim.AddScaleOp(pxr::UsdGeomXformOp::PrecisionDouble).Set(pxr::GfVec3d(1, 1, 1)); pxr::UsdPhysicsArticulationRootAPI physicsSchema = pxr::UsdPhysicsArticulationRootAPI::Apply(robotPrim.GetPrim()); pxr::PhysxSchemaPhysxArticulationAPI physxSchema = pxr::PhysxSchemaPhysxArticulationAPI::Apply(robotPrim.GetPrim()); physxSchema.CreateEnabledSelfCollisionsAttr().Set(config.selfCollision); // These are reasonable defaults, might want to expose them via the import config in the future. physxSchema.CreateSolverPositionIterationCountAttr().Set(32); physxSchema.CreateSolverVelocityIterationCountAttr().Set(16); if (config.makeDefaultPrim) { stage->SetDefaultPrim(robotPrim.GetPrim()); } KinematicChain chain; if (!chain.computeKinematicChain(urdfRobot)) { return ""; } if (!config.makeInstanceable) { addMaterials(stage, urdfRobot, primPath); } else { // first create instanceable meshes USD std::string instanceableStagePath = config.instanceableMeshUsdPath; if (config.instanceableMeshUsdPath[0] == '.') { // make relative path relative to output directory std::string relativePath = config.instanceableMeshUsdPath.substr(1); std::string curStagePath = stage->GetRootLayer()->GetIdentifier(); std::string directory; size_t pos = curStagePath.find_last_of("\\/"); directory = (std::string::npos == pos) ? "" : curStagePath.substr(0, pos); instanceableStagePath = directory + relativePath; } pxr::UsdStageRefPtr instanceableMeshStage = pxr::UsdStage::CreateNew(instanceableStagePath); std::string robotBasePath = robotPrim.GetPath().GetString() + "/"; buildInstanceableStage(instanceableMeshStage, chain.baseNode.get(), robotBasePath, urdfRobot); instanceableMeshStage->Export(instanceableStagePath); } addLinksAndJoints(stage, Transform(), chain.baseNode.get(), urdfRobot, robotPrim); return primPath.GetString(); } } } }
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/plugins/import/KinematicChain.h
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #pragma once #include "../UrdfTypes.h" #include <memory> #include <string> #include <vector> namespace omni { namespace importer { namespace urdf { // Represents the kinematic chain as a tree class KinematicChain { public: // A tree representing a link with its parent joint and child links struct Node { std::string linkName_; std::string parentJointName_; std::vector<std::unique_ptr<Node>> childNodes_; Node(std::string linkName, std::string parentJointName) : linkName_(linkName), parentJointName_(parentJointName) { } }; std::unique_ptr<Node> baseNode; KinematicChain() = default; ~KinematicChain(); // Computes the kinematic chain for a UrdfRobot description bool computeKinematicChain(const UrdfRobot& urdfRobot); private: // Recursively finds a node's children void computeChildNodes(std::unique_ptr<Node>& parentNode, const UrdfRobot& urdfRobot); }; } } }
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/plugins/import/MeshImporter.h
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #pragma once // clang-format off #include "../UsdPCH.h" // clang-format on #include "assimp/scene.h" #include <string> namespace omni { namespace importer { namespace urdf { pxr::SdfPath SimpleImport(pxr::UsdStageRefPtr usdStage, std::string path, const aiScene* mScene, const std::string mesh_path, std::map<pxr::TfToken, std::string>& materialsList, const bool loadMaterials = true, const bool flipVisuals = false, const char* subdvisionScheme = "none", const bool instanceable = false); } } }
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/plugins/import/UrdfImporter.h
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #pragma once // clang-format off #include "../UsdPCH.h" // clang-format on #include "../parse/UrdfParser.h" #include "KinematicChain.h" #include "MeshImporter.h" #include "../math/core/maths.h" #include "../Urdf.h" #include "../UrdfTypes.h" #include <carb/logging/Log.h> #include <pxr/usd/usdPhysics/articulationRootAPI.h> #include <pxr/usd/usdPhysics/collisionAPI.h> #include <pxr/usd/usdPhysics/driveAPI.h> #include <pxr/usd/usdPhysics/fixedJoint.h> #include <pxr/usd/usdPhysics/joint.h> #include <pxr/usd/usdPhysics/limitAPI.h> #include <pxr/usd/usdPhysics/massAPI.h> #include <pxr/usd/usdPhysics/prismaticJoint.h> #include <pxr/usd/usdPhysics/revoluteJoint.h> #include <pxr/usd/usdPhysics/scene.h> #include <pxr/usd/usdPhysics/sphericalJoint.h> namespace omni { namespace importer { namespace urdf { class UrdfImporter { private: std::string assetRoot_; std::string urdfPath_; const ImportConfig config; std::map<std::string, std::string> matPrimPaths; std::map<pxr::TfToken, std::string> materialsList; public: UrdfImporter(const std::string& assetRoot, const std::string& urdfPath, const ImportConfig& options) : assetRoot_(assetRoot), urdfPath_(urdfPath), config(options) { } // Creates and populates a GymAsset UrdfRobot createAsset(); std::string addToStage(pxr::UsdStageWeakPtr stage, const UrdfRobot& robot); private: void buildInstanceableStage(pxr::UsdStageRefPtr stage, const KinematicChain::Node* parentNode, const std::string& robotBasePath, const UrdfRobot& urdfRobot); void addInstanceableMeshes(pxr::UsdStageRefPtr stage, const UrdfLink& link, const std::string& robotBasePath, const UrdfRobot& robot); void addRigidBody(pxr::UsdStageWeakPtr stage, const UrdfLink& link, const Transform& poseBodyToWorld, pxr::UsdGeomXform robotPrim, const UrdfRobot& robot); void addJoint(pxr::UsdStageWeakPtr stage, pxr::UsdGeomXform robotPrim, const UrdfJoint& joint, const Transform& poseJointToParentBody); void addLinksAndJoints(pxr::UsdStageWeakPtr stage, const Transform& poseParentToWorld, const KinematicChain::Node* parentNode, const UrdfRobot& robot, pxr::UsdGeomXform robotPrim); void addMaterials(pxr::UsdStageWeakPtr stage, const UrdfRobot& robot, const pxr::SdfPath& prefixPath); pxr::UsdShadeMaterial addMaterial(pxr::UsdStageWeakPtr stage, const std::pair<std::string, UrdfMaterial>& mat, const pxr::SdfPath& prefixPath); }; } } }
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/plugins/core/PathUtils.h
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #pragma once // clang-format off #include "../UsdPCH.h" // clang-format on #include <string> #include <vector> namespace omni { namespace importer { namespace urdf { enum class PathType { eNone, // path does not exist eFile, // path is a regular file eDirectory, // path is a directory eOther, // path is something else }; PathType testPath(const char* path); bool isAbsolutePath(const char* path); bool makeDirectory(const char* path); std::string pathJoin(const std::string& path1, const std::string& path2); std::string getCwd(); // returns filename without extension (e.g. "foo/bar/bingo.txt" -> "bingo") std::string getPathStem(const char* path); std::vector<std::string> getFileListRecursive(const std::string& dir, bool sorted = true); std::string makeValidUSDIdentifier(const std::string& name); } } }
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/plugins/core/PathUtils.cpp
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include "PathUtils.h" #include <carb/logging/Log.h> #include <algorithm> #include <cctype> #include <cstring> #include <errno.h> #include <vector> #ifdef _WIN32 # include <direct.h> # include <windows.h> #else # include <sys/stat.h> # include <dirent.h> # include <unistd.h> #endif namespace omni { namespace importer { namespace urdf { PathType testPath(const char* path) { if (!path || !*path) { return PathType::eNone; } #ifdef _WIN32 DWORD attribs = GetFileAttributesA(path); if (attribs == INVALID_FILE_ATTRIBUTES) { return PathType::eNone; } else if (attribs & FILE_ATTRIBUTE_DIRECTORY) { return PathType::eDirectory; } else { // hmmm return PathType::eFile; } #else struct stat s; if (stat(path, &s) == -1) { return PathType::eNone; } else if (S_ISREG(s.st_mode)) { return PathType::eFile; } else if (S_ISDIR(s.st_mode)) { return PathType::eDirectory; } else { return PathType::eOther; } #endif } bool isAbsolutePath(const char* path) { if (!path || !*path) { return false; } #ifdef _WIN32 if (path[0] == '\\' || path[0] == '/') { return true; } else if (std::isalpha(path[0]) && path[1] == ':') { return true; } else { return false; } #else return path[0] == '/'; #endif } std::string pathJoin(const std::string& path1, const std::string& path2) { if (path1.empty()) { return path2; } else { auto last = path1.rbegin(); #ifdef _WIN32 if (*last != '/' && *last != '\\') #else if (*last != '/') #endif { return path1 + '/' + path2; } else { return path1 + path2; } } } std::string getCwd() { std::vector<char> buf(4096); #ifdef _WIN32 if (!_getcwd(buf.data(), int(buf.size()))) #else if (!getcwd(buf.data(), size_t(buf.size()))) #endif { return std::string(); } return std::string(buf.data()); } static int sysmkdir(const char* path) { #ifdef _WIN32 return _mkdir(path); #else return mkdir(path, 0755); #endif } static std::vector<std::string> tokenizePath(const char* path_) { std::vector<std::string> components; if (!path_ || !*path_) { return components; } std::string path(path_); size_t start = 0; bool done = false; while (!done) { #ifdef _WIN32 size_t end = path.find_first_of("/\\", start); #else size_t end = path.find_first_of('/', start); #endif if (end == std::string::npos) { end = path.length(); done = true; } if (end - start > 0) { components.push_back(path.substr(start, end - start)); } start = end + 1; } return components; } bool makeDirectory(const char* path) { std::vector<std::string> components = tokenizePath(path); if (components.empty()) { return false; } std::string pathSoFar; #ifndef _WIN32 // on Unixes, need to start with leading slash if absolute path if (isAbsolutePath(path)) { pathSoFar = "/"; } #endif for (unsigned i = 0; i < components.size(); i++) { if (i > 0) { pathSoFar += '/'; } pathSoFar += components[i]; if (sysmkdir(pathSoFar.c_str()) != 0 && errno != EEXIST) { fprintf(stderr, "*** Failed to create directory '%s'\n", pathSoFar.c_str()); return false; } // printf("Creating '%s'\n", pathSoFar.c_str()); } return true; } std::string getPathStem(const char* path) { if (!path || !*path) { return ""; } const char* p = strrchr(path, '/'); #ifdef _WIN32 const char* q = strrchr(path, '\\'); if (q > p) { p = q; } #endif const char* fnameStart = p ? p + 1 : path; const char* ext = strrchr(fnameStart, '.'); if (ext) { return std::string(fnameStart, ext); } else { return fnameStart; } } static void getFileListRecursiveRec(const std::string& dir, std::vector<std::string>& flist) { #if _WIN32 WIN32_FIND_DATAA fdata; memset(&fdata, 0, sizeof(fdata)); std::string pattern = dir + "\\*"; HANDLE handle = FindFirstFileA(pattern.c_str(), &fdata); while (handle != INVALID_HANDLE_VALUE) { if ((fdata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY) { if (strcmp(fdata.cFileName, ".") != 0 && strcmp(fdata.cFileName, "..") != 0) { getFileListRecursiveRec(dir + '\\' + fdata.cFileName, flist); } } else { flist.push_back(dir + '\\' + fdata.cFileName); } if (FindNextFileA(handle, &fdata) == FALSE) { break; } } FindClose(handle); #else DIR* d = opendir(dir.c_str()); if (d) { struct dirent* dent; while ((dent = readdir(d)) != nullptr) { if (dent->d_type == DT_DIR) { if (strcmp(dent->d_name, ".") != 0 && strcmp(dent->d_name, "..") != 0) { getFileListRecursiveRec(dir + '/' + dent->d_name, flist); } } else if (dent->d_type == DT_REG) { flist.push_back(dir + '/' + dent->d_name); } } closedir(d); } #endif } std::vector<std::string> getFileListRecursive(const std::string& dir, bool sorted) { std::vector<std::string> flist; getFileListRecursiveRec(dir, flist); if (sorted) { std::sort(flist.begin(), flist.end()); } return flist; } std::string makeValidUSDIdentifier(const std::string& name) { auto validName = pxr::TfMakeValidIdentifier(name); if (validName[0] == '_') { validName = "a" + validName; } if (pxr::TfIsValidIdentifier(name) == false) { CARB_LOG_WARN("The path %s is not a valid usd path, modifying to %s", name.c_str(), validName.c_str()); } return validName; } } } }
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/plugins/utils/Path.h
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #pragma once // clang-format off #include "../UsdPCH.h" // clang-format on #include <string> #include <OmniClient.h> namespace omni { namespace importer { namespace utils { namespace path { inline std::string normalizeUrl(const char* url) { std::string ret; char stringBuffer[1024]; std::unique_ptr<char[]> stringBufferHeap; size_t bufferSize = sizeof(stringBuffer); const char* normalizedUrl = omniClientNormalizeUrl(url, stringBuffer, &bufferSize); if (!normalizedUrl) { stringBufferHeap = std::unique_ptr<char[]>(new char[bufferSize]); normalizedUrl = omniClientNormalizeUrl(url, stringBufferHeap.get(), &bufferSize); if (!normalizedUrl) { normalizedUrl = ""; CARB_LOG_ERROR("Cannot normalize %s", url); } } ret = normalizedUrl; for (auto& c : ret) { if (c == '\\') { c = '/'; } } return ret; } std::string resolve_absolute(std::string parent, std::string relative) { size_t bufferSize = parent.size() + relative.size(); std::unique_ptr<char[]> stringBuffer = std::unique_ptr<char[]>(new char[bufferSize]); std::string combined_url = normalizeUrl((parent + "/" + relative).c_str()); return combined_url; } } } } }
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/plugins/parse/UrdfParser.cpp
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include "UrdfParser.h" #include "../core/PathUtils.h" #include <carb/logging/Log.h> namespace omni { namespace importer { namespace urdf { // Stream operators for nice printing std::ostream& operator<<(std::ostream& out, const Transform& origin) { out << "Origin: "; out << "px=" << origin.p.x << " py=" << origin.p.y << " pz=" << origin.p.z; out << " qx=" << origin.q.x << " qy=" << origin.q.y << " qz=" << origin.q.z << " qw=" << origin.q.w; return out; } std::ostream& operator<<(std::ostream& out, const UrdfInertia& inertia) { out << "Inertia: "; out << "ixx=" << inertia.ixx << " ixy=" << inertia.ixy << " ixz=" << inertia.ixz; out << " iyy=" << inertia.iyy << " iyz=" << inertia.iyz << " izz=" << inertia.izz; return out; } std::ostream& operator<<(std::ostream& out, const UrdfInertial& inertial) { out << "Inertial: " << std::endl; out << " \t \t" << inertial.origin << std::endl; if (inertial.hasMass) { out << " \t \tMass: " << inertial.mass << std::endl; } else { out << " \t \tMass: No mass was specified for the link" << std::endl; } if (inertial.hasInertia) { out << " \t \t" << inertial.inertia; } else { out << " \t \tInertia: No inertia was specified for the link" << std::endl; } return out; } std::ostream& operator<<(std::ostream& out, const UrdfAxis& axis) { out << "Axis: "; out << "x=" << axis.x << " y=" << axis.y << " z=" << axis.z; return out; } std::ostream& operator<<(std::ostream& out, const UrdfColor& color) { out << "Color: "; out << "r=" << color.r << " g=" << color.g << " b=" << color.b << " a=" << color.a; return out; } std::ostream& operator<<(std::ostream& out, const UrdfJointType& type) { out << "Type: "; std::string jointType = "unknown"; switch (type) { case UrdfJointType::REVOLUTE: jointType = "revolute"; break; case UrdfJointType::CONTINUOUS: jointType = "continuous"; break; case UrdfJointType::PRISMATIC: jointType = "prismatic"; break; case UrdfJointType::FIXED: jointType = "fixed"; break; case UrdfJointType::FLOATING: jointType = "floating"; break; case UrdfJointType::PLANAR: jointType = "planar"; break; } out << jointType; return out; } std::ostream& operator<<(std::ostream& out, const UrdfDynamics& dynamics) { out << "Dynamics: "; out << "damping=" << dynamics.damping << " friction=" << dynamics.friction; return out; } std::ostream& operator<<(std::ostream& out, const UrdfLimit& limit) { out << "Limit: "; out << "lower=" << limit.lower << " upper=" << limit.upper << " effort=" << limit.effort << " velocity=" << limit.velocity; out << std::endl; return out; } std::ostream& operator<<(std::ostream& out, const UrdfGeometry& geometry) { out << "Geometry: "; switch (geometry.type) { case UrdfGeometryType::BOX: out << "type=box size=" << geometry.size_x << " " << geometry.size_y << " " << geometry.size_z; break; case UrdfGeometryType::CYLINDER: out << "type=cylinder radius=" << geometry.radius << " length=" << geometry.length; break; case UrdfGeometryType::CAPSULE: out << "type=capsule radius=" << geometry.radius << " length=" << geometry.length; break; case UrdfGeometryType::SPHERE: out << "type=sphere, radius=" << geometry.radius; break; case UrdfGeometryType::MESH: out << "type=mesh filemame=" << geometry.meshFilePath; break; } return out; } std::ostream& operator<<(std::ostream& out, const UrdfMaterial& material) { out << "Material: "; out << " Name=" << material.name << " " << material.color; if (!material.textureFilePath.empty()) out << " textureFilePath=" << material.textureFilePath; return out; } std::ostream& operator<<(std::ostream& out, const UrdfVisual& visual) { out << "Visual:" << std::endl; if (!visual.name.empty()) out << " \t \tName=" << visual.name << std::endl; out << " \t \t" << visual.origin << std::endl; out << " \t \t" << visual.geometry << std::endl; out << " \t \t" << visual.material; return out; } std::ostream& operator<<(std::ostream& out, const UrdfCollision& collision) { out << "Collision:" << std::endl; if (!collision.name.empty()) out << " \t \tName=" << collision.name << std::endl; out << " \t \t" << collision.origin << std::endl; out << " \t \t" << collision.geometry; return out; } std::ostream& operator<<(std::ostream& out, const UrdfLink& link) { out << "Link: "; out << " \tName=" << link.name << std::endl; for (auto& visual : link.visuals) { out << " \t" << visual << std::endl; } for (auto& collision : link.collisions) { out << " \t" << collision << std::endl; } out << " \t" << link.inertial << std::endl; return out; } std::ostream& operator<<(std::ostream& out, const UrdfJoint& joint) { out << "Joint: "; out << " Name=" << joint.name << std::endl; out << " \t" << joint.type << std::endl; out << " \t" << joint.origin << std::endl; out << " \tParentLinkName=" << joint.parentLinkName << std::endl; out << " \tChildLinkName=" << joint.childLinkName << std::endl; out << " \t" << joint.axis << std::endl; out << " \t" << joint.dynamics << std::endl; out << " \t" << joint.limit << std::endl; out << " \t" << joint.dontCollapse << std::endl; return out; } std::ostream& operator<<(std::ostream& out, const UrdfRobot& robot) { out << "Robot: "; out << robot.name << std::endl; for (auto& link : robot.links) { out << link.second << std::endl; } for (auto& joint : robot.joints) { out << joint.second << std::endl; } for (auto& material : robot.materials) { out << material.second << std::endl; } return out; } using namespace tinyxml2; bool parseXyz(const char* str, float& x, float& y, float& z) { if (sscanf(str, "%f %f %f", &x, &y, &z) == 3) { return true; } else { printf("*** Could not parse xyz string '%s' \n", str); return false; } } bool parseColor(const char* str, float& r, float& g, float& b, float& a) { if (sscanf(str, "%f %f %f %f", &r, &g, &b, &a) == 4) { return true; } else { printf("*** Could not parse color string '%s' \n", str); return false; } } bool parseFloat(const char* str, float& value) { if (sscanf(str, "%f", &value) == 1) { return true; } else { printf("*** Could not parse float string '%s' \n", str); return false; } } bool parseInt(const char* str, int& value) { if (sscanf(str, "%d", &value) == 1) { return true; } else { printf("*** Could not parse int string '%s' \n", str); return false; } } bool parseJointType(const char* str, UrdfJointType& type) { if (strcmp(str, "revolute") == 0) { type = UrdfJointType::REVOLUTE; } else if (strcmp(str, "continuous") == 0) { type = UrdfJointType::CONTINUOUS; } else if (strcmp(str, "prismatic") == 0) { type = UrdfJointType::PRISMATIC; } else if (strcmp(str, "fixed") == 0) { type = UrdfJointType::FIXED; } else if (strcmp(str, "floating") == 0) { type = UrdfJointType::FLOATING; } else if (strcmp(str, "planar") == 0) { type = UrdfJointType::PLANAR; } else { printf("*** Unknown joint type '%s' \n", str); return false; } return true; } bool parseJointMimic(const XMLElement& element, UrdfJointMimic& mimic) { auto jointElement = element.Attribute("joint"); if (jointElement) { mimic.joint = std::string(jointElement); } auto multiplierElement = element.Attribute("multiplier"); if (!multiplierElement || !parseFloat(multiplierElement, mimic.multiplier)) { mimic.multiplier = 1.0f; } auto offsetElement = element.Attribute("offset"); if (!offsetElement ||!parseFloat(offsetElement, mimic.offset)) { mimic.offset = 0; } return true; } bool parseOrigin(const XMLElement& element, Transform& origin) { auto originElement = element.FirstChildElement("origin"); if (originElement) { auto attribute = originElement->Attribute("xyz"); if (attribute) { if (!parseXyz(attribute, origin.p.x, origin.p.y, origin.p.z)) { // optional, use zero vector origin.p = Vec3(0.0); } } attribute = originElement->Attribute("rpy"); if (attribute) { // parse roll pitch yaw float roll = 0.0f; float pitch = 0.0f; float yaw = 0.0f; if (!parseXyz(attribute, roll, pitch, yaw)) { roll = pitch = yaw = 0.0; } // convert to transform quaternion: origin.q = rpy2quat(roll, pitch, yaw); } return true; } return false; } bool parseAxis(const XMLElement& element, UrdfAxis& axis) { auto axisElement = element.FirstChildElement("axis"); if (axisElement) { auto attribute = axisElement->Attribute("xyz"); if (attribute) { if (!parseXyz(attribute, axis.x, axis.y, axis.z)) { printf("*** xyz not specified for axis\n"); return false; } } } return true; } bool parseLimit(const XMLElement& element, UrdfLimit& limit) { auto limitElement = element.FirstChildElement("limit"); if (limitElement) { auto attribute = limitElement->Attribute("lower"); if (attribute) { if (!parseFloat(attribute, limit.lower)) { // optional, use zero if not specified limit.lower = 0.0; } } attribute = limitElement->Attribute("upper"); if (attribute) { if (!parseFloat(attribute, limit.upper)) { // optional, use zero if not specified limit.upper = 0.0; } } attribute = limitElement->Attribute("effort"); if (attribute) { if (!parseFloat(attribute, limit.effort)) { printf("*** effort not specified for limit\n"); return false; } } attribute = limitElement->Attribute("velocity"); if (attribute) { if (!parseFloat(attribute, limit.velocity)) { printf("*** velocity not specified for limit\n"); return false; } } } return true; } bool parseDynamics(const XMLElement& element, UrdfDynamics& dynamics) { auto dynamicsElement = element.FirstChildElement("dynamics"); if (dynamicsElement) { auto attribute = dynamicsElement->Attribute("damping"); if (attribute) { if (!parseFloat(attribute, dynamics.damping)) { // optional dynamics.damping = 0; } } attribute = dynamicsElement->Attribute("friction"); if (attribute) { if (!parseFloat(attribute, dynamics.friction)) { // optional dynamics.friction = 0; } } } return true; } bool parseMass(const XMLElement& element, float& mass) { auto massElement = element.FirstChildElement("mass"); if (massElement) { auto attribute = massElement->Attribute("value"); if (attribute) { if (!parseFloat(attribute, mass)) { printf("*** couldn't parse mass \n"); return false; } return true; } else { printf("*** mass missing from inertia \n"); return false; } } return false; } bool parseInertia(const XMLElement& element, UrdfInertia& inertia) { auto inertiaElement = element.FirstChildElement("inertia"); if (inertiaElement) { auto attribute = inertiaElement->Attribute("ixx"); if (attribute) { if (!parseFloat(attribute, inertia.ixx)) { return false; } } else { printf("*** ixx missing from inertia \n"); return false; } attribute = inertiaElement->Attribute("ixz"); if (attribute) { if (!parseFloat(attribute, inertia.ixz)) { return false; } } else { printf("*** ixz missing from inertia \n"); return false; } attribute = inertiaElement->Attribute("ixy"); if (attribute) { if (!parseFloat(attribute, inertia.ixy)) { return false; } } else { printf("*** ixy missing from inertia \n"); return false; } attribute = inertiaElement->Attribute("iyy"); if (attribute) { if (!parseFloat(attribute, inertia.iyy)) { return false; } } else { printf("*** iyy missing from inertia \n"); return false; } attribute = inertiaElement->Attribute("iyz"); if (attribute) { if (!parseFloat(attribute, inertia.iyz)) { return false; } } else { printf("*** iyz missing from inertia \n"); return false; } attribute = inertiaElement->Attribute("izz"); if (attribute) { if (!parseFloat(attribute, inertia.izz)) { return false; } } else { printf("*** izz missing from inertia \n"); return false; } // if we made it here, all elements were parsed successfully return true; } return false; } bool parseInertial(const XMLElement& element, UrdfInertial& inertial) { auto inertialElement = element.FirstChildElement("inertial"); if (inertialElement) { inertial.hasOrigin = parseOrigin(*inertialElement, inertial.origin); inertial.hasMass = parseMass(*inertialElement, inertial.mass); inertial.hasInertia = parseInertia(*inertialElement, inertial.inertia); } return true; } bool parseGeometry(const XMLElement& element, UrdfGeometry& geometry) { auto geometryElement = element.FirstChildElement("geometry"); if (geometryElement) { auto geometryElementChild = geometryElement->FirstChildElement(); if (strcmp(geometryElementChild->Value(), "mesh") == 0) { geometry.type = UrdfGeometryType::MESH; auto filename = geometryElementChild->Attribute("filename"); if (filename) { geometry.meshFilePath = filename; } else { printf("*** mesh geometry requires a file path \n"); return false; } auto scale = geometryElementChild->Attribute("scale"); if (scale) { if (!parseXyz(scale, geometry.scale_x, geometry.scale_y, geometry.scale_z)) { printf("*** scale is missing xyz \n"); return false; } } } else if (strcmp(geometryElementChild->Value(), "box") == 0) { geometry.type = UrdfGeometryType::BOX; auto attribute = geometryElementChild->Attribute("size"); if (attribute) { if (!parseXyz(attribute, geometry.size_x, geometry.size_y, geometry.size_z)) { printf("*** couldn't parse xyz size \n"); return false; } } else { printf("*** box geometry requires a size \n"); return false; } } else if (strcmp(geometryElementChild->Value(), "cylinder") == 0) { geometry.type = UrdfGeometryType::CYLINDER; auto attribute = geometryElementChild->Attribute("radius"); if (attribute) { if (!parseFloat(attribute, geometry.radius)) { printf("*** couldn't parse radius \n"); return false; } } else { printf("*** cylinder geometry requires a radius \n"); return false; } attribute = geometryElementChild->Attribute("length"); if (attribute) { if (!parseFloat(attribute, geometry.length)) { printf("*** couldn't parse length \n"); return false; } } else { printf("*** cylinder geometry requires a length \n"); return false; } } else if (strcmp(geometryElementChild->Value(), "capsule") == 0) { geometry.type = UrdfGeometryType::CAPSULE; auto attribute = geometryElementChild->Attribute("radius"); if (attribute) { if (!parseFloat(attribute, geometry.radius)) { printf("*** couldn't parse radius \n"); return false; } } else { printf("*** capsule geometry requires a radius \n"); return false; } attribute = geometryElementChild->Attribute("length"); if (attribute) { if (!parseFloat(attribute, geometry.length)) { printf("*** couldn't parse length \n"); return false; } } else { printf("*** capsule geometry requires a length \n"); return false; } } else if (strcmp(geometryElementChild->Value(), "sphere") == 0) { geometry.type = UrdfGeometryType::SPHERE; auto attribute = geometryElementChild->Attribute("radius"); if (attribute) { if (!parseFloat(attribute, geometry.radius)) { printf("*** couldn't parse radius \n"); return false; } } else { printf("*** sphere geometry requires a radius \n"); return false; } } } return true; } bool parseChildAttributeFloat(const tinyxml2::XMLElement& element, const char* child, const char* attribute, float& output) { auto childElement = element.FirstChildElement(child); if (childElement) { const char* s = childElement->Attribute(attribute); if (s) { return parseFloat(s, output); } } return false; } bool parseChildAttributeString(const tinyxml2::XMLElement& element, const char* child, const char* attribute, std::string& output) { auto childElement = element.FirstChildElement(child); if (childElement) { const char* s = childElement->Attribute(attribute); if (s) { output = s; return true; } } return false; } // bool parseFem(const tinyxml2::XMLElement& element, UrdfFem& fem) // { // parseOrigin(element, fem.origin); // if (!parseChildAttributeFloat(element, "density", "value", fem.density)) // fem.density = 1000.0f; // if (!parseChildAttributeFloat(element, "youngs", "value", fem.youngs)) // fem.youngs = 1.e+4f; // if (!parseChildAttributeFloat(element, "poissons", "value", fem.poissons)) // fem.poissons = 0.3f; // if (!parseChildAttributeFloat(element, "damping", "value", fem.damping)) // fem.damping = 0.0f; // if (!parseChildAttributeFloat(element, "attachDistance", "value", fem.attachDistance)) // fem.attachDistance = 0.0f; // if (!parseChildAttributeString(element, "tetmesh", "filename", fem.meshFilePath)) // fem.meshFilePath = ""; // if (!parseChildAttributeFloat(element, "scale", "value", fem.scale)) // fem.scale = 1.0f; // return true; // } bool parseMaterial(const XMLElement& element, UrdfMaterial& material) { auto materialElement = element.FirstChildElement("material"); if (materialElement) { auto name = materialElement->Attribute("name"); if (name && strlen(name) > 0) { material.name = makeValidUSDIdentifier(name); } else { if (materialElement->FirstChildElement("color")) { if (!parseColor(materialElement->FirstChildElement("color")->Attribute("rgba"), material.color.r, material.color.g, material.color.b, material.color.a)) { // optional material.color = UrdfColor(); } } if (materialElement->FirstChildElement("texture")) { auto matString = materialElement->FirstChildElement("texture")->Attribute("filename"); if (matString == nullptr) { printf("*** filename required for material with texture \n"); return false; } material.textureFilePath = matString; } } } return true; } bool parseMaterials(const XMLElement& root, std::map<std::string, UrdfMaterial>& urdfMaterials) { auto materialElement = root.FirstChildElement("material"); if (materialElement) { do { UrdfMaterial material; auto name = materialElement->Attribute("name"); if (name) { material.name = makeValidUSDIdentifier(name); } else { printf("*** Found unnamed material \n"); return false; } auto elem = materialElement->FirstChildElement("color"); if (elem) { if (!parseColor(elem->Attribute("rgba"), material.color.r, material.color.g, material.color.b, material.color.a)) { return false; } } elem = materialElement->FirstChildElement("texture"); if (elem) { auto matString = elem->Attribute("filename"); if (matString == nullptr) { printf("*** filename required for material with texture \n"); return false; } } urdfMaterials.emplace(material.name, material); } while ((materialElement = materialElement->NextSiblingElement("material"))); } return true; } bool parseLinks(const XMLElement& root, std::map<std::string, UrdfLink>& urdfLinks) { auto linkElement = root.FirstChildElement("link"); if (linkElement) { do { UrdfLink link; // name auto name = linkElement->Attribute("name"); if (name) { link.name = makeValidUSDIdentifier(name); } else { printf("*** Found unnamed link \n"); return false; } // visuals auto visualElement = linkElement->FirstChildElement("visual"); if (visualElement) { do { UrdfVisual visual; auto name = visualElement->Attribute("name"); if (name) { visual.name = makeValidUSDIdentifier(name); } if (!parseOrigin(*visualElement, visual.origin)) { // optional default to identity transform visual.origin = Transform(); } if (!parseGeometry(*visualElement, visual.geometry)) { printf("*** Found visual without geometry \n"); return false; } if (!parseMaterial(*visualElement, visual.material)) { // optional, use default if not specified visual.material = UrdfMaterial(); } link.visuals.push_back(visual); } while ((visualElement = visualElement->NextSiblingElement("visual"))); } // collisions auto collisionElement = linkElement->FirstChildElement("collision"); if (collisionElement) { do { UrdfCollision collision; auto name = collisionElement->Attribute("name"); if (name) { collision.name = makeValidUSDIdentifier(name); } if (!parseOrigin(*collisionElement, collision.origin)) { // optional default to identity transform collision.origin = Transform(); } if (!parseGeometry(*collisionElement, collision.geometry)) { printf("*** Found collision without geometry \n"); return false; } link.collisions.push_back(collision); } while ((collisionElement = collisionElement->NextSiblingElement("collision"))); } // inertia if (!parseInertial(*linkElement, link.inertial)) { // optional, use default if not specified link.inertial = UrdfInertial(); } // auto femElement = linkElement->FirstChildElement("fem"); // if (femElement) // { // do // { // UrdfFem fem; // if (!parseFem(*femElement, fem)) // { // return false; // } // link.softs.push_back(fem); // } while ((femElement = femElement->NextSiblingElement("fem"))); // } urdfLinks.emplace(link.name, link); } while ((linkElement = linkElement->NextSiblingElement("link"))); } return true; } bool parseJoints(const XMLElement& root, std::map<std::string, UrdfJoint>& urdfJoints) { for(auto jointElement = root.FirstChildElement("joint"); jointElement; jointElement = jointElement->NextSiblingElement("joint")) { UrdfJoint joint; // name auto name = jointElement->Attribute("name"); if (name) { joint.name = makeValidUSDIdentifier(name); } else { printf("*** Found unnamed joint \n"); return false; } auto type = jointElement->Attribute("type"); if (type) { if (!parseJointType(type, joint.type)) { return false; } } else { printf("*** Found untyped joint \n"); return false; } auto dontCollapse = jointElement->Attribute("dont_collapse"); if (dontCollapse) { joint.dontCollapse = dontCollapse; } else { // default: if not specified, collapse the joint joint.dontCollapse = false; } auto parentElement = jointElement->FirstChildElement("parent"); if (parentElement) { joint.parentLinkName = makeValidUSDIdentifier(parentElement->Attribute("link")); } else { printf("*** Joint has no parent link \n"); return false; } auto childElement = jointElement->FirstChildElement("child"); if (childElement) { joint.childLinkName = makeValidUSDIdentifier(childElement->Attribute("link")); } else { printf("*** Joint has no child link \n"); return false; } if (!parseOrigin(*jointElement, joint.origin)) { // optional, default to identity joint.origin = Transform(); } if (!parseAxis(*jointElement, joint.axis)) { // optional, default to (1,0,0) joint.axis = UrdfAxis(); } if (!parseLimit(*jointElement, joint.limit)) { if (joint.type == UrdfJointType::REVOLUTE || joint.type == UrdfJointType::PRISMATIC) { printf("*** limit must be specified for revolute and prismatic \n"); return false; } joint.limit = UrdfLimit(); } if (!parseDynamics(*jointElement, joint.dynamics)) { // optional joint.dynamics = UrdfDynamics(); } urdfJoints.emplace(joint.name, joint); } // Add second pass to parse mimic information for(auto jointElement = root.FirstChildElement("joint"); jointElement; jointElement = jointElement->NextSiblingElement("joint")) { auto name = jointElement->Attribute("name"); if (name) { UrdfJoint& joint = urdfJoints[makeValidUSDIdentifier(name)]; auto mimicElement = jointElement->FirstChildElement("mimic"); if (mimicElement) { if(!parseJointMimic(*mimicElement, joint.mimic)) { joint.mimic.joint = ""; } else { auto& parentJoint = urdfJoints[joint.mimic.joint]; parentJoint.mimicChildren[joint.name] = joint.mimic.offset; } } } } return true; } // bool parseSpringGroup(const XMLElement& element, UrdfSpringGroup& springGroup) // { // auto start = element.Attribute("start"); // auto count = element.Attribute("size"); // auto scale = element.Attribute("scale"); // if (!start || !parseInt(start, springGroup.springStart)) // { // return false; // } // if (!count || !parseInt(count, springGroup.springCount)) // { // return false; // } // if (!scale || !parseFloat(scale, springGroup.scale)) // { // return false; // } // return true; // } // bool parseSoftActuators(const XMLElement& root, std::vector<UrdfSoft1DActuator>& urdfActs) // { // auto actuatorElement = root.FirstChildElement("actuator"); // while (actuatorElement) // { // auto name = actuatorElement->Attribute("name"); // auto type = actuatorElement->Attribute("type"); // if (type) // { // if (strcmp(type, "pneumatic1D") == 0) // { // UrdfSoft1DActuator act; // act.name = std::string(name); // act.link = std::string(actuatorElement->Attribute("link")); // auto gains = actuatorElement->FirstChildElement("gains"); // auto thresholds = actuatorElement->FirstChildElement("thresholds"); // auto springGroups = actuatorElement->FirstChildElement("springGroups"); // auto maxPressure = actuatorElement->Attribute("maxPressure"); // if (!maxPressure || !parseFloat(maxPressure, act.maxPressure)) // { // act.maxPressure = 0.0f; // } // if (gains) // { // auto inflate = gains->Attribute("inflate"); // auto deflate = gains->Attribute("deflate"); // if (!inflate || !parseFloat(inflate, act.inflateGain)) // { // act.inflateGain = 1.0f; // } // if (!deflate || !parseFloat(deflate, act.deflateGain)) // { // act.deflateGain = 1.0f; // } // } // if (thresholds) // { // auto deflate = thresholds->Attribute("deflate"); // auto deactivate = thresholds->Attribute("deactivate"); // if (!deflate || !parseFloat(deflate, act.deflateThreshold)) // { // act.deflateThreshold = 1.0f; // } // if (!deactivate || !parseFloat(deactivate, act.deactivateThreshold)) // { // act.deactivateThreshold = 1.0e-2f; // } // } // if (springGroups) // { // auto springGroup = springGroups->FirstChildElement("springGroup"); // while (springGroup) // { // UrdfSpringGroup sg; // if (parseSpringGroup(*springGroup, sg)) // { // act.springGroups.push_back(sg); // } // springGroup = springGroup->NextSiblingElement("springGroup"); // } // } // if (maxPressure && gains && thresholds && springGroups) // urdfActs.push_back(act); // else // { // printf("*** unable to parse soft actuator %s \n", act.name.c_str()); // return false; // } // } // } // actuatorElement = actuatorElement->NextSiblingElement("actuator"); // } // return true; // } bool parseRobot(const XMLElement& root, UrdfRobot& urdfRobot) { auto name = root.Attribute("name"); if (name) { urdfRobot.name = makeValidUSDIdentifier(name); } urdfRobot.links.clear(); urdfRobot.joints.clear(); urdfRobot.materials.clear(); if (!parseMaterials(root, urdfRobot.materials)) { return false; } if (!parseLinks(root, urdfRobot.links)) { return false; } if (!parseJoints(root, urdfRobot.joints)) { return false; } // if (!parseSoftActuators(root, urdfRobot.softActuators)) // { // return false; // } return true; } bool parseUrdf(const std::string& urdfPackagePath, const std::string& urdfFileRelativeToPackage, UrdfRobot& urdfRobot) { std::string path; // #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) // path = GetFilePathByPlatform((urdfPackagePath + "\\" + urdfFileRelativeToPackage).c_str()); //#else // path = GetFilePathByPlatform((urdfPackagePath + "/" + urdfFileRelativeToPackage).c_str()); //#endif path = urdfPackagePath + "/" + urdfFileRelativeToPackage; CARB_LOG_INFO("Loading URDF at '%s'", path.c_str()); // Weird stack smashing error with tinyxml2 when the descructor is called static tinyxml2::XMLDocument doc; if (doc.LoadFile(path.c_str()) != XML_SUCCESS) { printf("*** Failed to load '%s'", path.c_str()); return false; } XMLElement* root = doc.RootElement(); if (!root) { printf("*** Empty document '%s' \n", path.c_str()); return false; } if (!parseRobot(*root, urdfRobot)) { return false; } // std::cout << urdfRobot << std::endl; return true; } } // namespace urdf } }
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/plugins/parse/UrdfParser.h
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #pragma once #include "../UrdfTypes.h" #include <tinyxml2.h> namespace omni { namespace importer { namespace urdf { // Parsers bool parseJointType(const std::string& str, UrdfJointType& type); bool parseOrigin(const tinyxml2::XMLElement& element, Transform& origin); bool parseAxis(const tinyxml2::XMLElement& element, UrdfAxis& axis); bool parseLimit(const tinyxml2::XMLElement& element, UrdfLimit& limit); bool parseDynamics(const tinyxml2::XMLElement& element, UrdfDynamics& dynamics); bool parseMass(const tinyxml2::XMLElement& element, float& mass); bool parseInertia(const tinyxml2::XMLElement& element, UrdfInertia& inertia); bool parseInertial(const tinyxml2::XMLElement& element, UrdfInertial& inertial); bool parseGeometry(const tinyxml2::XMLElement& element, UrdfGeometry& geometry); bool parseMaterial(const tinyxml2::XMLElement& element, UrdfMaterial& material); bool parseMaterials(const tinyxml2::XMLElement& root, std::map<std::string, UrdfMaterial>& urdfMaterials); bool parseLinks(const tinyxml2::XMLElement& root, std::map<std::string, UrdfLink>& urdfLinks); bool parseJoints(const tinyxml2::XMLElement& root, std::map<std::string, UrdfJoint>& urdfJoints); bool parseUrdf(const std::string& urdfPackagePath, const std::string& urdfFileRelativeToPackage, UrdfRobot& urdfRobot); } // namespace urdf } }
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/docs/CHANGELOG.md
# Changelog ## [1.1.4] - 2023-10-18 ### Changed - Update code dependencies ## [1.1.3] - 2023-10-02 ### Changed - Mesh path parser now allows for prefixes other than "package://" ## [1.1.2] - 2023-08-21 ### Added - Added processing of capsule bodies to replace cylinders ### Fixed - Fixed computation of joint axis. Earlier arbitrary axis were not supported. - Fixed bug in merging joints when multiple levels of fixed joints exist. ## [1.1.1] - 2023-08-08 ### Added - Added support for the boolean attribute ``<joint dont_collapse>``: setting this parameter to true in the URDF joint tag prevents the child link from collapsing when the associated joint type is "fixed". ## [1.1.0] - 2023-08-04 ### Added - Suport for direct mimic joints - Maintain Merged Links as frames inside parent rigid body ### Fixed - Arbitrary joint axis were adding random 56.7 rotation degrees in the joint axis orientation ## [1.0.0] - 2023-07-03 ### Changed - Renamed the extension to omni.importer.urdf - Published the extension to the default registry ## [0.5.16] - 2023-06-27 ### Fixed - Support for arbitrary joint axis. ## [0.5.15] - 2023-06-26 ### Fixed - Support for non-diagonal inertia matrix - Support for convex decomposition mesh collision method ## [0.5.14] - 2023-06-13 ### Fixed - Kit 105.1 update - Accessing primvars is accessed through the PrimvarsAPI instead of usd convenience functions ## [0.5.13] - 2023-06-07 ### Fixed - Crash when name was not provided for a material, added check for null pointer and unit test ## [0.5.12] - 2023-05-16 ### Fixed - Removed duplicated code to copy collision geometry from the mesh visuals. ## [0.5.11] - 2023-05-06 ### Added - Collision geometry from visual meshes. ## [0.5.10] - 2023-05-04 ### Added - Code overview and limitations in README. ## [0.5.9] - 2023-02-28 ### Fixed - Appearance of carb warnings when setting the joint damping and stiffness to 0 for `NONE` drive type ## [0.5.8] - 2023-02-22 ### Fixed - removed max joint effort scaling by 60 during import - removed custom collision api when the shape is a cylinder ## [0.5.7] - 2023-02-17 ### Added - Unit test for joint limits. - URDF data file for joint limit unit test (test_limits.urdf) ## [0.5.6] - 2023-02-14 ### Fixed - Imported negative URDF effort and velocity joint constraints set the physics constraint value to infinity. ## [0.5.5] - 2023-01-06 ### Fixed - onclick_fn warning when creating UI ## [0.5.4] - 2022-10-13 ### Fixed - Fixes materials on instanceable imports ## [0.5.3] - 2022-10-13 ### Fixed - Added Test for import stl with custom material ## [0.5.2] - 2022-09-07 ### Fixed - Fixes for kit 103.5 ## [0.5.1] - 2022-01-02 ### Changed - Use omni.kit.viewport.utility when setting camera ## [0.5.0] - 2022-08-30 ### Changed - Remove direct legacy viewport calls ## [0.4.1] - 2022-08-30 ### Changed - Modified default gains in URDF -> USD converter to match gains for Franka and UR10 robots ## [0.4.0] - 2022-08-09 ### Added - Cobotta 900 urdf data files ## [0.3.1] - 2022-08-08 ### Fixed - Missing argument in example docstring ## [0.3.0] - 2022-07-09 ### Added - Add instanceable option to importer ## [0.2.2] - 2022-06-02 ### Changed - Fix title for file picker ## [0.2.1] - 2022-05-23 ### Changed - Fix units for samples ## [0.2.0] - 2022-05-17 ### Changed - Add joint values API ## [0.1.16] - 2022-04-19 ### Changed - Add Texture import compatibility for Windows. ## [0.1.16] - 2022-02-08 ### Changed - Revamped UI ## [0.1.15] - 2021-12-20 ### Changed - Fixed bug where missing mesh on part with urdf material assigned would crash on material binding in a non-existing prim. ## [0.1.14] - 2021-12-20 ### Changed - Fix bug where material was indexed by name and removing false duplicates. - Add Normal subdivision group import parameter. ## [0.1.13] - 2021-12-10 ### Changed - Texture support for OBJ and Collada assets. - Remove bug where an invalid link on a joint would stop importing the remainder of the urdf. raises an error message instead. ## [0.1.12] - 2021-12-03 ### Changed - Default to save Imported assets on a new USD and reference it on open stage. - Change base robot prim to also use orientOP instead of rotateOP - Change behavior where any stage event (e.g selection changed) was resetting some options on the UI ## [0.1.11] - 2021-11-29 ### Changed - Use double precision for xform ops to match isaac sim defaults ## [0.1.10] - 2021-11-04 ### Changed - create physics scene is false for import config - create physics scene will not create a scene if one exists - set default prim is false for import config ## [0.1.9] - 2021-10-25 ### Added - Support to specify usd paths for urdf meshes. ### Changed - distance_scale sets the stage to the same units for consistency - None drive mode still applies DriveAPI, but keeps the stiffness/damping at zero - rootJoint prim is renamed to root_joint for consistency with other joint names. ### Fixed - warnings when setting attributes as double when they should have been float ## [0.1.8] - 2021-10-18 ### Added - Floating joints are ignored but place any child links at the correct location. ### Fixed - Crash when urdf contained a floating joint ## [0.1.7] - 2021-09-23 ### Added - Default position drive damping to UI ### Fixed - Default config parameters are now respected ## [0.1.6] - 2021-08-31 ### Changed - Updated to New UI - Spheres and Cubes are treated as shapes - Cylinders are by default imported with custom geometry enabled - Joint drives are default force instead of acceleration ### Fixed - Meshes were not imported correctly, fixed subdivision scheme setting ### Removed - Parsing URDF is not a separate step with its own UI ## [0.1.5] - 2021-07-30 ### Fixed - Zero joint velocity issue - Artifact when dragging URDF file due to transform matrix ## [0.1.4] - 2021-06-09 ### Added - Fixed bugs with default density ## [0.1.3] - 2021-05-26 ### Added - Fixed bugs with import units - Streamlined UI and fixed missing elements - Fixed issues with creating new stage on import ## [0.1.2] - 2020-12-11 ### Added - Unit tests to extension - Add test urdf files - Fix unit issues with samples - Fix unit conversion issue with import ## [0.1.1] - 2020-12-03 ### Added - Sample URDF files for carter, franka ur10 and kaya ## [0.1.0] - 2020-12-03 ### Added - Initial version of URDF importer extension
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/docs/index.rst
URDF Import Extension [omni.importer.urdf] ########################################## URDF Import Commands ==================== The following commands can be used to simplify the import process. Below is a sample demonstrating how to import the Carter URDF included with this extension .. code-block:: python :linenos: import omni.kit.commands from pxr import UsdLux, Sdf, Gf, UsdPhysics, PhysicsSchemaTools # setting up import configuration: status, import_config = omni.kit.commands.execute("URDFCreateImportConfig") import_config.merge_fixed_joints = False import_config.convex_decomp = False import_config.import_inertia_tensor = True import_config.fix_base = False import_config.collision_from_visuals = False # Get path to extension data: ext_manager = omni.kit.app.get_app().get_extension_manager() ext_id = ext_manager.get_enabled_extension_id("omni.importer.urdf") extension_path = ext_manager.get_extension_path(ext_id) # import URDF omni.kit.commands.execute( "URDFParseAndImportFile", urdf_path=extension_path + "/data/urdf/robots/carter/urdf/carter.urdf", import_config=import_config, ) # get stage handle stage = omni.usd.get_context().get_stage() # enable physics scene = UsdPhysics.Scene.Define(stage, Sdf.Path("/physicsScene")) # set gravity scene.CreateGravityDirectionAttr().Set(Gf.Vec3f(0.0, 0.0, -1.0)) scene.CreateGravityMagnitudeAttr().Set(9.81) # add ground plane PhysicsSchemaTools.addGroundPlane(stage, "/World/groundPlane", "Z", 1500, Gf.Vec3f(0, 0, -50), Gf.Vec3f(0.5)) # add lighting distantLight = UsdLux.DistantLight.Define(stage, Sdf.Path("/DistantLight")) distantLight.CreateIntensityAttr(500) .. automodule:: omni.importer.urdf.scripts.commands :members: :undoc-members: :exclude-members: do, undo .. automodule:: omni.importer.urdf._urdf .. autoclass:: omni.importer.urdf._urdf.Urdf :members: :undoc-members: :no-show-inheritance: .. autoclass:: omni.importer.urdf._urdf.ImportConfig :members: :undoc-members: :no-show-inheritance:
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/docs/Overview.md
# Usage To enable this extension, go to the Extension Manager menu and enable omni.importer.urdf extension. # High Level Code Overview ## Python The URDF Importer extension sets attributes of `ImportConfig` on initialization, along with the UI giving the user options to change certain attributes. The complete list of configs can be found in `bindings/BindingsUrdfPython.cpp`. When the import button is pressed, the `URDFParseAndImportFile` command from `python/commands.py` is invoked; this first calls `URDFParseFile` command, which binds to `parseUrdf` in `plugins/Urdf.cpp`. It then runs `import_robot` which binds to `importRobot` in `plugins/Urdf.cpp`. ## C++ ### `parseUrdf` in `plugins/Urdf.cpp` Calls `parseUrdf` in `plugins/UrdfParser.cpp`, which parses the URDF file using tinyxml2 and calls `parseRobot` in the same file. `parseRobot` writes to the `urdfRobot` class, which is an the internal data structure that contains the name, the links, the joints, and the materials of the robot. It first parses materials, which are stored in a map between material name and `UrdfMaterial` class that contains the material name, the color, and the texture file path. It then parses the links, which are stored in a map between the link name and `UrdfLink` class containing the name, the inertial, visual mesh, and collision mesh. It finally parses the joints and store each joint in `UrdfJoint`. Note that for joints, if there is no axis specified, the axis defaults to (1,0,0). If there is no origin, it defaults to the identity transformation. ### `importRobot` in `plugins/Urdf.cpp` Initializes `urdfImporter` class defined in `plugins/UrdfImporter.h`. Calls `urdfImporter.addToStage`, which does the following: - Creates a physics scene if desired in the config - Creates a new prim that represents the robot and applies Articulation API, enables self-collision is set in the config, and sets the position and velocity iteraiton count to 32 and 16 by default. - Sets the robot prim as the default prim if desired in the config - Initializes a `KinematicChain` object from `plugins/KinematicChain.h` and calls `computeKinematicChain` given the `urdfRobot`. `computeKinematicChain` first finds the base link and calls `computeChildNodes` recursively to populate the entire kinematic chain. - If the asset needs to be made instanceable, it will create a new stage, go through every link in the kinematic chain, import the meshes onto the new stage, and save the new stage as a USD file at the specified path. Details regarding instanceable assets can be found here: https://docs.omniverse.nvidia.com/app_isaacsim/app_isaacsim/tutorial_gym_instanceable_assets.html - Recursively calls `addLinksAndJoints` along the entire kinematic chain to add the link and joint prims on stage. # Limitations - The URDF importer can only import robots that can be represented with a kinematic tree and hence cannot handle parallel robots. However, this is a limitation of the URDF format itself as opposed to a limitation of the URDF importer. For parallel robots, please consider switching to using [MJCF](https://mujoco.readthedocs.io/en/stable/modeling.html) along with the [MJCF importer](https://docs.omniverse.nvidia.com/app_isaacsim/app_isaacsim/ext_omni_isaac_mjcf.html). - The URDF importer does not currently support the `planar` joint type. In order to achieve a planar movement, please define two prismatic joints in tandem in place of a planar joint. - The URDF importer does not support `<mimic>` for joints. However, a mimicing joint effect can be achieved manually in code by setting the joint target value to <em>multiplier * other_joint_value + offset</em>.
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/objects/cube.urdf
<?xml version="1.0"?> <robot name="object"> <link name="object"> <visual> <origin xyz="0 0 0"/> <geometry> <box size="0.05 0.05 0.05"/> </geometry> </visual> <collision> <origin xyz="0 0 0"/> <geometry> <box size="0.05 0.05 0.05"/> </geometry> </collision> <inertial> <mass value="0.5"/> <inertia ixx="0.05" ixy="0.0" ixz="0.0" iyy="0.05" iyz="0.0" izz="0.05"/> </inertial> </link> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/objects/square_table.urdf
<?xml version="1.0"?> <robot name="box"> <link name="box"> <visual> <origin xyz="0 0 0"/> <geometry> <box size="0.4 0.4 0.3"/> </geometry> </visual> <collision> <origin xyz="0 0 0"/> <geometry> <box size="0.4 0.4 0.3"/> </geometry> </collision> <inertial> <mass value="500"/> <friction value="1.0"/> <inertia ixx="1000.0" ixy="0.0" ixz="0.0" iyy="1000.0" iyz="0.0" izz="1000.0"/> </inertial> </link> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/objects/small_ball.urdf
<?xml version="1.0"?> <robot name="ball"> <link name="ball"> <visual> <origin xyz="0 0 0"/> <geometry> <sphere radius="0.01"/> </geometry> </visual> <collision> <origin xyz="0 0 0"/> <geometry> <sphere radius="0.01"/> </geometry> </collision> <inertial> <mass value="0.5"/> <inertia ixx="0.01" ixy="0.0" ixz="0.0" iyy="0.01" iyz="0.0" izz="0.01"/> </inertial> </link> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/objects/ball.urdf
<?xml version="1.0"?> <robot name="ball"> <link name="ball"> <visual> <origin xyz="0 0 0"/> <geometry> <sphere radius="0.2"/> </geometry> </visual> <collision> <origin xyz="0 0 0"/> <geometry> <sphere radius="0.2"/> </geometry> </collision> <inertial> <mass value="0.5"/> <inertia ixx="0.01" ixy="0.0" ixz="0.0" iyy="0.01" iyz="0.0" izz="0.01"/> </inertial> </link> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/tests/test_missing.urdf
<?xml version="1.0" encoding="UTF-8"?> <robot name="test_missing"> <material name="gray"> <color rgba="0.2 0.2 0.2 1.0"/> </material> <link name="cube"> <visual> <origin rpy="0 0 0" xyz="0 0 0" /> <geometry> <mesh filename="does_not/exist.obj" /> </geometry> <material name="gray"/> </visual> </link> <link name="cube2"> <visual> <origin rpy="0 0 0" xyz="0 0 0" /> <geometry> <mesh filename="does_not/exist.obj" /> </geometry> </visual> </link> <joint name="fixed" type="fixed"> <parent link="cube"/> <child link="cube2"/> </joint> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/tests/test_material.urdf
<?xml version="1.0" encoding="UTF-8"?> <robot name="test_material"> <link name="base"> <visual> <geometry> <box size="0.001 4.0 4.0 "/> </geometry> <material> <color rgba="1.0 0. 0. 1.0"/> </material> </visual> </link> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/tests/test_large.urdf
<?xml version="1.0" encoding="UTF-8"?> <robot name="test_large"> <link name="link_0" /> <link name="link_1" /> <link name="link_2" /> <link name="link_3" /> <link name="link_4" /> <link name="link_5" /> <link name="link_6" /> <link name="link_7" /> <link name="link_8" /> <link name="link_9" /> <link name="link_10" /> <link name="link_11" /> <link name="link_12" /> <link name="link_13" /> <link name="link_14" /> <link name="link_15" /> <link name="link_16" /> <link name="link_17" /> <link name="link_18" /> <link name="link_19" /> <link name="link_20" /> <link name="link_21" /> <link name="link_22" /> <link name="link_23" /> <link name="link_24" /> <link name="link_25" /> <link name="link_26" /> <link name="link_27" /> <link name="link_28" /> <link name="link_29" /> <link name="link_30" /> <link name="link_31" /> <link name="link_32" /> <link name="link_33" /> <link name="link_34" /> <link name="link_35" /> <link name="link_36" /> <link name="link_37" /> <link name="link_38" /> <link name="link_39" /> <link name="link_40" /> <link name="link_41" /> <link name="link_42" /> <link name="link_43" /> <link name="link_44" /> <link name="link_45" /> <link name="link_46" /> <link name="link_47" /> <link name="link_48" /> <link name="link_49" /> <link name="link_50" /> <link name="link_51" /> <link name="link_52" /> <link name="link_53" /> <link name="link_54" /> <link name="link_55" /> <link name="link_56" /> <link name="link_57" /> <link name="link_58" /> <link name="link_59" /> <link name="link_60" /> <link name="link_61" /> <link name="link_62" /> <link name="link_63" /> <!-- <link name="link_64" /> --> <joint name="joint_0" type="fixed"> <parent link="link_0" /> <child link="link_1" /> </joint> <joint name="joint_1" type="fixed"> <parent link="link_1" /> <child link="link_2" /> </joint> <joint name="joint_2" type="fixed"> <parent link="link_2" /> <child link="link_3" /> </joint> <joint name="joint_3" type="fixed"> <parent link="link_3" /> <child link="link_4" /> </joint> <joint name="joint_4" type="fixed"> <parent link="link_4" /> <child link="link_5" /> </joint> <joint name="joint_5" type="fixed"> <parent link="link_5" /> <child link="link_6" /> </joint> <joint name="joint_6" type="fixed"> <parent link="link_6" /> <child link="link_7" /> </joint> <joint name="joint_7" type="fixed"> <parent link="link_7" /> <child link="link_8" /> </joint> <joint name="joint_8" type="fixed"> <parent link="link_8" /> <child link="link_9" /> </joint> <joint name="joint_9" type="fixed"> <parent link="link_9" /> <child link="link_10" /> </joint> <joint name="joint_10" type="fixed"> <parent link="link_10" /> <child link="link_11" /> </joint> <joint name="joint_11" type="fixed"> <parent link="link_11" /> <child link="link_12" /> </joint> <joint name="joint_12" type="fixed"> <parent link="link_12" /> <child link="link_13" /> </joint> <joint name="joint_13" type="fixed"> <parent link="link_13" /> <child link="link_14" /> </joint> <joint name="joint_14" type="fixed"> <parent link="link_14" /> <child link="link_15" /> </joint> <joint name="joint_15" type="fixed"> <parent link="link_15" /> <child link="link_16" /> </joint> <joint name="joint_16" type="fixed"> <parent link="link_16" /> <child link="link_17" /> </joint> <joint name="joint_17" type="fixed"> <parent link="link_17" /> <child link="link_18" /> </joint> <joint name="joint_18" type="fixed"> <parent link="link_18" /> <child link="link_19" /> </joint> <joint name="joint_19" type="fixed"> <parent link="link_19" /> <child link="link_20" /> </joint> <joint name="joint_20" type="fixed"> <parent link="link_20" /> <child link="link_21" /> </joint> <joint name="joint_21" type="fixed"> <parent link="link_21" /> <child link="link_22" /> </joint> <joint name="joint_22" type="fixed"> <parent link="link_22" /> <child link="link_23" /> </joint> <joint name="joint_23" type="fixed"> <parent link="link_23" /> <child link="link_24" /> </joint> <joint name="joint_24" type="fixed"> <parent link="link_24" /> <child link="link_25" /> </joint> <joint name="joint_25" type="fixed"> <parent link="link_25" /> <child link="link_26" /> </joint> <joint name="joint_26" type="fixed"> <parent link="link_26" /> <child link="link_27" /> </joint> <joint name="joint_27" type="fixed"> <parent link="link_27" /> <child link="link_28" /> </joint> <joint name="joint_28" type="fixed"> <parent link="link_28" /> <child link="link_29" /> </joint> <joint name="joint_29" type="fixed"> <parent link="link_29" /> <child link="link_30" /> </joint> <joint name="joint_30" type="fixed"> <parent link="link_30" /> <child link="link_31" /> </joint> <joint name="joint_31" type="fixed"> <parent link="link_31" /> <child link="link_32" /> </joint> <joint name="joint_32" type="fixed"> <parent link="link_32" /> <child link="link_33" /> </joint> <joint name="joint_33" type="fixed"> <parent link="link_33" /> <child link="link_34" /> </joint> <joint name="joint_34" type="fixed"> <parent link="link_34" /> <child link="link_35" /> </joint> <joint name="joint_35" type="fixed"> <parent link="link_35" /> <child link="link_36" /> </joint> <joint name="joint_36" type="fixed"> <parent link="link_36" /> <child link="link_37" /> </joint> <joint name="joint_37" type="fixed"> <parent link="link_37" /> <child link="link_38" /> </joint> <joint name="joint_38" type="fixed"> <parent link="link_38" /> <child link="link_39" /> </joint> <joint name="joint_39" type="fixed"> <parent link="link_39" /> <child link="link_40" /> </joint> <joint name="joint_40" type="fixed"> <parent link="link_40" /> <child link="link_41" /> </joint> <joint name="joint_41" type="fixed"> <parent link="link_41" /> <child link="link_42" /> </joint> <joint name="joint_42" type="fixed"> <parent link="link_42" /> <child link="link_43" /> </joint> <joint name="joint_43" type="fixed"> <parent link="link_43" /> <child link="link_44" /> </joint> <joint name="joint_44" type="fixed"> <parent link="link_44" /> <child link="link_45" /> </joint> <joint name="joint_45" type="fixed"> <parent link="link_45" /> <child link="link_46" /> </joint> <joint name="joint_46" type="fixed"> <parent link="link_46" /> <child link="link_47" /> </joint> <joint name="joint_47" type="fixed"> <parent link="link_47" /> <child link="link_48" /> </joint> <joint name="joint_48" type="fixed"> <parent link="link_48" /> <child link="link_49" /> </joint> <joint name="joint_49" type="fixed"> <parent link="link_49" /> <child link="link_50" /> </joint> <joint name="joint_50" type="fixed"> <parent link="link_50" /> <child link="link_51" /> </joint> <joint name="joint_51" type="fixed"> <parent link="link_51" /> <child link="link_52" /> </joint> <joint name="joint_52" type="fixed"> <parent link="link_52" /> <child link="link_53" /> </joint> <joint name="joint_53" type="fixed"> <parent link="link_53" /> <child link="link_54" /> </joint> <joint name="joint_54" type="fixed"> <parent link="link_54" /> <child link="link_55" /> </joint> <joint name="joint_55" type="fixed"> <parent link="link_55" /> <child link="link_56" /> </joint> <joint name="joint_56" type="fixed"> <parent link="link_56" /> <child link="link_57" /> </joint> <joint name="joint_57" type="fixed"> <parent link="link_57" /> <child link="link_58" /> </joint> <joint name="joint_58" type="fixed"> <parent link="link_58" /> <child link="link_59" /> </joint> <joint name="joint_59" type="fixed"> <parent link="link_59" /> <child link="link_60" /> </joint> <joint name="joint_60" type="fixed"> <parent link="link_60" /> <child link="link_61" /> </joint> <joint name="joint_61" type="fixed"> <parent link="link_61" /> <child link="link_62" /> </joint> <joint name="joint_62" type="fixed"> <parent link="link_62" /> <child link="link_63" /> </joint> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/tests/differential_base.urdf
<?xml version="1.0" encoding="UTF-8"?> <robot name="differential_base"> <link name="chassis"> <visual> <origin rpy="0 0 0" xyz="0 0 0" /> <geometry> <box size=".5 .5 .5"/> </geometry> </visual> <collision> <origin rpy="0 0 0" xyz= "0 0 0" /> <geometry> <box size=".5 .5 .5"/> </geometry> </collision> <inertial> <mass value="10" /> </inertial> </link> <link name="left_wheel_link"> <visual> <origin rpy="0 0 0" xyz="0 0 0" /> <geometry> <sphere radius = "0.5"/> </geometry> </visual> <collision> <origin rpy="0 0 0" xyz="0 0 0" /> <geometry> <sphere radius = "0.5"/> </geometry> </collision> <inertial> <mass value="1" /> </inertial> </link> <link name="right_wheel_link"> <visual> <origin rpy="0 0 0" xyz="0 0 0" /> <geometry> <sphere radius = "0.5"/> </geometry> </visual> <collision> <origin rpy="0 0 0" xyz="0 0 0" /> <geometry> <sphere radius = "0.5"/> </geometry> </collision> <inertial> <mass value="1" /> </inertial> </link> <joint name="left_wheel" type="continuous"> <origin rpy="0 0 0" xyz="0 0.5 0" /> <axis xyz="0 1 0" /> <parent link="chassis" /> <child link="left_wheel_link" /> </joint> <joint name="right_wheel" type="continuous"> <origin rpy="0 0 0" xyz="0 -0.5 0" /> <axis xyz="0 1 0" /> <parent link="chassis" /> <child link="right_wheel_link" /> </joint> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/tests/test_floating.urdf
<?xml version="1.0" encoding="UTF-8"?> <robot name="test_floating"> <link name="root_link"/> <joint name="root_to_base" type="fixed"> <parent link="root_link"/> <child link="base_link"/> </joint> <link name="base_link"> <visual> <geometry> <sphere radius="0.2"/> </geometry> </visual> <collision> <geometry> <sphere radius="0.2"/> </geometry> </collision> <inertial> <mass value="10"/> <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/> </inertial> </link> <joint name="base_joint" type="continuous"> <parent link="base_link"/> <child link="link_1"/> <axis xyz="0 0 1"/> <origin xyz="0 0 0.45"/> </joint> <link name="link_1"> <visual> <geometry> <cylinder length="0.8" radius=".1"/> </geometry> </visual> <collision> <geometry> <cylinder length="0.8" radius=".1"/> </geometry> </collision> <inertial> <mass value="10"/> <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/> </inertial> </link> <link name="floating_link"> <visual> <geometry> <cylinder length="0.8" radius=".1"/> </geometry> <material name="green"/> </visual> <collision> <geometry> <cylinder length="0.8" radius=".1"/> </geometry> </collision> <inertial> <mass value="10"/> <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/> </inertial> </link> <joint name="floating_joint" type="floating"> <parent link="link_1"/> <child link="floating_link"/> <origin xyz="0.0 0.0 1.0"/> </joint> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/tests/test_limits.urdf
<?xml version="1.0" encoding="UTF-8"?> <robot name="test_limits"> <link name="root_link"/> <joint name="root_to_base" type="fixed"> <parent link="root_link"/> <child link="base_link"/> </joint> <link name="base_link"> <visual> <geometry> <sphere radius="0.2"/> </geometry> </visual> <collision> <geometry> <sphere radius="0.2"/> </geometry> </collision> <inertial> <mass value="10"/> <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/> </inertial> </link> <joint name="base_joint" type="continuous"> <parent link="base_link"/> <child link="link_1"/> <axis xyz="0 0 1"/> <origin xyz="0 0 0.45"/> </joint> <link name="link_1"> <visual> <geometry> <cylinder length="0.8" radius=".1"/> </geometry> </visual> <collision> <geometry> <cylinder length="0.8" radius=".1"/> </geometry> </collision> <inertial> <mass value="10"/> <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/> </inertial> </link> <joint name="elbow_joint" type="revolute"> <parent link="link_1"/> <child link="link_2"/> <limit effort="1000.0" lower="-0.6" upper="0.6" velocity="-1.0"/> <origin xyz="0 0 0.4" rpy="1.571 0 0"/> <axis xyz="1 0 0"/> </joint> <link name="link_2"> <visual> <geometry> <cylinder length="0.6" radius=".06"/> </geometry> </visual> <collision> <geometry> <cylinder length="0.6" radius=".06"/> </geometry> </collision> <inertial> <mass value="10"/> <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/> </inertial> </link> <joint name="wrist_joint" type="continuous"> <parent link="link_2"/> <child link="palm_link"/> <origin xyz="0 0 0.33"/> <axis xyz="0 0 1"/> </joint> <link name="palm_link"> <visual> <geometry> <box size="0.2 .06 .06"/> </geometry> </visual> <collision> <geometry> <box size="0.2 .06 .06"/> </geometry> </collision> <inertial> <mass value="10"/> <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/> </inertial> </link> <joint name="finger_1_joint" type="prismatic"> <parent link="palm_link"/> <child link="finger_link_1"/> <limit effort="-1.0" lower="-0.02" upper="0.08" velocity="0.5"/> <origin rpy="0 1.571 0" xyz="-0.10 0 0.05"/> <axis xyz="0 0 1"/> </joint> <link name="finger_link_1"> <visual> <geometry> <box size="0.06 .01 .01"/> </geometry> </visual> <collision> <geometry> <box size="0.06 .1 .1"/> </geometry> </collision> <inertial> <mass value="3"/> <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/> </inertial> </link> <joint name="finger_2_joint" type="prismatic"> <parent link="palm_link"/> <child link="finger_link_2"/> <limit effort="-1.0" lower="-0.08" upper="0.02" velocity="-1.0"/> <origin rpy="0 1.571 0" xyz="0.10 0 0.05"/> <axis xyz="0 0 1"/> </joint> <link name="finger_link_2"> <visual> <geometry> <box size="0.06 .01 .01"/> </geometry> </visual> <collision> <geometry> <box size="0.06 .1 .1"/> </geometry> </collision> <inertial> <mass value="3"/> <inertia ixx="2.0" ixy="0.0" ixz="0.0" iyy="3.0" iyz="0.0" izz="4.0"/> </inertial> </link> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/tests/test_merge_joints.urdf
<?xml version="1.0" encoding="UTF-8"?> <robot name="test_merge_joints"> <link name="root_link"/> <joint name="root_to_base" type="fixed"> <parent link="root_link"/> <child link="base_link"/> </joint> <link name="base_link"> <visual> <geometry> <box size="0.3 .3 .2"/> </geometry> </visual> <collision> <geometry> <box size="0.3 .3 .2"/> </geometry> </collision> <inertial> <mass value="10"/> <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/> </inertial> </link> <joint name="base_joint" type="continuous"> <parent link="base_link"/> <child link="link_1"/> <axis xyz="0 0 1"/> <origin xyz="0 0 0.45"/> </joint> <link name="link_1"> <visual> <geometry> <cylinder length="0.8" radius=".1"/> </geometry> </visual> <collision> <geometry> <cylinder length="0.8" radius=".1"/> </geometry> </collision> <inertial> <mass value="10"/> <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/> </inertial> </link> <joint name="elbow_joint" type="fixed"> <parent link="link_1"/> <child link="link_2"/> <limit effort="1000.0" lower="-0.6" upper="0.6" velocity="0.5"/> <origin xyz="0 0 0.4" rpy="1.571 0 0"/> <axis xyz="1 0 0"/> </joint> <link name="link_2"> <visual> <geometry> <cylinder length="0.6" radius=".06"/> </geometry> </visual> <collision> <geometry> <cylinder length="0.6" radius=".06"/> </geometry> </collision> <inertial> <mass value="10"/> <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/> </inertial> </link> <joint name="wrist_joint" type="fixed"> <parent link="link_2"/> <child link="palm_link"/> <origin xyz="0 0 0.33"/> <axis xyz="0 0 1"/> </joint> <link name="palm_link"> <visual> <geometry> <box size="0.2 .06 .06"/> </geometry> </visual> <collision> <geometry> <box size="0.2 .06 .06"/> </geometry> </collision> <inertial> <mass value="10"/> <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/> </inertial> </link> <joint name="finger_1_joint" type="prismatic"> <parent link="palm_link"/> <child link="finger_link_1"/> <limit effort="1000.0" lower="-0.02" upper="0.08" velocity="0.5"/> <origin rpy="0 1.571 0" xyz="-0.10 0 0.05"/> <axis xyz="0 0 1"/> </joint> <link name="finger_link_1"> <visual> <geometry> <box size="0.06 .01 .01"/> </geometry> </visual> <collision> <geometry> <box size="0.06 .1 .1"/> </geometry> </collision> <inertial> <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/> </inertial> </link> <joint name="finger_2_joint" type="prismatic"> <parent link="palm_link"/> <child link="finger_link_2"/> <limit effort="1000.0" lower="-0.08" upper="0.02" velocity="0.5"/> <origin rpy="0 1.571 0" xyz="0.10 0 0.05"/> <axis xyz="0 0 1"/> </joint> <link name="finger_link_2"> <visual> <geometry> <box size="0.06 .01 .01"/> </geometry> </visual> <collision> <geometry> <box size="0.06 .1 .1"/> </geometry> </collision> <inertial> <inertia ixx="2.0" ixy="0.0" ixz="0.0" iyy="3.0" iyz="0.0" izz="1.0"/> </inertial> </link> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/tests/test_mtl.urdf
<?xml version="1.0" encoding="UTF-8"?> <robot name="test_mtl"> <link name="cube"> <visual> <origin rpy="0 0 0" xyz="0 0 0" /> <geometry> <mesh filename="test_mtl/test_mtl.obj" /> </geometry> <material name="gray"/> </visual> </link> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/tests/test_mtl_stl.urdf
<?xml version="1.0" encoding="UTF-8"?> <robot name="test_mtl_stl"> <material name="my_mat"> <color rgba="0.8 0.0 0.0 1.0"/> <!-- rviz green color --> </material> <link name="cube"> <visual> <origin rpy="0 0 0" xyz="0 0 0" /> <geometry> <mesh filename="test_mtl_stl/cube.stl" /> </geometry> <material name="my_mat" /> </visual> </link> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/tests/test_basic.urdf
<?xml version="1.0" encoding="UTF-8"?> <robot name="test_basic"> <link name="root_link"/> <joint name="root_to_base" type="fixed"> <parent link="root_link"/> <child link="base_link"/> </joint> <link name="base_link"> <visual> <geometry> <sphere radius="0.2"/> </geometry> </visual> <collision> <geometry> <sphere radius="0.2"/> </geometry> </collision> <inertial> <mass value="10"/> <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/> </inertial> </link> <joint name="base_joint" type="continuous"> <parent link="base_link"/> <child link="link_1"/> <axis xyz="0 0 1"/> <origin xyz="0 0 0.45"/> </joint> <link name="link_1"> <visual> <geometry> <cylinder length="0.8" radius=".1"/> </geometry> </visual> <collision> <geometry> <cylinder length="0.8" radius=".1"/> </geometry> </collision> <inertial> <mass value="10"/> <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/> </inertial> </link> <joint name="elbow_joint" type="revolute"> <parent link="link_1"/> <child link="link_2"/> <limit effort="1000.0" lower="-0.6" upper="0.6" velocity="0.5"/> <origin xyz="0 0 0.4" rpy="1.571 0 0"/> <axis xyz="1 0 0"/> </joint> <link name="link_2"> <visual> <geometry> <cylinder length="0.6" radius=".06"/> </geometry> </visual> <collision> <geometry> <cylinder length="0.6" radius=".06"/> </geometry> </collision> <inertial> <mass value="10"/> <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/> </inertial> </link> <joint name="wrist_joint" type="continuous"> <parent link="link_2"/> <child link="palm_link"/> <origin xyz="0 0 0.33"/> <axis xyz="0 0 1"/> </joint> <link name="palm_link"> <visual> <geometry> <box size="0.2 .06 .06"/> </geometry> </visual> <collision> <geometry> <box size="0.2 .06 .06"/> </geometry> </collision> <inertial> <mass value="10"/> <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/> </inertial> </link> <joint name="finger_1_joint" type="prismatic"> <parent link="palm_link"/> <child link="finger_link_1"/> <limit effort="1000.0" lower="-0.02" upper="0.08" velocity="0.5"/> <origin rpy="0 1.571 0" xyz="-0.10 0 0.05"/> <axis xyz="0 0 1"/> </joint> <link name="finger_link_1"> <visual> <geometry> <box size="0.06 .01 .01"/> </geometry> </visual> <collision> <geometry> <box size="0.06 .1 .1"/> </geometry> </collision> <inertial> <mass value="3"/> <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/> </inertial> </link> <joint name="finger_2_joint" type="prismatic"> <parent link="palm_link"/> <child link="finger_link_2"/> <limit effort="1000.0" lower="-0.08" upper="0.02" velocity="0.5"/> <origin rpy="0 1.571 0" xyz="0.10 0 0.05"/> <axis xyz="0 0 1"/> </joint> <link name="finger_link_2"> <visual> <geometry> <box size="0.06 .01 .01"/> </geometry> </visual> <collision> <geometry> <box size="0.06 .1 .1"/> </geometry> </collision> <inertial> <mass value="3"/> <inertia ixx="2.0" ixy="0.0" ixz="0.0" iyy="3.0" iyz="0.0" izz="4.0"/> </inertial> </link> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/tests/test_collision_from_visuals.urdf
<?xml version="1.0" encoding="UTF-8"?> <robot name="test_collision_from_visuals"> <link name="root_link"/> <joint name="root_to_base" type="fixed"> <parent link="root_link"/> <child link="base_link"/> </joint> <link name="base_link"> <visual> <geometry> <sphere radius="0.2"/> </geometry> </visual> <inertial> <mass value="10"/> <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/> </inertial> </link> <joint name="base_joint" type="continuous"> <parent link="base_link"/> <child link="link_1"/> <axis xyz="0 0 1"/> <origin xyz="0 0 0.45"/> </joint> <link name="link_1"> <visual> <geometry> <cylinder length="0.8" radius=".1"/> </geometry> </visual> <inertial> <mass value="10"/> <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/> </inertial> </link> <joint name="elbow_joint" type="revolute"> <parent link="link_1"/> <child link="link_2"/> <limit effort="1000.0" lower="-0.6" upper="0.6" velocity="0.5"/> <origin xyz="0 0 0.4" rpy="1.571 0 0"/> <axis xyz="1 0 0"/> </joint> <link name="link_2"> <visual> <geometry> <cylinder length="0.6" radius=".06"/> </geometry> </visual> <inertial> <mass value="10"/> <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/> </inertial> </link> <joint name="wrist_joint" type="continuous"> <parent link="link_2"/> <child link="palm_link"/> <origin xyz="0 0 0.33"/> <axis xyz="0 0 1"/> </joint> <link name="palm_link"> <visual> <geometry> <box size="0.2 .06 .06"/> </geometry> </visual> <inertial> <mass value="10"/> <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/> </inertial> </link> <joint name="finger_1_joint" type="prismatic"> <parent link="palm_link"/> <child link="finger_link_1"/> <limit effort="1000.0" lower="-0.02" upper="0.08" velocity="0.5"/> <origin rpy="0 1.571 0" xyz="-0.10 0 0.05"/> <axis xyz="0 0 1"/> </joint> <link name="finger_link_1"> <visual> <geometry> <box size="0.06 .01 .01"/> </geometry> </visual> <inertial> <mass value="3"/> <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/> </inertial> </link> <joint name="finger_2_joint" type="prismatic"> <parent link="palm_link"/> <child link="finger_link_2"/> <limit effort="1000.0" lower="-0.08" upper="0.02" velocity="0.5"/> <origin rpy="0 1.571 0" xyz="0.10 0 0.05"/> <axis xyz="0 0 1"/> </joint> <link name="finger_link_2"> <visual> <geometry> <box size="0.06 .01 .01"/> </geometry> </visual> <inertial> <mass value="3"/> <inertia ixx="2.0" ixy="0.0" ixz="0.0" iyy="3.0" iyz="0.0" izz="4.0"/> </inertial> </link> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/tests/test_usd.urdf
<?xml version="1.0" encoding="UTF-8"?> <robot name="test_usd"> <link name="cube"> <visual> <origin rpy="0 0 0" xyz="0 0 0" /> <geometry> <mesh filename="test_usd/cylinder.usda" scale="0.01 0.01 0.01"/> </geometry> <material name="gray"/> </visual> <visual> <origin rpy="0 0 0" xyz="0 0 0" /> <geometry> <mesh filename="test_usd/torus.usd" scale="0.01 0.01 0.01"/> </geometry> <material name="gray"/> </visual> </link> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/tests/crash_test.urdf
<?xml version="1.0" encoding="UTF-8"?> <robot name="test_basic"> <link name="root_link"/> <joint name="root_to_base" type="fixed"> <parent link="root_link"/> <child link="base_link"/> </joint> <link name="base_link"> <visual> <geometry> <box size="0.3 .3 .2"/> </geometry> </visual> <collision> <geometry> <box size="0.3 .3 .2"/> </geometry> </collision> <inertial> <mass value="10"/> <!-- no inertial matrix --> </inertial> </link> <joint name="base_joint" type="continuous"> <parent link="base_link"/> <child link="link_1"/> <axis xyz="0 0 1"/> <origin xyz="0 0 0.45"/> </joint> <link name="link_1"> <visual> <geometry> <cylinder length="0.8" radius=".1"/> </geometry> </visual> <!-- no collision mesh info --> <inertial> <mass value="10"/> <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/> </inertial> </link> <joint name="elbow_joint" type="revolute"> <parent link="link_1"/> <child link="link_2"/> <limit effort="1000.0" lower="-0.6" upper="0.6" velocity="0.5"/> <origin xyz="0 0 0.4" rpy="1.571 0 0"/> <axis xyz="1 0 0"/> </joint> <link name="link_2"> <visual> <geometry> <cylinder length="0.6" radius=".06"/> </geometry> </visual> <collision> <geometry> <cylinder length="0.6" radius=".06"/> </geometry> </collision> <!-- no inertia or mass info --> </link> <joint name="wrist_joint" type="continuous"> <parent link="link_2"/> <child link="palm_link"/> <origin xyz="0 0 0.33"/> <axis xyz="0 0 1"/> </joint> <link name="palm_link"> <!-- no visual mesh info --> <collision> <geometry> <box size="0.2 .06 .06"/> </geometry> </collision> </link> <joint name="finger_1_joint" type="prismatic"> <parent link="palm_link"/> <child link="finger_link_1"/> <!-- limit effort="1000.0" lower="-0.02" upper="0.08" velocity="0.5"/--> <!-- missing joint info --> <origin rpy="0 1.571 0" xyz="-0.10 0 0.05"/> <axis xyz="0 0 1"/> </joint> <link name="finger_link_1"> <visual> <geometry> <box size="0.06 .01 .01"/> </geometry> </visual> <collision> <geometry> <box size="0.06 .1 .1"/> </geometry> </collision> <inertial> <mass value="3"/> <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/> </inertial> </link> <joint name="finger_2_joint" type="prismatic"> <parent link="palm_link"/> <child link="finger_link_2"/> <limit effort="1000.0" lower="-0.08" upper="0.02" velocity="0.5"/> <origin rpy="0 1.571 0" xyz="0.10 0 0.05"/> <axis xyz="0 0 1"/> </joint> <link name="finger_link_2"> <visual> <geometry> <box size="0.06 .01 .01"/> </geometry> </visual> <collision> <geometry> <box size="0.06 .1 .1"/> </geometry> </collision> <inertial> <mass value="3"/> <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/> </inertial> </link> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/tests/test_advanced.urdf
<?xml version="1.0" encoding="UTF-8"?> <robot name="test_advanced"> <gazebo> <plugin filename="libgazebo_ros_control.so" name="gazebo_ros_control"> <robotNamespace>/gripper</robotNamespace> <robotSimType>gazebo_ros_control/DefaultRobotHWSim</robotSimType> <legacyModeNS>true</legacyModeNS> </plugin> </gazebo> <material name="blue"> <color rgba="0 0 .8 1"/> </material> <material name="red"> <color rgba="0.8 0 0 1"/> </material> <material name="green"> <color rgba="0 0.8 0 1"/> </material> <material name="yellow"> <color rgba="0.8 0.8 0 1"/> </material> <material name="cyan"> <color rgba="0 0.8 0.8 1"/> </material> <link name="root_link"/> <joint name="root_to_base" type="fixed"> <parent link="root_link"/> <child link="base_link"/> </joint> <link name="base_link"> <visual> <geometry> <box size="0.3 .3 .2"/> </geometry> <material name="blue"/> </visual> <collision> <geometry> <box size="0.3 .3 .2"/> </geometry> </collision> <inertial> <mass value="10"/> <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/> </inertial> </link> <joint name="base_joint" type="continuous"> <parent link="base_link"/> <child link="link_1"/> <axis xyz="0 0 1"/> <origin xyz="0 0 0.45"/> </joint> <link name="link_1"> <visual> <geometry> <cylinder length="0.8" radius=".1"/> </geometry> <material name="green"/> </visual> <collision> <geometry> <cylinder length="0.8" radius=".1"/> </geometry> </collision> <inertial> <mass value="10"/> <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/> </inertial> </link> <joint name="elbow_joint" type="revolute"> <parent link="link_1"/> <child link="link_2"/> <origin xyz="0 0 0.4" rpy="1.571 0 0"/> <axis xyz="1 0 0"/> <calibration rising="0.0" falling="0.1"/> <dynamics damping="0.10" friction="0.1"/> <limit effort="1000.0" lower="-0.6" upper="0.6" velocity="0.5"/> <safety_controller k_velocity="10" k_position="15" soft_lower_limit="-2.0" soft_upper_limit="0.5"/> </joint> <transmission name="trans_1"> <type>transmission_interface/SimpleTransmission</type> <joint name="elbow_joint"> <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface> </joint> <actuator name="elbow_motor"> <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface> <mechanicalReduction>12</mechanicalReduction> </actuator> </transmission> <link name="link_2"> <visual> <geometry> <cylinder length="0.6" radius=".06"/> </geometry> <material name="red"/> </visual> <collision> <geometry> <cylinder length="0.6" radius=".06"/> </geometry> </collision> <inertial> <mass value="10"/> <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/> </inertial> </link> <joint name="wrist_joint" type="continuous"> <parent link="link_2"/> <child link="palm_link"/> <origin xyz="0 0 0.33"/> <axis xyz="0 0 1"/> </joint> <link name="palm_link"> <visual> <geometry> <box size="0.2 .06 .06"/> </geometry> <material name="yellow"/> </visual> <collision> <geometry> <box size="0.2 .06 .06"/> </geometry> </collision> <inertial> <mass value="10"/> <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/> </inertial> </link> <sensor name="my_camera_sensor" update_rate="20"> <parent link="palm_link"/> <origin xyz="0 0 0" rpy="0 0 0"/> <camera> <image width="640" height="480" hfov="1.5708" format="RGB8" near="0.01" far="50.0"/> </camera> </sensor> <joint name="finger_1_joint" type="prismatic"> <parent link="palm_link"/> <child link="finger_link_1"/> <limit effort="1000.0" lower="-0.02" upper="0.08" velocity="0.5"/> <origin rpy="0 1.571 0" xyz="-0.10 0 0.05"/> <axis xyz="0 0 1"/> </joint> <link name="finger_link_1"> <visual> <geometry> <box size="0.06 .01 .01"/> </geometry> <material name="cyan"/> </visual> <collision> <geometry> <box size="0.06 .1 .1"/> </geometry> </collision> <inertial> <mass value="10"/> <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/> </inertial> </link> <joint name="finger_2_joint" type="prismatic"> <parent link="palm_link"/> <child link="finger_link_2"/> <limit effort="1000.0" lower="-0.08" upper="0.02" velocity="0.5"/> <origin rpy="0 1.571 0" xyz="0.10 0 0.05"/> <axis xyz="0 0 1"/> </joint> <link name="finger_link_2"> <visual> <geometry> <box size="0.06 .01 .01"/> </geometry> <material name="cyan"/> </visual> <collision> <geometry> <box size="0.06 .1 .1"/> </geometry> </collision> <inertial> <mass value="10"/> <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/> </inertial> </link> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/tests/test_names.urdf
<?xml version="1.0" encoding="UTF-8"?> <robot name="test_names"> <link name="cube"> <visual name="block"> <origin rpy="0 0 0" xyz="0 0 0" /> <geometry> <mesh filename="test_mtl/test_mtl.obj" /> </geometry> <material name="gray"/> </visual> <visual name="block"> <origin rpy="0 0 0" xyz="1 0 0" /> <geometry> <mesh filename="test_mtl/test_mtl.obj" /> </geometry> <material name="gray"/> </visual> <visual name="block"> <origin rpy="0 0 0" xyz="0 1 0" /> <geometry> <mesh filename="test_mtl/test_mtl.obj" /> </geometry> <material name="gray"/> </visual> <visual name="block"> <origin rpy="0 0 0" xyz="-1 0 -1" /> <geometry> <mesh filename="test_mtl/test_mtl.obj" /> </geometry> <material name="gray"/> </visual> <visual name="block_1"> <origin rpy="0 0 0" xyz="0 -1 1" /> <geometry> <mesh filename="test_mtl/test_mtl.obj" /> </geometry> <material name="gray"/> </visual> <visual name="block-1"> <origin rpy="0 0 0" xyz="0 0 -1" /> <geometry> <mesh filename="test_mtl/test_mtl.obj" /> </geometry> <material name="gray"/> </visual> </link> <link name="01_number"> <visual name="block"> <origin rpy="0 0 0" xyz="0 0 0" /> <geometry> <mesh filename="test_mtl/test_mtl.obj" /> </geometry> <material name="gray"/> </visual> </link> <link name=" name with spaces"> <visual name="block"> <origin rpy="0 0 0" xyz="0 0 0" /> <geometry> <mesh filename="test_mtl/test_mtl.obj" /> </geometry> <material name="gray"/> </visual> </link> <link name="/name/with/slashes"> <visual name="block"> <origin rpy="0 0 0" xyz="0 0 0" /> <geometry> <mesh filename="test_mtl/test_mtl.obj" /> </geometry> <material name="gray"/> </visual> </link> <link name="another/name/with/slashes"> <visual name="block"> <origin rpy="0 0 0" xyz="0 0 0" /> <geometry> <mesh filename="test_mtl/test_mtl.obj" /> </geometry> <material name="gray"/> </visual> </link> <joint name="01_joint" type="revolute"> <origin xyz="0 0 1" rpy="0 0 0" /> <parent link="cube" /> <child link="01_number" /> <axis xyz="0 0 1" /> <limit lower="0" upper="0" effort="0" velocity="0" /> </joint> <joint name=" joint with spaces" type="revolute"> <origin xyz="0 0 1" rpy="0 0 0" /> <parent link="01_number" /> <child link=" name with spaces" /> <axis xyz="0 0 1" /> <limit lower="0" upper="0" effort="0" velocity="0" /> </joint> <joint name="/joint/with/slashes" type="revolute"> <origin xyz="0 0 1" rpy="0 0 0" /> <parent link="01_number" /> <child link="/name/with/slashes" /> <axis xyz="0 0 1" /> <limit lower="0" upper="0" effort="0" velocity="0" /> </joint> <joint name="another/joint/with/slashes" type="revolute"> <origin xyz="0 0 1" rpy="0 0 0" /> <parent link="/name/with/slashes" /> <child link="another/name/with/slashes" /> <axis xyz="0 0 1" /> <limit lower="0" upper="0" effort="0" velocity="0" /> </joint> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/tests/test_textures_urdf/cube_dae.urdf
<?xml version="1.0" ?> <robot name="cube"> <link name="cube_dae"> <contact> <lateral_friction value="1.0"/> <rolling_friction value="0.0"/> <contact_cfm value="0.0"/> <contact_erp value="1.0"/> </contact> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="1.0"/> <inertia ixx="1" ixy="0" ixz="0" iyy="1" iyz="0" izz="1"/> </inertial> <visual> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="meshes/tex_cube.dae" scale="1 1 1"/> </geometry> </visual> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <box size="1 1 1"/> </geometry> </collision> </link> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/tests/test_textures_urdf/cube_obj.urdf
<?xml version="1.0" ?> <robot name="cube"> <link name="cube_obj"> <contact> <lateral_friction value="1.0"/> <rolling_friction value="0.0"/> <contact_cfm value="0.0"/> <contact_erp value="1.0"/> </contact> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="1.0"/> <inertia ixx="1" ixy="0" ixz="0" iyy="1" iyz="0" izz="1"/> </inertial> <visual> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="meshes/tex_cube.obj" scale="1 1 1"/> </geometry> </visual> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <box size="1 1 1"/> </geometry> </collision> </link> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/tests/test_usd/cylinder.usda
#usda 1.0 ( customLayerData = { dictionary audioSettings = { double dopplerLimit = 2 double dopplerScale = 1 double nonSpatialTimeScale = 1 double spatialTimeScale = 1 double speedOfSound = 340 } dictionary cameraSettings = { dictionary Front = { double3 position = (50000.000000000015, -1.1102230246251565e-11, 0) double radius = 500 } dictionary Perspective = { double3 position = (4.999999999999999, 5, 5.0000000000000036) double3 target = (0, 0, 0) } dictionary Right = { double3 position = (0, -50000, -1.1102230246251565e-11) double radius = 500 } dictionary Top = { double3 position = (0, 0, 50000) double radius = 500 } string boundCamera = "/OmniverseKit_Persp" } dictionary omni_layer = { dictionary muteness = { } } int refinementOverrideImplVersion = 0 dictionary renderSettings = { } } defaultPrim = "World" endTimeCode = 100 metersPerUnit = 1 startTimeCode = 0 timeCodesPerSecond = 24 upAxis = "Z" ) def Xform "World" { def Cylinder "Cylinder" { uniform token axis = "Z" float3[] extent = [(-50, -50, -50), (50, 50, 50)] double height = 0.9999999776482582 double radius = 0.4999999888241291 custom bool refinementEnableOverride = 1 custom int refinementLevel = 2 double3 xformOp:rotateXYZ = (0, 0, 0) double3 xformOp:scale = (1, 1, 1) double3 xformOp:translate = (0, 0, 0) uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:rotateXYZ", "xformOp:scale"] } } def DistantLight "DistantLight" ( prepend apiSchemas = ["ShapingAPI"] ) { float angle = 1 float intensity = 3000 float shaping:cone:angle = 180 float shaping:cone:softness float shaping:focus color3f shaping:focusTint asset shaping:ies:file double3 xformOp:rotateXYZ = (45, 0, 90) double3 xformOp:scale = (0.009999999776482582, 0.009999999776482582, 0.009999999776482582) double3 xformOp:translate = (0, 0, 0) uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:rotateXYZ", "xformOp:scale"] }
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/robots/cartpole/cartpole.urdf
<?xml version="1.0"?> <robot name="cartpole"> <link name="slider"> <visual> <geometry> <box size="0.03 8 0.03"/> </geometry> <material name="slider_mat"> <color rgba="0.9 0.6 0.2 1"/> </material> </visual> <collision> <geometry> <box size="0.03 8 0.03"/> </geometry> </collision> </link> <link name="cart"> <visual> <geometry> <box size="0.2 0.25 0.2"/> </geometry> <material name="cart_mat"> <color rgba="0.3 0.5 0.7 1"/> </material> </visual> <collision> <geometry> <box size="0.2 0.25 0.2"/> </geometry> </collision> <inertial> <mass value="1"/> </inertial> </link> <link name="pole"> <visual> <geometry> <box size="0.04 0.06 1.0"/> </geometry> <origin xyz="0 0 0.47"/> <material name="pole_mat"> <color rgba="0.1 0.1 0.3 1"/> </material> </visual> <collision> <geometry> <box size="0.04 0.06 1.0"/> </geometry> <origin xyz="0 0 0.47"/> </collision> <inertial> <mass value="1"/> <origin xyz="0 0 0.47"/> </inertial> </link> <joint name="slider_to_cart" type="prismatic"> <axis xyz="0 1 0"/> <origin xyz="0 0 0"/> <parent link="slider"/> <child link="cart"/> <limit effort="1000.0" lower="-4" upper="4" velocity="100"/> </joint> <joint name="cart_to_pole" type="continuous"> <axis xyz="1 0 0"/> <origin xyz="0.12 0 0"/> <parent link="cart"/> <child link="pole"/> <limit effort="1000.0" velocity="8"/> </joint> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/robots/ur10/urdf/ur10.urdf
<?xml version="1.0" encoding="utf-8"?> <robot name="ur10"> <link name="base_link"> <collision> <origin xyz="0 0 0.02" rpy="0 0 0"/> <geometry> <cylinder radius="0.075" length="0.03"/> </geometry> </collision> <visual> <origin xyz="0 0 0" rpy="0 0 0"/> <geometry> <mesh filename="../meshes/ur10_base.obj" scale="1 1 1"/> </geometry> </visual> <inertial> <mass value="200.0"/> </inertial> </link> <link name="shoulder_link"> <visual> <origin xyz="0 0 -.1273" rpy="0 0 0"/> <geometry> <mesh filename="../meshes/ur10_shoulder.obj" scale="1 1 1"/> </geometry> </visual> <collision> <origin xyz="0 0.0 0.0027000046)" rpy="0 0 0"/> <geometry> <cylinder radius="0.075" length="0.17"/> </geometry> </collision> <collision> <origin xyz="0 .0425 0.007000065" rpy="1.57079632679 0 0"/> <geometry> <cylinder radius="0.075" length="0.085"/> </geometry> </collision> <inertial> <mass value="7.1"/> </inertial> </link> <link name="upper_arm_link"> <visual> <origin xyz="-0.0007000065 -0.044941006 0" rpy="0 -1.57079632679 0"/> <geometry> <mesh filename="../meshes/ur10_upper_arm.obj" scale="1 1 1"/> </geometry> </visual> <collision> <origin xyz="-0.0007000065 -0.044941006 0" rpy="1.57079632679 0 0"/> <geometry> <cylinder radius="0.075" length="0.175"/> </geometry> </collision> <collision> <origin xyz="-0.0007000065 -0.044941006 0.306" rpy="0 0 0"/> <geometry> <cylinder radius="0.06" length="0.612"/> </geometry> </collision> <collision> <origin xyz="-0.0007000065 -0.044941006 0.612" rpy="1.57079632679 0 0"/> <geometry> <cylinder radius="0.06" length="0.136"/> </geometry> </collision> <inertial> <mass value="12.7"/> </inertial> </link> <link name="forearm_link"> <visual> <origin xyz="-0.0007000351 -0.0010410404 0" rpy="0 -1.57079632679 0"/> <geometry> <mesh filename="../meshes/ur10_forearm.obj" scale="1 1 1"/> </geometry> </visual> <collision> <origin xyz="-0.0007000351 -0.0041510403 0" rpy="1.57079632679 0 0"/> <geometry> <cylinder radius="0.06" length="0.126"/> </geometry> </collision> <collision> <origin xyz="-0.0007000351 -0.0010410404 0.286" rpy="0 0 0"/> <geometry> <cylinder radius="0.047" length="0.572"/> </geometry> </collision> <collision> <origin xyz="-0.0007000547 0.0017589596 0.572" rpy="1.57079632679 0 0"/> <geometry> <cylinder radius="0.047" length="0.118"/> </geometry> </collision> <inertial> <mass value="4.27"/> </inertial> </link> <link name="wrist_1_link"> <visual> <origin xyz="0.0002999115 0.11495896 -0.0007000637" rpy="-3.14159265359 0 -3.14159265359"/> <geometry> <mesh filename="../meshes/ur10_wrist_1.obj" scale="1 1 1"/> </geometry> </visual> <collision> <origin xyz="0.0002999115 0.08745896 -0.0007000637" rpy="1.57079632679 0 3.14159265359"/> <geometry> <cylinder radius="0.047" length="0.055"/> </geometry> </collision> <collision> <origin xyz="0.0002999115 0.11495896 0.0020999363" rpy="-3.14159265359 0 -3.14159265359"/> <geometry> <cylinder radius="0.047" length="0.118"/> </geometry> </collision> <inertial> <mass value="1.0"/> </inertial> </link> <link name="wrist_2_link"> <visual> <origin xyz="0.0002999115 0.000058994293 0.11529993" rpy="-3.14159265359 0 -3.14159265359"/> <geometry> <mesh filename="../meshes/ur10_wrist_2.obj" scale="1 1 1"/> </geometry> </visual> <collision> <origin xyz="0.0002999115 0.000058994293 0.08829992" rpy="-3.14159265359 0 -3.14159265359"/> <geometry> <cylinder radius="0.047" length="0.054"/> </geometry> </collision> <collision> <origin xyz="0.0002999115 0.0028589943 0.11529993" rpy="1.57079632679 0 3.14159265359"/> <geometry> <cylinder radius="0.047" length="0.118"/> </geometry> </collision> <inertial> <mass value="1.0"/> </inertial> </link> <link name="wrist_3_link"> <visual> <origin xyz="0.0002999115 0.09205898 -0.00040007472" rpy="-3.14159265359 0 -3.14159265359"/> <geometry> <mesh filename="../meshes/ur10_wrist_3.obj" scale="1 1 1"/> </geometry> </visual> <collision> <origin xyz="0.0002999115 0.077058983 -0.00040007472" rpy="1.57079632679 0 -3.14159265359"/> <geometry> <cylinder radius="0.047" length="0.03"/> </geometry> </collision> <inertial> <mass value="0.365"/> </inertial> </link> <joint name="shoulder_pan_joint" type="revolute"> <origin rpy="0 0 0" xyz="0 0 0.1273"/> <axis xyz="0 0 1" /> <limit upper="6.28318" lower="-6.28318" velocity="2.0944" effort="330" /> <parent link="base_link" /> <child link ="shoulder_link" /> </joint> <joint name="shoulder_lift_joint" type="revolute"> <origin rpy="0.0 1.5707963267948966 0.0" xyz="0.0 0.220941 0.0"/> <axis xyz="0 1 0" /> <limit upper="6.28318" lower="-6.28318" velocity="2.0944" effort="330.0" /> <parent link ="shoulder_link" /> <child link="upper_arm_link" /> </joint> <joint name="elbow_joint" type="revolute"> <origin rpy="0.0 0.0 0.0" xyz="0.0 -0.1719 0.612"/> <axis xyz="0 1 0" /> <limit upper="6.28318" lower="-6.28318" velocity="3.14159" effort="150.0" /> <parent link ="upper_arm_link" /> <child link="forearm_link" /> </joint> <joint name="wrist_1_joint" type="revolute"> <origin rpy="0.0 1.5707963267948966 0.0" xyz="0.0 0.0 0.5723"/> <axis xyz="0 1 0" /> <limit upper="6.28318" lower="-6.28318" velocity="3.14159" effort="56.0" /> <parent link ="forearm_link" /> <child link="wrist_1_link" /> </joint> <joint name="wrist_2_joint" type="revolute"> <origin rpy="0.0 0.0 0.0" xyz="0.0 0.1149 0.0"/> <axis xyz="0 0 1"/> <limit upper="6.28318" lower="-6.28318" velocity="3.14159" effort="56.0" /> <parent link ="wrist_1_link" /> <child link="wrist_2_link" /> </joint> <joint name="wrist_3_joint" type="revolute"> <origin rpy="0.0 0.0 0.0" xyz="0.0 0.0 0.1157"/> <axis xyz="0 1 0" /> <limit upper="6.28318" lower="-6.28318" velocity="3.14159" effort="56.0" /> <parent link ="wrist_2_link" /> <child link="wrist_3_link" /> </joint> <joint name="ee_fixed_joint" type="fixed"> <parent link="wrist_3_link"/> <child link="ee_link"/> <origin rpy="0.0 0.0 1.5707963267948966" xyz="0.0 0.0922 0.0"/> </joint> <link name="ee_link"> <collision> <geometry> <box size="0.01 0.01 0.01"/> </geometry> <origin rpy="0 0 0" xyz="-0.01 0 0"/> </collision> </link> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/robots/franka_description/package.xml
<?xml version="1.0"?> <package format="2"> <name>franka_description</name> <version>0.7.1</version> <description>franka_description contains URDF files and meshes of Franka Emika robots</description> <maintainer email="[email protected]">Franka Emika GmbH</maintainer> <license>Apache 2.0</license> <url type="website">http://wiki.ros.org/franka_description</url> <url type="repository">https://github.com/frankaemika/franka_ros</url> <url type="bugtracker">https://github.com/frankaemika/franka_ros/issues</url> <author>Franka Emika GmbH</author> <buildtool_depend>catkin</buildtool_depend> <exec_depend>xacro</exec_depend> </package>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/robots/franka_description/robots/create_urdf.sh
#!/bin/bash source /opt/ros/melodic/setup.bash SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # add to ROS package path export ROS_PACKAGE_PATH=${SCRIPT_DIR}/../..:$ROS_PACKAGE_PATH echo "Using ROS_PACKAGE_PATH ${ROS_PACKAGE_PATH}" rosrun xacro xacro --inorder -o panda_arm.urdf panda_arm.urdf.xacro rosrun xacro xacro --inorder -o panda_arm_hand.urdf panda_arm_hand.urdf.xacro
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/robots/franka_description/robots/hand.xacro
<?xml version="1.0" encoding="utf-8"?> <robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="hand"> <xacro:macro name="hand" params="connected_to:='' ns:='' rpy:='0 0 0' xyz:='0 0 0' "> <xacro:unless value="${connected_to == ''}"> <joint name="${ns}_hand_joint" type="fixed"> <parent link="${connected_to}"/> <child link="${ns}_hand"/> <origin xyz="${xyz}" rpy="${rpy}"/> </joint> </xacro:unless> <link name="${ns}_hand"> <visual> <geometry> <mesh filename="package://franka_description/meshes/visual/hand.dae"/> </geometry> </visual> <collision> <geometry> <mesh filename="package://franka_description/meshes/collision/hand.stl"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0" /> <mass value="0.5583304799"/> <inertia ixx="0.0023394448" ixy="0.0" ixz="0.0" iyy="0.0005782786" iyz="0" izz="0.0021310296"/> </inertial> </link> <link name="${ns}_leftfinger"> <visual> <geometry> <mesh filename="package://franka_description/meshes/visual/finger.dae"/> </geometry> </visual> <collision> <geometry> <mesh filename="package://franka_description/meshes/collision/finger.stl"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0" /> <mass value="0.0140552232"/> <inertia ixx="4.20413082650939E-06" ixy="0.0" ixz="0.0" iyy="3.90263687466755E-06" iyz="0" izz="1.33474964199095E-06"/> </inertial> </link> <link name="${ns}_rightfinger"> <visual> <origin xyz="0 0 0" rpy="0 0 ${pi}"/> <geometry> <mesh filename="package://franka_description/meshes/visual/finger.dae"/> </geometry> </visual> <collision> <origin xyz="0 0 0" rpy="0 0 ${pi}"/> <geometry> <mesh filename="package://franka_description/meshes/collision/finger.stl"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0" /> <mass value="0.0140552232"/> <inertia ixx="4.20413082650939E-06" ixy="0.0" ixz="0.0" iyy="3.90263687466755E-06" iyz="0" izz="1.33474964199095E-06"/> </inertial> </link> <joint name="${ns}_finger_joint1" type="prismatic"> <parent link="${ns}_hand"/> <child link="${ns}_leftfinger"/> <origin xyz="0 0 0.0584" rpy="0 0 0"/> <axis xyz="0 1 0"/> <limit effort="20" lower="0.0" upper="0.04" velocity="0.2"/> </joint> <joint name="${ns}_finger_joint2" type="prismatic"> <parent link="${ns}_hand"/> <child link="${ns}_rightfinger"/> <origin xyz="0 0 0.0584" rpy="0 0 0"/> <axis xyz="0 -1 0"/> <limit effort="20" lower="0.0" upper="0.04" velocity="0.2"/> <mimic joint="${ns}_finger_joint1" /> </joint> </xacro:macro> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/robots/franka_description/robots/panda_arm.urdf.xacro
<?xml version="1.0" encoding="utf-8"?> <robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="panda"> <xacro:include filename="$(find franka_description)/robots/panda_arm.xacro"/> <xacro:panda_arm /> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/robots/franka_description/robots/panda_arm_hand.urdf.xacro
<?xml version="1.0" encoding="utf-8"?> <robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="panda"> <xacro:include filename="$(find franka_description)/robots/panda_arm.xacro"/> <xacro:include filename="$(find franka_description)/robots/hand.xacro"/> <xacro:panda_arm /> <xacro:hand ns="panda" rpy="0 0 ${-pi/4}" connected_to="panda_link8"/> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/robots/franka_description/robots/panda_arm.xacro
<?xml version='1.0' encoding='utf-8'?> <robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="panda"> <xacro:macro name="panda_arm" params="arm_id:='panda' description_pkg:='franka_description' connected_to:='' xyz:='0 0 0' rpy:='0 0 0'"> <xacro:unless value="${not connected_to}"> <joint name="${arm_id}_joint_${connected_to}" type="fixed"> <parent link="${connected_to}"/> <child link="${arm_id}_link0"/> <origin rpy="${rpy}" xyz="${xyz}"/> </joint> </xacro:unless> <link name="${arm_id}_link0"> <visual> <geometry> <mesh filename="package://${description_pkg}/meshes/visual/link0.dae"/> </geometry> </visual> <collision> <geometry> <mesh filename="package://${description_pkg}/meshes/collision/link0.stl"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="2.8142028896"/> <inertia ixx="0.0129886979" ixy="0.0" ixz="0.0" iyy="0.0165355284" iyz="0" izz="0.0203311636"/> </inertial> </link> <link name="${arm_id}_link1"> <visual> <geometry> <mesh filename="package://${description_pkg}/meshes/visual/link1.dae"/> </geometry> </visual> <collision> <geometry> <mesh filename="package://${description_pkg}/meshes/collision/link1.stl"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0" /> <mass value="2.3599995791"/> <inertia ixx="0.0186863903" ixy="0.0" ixz="0.0" iyy="0.0143789874" iyz="0" izz="0.00906812"/> </inertial> </link> <joint name="${arm_id}_joint1" type="revolute"> <safety_controller k_position="100.0" k_velocity="40.0" soft_lower_limit="-2.8973" soft_upper_limit="2.8973"/> <origin rpy="0 0 0" xyz="0 0 0.333"/> <parent link="${arm_id}_link0"/> <child link="${arm_id}_link1"/> <axis xyz="0 0 1"/> <limit effort="87" lower="-2.8973" upper="2.8973" velocity="2.1750"/> </joint> <link name="${arm_id}_link2"> <visual> <geometry> <mesh filename="package://${description_pkg}/meshes/visual/link2.dae"/> </geometry> </visual> <collision> <geometry> <mesh filename="package://${description_pkg}/meshes/collision/link2.stl"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0" /> <mass value="2.379518833" /> <inertia ixx="0.0190388734" ixy="0.0" ixz="0.0" iyy="0.0091429124" iyz="0" izz="0.014697537"/> </inertial> </link> <joint name="${arm_id}_joint2" type="revolute"> <safety_controller k_position="100.0" k_velocity="40.0" soft_lower_limit="-1.7628" soft_upper_limit="1.7628"/> <origin rpy="${-pi/2} 0 0" xyz="0 0 0"/> <parent link="${arm_id}_link1"/> <child link="${arm_id}_link2"/> <axis xyz="0 0 1"/> <limit effort="87" lower="-1.7628" upper="1.7628" velocity="2.1750"/> </joint> <link name="${arm_id}_link3"> <visual> <geometry> <mesh filename="package://${description_pkg}/meshes/visual/link3.dae"/> </geometry> </visual> <collision> <geometry> <mesh filename="package://${description_pkg}/meshes/collision/link3.stl"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0" /> <mass value="2.6498823337"/> <inertia ixx="0.0129300178" ixy="0.0" ixz="0.0" iyy="0.0150242121" iyz="0" izz="0.0142734598"/> </inertial> </link> <joint name="${arm_id}_joint3" type="revolute"> <safety_controller k_position="100.0" k_velocity="40.0" soft_lower_limit="-2.8973" soft_upper_limit="2.8973"/> <origin rpy="${pi/2} 0 0" xyz="0 -0.316 0"/> <parent link="${arm_id}_link2"/> <child link="${arm_id}_link3"/> <axis xyz="0 0 1"/> <limit effort="87" lower="-2.8973" upper="2.8973" velocity="2.1750"/> </joint> <link name="${arm_id}_link4"> <visual> <geometry> <mesh filename="package://${description_pkg}/meshes/visual/link4.dae"/> </geometry> </visual> <collision> <geometry> <mesh filename="package://${description_pkg}/meshes/collision/link4.stl"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0" /> <mass value="2.6948018744"/> <inertia ixx="0.0133874611" ixy="0.0" ixz="0.0" iyy="0.014514325" iyz="0" izz="0.0155175551"/> </inertial> </link> <joint name="${arm_id}_joint4" type="revolute"> <safety_controller k_position="100.0" k_velocity="40.0" soft_lower_limit="-3.0718" soft_upper_limit="-0.0698"/> <origin rpy="${pi/2} 0 0" xyz="0.0825 0 0"/> <parent link="${arm_id}_link3"/> <child link="${arm_id}_link4"/> <axis xyz="0 0 1"/> <limit effort="87" lower="-3.0718" upper="-0.0698" velocity="2.1750"/> </joint> <link name="${arm_id}_link5"> <visual> <geometry> <mesh filename="package://${description_pkg}/meshes/visual/link5.dae"/> </geometry> </visual> <collision> <geometry> <mesh filename="package://${description_pkg}/meshes/collision/link5.stl"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0" /> <mass value="2.9812816864"/> <inertia ixx="0.0325565705" ixy="0.0" ixz="0.0" iyy="0.0270660472" iyz="0" izz="0.0115023375"/> </inertial> </link> <joint name="${arm_id}_joint5" type="revolute"> <safety_controller k_position="100.0" k_velocity="40.0" soft_lower_limit="-2.8973" soft_upper_limit="2.8973"/> <origin rpy="${-pi/2} 0 0" xyz="-0.0825 0.384 0"/> <parent link="${arm_id}_link4"/> <child link="${arm_id}_link5"/> <axis xyz="0 0 1"/> <limit effort="12" lower="-2.8973" upper="2.8973" velocity="2.6100"/> </joint> <link name="${arm_id}_link6"> <visual> <geometry> <mesh filename="package://${description_pkg}/meshes/visual/link6.dae"/> </geometry> </visual> <collision> <geometry> <mesh filename="package://${description_pkg}/meshes/collision/link6.stl"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0" /> <mass value="1.1285806309"/> <inertia ixx="0.0026052565" ixy="0.0" ixz="0.0" iyy="0.0039897229" iyz="0" izz="0.0047048591"/> </inertial> </link> <joint name="${arm_id}_joint6" type="revolute"> <safety_controller k_position="100.0" k_velocity="40.0" soft_lower_limit="-0.0175" soft_upper_limit="3.7525"/> <origin rpy="${pi/2} 0 0" xyz="0 0 0"/> <parent link="${arm_id}_link5"/> <child link="${arm_id}_link6"/> <axis xyz="0 0 1"/> <limit effort="12" lower="-0.0175" upper="3.7525" velocity="2.6100"/> </joint> <link name="${arm_id}_link7"> <visual> <geometry> <mesh filename="package://${description_pkg}/meshes/visual/link7.dae"/> </geometry> </visual> <collision> <geometry> <mesh filename="package://${description_pkg}/meshes/collision/link7.stl"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0" /> <mass value="0.4052912465"/> <inertia ixx="0.0006316592" ixy="0.0" ixz="0.0" iyy="0.0006319639" iyz="0" izz="0.0010607721"/> </inertial> </link> <joint name="${arm_id}_joint7" type="revolute"> <safety_controller k_position="100.0" k_velocity="40.0" soft_lower_limit="-2.8973" soft_upper_limit="2.8973"/> <origin rpy="${pi/2} 0 0" xyz="0.088 0 0"/> <parent link="${arm_id}_link6"/> <child link="${arm_id}_link7"/> <axis xyz="0 0 1"/> <limit effort="12" lower="-2.8973" upper="2.8973" velocity="2.6100"/> </joint> <link name="${arm_id}_link8"/> <joint name="${arm_id}_joint8" type="fixed"> <origin rpy="0 0 0" xyz="0 0 0.107"/> <parent link="${arm_id}_link7"/> <child link="${arm_id}_link8"/> <axis xyz="0 0 0"/> </joint> </xacro:macro> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/robots/franka_description/robots/panda_arm.urdf
<?xml version="1.0" ?> <!-- =================================================================================== --> <!-- | This document was autogenerated by xacro from panda_arm.urdf.xacro | --> <!-- | EDITING THIS FILE BY HAND IS NOT RECOMMENDED | --> <!-- =================================================================================== --> <robot name="panda" xmlns:xacro="http://www.ros.org/wiki/xacro"> <link name="panda_link0"> <visual> <geometry> <mesh filename="package://franka_description/meshes/visual/link0.dae"/> </geometry> </visual> <collision> <geometry> <mesh filename="package://franka_description/meshes/collision/link0.stl"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="2.8142028896"/> <inertia ixx="0.0129886979" ixy="0.0" ixz="0.0" iyy="0.0165355284" iyz="0" izz="0.0203311636"/> </inertial> </link> <link name="panda_link1"> <visual> <geometry> <mesh filename="package://franka_description/meshes/visual/link1.dae"/> </geometry> </visual> <collision> <geometry> <mesh filename="package://franka_description/meshes/collision/link1.stl"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="2.3599995791"/> <inertia ixx="0.0186863903" ixy="0.0" ixz="0.0" iyy="0.0143789874" iyz="0" izz="0.00906812"/> </inertial> </link> <joint name="panda_joint1" type="revolute"> <safety_controller k_position="100.0" k_velocity="40.0" soft_lower_limit="-2.8973" soft_upper_limit="2.8973"/> <origin rpy="0 0 0" xyz="0 0 0.333"/> <parent link="panda_link0"/> <child link="panda_link1"/> <axis xyz="0 0 1"/> <limit effort="87" lower="-2.8973" upper="2.8973" velocity="2.1750"/> </joint> <link name="panda_link2"> <visual> <geometry> <mesh filename="package://franka_description/meshes/visual/link2.dae"/> </geometry> </visual> <collision> <geometry> <mesh filename="package://franka_description/meshes/collision/link2.stl"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="2.379518833"/> <inertia ixx="0.0190388734" ixy="0.0" ixz="0.0" iyy="0.0091429124" iyz="0" izz="0.014697537"/> </inertial> </link> <joint name="panda_joint2" type="revolute"> <safety_controller k_position="100.0" k_velocity="40.0" soft_lower_limit="-1.7628" soft_upper_limit="1.7628"/> <origin rpy="-1.57079632679 0 0" xyz="0 0 0"/> <parent link="panda_link1"/> <child link="panda_link2"/> <axis xyz="0 0 1"/> <limit effort="87" lower="-1.7628" upper="1.7628" velocity="2.1750"/> </joint> <link name="panda_link3"> <visual> <geometry> <mesh filename="package://franka_description/meshes/visual/link3.dae"/> </geometry> </visual> <collision> <geometry> <mesh filename="package://franka_description/meshes/collision/link3.stl"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="2.6498823337"/> <inertia ixx="0.0129300178" ixy="0.0" ixz="0.0" iyy="0.0150242121" iyz="0" izz="0.0142734598"/> </inertial> </link> <joint name="panda_joint3" type="revolute"> <safety_controller k_position="100.0" k_velocity="40.0" soft_lower_limit="-2.8973" soft_upper_limit="2.8973"/> <origin rpy="1.57079632679 0 0" xyz="0 -0.316 0"/> <parent link="panda_link2"/> <child link="panda_link3"/> <axis xyz="0 0 1"/> <limit effort="87" lower="-2.8973" upper="2.8973" velocity="2.1750"/> </joint> <link name="panda_link4"> <visual> <geometry> <mesh filename="package://franka_description/meshes/visual/link4.dae"/> </geometry> </visual> <collision> <geometry> <mesh filename="package://franka_description/meshes/collision/link4.stl"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="2.6948018744"/> <inertia ixx="0.0133874611" ixy="0.0" ixz="0.0" iyy="0.014514325" iyz="0" izz="0.0155175551"/> </inertial> </link> <joint name="panda_joint4" type="revolute"> <safety_controller k_position="100.0" k_velocity="40.0" soft_lower_limit="-3.0718" soft_upper_limit="-0.0698"/> <origin rpy="1.57079632679 0 0" xyz="0.0825 0 0"/> <parent link="panda_link3"/> <child link="panda_link4"/> <axis xyz="0 0 1"/> <limit effort="87" lower="-3.0718" upper="-0.0698" velocity="2.1750"/> </joint> <link name="panda_link5"> <visual> <geometry> <mesh filename="package://franka_description/meshes/visual/link5.dae"/> </geometry> </visual> <collision> <geometry> <mesh filename="package://franka_description/meshes/collision/link5.stl"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="2.9812816864"/> <inertia ixx="0.0325565705" ixy="0.0" ixz="0.0" iyy="0.0270660472" iyz="0" izz="0.0115023375"/> </inertial> </link> <joint name="panda_joint5" type="revolute"> <safety_controller k_position="100.0" k_velocity="40.0" soft_lower_limit="-2.8973" soft_upper_limit="2.8973"/> <origin rpy="-1.57079632679 0 0" xyz="-0.0825 0.384 0"/> <parent link="panda_link4"/> <child link="panda_link5"/> <axis xyz="0 0 1"/> <limit effort="12" lower="-2.8973" upper="2.8973" velocity="2.6100"/> </joint> <link name="panda_link6"> <visual> <geometry> <mesh filename="package://franka_description/meshes/visual/link6.dae"/> </geometry> </visual> <collision> <geometry> <mesh filename="package://franka_description/meshes/collision/link6.stl"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="1.1285806309"/> <inertia ixx="0.0026052565" ixy="0.0" ixz="0.0" iyy="0.0039897229" iyz="0" izz="0.0047048591"/> </inertial> </link> <joint name="panda_joint6" type="revolute"> <safety_controller k_position="100.0" k_velocity="40.0" soft_lower_limit="-0.0175" soft_upper_limit="3.7525"/> <origin rpy="1.57079632679 0 0" xyz="0 0 0"/> <parent link="panda_link5"/> <child link="panda_link6"/> <axis xyz="0 0 1"/> <limit effort="12" lower="-0.0175" upper="3.7525" velocity="2.6100"/> </joint> <link name="panda_link7"> <visual> <geometry> <mesh filename="package://franka_description/meshes/visual/link7.dae"/> </geometry> </visual> <collision> <geometry> <mesh filename="package://franka_description/meshes/collision/link7.stl"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="0.4052912465"/> <inertia ixx="0.0006316592" ixy="0.0" ixz="0.0" iyy="0.0006319639" iyz="0" izz="0.0010607721"/> </inertial> </link> <joint name="panda_joint7" type="revolute"> <safety_controller k_position="100.0" k_velocity="40.0" soft_lower_limit="-2.8973" soft_upper_limit="2.8973"/> <origin rpy="1.57079632679 0 0" xyz="0.088 0 0"/> <parent link="panda_link6"/> <child link="panda_link7"/> <axis xyz="0 0 1"/> <limit effort="12" lower="-2.8973" upper="2.8973" velocity="2.6100"/> </joint> <link name="panda_link8"/> <joint name="panda_joint8" type="fixed"> <origin rpy="0 0 0" xyz="0 0 0.107"/> <parent link="panda_link7"/> <child link="panda_link8"/> <axis xyz="0 0 0"/> </joint> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/robots/franka_description/robots/panda_arm_hand.urdf
<?xml version="1.0" ?> <!-- =================================================================================== --> <!-- | This document was autogenerated by xacro from panda_arm_hand.urdf.xacro | --> <!-- | EDITING THIS FILE BY HAND IS NOT RECOMMENDED | --> <!-- =================================================================================== --> <robot name="panda" xmlns:xacro="http://www.ros.org/wiki/xacro"> <link name="panda_link0"> <visual> <geometry> <mesh filename="package://franka_description/meshes/visual/link0.dae"/> </geometry> </visual> <collision> <geometry> <mesh filename="package://franka_description/meshes/collision/link0.stl"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="2.8142028896"/> <inertia ixx="0.0129886979" ixy="0.0" ixz="0.0" iyy="0.0165355284" iyz="0" izz="0.0203311636"/> </inertial> </link> <link name="panda_link1"> <visual> <geometry> <mesh filename="package://franka_description/meshes/visual/link1.dae"/> </geometry> </visual> <collision> <geometry> <mesh filename="package://franka_description/meshes/collision/link1.stl"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="2.3599995791"/> <inertia ixx="0.0186863903" ixy="0.0" ixz="0.0" iyy="0.0143789874" iyz="0" izz="0.00906812"/> </inertial> </link> <joint name="panda_joint1" type="revolute"> <safety_controller k_position="100.0" k_velocity="40.0" soft_lower_limit="-2.8973" soft_upper_limit="2.8973"/> <origin rpy="0 0 0" xyz="0 0 0.333"/> <parent link="panda_link0"/> <child link="panda_link1"/> <axis xyz="0 0 1"/> <limit effort="87" lower="-2.8973" upper="2.8973" velocity="2.1750"/> </joint> <link name="panda_link2"> <visual> <geometry> <mesh filename="package://franka_description/meshes/visual/link2.dae"/> </geometry> </visual> <collision> <geometry> <mesh filename="package://franka_description/meshes/collision/link2.stl"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="2.379518833"/> <inertia ixx="0.0190388734" ixy="0.0" ixz="0.0" iyy="0.0091429124" iyz="0" izz="0.014697537"/> </inertial> </link> <joint name="panda_joint2" type="revolute"> <safety_controller k_position="100.0" k_velocity="40.0" soft_lower_limit="-1.7628" soft_upper_limit="1.7628"/> <origin rpy="-1.57079632679 0 0" xyz="0 0 0"/> <parent link="panda_link1"/> <child link="panda_link2"/> <axis xyz="0 0 1"/> <limit effort="87" lower="-1.7628" upper="1.7628" velocity="2.1750"/> </joint> <link name="panda_link3"> <visual> <geometry> <mesh filename="package://franka_description/meshes/visual/link3.dae"/> </geometry> </visual> <collision> <geometry> <mesh filename="package://franka_description/meshes/collision/link3.stl"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="2.6498823337"/> <inertia ixx="0.0129300178" ixy="0.0" ixz="0.0" iyy="0.0150242121" iyz="0" izz="0.0142734598"/> </inertial> </link> <joint name="panda_joint3" type="revolute"> <safety_controller k_position="100.0" k_velocity="40.0" soft_lower_limit="-2.8973" soft_upper_limit="2.8973"/> <origin rpy="1.57079632679 0 0" xyz="0 -0.316 0"/> <parent link="panda_link2"/> <child link="panda_link3"/> <axis xyz="0 0 1"/> <limit effort="87" lower="-2.8973" upper="2.8973" velocity="2.1750"/> </joint> <link name="panda_link4"> <visual> <geometry> <mesh filename="package://franka_description/meshes/visual/link4.dae"/> </geometry> </visual> <collision> <geometry> <mesh filename="package://franka_description/meshes/collision/link4.stl"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="2.6948018744"/> <inertia ixx="0.0133874611" ixy="0.0" ixz="0.0" iyy="0.014514325" iyz="0" izz="0.0155175551"/> </inertial> </link> <joint name="panda_joint4" type="revolute"> <safety_controller k_position="100.0" k_velocity="40.0" soft_lower_limit="-3.0718" soft_upper_limit="-0.0698"/> <origin rpy="1.57079632679 0 0" xyz="0.0825 0 0"/> <parent link="panda_link3"/> <child link="panda_link4"/> <axis xyz="0 0 1"/> <limit effort="87" lower="-3.0718" upper="-0.0698" velocity="2.1750"/> </joint> <link name="panda_link5"> <visual> <geometry> <mesh filename="package://franka_description/meshes/visual/link5.dae"/> </geometry> </visual> <collision> <geometry> <mesh filename="package://franka_description/meshes/collision/link5.stl"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="2.9812816864"/> <inertia ixx="0.0325565705" ixy="0.0" ixz="0.0" iyy="0.0270660472" iyz="0" izz="0.0115023375"/> </inertial> </link> <joint name="panda_joint5" type="revolute"> <safety_controller k_position="100.0" k_velocity="40.0" soft_lower_limit="-2.8973" soft_upper_limit="2.8973"/> <origin rpy="-1.57079632679 0 0" xyz="-0.0825 0.384 0"/> <parent link="panda_link4"/> <child link="panda_link5"/> <axis xyz="0 0 1"/> <limit effort="12" lower="-2.8973" upper="2.8973" velocity="2.6100"/> </joint> <link name="panda_link6"> <visual> <geometry> <mesh filename="package://franka_description/meshes/visual/link6.dae"/> </geometry> </visual> <collision> <geometry> <mesh filename="package://franka_description/meshes/collision/link6.stl"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="1.1285806309"/> <inertia ixx="0.0026052565" ixy="0.0" ixz="0.0" iyy="0.0039897229" iyz="0" izz="0.0047048591"/> </inertial> </link> <joint name="panda_joint6" type="revolute"> <safety_controller k_position="100.0" k_velocity="40.0" soft_lower_limit="-0.0175" soft_upper_limit="3.7525"/> <origin rpy="1.57079632679 0 0" xyz="0 0 0"/> <parent link="panda_link5"/> <child link="panda_link6"/> <axis xyz="0 0 1"/> <limit effort="12" lower="-0.0175" upper="3.7525" velocity="2.6100"/> </joint> <link name="panda_link7"> <visual> <geometry> <mesh filename="package://franka_description/meshes/visual/link7.dae"/> </geometry> </visual> <collision> <geometry> <mesh filename="package://franka_description/meshes/collision/link7.stl"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="0.4052912465"/> <inertia ixx="0.0006316592" ixy="0.0" ixz="0.0" iyy="0.0006319639" iyz="0" izz="0.0010607721"/> </inertial> </link> <joint name="panda_joint7" type="revolute"> <safety_controller k_position="100.0" k_velocity="40.0" soft_lower_limit="-2.8973" soft_upper_limit="2.8973"/> <origin rpy="1.57079632679 0 0" xyz="0.088 0 0"/> <parent link="panda_link6"/> <child link="panda_link7"/> <axis xyz="0 0 1"/> <limit effort="12" lower="-2.8973" upper="2.8973" velocity="2.6100"/> </joint> <link name="panda_link8"/> <joint name="panda_joint8" type="fixed"> <origin rpy="0 0 0" xyz="0 0 0.107"/> <parent link="panda_link7"/> <child link="panda_link8"/> <axis xyz="0 0 0"/> </joint> <joint name="panda_hand_joint" type="fixed"> <parent link="panda_link8"/> <child link="panda_hand"/> <origin rpy="0 0 -0.785398163397" xyz="0 0 0"/> </joint> <link name="panda_hand"> <visual> <geometry> <mesh filename="package://franka_description/meshes/visual/hand.dae"/> </geometry> </visual> <collision> <geometry> <mesh filename="package://franka_description/meshes/collision/hand.stl"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="0.5583304799"/> <inertia ixx="0.0023394448" ixy="0.0" ixz="0.0" iyy="0.0005782786" iyz="0" izz="0.0021310296"/> </inertial> </link> <link name="panda_leftfinger"> <visual> <geometry> <mesh filename="package://franka_description/meshes/visual/finger.dae"/> </geometry> </visual> <collision> <geometry> <mesh filename="package://franka_description/meshes/collision/finger.stl"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="0.0140552232"/> <inertia ixx="4.20413082650939E-06" ixy="0.0" ixz="0.0" iyy="3.90263687466755E-06" iyz="0" izz="1.33474964199095E-06"/> </inertial> </link> <link name="panda_rightfinger"> <visual> <origin rpy="0 0 3.14159265359" xyz="0 0 0"/> <geometry> <mesh filename="package://franka_description/meshes/visual/finger.dae"/> </geometry> </visual> <collision> <origin rpy="0 0 3.14159265359" xyz="0 0 0"/> <geometry> <mesh filename="package://franka_description/meshes/collision/finger.stl"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="0.0140552232"/> <inertia ixx="4.20413082650939E-06" ixy="0.0" ixz="0.0" iyy="3.90263687466755E-06" iyz="0" izz="1.33474964199095E-06"/> </inertial> </link> <joint name="panda_finger_joint1" type="prismatic"> <parent link="panda_hand"/> <child link="panda_leftfinger"/> <origin rpy="0 0 0" xyz="0 0 0.0584"/> <axis xyz="0 1 0"/> <limit effort="20" lower="0.0" upper="0.04" velocity="0.2"/> </joint> <joint name="panda_finger_joint2" type="prismatic"> <parent link="panda_hand"/> <child link="panda_rightfinger"/> <origin rpy="0 0 0" xyz="0 0 0.0584"/> <axis xyz="0 -1 0"/> <limit effort="20" lower="0.0" upper="0.04" velocity="0.2"/> <mimic joint="panda_finger_joint1"/> </joint> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/robots/franka_description/robots/hand.urdf.xacro
<?xml version="1.0" encoding="utf-8"?> <robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="hand"> <xacro:include filename="hand.xacro"/> <xacro:hand ns="panda"/> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/robots/cobotta_pro_900/cobotta_pro_900.urdf
<?xml version="1.0" ?> <!-- =================================================================================== --> <!-- | This document was autogenerated by xacro from cobotta_pro_900_visualization/urdf/cobotta_pro_900.xacro | --> <!-- | EDITING THIS FILE BY HAND IS NOT RECOMMENDED | --> <!-- =================================================================================== --> <robot name="cobotta_pro_900"> <link name="world"/> <joint name="joint_w" type="fixed"> <parent link="world"/> <child link="base_link"/> </joint> <link name="base_link"> <visual> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://cobotta_pro_900_visualization/meshes/visual/base_link.dae" scale="1 1 1"/> </geometry> </visual> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://cobotta_pro_900_visualization/meshes/collision/base_link.dae" scale="1 1 1"/> </geometry> </collision> <inertial> <mass value="1"/> <origin rpy="0.000000 0.000000 0.000000" xyz="0.000000 0.000000 0.000000"/> <inertia ixx="1" ixy="0" ixz="0" iyy="1" iyz="0" izz="1"/> </inertial> </link> <link name="J1"> <visual> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://cobotta_pro_900_visualization/meshes/visual/J1.dae" scale="1 1 1"/> </geometry> </visual> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://cobotta_pro_900_visualization/meshes/collision/J1.dae" scale="1 1 1"/> </geometry> </collision> <inertial> <mass value="1"/> <origin rpy="0.000000 0.000000 0.000000" xyz="0.000000 0.000000 0.000000"/> <inertia ixx="1" ixy="0" ixz="0" iyy="1" iyz="0" izz="1"/> </inertial> </link> <joint name="joint_1" type="revolute"> <parent link="base_link"/> <child link="J1"/> <origin rpy="0.000000 0.000000 0.000000" xyz="0.000000 0.000000 0.000000"/> <axis xyz="-0.000000 -0.000000 1.000000"/> <limit effort="1" lower="-4.71238898038469" upper="4.71238898038469" velocity="1"/> <dynamics damping="0" friction="0"/> </joint> <transmission name="trans_1"> <type>transmission_interface/SimpleTransmission</type> <joint name="joint_1"> <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface> </joint> <actuator name="motor_1"> <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface> <mechanicalReduction>1</mechanicalReduction> </actuator> </transmission> <link name="J2"> <visual> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://cobotta_pro_900_visualization/meshes/visual/J2.dae" scale="1 1 1"/> </geometry> </visual> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://cobotta_pro_900_visualization/meshes/collision/J2.dae" scale="1 1 1"/> </geometry> </collision> <inertial> <mass value="1"/> <origin rpy="0.000000 0.000000 0.000000" xyz="0.000000 0.000000 0.000000"/> <inertia ixx="1" ixy="0" ixz="0" iyy="1" iyz="0" izz="1"/> </inertial> </link> <joint name="joint_2" type="revolute"> <parent link="J1"/> <child link="J2"/> <origin rpy="0.000000 0.000000 0.000000" xyz="0.000000 0.000000 0.210000"/> <axis xyz="-0.000000 1.000000 -0.000000"/> <limit effort="1" lower="-2.61799387799149" upper="2.61799387799149" velocity="1"/> <dynamics damping="0" friction="0"/> </joint> <transmission name="trans_2"> <type>transmission_interface/SimpleTransmission</type> <joint name="joint_2"> <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface> </joint> <actuator name="motor_2"> <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface> <mechanicalReduction>1</mechanicalReduction> </actuator> </transmission> <link name="J3"> <visual> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://cobotta_pro_900_visualization/meshes/visual/J3.dae" scale="1 1 1"/> </geometry> </visual> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://cobotta_pro_900_visualization/meshes/collision/J3.dae" scale="1 1 1"/> </geometry> </collision> <inertial> <mass value="1"/> <origin rpy="0.000000 0.000000 0.000000" xyz="0.000000 0.000000 0.000000"/> <inertia ixx="1" ixy="0" ixz="0" iyy="1" iyz="0" izz="1"/> </inertial> </link> <joint name="joint_3" type="revolute"> <parent link="J2"/> <child link="J3"/> <origin rpy="0.000000 0.000000 0.000000" xyz="0.000000 0.000000 0.510000"/> <axis xyz="-0.000000 1.000000 -0.000000"/> <limit effort="1" lower="-2.61799387799149" upper="2.61799387799149" velocity="1"/> <dynamics damping="0" friction="0"/> </joint> <transmission name="trans_3"> <type>transmission_interface/SimpleTransmission</type> <joint name="joint_3"> <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface> </joint> <actuator name="motor_3"> <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface> <mechanicalReduction>1</mechanicalReduction> </actuator> </transmission> <link name="J4"> <visual> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://cobotta_pro_900_visualization/meshes/visual/J4.dae" scale="1 1 1"/> </geometry> </visual> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://cobotta_pro_900_visualization/meshes/collision/J4.dae" scale="1 1 1"/> </geometry> </collision> <inertial> <mass value="1"/> <origin rpy="0.000000 0.000000 0.000000" xyz="0.000000 0.000000 0.000000"/> <inertia ixx="1" ixy="0" ixz="0" iyy="1" iyz="0" izz="1"/> </inertial> </link> <joint name="joint_4" type="revolute"> <parent link="J3"/> <child link="J4"/> <origin rpy="0.000000 0.000000 0.000000" xyz="0.000000 -0.030000 -0.720000"/> <axis xyz="-0.000000 -0.000000 1.000000"/> <limit effort="1" lower="-4.71238898038469" upper="4.71238898038469" velocity="1"/> <dynamics damping="0" friction="0"/> </joint> <transmission name="trans_4"> <type>transmission_interface/SimpleTransmission</type> <joint name="joint_4"> <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface> </joint> <actuator name="motor_4"> <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface> <mechanicalReduction>1</mechanicalReduction> </actuator> </transmission> <link name="J5"> <visual> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://cobotta_pro_900_visualization/meshes/visual/J5.dae" scale="1 1 1"/> </geometry> </visual> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://cobotta_pro_900_visualization/meshes/collision/J5.dae" scale="1 1 1"/> </geometry> </collision> <inertial> <mass value="1"/> <origin rpy="0.000000 0.000000 0.000000" xyz="0.000000 0.000000 0.000000"/> <inertia ixx="1" ixy="0" ixz="0" iyy="1" iyz="0" izz="1"/> </inertial> </link> <joint name="joint_5" type="revolute"> <parent link="J4"/> <child link="J5"/> <origin rpy="0.000000 0.000000 0.000000" xyz="0.000000 0.030000 1.110000"/> <axis xyz="-0.000000 1.000000 -0.000000"/> <limit effort="1" lower="-2.61799387799149" upper="2.61799387799149" velocity="1"/> <dynamics damping="0" friction="0"/> </joint> <transmission name="trans_5"> <type>transmission_interface/SimpleTransmission</type> <joint name="joint_5"> <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface> </joint> <actuator name="motor_5"> <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface> <mechanicalReduction>1</mechanicalReduction> </actuator> </transmission> <link name="J6"> <visual> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://cobotta_pro_900_visualization/meshes/visual/J6.dae" scale="1 1 1"/> </geometry> </visual> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://cobotta_pro_900_visualization/meshes/collision/J6.dae" scale="1 1 1"/> </geometry> </collision> <inertial> <mass value="1"/> <origin rpy="0.000000 0.000000 0.000000" xyz="0.000000 0.000000 0.000000"/> <inertia ixx="1" ixy="0" ixz="0" iyy="1" iyz="0" izz="1"/> </inertial> </link> <joint name="joint_6" type="revolute"> <parent link="J5"/> <child link="J6"/> <origin rpy="0.000000 0.000000 0.000000" xyz="0.000000 0.120000 0.160000"/> <axis xyz="-0.000000 -0.000000 1.000000"/> <limit effort="1" lower="-6.28318530717959" upper="6.28318530717959" velocity="1"/> <dynamics damping="0" friction="0"/> </joint> <transmission name="trans_6"> <type>transmission_interface/SimpleTransmission</type> <joint name="joint_6"> <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface> </joint> <actuator name="motor_6"> <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface> <mechanicalReduction>1</mechanicalReduction> </actuator> </transmission> <link name="onrobot_rg6_base_link"> <inertial> <origin rpy="0 0 0" xyz="0.0 0.0 0.0"/> <mass value="0.7"/> <inertia ixx="1.0E-03" ixy="1.0E-06" ixz="1.0E-06" iyy="1.0E-03" iyz="1.0E-06" izz="1.0E-03"/> </inertial> <visual> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://onrobot_rg6_visualization/meshes/visual/base_link.stl"/> </geometry> <material name=""> <color rgba="0.8 0.8 0.8 1"/> </material> </visual> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://onrobot_rg6_visualization/meshes/collision/base_link.stl"/> </geometry> </collision> </link> <link name="left_outer_knuckle"> <inertial> <origin rpy="0 0 0" xyz="0.0 0.0 0.0"/> <mass value="0.05"/> <inertia ixx="1.0E-03" ixy="1.0E-06" ixz="1.0E-06" iyy="1.0E-03" iyz="1.0E-06" izz="1.0E-03"/> </inertial> <visual> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://onrobot_rg6_visualization/meshes/visual/outer_knuckle.stl"/> </geometry> <material name=""> <color rgba="0.8 0.8 0.8 1"/> </material> </visual> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://onrobot_rg6_visualization/meshes/collision/outer_knuckle.stl"/> </geometry> </collision> </link> <link name="left_inner_knuckle"> <inertial> <origin rpy="0 0 0" xyz="0.0 0.0 0.0"/> <mass value="0.05"/> <inertia ixx="1.0E-03" ixy="1.0E-06" ixz="1.0E-06" iyy="1.0E-03" iyz="1.0E-06" izz="1.0E-03"/> </inertial> <visual> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://onrobot_rg6_visualization/meshes/visual/inner_knuckle.stl"/> </geometry> <material name=""> <color rgba="0.8 0.8 0.8 1"/> </material> </visual> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://onrobot_rg6_visualization/meshes/collision/inner_knuckle.stl"/> </geometry> </collision> </link> <link name="left_inner_finger"> <inertial> <origin rpy="0 0 0" xyz="0.0 0.0 0.0"/> <mass value="0.05"/> <inertia ixx="1.0E-03" ixy="1.0E-06" ixz="1.0E-06" iyy="1.0E-03" iyz="1.0E-06" izz="1.0E-03"/> </inertial> <visual> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://onrobot_rg6_visualization/meshes/visual/inner_finger.stl"/> </geometry> <material name=""> <color rgba="0.1 0.1 0.1 1"/> </material> </visual> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://onrobot_rg6_visualization/meshes/collision/inner_finger.stl"/> </geometry> </collision> </link> <link name="right_outer_knuckle"> <inertial> <origin rpy="0 0 0" xyz="0.0 0.0 0.0"/> <mass value="0.05"/> <inertia ixx="1.0E-03" ixy="1.0E-06" ixz="1.0E-06" iyy="1.0E-03" iyz="1.0E-06" izz="1.0E-03"/> </inertial> <visual> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://onrobot_rg6_visualization/meshes/visual/outer_knuckle.stl"/> </geometry> <material name=""> <color rgba="0.8 0.8 0.8 1"/> </material> </visual> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://onrobot_rg6_visualization/meshes/collision/outer_knuckle.stl"/> </geometry> </collision> </link> <link name="right_inner_knuckle"> <inertial> <origin rpy="0 0 0" xyz="0.0 0.0 0.0"/> <mass value="0.05"/> <inertia ixx="1.0E-03" ixy="1.0E-06" ixz="1.0E-06" iyy="1.0E-03" iyz="1.0E-06" izz="1.0E-03"/> </inertial> <visual> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://onrobot_rg6_visualization/meshes/visual/inner_knuckle.stl"/> </geometry> <material name=""> <color rgba="0.8 0.8 0.8 1"/> </material> </visual> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://onrobot_rg6_visualization/meshes/collision/inner_knuckle.stl"/> </geometry> </collision> </link> <link name="right_inner_finger"> <inertial> <origin rpy="0 0 0" xyz="0.0 0.0 0.0"/> <mass value="0.05"/> <inertia ixx="1.0E-03" ixy="1.0E-06" ixz="1.0E-06" iyy="1.0E-03" iyz="1.0E-06" izz="1.0E-03"/> </inertial> <visual> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://onrobot_rg6_visualization/meshes/visual/inner_finger.stl"/> </geometry> <material name=""> <color rgba="0.1 0.1 0.1 1"/> </material> </visual> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://onrobot_rg6_visualization/meshes/collision/inner_finger.stl"/> </geometry> </collision> </link> <joint name="finger_joint" type="revolute"> <origin rpy="0 0 0" xyz="0 -0.024112 0.136813"/> <parent link="onrobot_rg6_base_link"/> <child link="left_outer_knuckle"/> <axis xyz="-1 0 0"/> <limit effort="1000" lower="-0.628319" upper="0.628319" velocity="2.0"/> </joint> <joint name="left_inner_knuckle_joint" type="revolute"> <origin rpy="0 0 0.0" xyz="0 -0.01272 0.159500"/> <parent link="onrobot_rg6_base_link"/> <child link="left_inner_knuckle"/> <axis xyz="1 0 0"/> <limit effort="1000" lower="-0.628319" upper="0.628319" velocity="2.0"/> <mimic joint="finger_joint" multiplier="-1" offset="0"/> </joint> <joint name="left_inner_finger_joint" type="revolute"> <origin rpy="0 0 0" xyz="0 -0.047334999999999995 0.064495"/> <parent link="left_outer_knuckle"/> <child link="left_inner_finger"/> <axis xyz="1 0 0"/> <limit effort="1000" lower="-0.872665" upper="0.872665" velocity="2.0"/> <mimic joint="finger_joint" multiplier="1" offset="0"/> </joint> <joint name="right_outer_knuckle_joint" type="revolute"> <origin rpy="0 0 3.141592653589793" xyz="0 0.024112 0.136813"/> <parent link="onrobot_rg6_base_link"/> <child link="right_outer_knuckle"/> <axis xyz="1 0 0"/> <limit effort="1000" lower="-0.628319" upper="0.628319" velocity="2.0"/> <mimic joint="finger_joint" multiplier="-1" offset="0"/> </joint> <joint name="right_inner_knuckle_joint" type="revolute"> <origin rpy="0 0 -3.141592653589793" xyz="0 0.01272 0.159500"/> <parent link="onrobot_rg6_base_link"/> <child link="right_inner_knuckle"/> <axis xyz="1 0 0"/> <limit effort="1000" lower="-0.628319" upper="0.628319" velocity="2.0"/> <mimic joint="finger_joint" multiplier="-1" offset="0"/> </joint> <joint name="right_inner_finger_joint" type="revolute"> <origin rpy="0 0 0" xyz="0 -0.047334999999999995 0.064495"/> <parent link="right_outer_knuckle"/> <child link="right_inner_finger"/> <axis xyz="1 0 0"/> <limit effort="1000" lower="-0.872665" upper="0.872665" velocity="2.0"/> <mimic joint="finger_joint" multiplier="1" offset="0"/> </joint> <transmission name="finger_joint_trans"> <type>transmission_interface/SimpleTransmission</type> <joint name="finger_joint"> <hardwareInterface>PositionJointInterface</hardwareInterface> </joint> <actuator name="finger_joint_motor"> <mechanicalReduction>1</mechanicalReduction> </actuator> </transmission> <joint name="joint_tcp_fixed" type="fixed"> <parent link="J6"/> <child link="onrobot_rg6_base_link"/> <origin rpy="0 0 0" xyz="0 0 0"/> </joint> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/robots/cobotta_pro_900/onrobot_rg6_visualization/urdf/onrobot_rg6_model_macro.xacro
<?xml version="1.0"?> <robot xmlns:xacro="http://ros.org/wiki/xacro"> <xacro:include filename="$(find onrobot_rg6_visualization)/urdf/onrobot_rg6_transmission.xacro" /> <xacro:macro name="outer_knuckle" params="prefix fingerprefix"> <link name="${prefix}${fingerprefix}_outer_knuckle"> <inertial> <origin xyz="0.0 0.0 0.0" rpy="0 0 0" /> <mass value="0.05" /> <inertia ixx="1.0E-03" ixy="1.0E-06" ixz="1.0E-06" iyy="1.0E-03" iyz="1.0E-06" izz="1.0E-03" /> </inertial> <visual> <origin xyz="0 0 0" rpy="0 0 0" /> <geometry> <mesh filename="package://onrobot_rg6_visualization/meshes/visual/outer_knuckle.stl" /> </geometry> <material name=""> <color rgba="0.8 0.8 0.8 1" /> </material> </visual> <collision> <origin xyz="0 0 0" rpy="0 0 0" /> <geometry> <mesh filename="package://onrobot_rg6_visualization/meshes/collision/outer_knuckle.stl" /> </geometry> </collision> </link> </xacro:macro> <xacro:macro name="inner_knuckle" params="prefix fingerprefix"> <link name="${prefix}${fingerprefix}_inner_knuckle"> <inertial> <origin xyz="0.0 0.0 0.0" rpy="0 0 0" /> <mass value="0.05" /> <inertia ixx="1.0E-03" ixy="1.0E-06" ixz="1.0E-06" iyy="1.0E-03" iyz="1.0E-06" izz="1.0E-03" /> </inertial> <visual> <origin xyz="0 0 0" rpy="0 0 0" /> <geometry> <mesh filename="package://onrobot_rg6_visualization/meshes/visual/inner_knuckle.stl" /> </geometry> <material name=""> <color rgba="0.8 0.8 0.8 1" /> </material> </visual> <collision> <origin xyz="0 0 0" rpy="0 0 0" /> <geometry> <mesh filename="package://onrobot_rg6_visualization/meshes/collision/inner_knuckle.stl" /> </geometry> </collision> </link> </xacro:macro> <xacro:macro name="inner_finger" params="prefix fingerprefix"> <link name="${prefix}${fingerprefix}_inner_finger"> <inertial> <origin xyz="0.0 0.0 0.0" rpy="0 0 0" /> <mass value="0.05" /> <inertia ixx="1.0E-03" ixy="1.0E-06" ixz="1.0E-06" iyy="1.0E-03" iyz="1.0E-06" izz="1.0E-03" /> </inertial> <visual> <origin xyz="0 0 0" rpy="0 0 0" /> <geometry> <mesh filename="package://onrobot_rg6_visualization/meshes/visual/inner_finger.stl" /> </geometry> <material name=""> <color rgba="0.1 0.1 0.1 1" /> </material> </visual> <collision> <origin xyz="0 0 0" rpy="0 0 0" /> <geometry> <mesh filename="package://onrobot_rg6_visualization/meshes/collision/inner_finger.stl" /> </geometry> </collision> </link> </xacro:macro> <xacro:macro name="inner_knuckle_joint" params="prefix fingerprefix reflect"> <joint name="${prefix}${fingerprefix}_inner_knuckle_joint" type="revolute"> <origin xyz="0 ${reflect * -0.012720} 0.159500" rpy="0 0 ${(reflect - 1) * pi / 2}" /> <parent link="${prefix}onrobot_rg6_base_link" /> <child link="${prefix}${fingerprefix}_inner_knuckle" /> <axis xyz="1 0 0" /> <limit lower="-0.628319" upper="0.628319" velocity="2.0" effort="1000" /> <mimic joint="${prefix}finger_joint" multiplier="-1" offset="0" /> </joint> </xacro:macro> <xacro:macro name="inner_finger_joint" params="prefix fingerprefix"> <joint name="${prefix}${fingerprefix}_inner_finger_joint" type="revolute"> <origin xyz="0 ${-(0.071447-0.024112)} ${0.201308-0.136813}" rpy="0 0 0" /> <parent link="${prefix}${fingerprefix}_outer_knuckle" /> <child link="${prefix}${fingerprefix}_inner_finger" /> <axis xyz="1 0 0" /> <limit lower="-0.872665" upper="0.872665" velocity="2.0" effort="1000" /> <mimic joint="${prefix}finger_joint" multiplier="1" offset="0" /> </joint> </xacro:macro> <xacro:include filename="$(find onrobot_rg6_visualization)/urdf/onrobot_rg6.xacro" /> <xacro:macro name="finger_joint" params="prefix"> <joint name="${prefix}finger_joint" type="revolute"> <origin xyz="0 -0.024112 0.136813" rpy="0 0 0" /> <parent link="${prefix}onrobot_rg6_base_link" /> <child link="${prefix}left_outer_knuckle" /> <axis xyz="-1 0 0" /> <limit lower="-0.628319" upper="0.628319" velocity="2.0" effort="1000" /> </joint> <xacro:finger_joints prefix="${prefix}" fingerprefix="left" reflect="1.0"/> </xacro:macro> <xacro:macro name="right_outer_knuckle_joint" params="prefix"> <joint name="${prefix}right_outer_knuckle_joint" type="revolute"> <origin xyz="0 0.024112 0.136813" rpy="0 0 ${pi}" /> <parent link="${prefix}onrobot_rg6_base_link" /> <child link="${prefix}right_outer_knuckle" /> <axis xyz="1 0 0" /> <limit lower="-0.628319" upper="0.628319" velocity="2.0" effort="1000" /> <mimic joint="${prefix}finger_joint" multiplier="-1" offset="0" /> </joint> <xacro:finger_joints prefix="${prefix}" fingerprefix="right" reflect="-1.0"/> </xacro:macro> <xacro:macro name="onrobot_rg6" params="prefix"> <xacro:onrobot_rg6_base_link prefix="${prefix}"/> <xacro:finger_links prefix="${prefix}" fingerprefix="left"/> <xacro:finger_links prefix="${prefix}" fingerprefix="right"/> <xacro:finger_joint prefix="${prefix}"/> <xacro:right_outer_knuckle_joint prefix="${prefix}"/> <xacro:onrobot_rg6_transmission prefix="${prefix}"/> </xacro:macro> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/robots/cobotta_pro_900/onrobot_rg6_visualization/urdf/onrobot_rg6_model.xacro
<?xml version="1.0"?> <robot name="onrobot_rg6_model" xmlns:xacro="http://ros.org/wiki/xacro"> <xacro:include filename="$(find onrobot_rg6_visualization)/urdf/onrobot_rg6_model_macro.xacro" /> <xacro:onrobot_rg6 prefix=""/> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/robots/cobotta_pro_900/onrobot_rg6_visualization/urdf/onrobot_rg6.xacro
<?xml version="1.0"?> <robot xmlns:xacro="http://ros.org/wiki/xacro"> <xacro:macro name="onrobot_rg6_base_link" params="prefix"> <link name="${prefix}onrobot_rg6_base_link"> <inertial> <origin xyz="0.0 0.0 0.0" rpy="0 0 0" /> <mass value="0.7" /> <inertia ixx="1.0E-03" ixy="1.0E-06" ixz="1.0E-06" iyy="1.0E-03" iyz="1.0E-06" izz="1.0E-03" /> </inertial> <visual> <origin xyz="0 0 0" rpy="0 0 0" /> <geometry> <mesh filename="package://onrobot_rg6_visualization/meshes/visual/base_link.stl" /> </geometry> <material name=""> <color rgba="0.8 0.8 0.8 1" /> </material> </visual> <collision> <origin xyz="0 0 0" rpy="0 0 0" /> <geometry> <mesh filename="package://onrobot_rg6_visualization/meshes/collision/base_link.stl" /> </geometry> </collision> </link> </xacro:macro> <xacro:macro name="finger_joints" params="prefix fingerprefix reflect"> <xacro:inner_knuckle_joint prefix="${prefix}" fingerprefix="${fingerprefix}" reflect="${reflect}"/> <xacro:inner_finger_joint prefix="${prefix}" fingerprefix="${fingerprefix}"/> </xacro:macro> <xacro:macro name="finger_links" params="prefix fingerprefix"> <xacro:outer_knuckle prefix="${prefix}" fingerprefix="${fingerprefix}"/> <xacro:inner_knuckle prefix="${prefix}" fingerprefix="${fingerprefix}"/> <xacro:inner_finger prefix="${prefix}" fingerprefix="${fingerprefix}"/> </xacro:macro> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/robots/cobotta_pro_900/onrobot_rg6_visualization/urdf/onrobot_rg6_transmission.xacro
<?xml version="1.0"?> <robot xmlns:xacro="http://ros.org/wiki/xacro"> <xacro:macro name="onrobot_rg6_transmission" params="prefix"> <transmission name="${prefix}finger_joint_trans"> <type>transmission_interface/SimpleTransmission</type> <joint name="${prefix}finger_joint"> <hardwareInterface>PositionJointInterface</hardwareInterface> </joint> <actuator name="${prefix}finger_joint_motor"> <mechanicalReduction>1</mechanicalReduction> </actuator> </transmission> </xacro:macro> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/robots/cobotta_pro_900/cobotta_pro_900_visualization/urdf/cobotta_pro_900.xacro
<?xml version="1.0" encoding="UTF-8"?> <robot name="cobotta_pro_900" xmlns:xacro="http://www.ros.org/wiki/xacro"> <link name="world"/> <joint name="joint_w" type="fixed"> <parent link="world"/> <child link="base_link"/> </joint> <link name="base_link"> <visual> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://cobotta_pro_900_visualization/meshes/visual/base_link.dae" scale="1 1 1"/> </geometry> </visual> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://cobotta_pro_900_visualization/meshes/collision/base_link.dae" scale="1 1 1"/> </geometry> </collision> <inertial> <mass value="1"/> <origin rpy="0.000000 0.000000 0.000000" xyz="0.000000 0.000000 0.000000"/> <inertia ixx="1" ixy="0" ixz="0" iyy="1" iyz="0" izz="1"/> </inertial> </link> <link name="J1"> <visual> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://cobotta_pro_900_visualization/meshes/visual/J1.dae" scale="1 1 1"/> </geometry> </visual> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://cobotta_pro_900_visualization/meshes/collision/J1.dae" scale="1 1 1"/> </geometry> </collision> <inertial> <mass value="1"/> <origin rpy="0.000000 0.000000 0.000000" xyz="0.000000 0.000000 0.000000"/> <inertia ixx="1" ixy="0" ixz="0" iyy="1" iyz="0" izz="1"/> </inertial> </link> <joint name="joint_1" type="revolute"> <parent link="base_link"/> <child link="J1"/> <origin rpy="0.000000 0.000000 0.000000" xyz="0.000000 0.000000 0.000000"/> <axis xyz="-0.000000 -0.000000 1.000000"/> <limit effort="1" lower="-4.71238898038469" upper="4.71238898038469" velocity="1"/> <dynamics damping="0" friction="0"/> </joint> <transmission name="trans_1"> <type>transmission_interface/SimpleTransmission</type> <joint name="joint_1"> <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface> </joint> <actuator name="motor_1"> <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface> <mechanicalReduction>1</mechanicalReduction> </actuator> </transmission> <link name="J2"> <visual> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://cobotta_pro_900_visualization/meshes/visual/J2.dae" scale="1 1 1"/> </geometry> </visual> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://cobotta_pro_900_visualization/meshes/collision/J2.dae" scale="1 1 1"/> </geometry> </collision> <inertial> <mass value="1"/> <origin rpy="0.000000 0.000000 0.000000" xyz="0.000000 0.000000 0.000000"/> <inertia ixx="1" ixy="0" ixz="0" iyy="1" iyz="0" izz="1"/> </inertial> </link> <joint name="joint_2" type="revolute"> <parent link="J1"/> <child link="J2"/> <origin rpy="0.000000 0.000000 0.000000" xyz="0.000000 0.000000 0.210000"/> <axis xyz="-0.000000 1.000000 -0.000000"/> <limit effort="1" lower="-2.61799387799149" upper="2.61799387799149" velocity="1"/> <dynamics damping="0" friction="0"/> </joint> <transmission name="trans_2"> <type>transmission_interface/SimpleTransmission</type> <joint name="joint_2"> <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface> </joint> <actuator name="motor_2"> <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface> <mechanicalReduction>1</mechanicalReduction> </actuator> </transmission> <link name="J3"> <visual> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://cobotta_pro_900_visualization/meshes/visual/J3.dae" scale="1 1 1"/> </geometry> </visual> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://cobotta_pro_900_visualization/meshes/collision/J3.dae" scale="1 1 1"/> </geometry> </collision> <inertial> <mass value="1"/> <origin rpy="0.000000 0.000000 0.000000" xyz="0.000000 0.000000 0.000000"/> <inertia ixx="1" ixy="0" ixz="0" iyy="1" iyz="0" izz="1"/> </inertial> </link> <joint name="joint_3" type="revolute"> <parent link="J2"/> <child link="J3"/> <origin rpy="0.000000 0.000000 0.000000" xyz="0.000000 0.000000 0.510000"/> <axis xyz="-0.000000 1.000000 -0.000000"/> <limit effort="1" lower="-2.61799387799149" upper="2.61799387799149" velocity="1"/> <dynamics damping="0" friction="0"/> </joint> <transmission name="trans_3"> <type>transmission_interface/SimpleTransmission</type> <joint name="joint_3"> <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface> </joint> <actuator name="motor_3"> <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface> <mechanicalReduction>1</mechanicalReduction> </actuator> </transmission> <link name="J4"> <visual> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://cobotta_pro_900_visualization/meshes/visual/J4.dae" scale="1 1 1"/> </geometry> </visual> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://cobotta_pro_900_visualization/meshes/collision/J4.dae" scale="1 1 1"/> </geometry> </collision> <inertial> <mass value="1"/> <origin rpy="0.000000 0.000000 0.000000" xyz="0.000000 0.000000 0.000000"/> <inertia ixx="1" ixy="0" ixz="0" iyy="1" iyz="0" izz="1"/> </inertial> </link> <joint name="joint_4" type="revolute"> <parent link="J3"/> <child link="J4"/> <origin rpy="0.000000 0.000000 0.000000" xyz="0.000000 -0.030000 -0.720000"/> <axis xyz="-0.000000 -0.000000 1.000000"/> <limit effort="1" lower="-4.71238898038469" upper="4.71238898038469" velocity="1"/> <dynamics damping="0" friction="0"/> </joint> <transmission name="trans_4"> <type>transmission_interface/SimpleTransmission</type> <joint name="joint_4"> <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface> </joint> <actuator name="motor_4"> <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface> <mechanicalReduction>1</mechanicalReduction> </actuator> </transmission> <link name="J5"> <visual> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://cobotta_pro_900_visualization/meshes/visual/J5.dae" scale="1 1 1"/> </geometry> </visual> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://cobotta_pro_900_visualization/meshes/collision/J5.dae" scale="1 1 1"/> </geometry> </collision> <inertial> <mass value="1"/> <origin rpy="0.000000 0.000000 0.000000" xyz="0.000000 0.000000 0.000000"/> <inertia ixx="1" ixy="0" ixz="0" iyy="1" iyz="0" izz="1"/> </inertial> </link> <joint name="joint_5" type="revolute"> <parent link="J4"/> <child link="J5"/> <origin rpy="0.000000 0.000000 0.000000" xyz="0.000000 0.030000 1.110000"/> <axis xyz="-0.000000 1.000000 -0.000000"/> <limit effort="1" lower="-2.61799387799149" upper="2.61799387799149" velocity="1"/> <dynamics damping="0" friction="0"/> </joint> <transmission name="trans_5"> <type>transmission_interface/SimpleTransmission</type> <joint name="joint_5"> <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface> </joint> <actuator name="motor_5"> <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface> <mechanicalReduction>1</mechanicalReduction> </actuator> </transmission> <link name="J6"> <visual> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://cobotta_pro_900_visualization/meshes/visual/J6.dae" scale="1 1 1"/> </geometry> </visual> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://cobotta_pro_900_visualization/meshes/collision/J6.dae" scale="1 1 1"/> </geometry> </collision> <inertial> <mass value="1"/> <origin rpy="0.000000 0.000000 0.000000" xyz="0.000000 0.000000 0.000000"/> <inertia ixx="1" ixy="0" ixz="0" iyy="1" iyz="0" izz="1"/> </inertial> </link> <joint name="joint_6" type="revolute"> <parent link="J5"/> <child link="J6"/> <origin rpy="0.000000 0.000000 0.000000" xyz="0.000000 0.120000 0.160000"/> <axis xyz="-0.000000 -0.000000 1.000000"/> <limit effort="1" lower="-6.28318530717959" upper="6.28318530717959" velocity="1"/> <dynamics damping="0" friction="0"/> </joint> <transmission name="trans_6"> <type>transmission_interface/SimpleTransmission</type> <joint name="joint_6"> <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface> </joint> <actuator name="motor_6"> <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface> <mechanicalReduction>1</mechanicalReduction> </actuator> </transmission> <xacro:include filename="$(find onrobot_rg6_visualization)/urdf/onrobot_rg6_model.xacro" /> <joint name="joint_tcp_fixed" type="fixed"> <parent link="J6"/> <child link="onrobot_rg6_base_link"/> <origin rpy="0 0 0" xyz="0 0 0"/> </joint> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/robots/carter/urdf/carter.urdf
<?xml version="1.0" encoding="UTF-8"?> <robot name="carter"> <link name="chassis_link"> <visual> <origin rpy="0 0 0" xyz="0 0 0" /> <geometry> <mesh filename="package://carter/meshes/chassis.obj" /> </geometry> <material name="gray"/> </visual> <collision> <origin rpy="0 0 0" xyz="-0.07764248 -0.000000 0.14683718" /> <geometry> <box size=".55 .40 .54"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="-0.07764248 -0.000000 0.14683718" /> <mass value="45.88" /> <inertia ixx="1.182744" ixy="0.017957" ixz="-0.077476" iyx="0.017957" iyy="0.538664" iyz="0.000018" izx="-0.077476" izy="0.000018" izz="1.240229"/> </inertial> </link> <link name="left_wheel_link"> <visual> <origin rpy="1.57057 -1.57057 0" xyz="0 0 0" /> <geometry> <mesh filename="package://carter/meshes/side_wheel.obj" /> </geometry> <material name="black"/> </visual> <collision> <origin rpy="1.57057 -1.57057 0" xyz="0 -0.05 0" /> <geometry> <cylinder length = "0.1" radius = "0.240"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 -0.05 0" /> <mass value="4.195729" /> <inertia ixx="0.063680" ixy="0.000000" ixz="0.000000" iyx="0.000000" iyy="0.121410" iyz="0.000000" izx="0.000000" izy="0.000000" izz="0.063680"/> </inertial> </link> <link name="right_wheel_link"> <visual> <origin rpy="-1.57057 -1.57057 0" xyz="0 0 0" /> <geometry> <mesh filename="package://carter/meshes/side_wheel.obj" /> </geometry> <material name="black"/> </visual> <collision> <origin rpy="-1.57057 -1.57057 0" xyz="0 .05 0" /> <geometry> <cylinder length = "0.1" radius = "0.240"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 .05 0" /> <mass value="4.195729" /> <inertia ixx="0.063680" ixy="0.000000" ixz="0.000000" iyx="0.000000" iyy="0.121410" iyz="0.000000" izx="0.000000" izy="0.000000" izz="0.063680"/> </inertial> </link> <link name="rear_pivot_link"> <visual> <origin rpy="-1.57057 0 0" xyz="-.03809695 0 -.088" /> <geometry> <mesh filename="package://carter/meshes/pivot.obj" /> </geometry> <material name="black"/> </visual> <collision> <origin rpy="0 0 0" xyz="-.01 0 -.03" /> <geometry> <box size=".09 .08 .12"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="-.01 0 -.03" /> <mass value="0.579519"/> <inertia ixx="0.001361" ixy="-0.000003" ixz="0.000347" iyx="-0.000003" iyy="0.001287" iyz="-0.000010" izx="0.000347" izy="-0.000010" izz="0.000632"/> </inertial> </link> <link name="rear_wheel_link"> <visual> <origin rpy="1.57057 0 0" xyz="0 0 0" /> <geometry> <mesh filename="package://carter/meshes/caster_wheel.obj" /> </geometry> </visual> <collision> <origin rpy="1.57057 0 0" xyz="0 0 0" /> <geometry> <cylinder length = "0.04" radius = "0.076"/> </geometry> </collision> <inertial> <origin rpy="1.57057 0 0" xyz="0.000000 0.000000 0.000000" /> <mass value="1.25"/> <inertia ixx="0.02888" ixy="0.000000" ixz="0.000000" iyx="0.000000" iyy="0.02888" iyz="0.000000" izx="0.000000" izy="0.000000" izz="0.02888"/> </inertial> </link> <link name="com_offset"> <collision> <origin rpy="0 0 0" xyz="0 0 0" /> <geometry> <box size=".25 .25 .1"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0" /> <mass value="20.0" /> <inertia ixx="1.208" ixy="0" ixz="0" iyy="1.208" iyz="0" izz="2.08" /> </inertial> </link> <link name="imu"> <collision> <origin rpy="0 0 0" xyz="0 0 0" /> <geometry> <box size=".1 .1 .1"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0" /> <mass value=".1" /> </inertial> </link> <joint name="com_joint" type="fixed"> <origin rpy="0 0 0" xyz="-.3 0 0" /> <axis xyz="0 1 0" /> <parent link="chassis_link" /> <child link="com_offset" /> </joint> <joint name="imu_joint" type="fixed"> <origin rpy="0 0 0" xyz="0 0 0" /> <axis xyz="0 1 0" /> <parent link="chassis_link" /> <child link="imu" /> </joint> <joint name="left_wheel" type="continuous"> <origin rpy="0 0 0" xyz="0 0.31420517 0" /> <axis xyz="0 1 0" /> <parent link="chassis_link" /> <child link="left_wheel_link" /> </joint> <joint name="right_wheel" type="continuous"> <origin rpy="0 0 0" xyz="0 -0.31420517 0" /> <axis xyz="0 1 0" /> <parent link="chassis_link" /> <child link="right_wheel_link" /> </joint> <joint name="rear_pivot" type="continuous"> <origin rpy="0 0 0" xyz="-0.31613607 0 -.0758" /> <axis xyz="0 0 1" /> <parent link="chassis_link" /> <child link="rear_pivot_link" /> </joint> <joint name="rear_axle" type="continuous"> <origin rpy="0 0 0" xyz="-.03809695 0 -.08961022" /> <axis xyz="0 1 0" /> <parent link="rear_pivot_link" /> <child link="rear_wheel_link" /> </joint> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/robots/kaya/urdf/xacro_to_urdf.sh
#!/bin/bash ​ source /opt/ros/melodic/setup.bash ​ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" ​ # add to ROS package path export ROS_PACKAGE_PATH=${SCRIPT_DIR}/../..:$ROS_PACKAGE_PATH ​ echo "Using ROS_PACKAGE_PATH ${ROS_PACKAGE_PATH}" ​ ​ rosrun xacro xacro --inorder -o kaya.urdf kaya.xacro
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/robots/kaya/urdf/kaya.xacro
<?xml version="1.0"?> <robot name="kaya" xmlns:xacro="http://ros.org/wiki/xacro"> <xacro:macro name="inertial_box" params="size rho:=1000 xyz:='0 0 0' rpy:='0 0 0'"> <xacro:property name="w" value="${size.split()[0]}"/> <xacro:property name="d" value="${size.split()[1]}"/> <xacro:property name="h" value="${size.split()[2]}"/> <xacro:property name="mass" value="${rho*w*d*h}"/> <inertial> <origin xyz="${xyz}" rpy="${rpy}"/> <mass value="${mass}"/> <inertia ixx="${(mass/12)*(h**2 + d**2)}" iyy="${(mass/12)*(w**2 + h**2)}" izz="${(mass/12)*(w**2 + d**2)}" ixy="0" ixz="0" iyz="0"/> </inertial> </xacro:macro> <xacro:macro name="inertial_cylinder" params="length radius rho:=1000 xyz:='0 0 0' rpy:='0 0 0'"> <xacro:property name="mass" value="${rho*pi*length*radius**2}"/> <inertial> <origin xyz="${xyz}" rpy="${rpy}"/> <mass value="${mass}"/> <inertia ixx="${(mass/12)*(3*radius**2 + length**2)}" iyy="${(mass/12)*(3*radius**2 + length**2)}" izz="${(mass/2)*radius**2}" ixy="0" ixz="0" iyz="0"/> </inertial> </xacro:macro> <xacro:macro name="inertial_sphere" params="radius rho:=1000 xyz:='0 0 0' rpy:='0 0 0'"> <xacro:property name="mass" value="${4/3*rho*pi*radius**3}"/> <inertial> <origin xyz="${xyz}" rpy="${rpy}"/> <mass value="${mass}"/> <inertia ixx="${(2/5*mass)*(radius**2)}" iyy="${(2/5*mass)*(radius**2)}" izz="${(2/5*mass)*(radius**2)}" ixy="0" ixz="0" iyz="0"/> </inertial> </xacro:macro> <xacro:macro name="collision_cylinder" params="length radius xyz:='0 0 0' rpy:='0 0 0'"> <collision> <origin xyz="${xyz}" rpy="${rpy}"/> <geometry> <cylinder length="${length}" radius="${radius}"/> </geometry> </collision> </xacro:macro> <xacro:macro name="collision_capsule" params="length radius xyz:='0 0 0' rpy:='0 0 0'"> <collision> <origin xyz="${xyz}" rpy="${rpy}"/> <geometry> <capsule length="${length}" radius="${radius}"/> </geometry> </collision> </xacro:macro> <xacro:macro name="collision_box" params="size xyz:='0 0 0' rpy:='0 0 0'"> <collision> <origin xyz="${xyz}" rpy="${rpy}"/> <geometry> <box size="${size}"/> </geometry> </collision> </xacro:macro> <xacro:macro name="collision_sphere" params="radius xyz:='0 0 0' rpy:='0 0 0'"> <collision> <origin xyz="${xyz}" rpy="${rpy}"/> <geometry> <sphere radius="${radius}"/> </geometry> </collision> </xacro:macro> <link name="base_link"> <visual> <geometry> <mesh filename="package://meshes/base.dae" scale="0.1 0.1 0.1"/> </geometry> </visual> <visual> <origin xyz="0.000825 0.077436 0.024927"/> <geometry> <mesh filename="package://meshes/nano_chassis_base.dae" scale="0.1 0.1 0.1"/> </geometry> </visual> <visual> <origin xyz="0.001140 0.071549 0.062302"/> <geometry> <mesh filename="package://meshes/nano_chassis_bridge.dae" scale="0.1 0.1 0.1"/> </geometry> </visual> <visual> <origin xyz="0.001192 0.079804 0.084978"/> <geometry> <mesh filename="package://meshes/nano_chassis_rs_mount.dae" scale="0.1 0.1 0.1"/> </geometry> </visual> <visual> <origin xyz="0.001053 0.090384 0.090843"/> <geometry> <mesh filename="package://meshes/realsense.dae" scale="0.1 0.1 0.1"/> </geometry> </visual> <collision> <geometry> <mesh filename="package://meshes/base_collision.dae" scale="0.1 0.1 0.1"/> </geometry> </collision> <inertial> <mass value="0.1"/> </inertial> </link> <link name="assembly_battery"> <visual> <geometry> <mesh filename="package://meshes/assembly_battery.dae" scale="0.1 0.1 0.1"/> </geometry> </visual> <xacro:collision_box xyz="0.0000033 -0.00127 0.000241" size="0.0770 0.1140 0.0486"/> <xacro:inertial_box xyz="0.00033 -0.00127 0.000241" size="0.0770 0.1140 0.0486"/> </link> <joint name="assembly_battery_joint" type="fixed"> <origin xyz="0.000996 0.055389 -0.033654"/> <parent link="base_link"/> <child link="assembly_battery"/> </joint> <xacro:macro name="shock_mount" params="num xyz"> <link name="shock_mount_${num}"> <visual> <geometry> <mesh filename="package://meshes/shock_mount.dae" scale="0.1 0.1 0.1"/> </geometry> </visual> </link> <joint name="shock_mount_${num}_joint" type="fixed"> <origin xyz="${xyz}"/> <parent link="base_link"/> <child link="shock_mount_${num}"/> </joint> </xacro:macro> <xacro:shock_mount num="0" xyz="-0.021377 0.075734 0.073117"/> <xacro:shock_mount num="1" xyz=" 0.023644 0.075734 0.073117"/> <xacro:shock_mount num="2" xyz=" 0.001141 0.054717 0.073117"/> <link name="pusher"> <visual> <geometry> <mesh filename="package://meshes/pusher.dae" scale="0.1 0.1 0.1"/> </geometry> </visual> <xacro:collision_box xyz=" 0 -0.000983 -0.047219" size="0.0290 0.0090 0.0952"/> <xacro:collision_box xyz="-0.049078 0.017466 -0.074854" rpy="0 0 -0.41888" size="0.0904 0.0056 0.0394"/> <xacro:collision_box xyz=" 0.049078 0.017466 -0.074854" rpy="0 0 0.41888" size="0.0904 0.0056 0.0394"/> <xacro:collision_box xyz="-0.095612 0.044530 -0.081565" rpy="0 0 -1.05770" size="0.0198 0.0056 0.0258"/> <xacro:collision_box xyz=" 0.095612 0.044530 -0.081565" rpy="0 0 1.05770" size="0.0198 0.0056 0.0258"/> </link> <joint name="pusher_joint" type="fixed"> <origin xyz="0.0 0.124025 0.015933"/> <parent link="base_link"/> <child link="pusher"/> </joint> <xacro:macro name="roller" params="wheel_num num side"> <!-- Radius of the sphere used for the roller --> <xacro:property name="radius" value="0.02"/> <!-- Distance from center of wheel to the visual rotation axis --> <xacro:property name="visual_axis_offset" value="-0.033162"/> <!-- Distance from center of wheel to the bottom of the roller --> <xacro:property name="roller_bottom_offset" value="-0.041319"/> <!-- Distance from center of wheel to the real rotation axis--> <xacro:property name="axis_offset" value="${roller_bottom_offset + radius}"/> <xacro:property name="angle" value="${(2*num+side)*0.2*pi}"/> <link name="roller_${wheel_num}_${side}_${num}"> <!-- <visual> <geometry> <box size="0.0001 0.0001 0.0001"/> </geometry> </visual> --> <!-- <xacro:collision_cylinder rpy="0 ${pi/2} 0" length="0.232" radius="0.094"/> --> <xacro:collision_sphere xyz="0 0 0" radius="${radius}"/> <!-- <xacro:inertial_cylinder rpy="0 ${pi/2} 0" length="0.0232" radius="0.0094"/> --> <xacro:inertial_sphere rpy="0 0 0" radius="${radius}"/> </link> <joint name="roller_${wheel_num}_${side}_${num}_joint" type="continuous"> <origin xyz="${-sin(angle)*axis_offset} ${(2*side-1)*-0.009521} ${cos(angle)*axis_offset}" rpy="0 ${-angle} 0"/> <parent link="wheel_${wheel_num}"/> <child link="roller_${wheel_num}_${side}_${num}"/> </joint> </xacro:macro> <xacro:macro name="mx12w_assembly" params="num xyz rpy"> <link name="mx12w_${num}"> <visual> <geometry> <mesh filename="package://meshes/mx12w.dae" scale="0.1 0.1 0.1"/> </geometry> </visual> <xacro:collision_box size="0.0328 0.0380 0.0502"/> <xacro:inertial_box size="0.0328 0.0380 0.0502"/> </link> <joint name="mx12w_${num}_joint" type="fixed"> <origin xyz="${xyz}" rpy="${rpy}"/> <parent link="base_link"/> <child link="mx12w_${num}"/> </joint> <link name="axle_${num}"> <visual> <geometry> <mesh filename="package://meshes/axle.dae" scale="0.1 0.1 0.1"/> </geometry> </visual> <xacro:collision_cylinder xyz="0.0 -0.018622 0.0" rpy="${pi/2} 0 0" length="0.0448" radius="0.0155"/> <xacro:inertial_cylinder xyz="0.0 -0.018622 0.0" rpy="${pi/2} 0 0" length="0.0448" radius="0.0155"/> </link> <joint name="axle_${num}_joint" type="continuous"> <origin xyz="-0.000105 -0.022823 -0.012904"/> <axis xyz="0 -1 0"/> <parent link="mx12w_${num}"/> <child link="axle_${num}"/> </joint> <link name="wheel_${num}"> <visual> <geometry> <mesh filename="package://meshes/wheel_and_rollers.dae" scale="0.1 0.1 0.1"/> </geometry> </visual> <xacro:collision_cylinder rpy="${pi/2} 0 0" length="0.0292" radius="0.0340"/> <xacro:inertial_cylinder rpy="${pi/2} 0 0" length="0.0292" radius="0.0378"/> </link> <joint name="wheel_${num}_joint" type="fixed"> <origin xyz="-0.000023 -0.019556 -0.000006"/> <axis xyz="0 -1 0"/> <parent link="axle_${num}"/> <child link="wheel_${num}"/> </joint> <xacro:roller wheel_num="${num}" num="0" side="0"/> <xacro:roller wheel_num="${num}" num="1" side="0"/> <xacro:roller wheel_num="${num}" num="2" side="0"/> <xacro:roller wheel_num="${num}" num="3" side="0"/> <xacro:roller wheel_num="${num}" num="4" side="0"/> <xacro:roller wheel_num="${num}" num="0" side="1"/> <xacro:roller wheel_num="${num}" num="1" side="1"/> <xacro:roller wheel_num="${num}" num="2" side="1"/> <xacro:roller wheel_num="${num}" num="3" side="1"/> <xacro:roller wheel_num="${num}" num="4" side="1"/> </xacro:macro> <xacro:mx12w_assembly num="0" xyz=" 0.000105 -0.025453 -0.032597" rpy="0 0 0"/> <xacro:mx12w_assembly num="1" xyz=" 0.065344 0.087794 -0.032597" rpy="0 0 2.0944"/> <xacro:mx12w_assembly num="2" xyz="-0.065344 0.087794 -0.032597" rpy="0 0 4.1888"/> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/extensions/omni.importer.urdf/data/urdf/robots/kaya/urdf/kaya.urdf
<?xml version="1.0" encoding="utf-8"?> <!-- =================================================================================== --> <!-- | This document was autogenerated by xacro from kaya.xacro | --> <!-- | EDITING THIS FILE BY HAND IS NOT RECOMMENDED | --> <!-- =================================================================================== --> <robot name="kaya"> <link name="base_link"> <visual> <geometry> <mesh filename="package://meshes/base.dae" scale="0.1 0.1 0.1"/> </geometry> </visual> <visual> <origin xyz="0.000825 0.077436 0.024927"/> <geometry> <mesh filename="package://meshes/nano_chassis_base.dae" scale="0.1 0.1 0.1"/> </geometry> </visual> <visual> <origin xyz="0.001140 0.071549 0.062302"/> <geometry> <mesh filename="package://meshes/nano_chassis_bridge.dae" scale="0.1 0.1 0.1"/> </geometry> </visual> <visual> <origin xyz="0.001192 0.079804 0.084978"/> <geometry> <mesh filename="package://meshes/nano_chassis_rs_mount.dae" scale="0.1 0.1 0.1"/> </geometry> </visual> <visual> <origin xyz="0.001053 0.090384 0.090843"/> <geometry> <mesh filename="package://meshes/realsense.dae" scale="0.1 0.1 0.1"/> </geometry> </visual> <collision> <geometry> <mesh filename="package://meshes/base_collision.dae" scale="0.1 0.1 0.1"/> </geometry> </collision> <inertial> <mass value="0.1"/> </inertial> </link> <link name="assembly_battery"> <visual> <geometry> <mesh filename="package://meshes/assembly_battery.dae" scale="0.1 0.1 0.1"/> </geometry> </visual> <collision> <origin rpy="0 0 0" xyz="0.0000033 -0.00127 0.000241"/> <geometry> <box size="0.0770 0.1140 0.0486"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0.00033 -0.00127 0.000241"/> <mass value="0.4266108"/> <inertia ixx="0.000545989300164" ixy="0" ixz="0" iyy="0.000294751089864" iyz="0" izz="0.0006728007825"/> </inertial> </link> <joint name="assembly_battery_joint" type="fixed"> <origin xyz="0.000996 0.055389 -0.033654"/> <parent link="base_link"/> <child link="assembly_battery"/> </joint> <link name="shock_mount_0"> <visual> <geometry> <mesh filename="package://meshes/shock_mount.dae" scale="0.1 0.1 0.1"/> </geometry> </visual> </link> <joint name="shock_mount_0_joint" type="fixed"> <origin xyz="-0.021377 0.075734 0.073117"/> <parent link="base_link"/> <child link="shock_mount_0"/> </joint> <link name="shock_mount_1"> <visual> <geometry> <mesh filename="package://meshes/shock_mount.dae" scale="0.1 0.1 0.1"/> </geometry> </visual> </link> <joint name="shock_mount_1_joint" type="fixed"> <origin xyz=" 0.023644 0.075734 0.073117"/> <parent link="base_link"/> <child link="shock_mount_1"/> </joint> <link name="shock_mount_2"> <visual> <geometry> <mesh filename="package://meshes/shock_mount.dae" scale="0.1 0.1 0.1"/> </geometry> </visual> </link> <joint name="shock_mount_2_joint" type="fixed"> <origin xyz=" 0.001141 0.054717 0.073117"/> <parent link="base_link"/> <child link="shock_mount_2"/> </joint> <link name="pusher"> <visual> <geometry> <mesh filename="package://meshes/pusher.dae" scale="0.1 0.1 0.1"/> </geometry> </visual> <collision> <origin rpy="0 0 0" xyz=" 0 -0.000983 -0.047219"/> <geometry> <box size="0.0290 0.0090 0.0952"/> </geometry> </collision> <collision> <origin rpy="0 0 -0.41888" xyz="-0.049078 0.017466 -0.074854"/> <geometry> <box size="0.0904 0.0056 0.0394"/> </geometry> </collision> <collision> <origin rpy="0 0 0.41888" xyz=" 0.049078 0.017466 -0.074854"/> <geometry> <box size="0.0904 0.0056 0.0394"/> </geometry> </collision> <collision> <origin rpy="0 0 -1.05770" xyz="-0.095612 0.044530 -0.081565"/> <geometry> <box size="0.0198 0.0056 0.0258"/> </geometry> </collision> <collision> <origin rpy="0 0 1.05770" xyz=" 0.095612 0.044530 -0.081565"/> <geometry> <box size="0.0198 0.0056 0.0258"/> </geometry> </collision> </link> <joint name="pusher_joint" type="fixed"> <origin xyz="0.0 0.124025 0.015933"/> <parent link="base_link"/> <child link="pusher"/> </joint> <link name="mx12w_0"> <visual> <geometry> <mesh filename="package://meshes/mx12w.dae" scale="0.1 0.1 0.1"/> </geometry> </visual> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <box size="0.0328 0.0380 0.0502"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="0.06256928"/> <inertia ixx="2.06689273909e-05" ixy="0" ixz="0" iyy="1.87493018805e-05" iyz="0" izz="1.31387145429e-05"/> </inertial> </link> <joint name="mx12w_0_joint" type="fixed"> <origin rpy="0 0 0" xyz=" 0.000105 -0.025453 -0.032597"/> <parent link="base_link"/> <child link="mx12w_0"/> </joint> <link name="axle_0"> <visual> <geometry> <mesh filename="package://meshes/axle.dae" scale="0.1 0.1 0.1"/> </geometry> </visual> <collision> <origin rpy="1.57079632679 0 0" xyz="0.0 -0.018622 0.0"/> <geometry> <cylinder length="0.0448" radius="0.0155"/> </geometry> </collision> <inertial> <origin rpy="1.57079632679 0 0" xyz="0.0 -0.018622 0.0"/> <mass value="0.0338135900491"/> <inertia ixx="7.68636440001e-06" ixy="0" ixz="0" iyy="7.68636440001e-06" iyz="0" izz="4.06185750465e-06"/> </inertial> </link> <joint name="axle_0_joint" type="continuous"> <origin xyz="-0.000105 -0.022823 -0.012904"/> <axis xyz="0 -1 0"/> <parent link="mx12w_0"/> <child link="axle_0"/> </joint> <link name="wheel_0"> <visual> <geometry> <mesh filename="package://meshes/wheel_and_rollers.dae" scale="0.1 0.1 0.1"/> </geometry> </visual> <collision> <origin rpy="1.57079632679 0 0" xyz="0 0 0"/> <geometry> <cylinder length="0.0292" radius="0.034"/> </geometry> </collision> <inertial> <origin rpy="1.57079632679 0 0" xyz="0 0 0"/> <mass value="0.131073930817"/> <inertia ixx="5.61341585248e-05" ixy="0" ixz="0" iyy="5.61341585248e-05" iyz="0" izz="9.36418376542e-05"/> </inertial> </link> <joint name="wheel_0_joint" type="fixed"> <origin xyz="-0.000023 -0.019556 -0.000006"/> <axis xyz="0 -1 0"/> <parent link="axle_0"/> <child link="wheel_0"/> </joint> <link name="roller_0_0_0"> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <sphere radius="0.02"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="0.0335103216383"/> <inertia ixx="5.36165146213e-06" ixy="0" ixz="0" iyy="5.36165146213e-06" iyz="0" izz="5.36165146213e-06"/> </inertial> </link> <joint name="roller_0_0_0_joint" type="continuous"> <origin rpy="0 -0.0 0" xyz="0.0 0.009521 -0.021319"/> <parent link="wheel_0"/> <child link="roller_0_0_0"/> </joint> <link name="roller_0_0_1"> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <sphere radius="0.02"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="0.0335103216383"/> <inertia ixx="5.36165146213e-06" ixy="0" ixz="0" iyy="5.36165146213e-06" iyz="0" izz="5.36165146213e-06"/> </inertial> </link> <joint name="roller_0_0_1_joint" type="continuous"> <origin rpy="0 -1.25663706144 0" xyz="0.0202755738709 0.009521 -0.00658793330308"/> <parent link="wheel_0"/> <child link="roller_0_0_1"/> </joint> <link name="roller_0_0_2"> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <sphere radius="0.02"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="0.0335103216383"/> <inertia ixx="5.36165146213e-06" ixy="0" ixz="0" iyy="5.36165146213e-06" iyz="0" izz="5.36165146213e-06"/> </inertial> </link> <joint name="roller_0_0_2_joint" type="continuous"> <origin rpy="0 -2.51327412287 0" xyz="0.0125309937936 0.009521 0.0172474333031"/> <parent link="wheel_0"/> <child link="roller_0_0_2"/> </joint> <link name="roller_0_0_3"> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <sphere radius="0.02"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="0.0335103216383"/> <inertia ixx="5.36165146213e-06" ixy="0" ixz="0" iyy="5.36165146213e-06" iyz="0" izz="5.36165146213e-06"/> </inertial> </link> <joint name="roller_0_0_3_joint" type="continuous"> <origin rpy="0 -3.76991118431 0" xyz="-0.0125309937936 0.009521 0.0172474333031"/> <parent link="wheel_0"/> <child link="roller_0_0_3"/> </joint> <link name="roller_0_0_4"> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <sphere radius="0.02"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="0.0335103216383"/> <inertia ixx="5.36165146213e-06" ixy="0" ixz="0" iyy="5.36165146213e-06" iyz="0" izz="5.36165146213e-06"/> </inertial> </link> <joint name="roller_0_0_4_joint" type="continuous"> <origin rpy="0 -5.02654824574 0" xyz="-0.0202755738709 0.009521 -0.00658793330308"/> <parent link="wheel_0"/> <child link="roller_0_0_4"/> </joint> <link name="roller_0_1_0"> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <sphere radius="0.02"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="0.0335103216383"/> <inertia ixx="5.36165146213e-06" ixy="0" ixz="0" iyy="5.36165146213e-06" iyz="0" izz="5.36165146213e-06"/> </inertial> </link> <joint name="roller_0_1_0_joint" type="continuous"> <origin rpy="0 -0.628318530718 0" xyz="0.0125309937936 -0.009521 -0.0172474333031"/> <parent link="wheel_0"/> <child link="roller_0_1_0"/> </joint> <link name="roller_0_1_1"> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <sphere radius="0.02"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="0.0335103216383"/> <inertia ixx="5.36165146213e-06" ixy="0" ixz="0" iyy="5.36165146213e-06" iyz="0" izz="5.36165146213e-06"/> </inertial> </link> <joint name="roller_0_1_1_joint" type="continuous"> <origin rpy="0 -1.88495559215 0" xyz="0.0202755738709 -0.009521 0.00658793330308"/> <parent link="wheel_0"/> <child link="roller_0_1_1"/> </joint> <link name="roller_0_1_2"> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <sphere radius="0.02"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="0.0335103216383"/> <inertia ixx="5.36165146213e-06" ixy="0" ixz="0" iyy="5.36165146213e-06" iyz="0" izz="5.36165146213e-06"/> </inertial> </link> <joint name="roller_0_1_2_joint" type="continuous"> <origin rpy="0 -3.14159265359 0" xyz="2.6108245111e-18 -0.009521 0.021319"/> <parent link="wheel_0"/> <child link="roller_0_1_2"/> </joint> <link name="roller_0_1_3"> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <sphere radius="0.02"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="0.0335103216383"/> <inertia ixx="5.36165146213e-06" ixy="0" ixz="0" iyy="5.36165146213e-06" iyz="0" izz="5.36165146213e-06"/> </inertial> </link> <joint name="roller_0_1_3_joint" type="continuous"> <origin rpy="0 -4.39822971503 0" xyz="-0.0202755738709 -0.009521 0.00658793330308"/> <parent link="wheel_0"/> <child link="roller_0_1_3"/> </joint> <link name="roller_0_1_4"> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <sphere radius="0.02"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="0.0335103216383"/> <inertia ixx="5.36165146213e-06" ixy="0" ixz="0" iyy="5.36165146213e-06" iyz="0" izz="5.36165146213e-06"/> </inertial> </link> <joint name="roller_0_1_4_joint" type="continuous"> <origin rpy="0 -5.65486677646 0" xyz="-0.0125309937936 -0.009521 -0.0172474333031"/> <parent link="wheel_0"/> <child link="roller_0_1_4"/> </joint> <link name="mx12w_1"> <visual> <geometry> <mesh filename="package://meshes/mx12w.dae" scale="0.1 0.1 0.1"/> </geometry> </visual> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <box size="0.0328 0.0380 0.0502"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="0.06256928"/> <inertia ixx="2.06689273909e-05" ixy="0" ixz="0" iyy="1.87493018805e-05" iyz="0" izz="1.31387145429e-05"/> </inertial> </link> <joint name="mx12w_1_joint" type="fixed"> <origin rpy="0 0 2.0944" xyz=" 0.065344 0.087794 -0.032597"/> <parent link="base_link"/> <child link="mx12w_1"/> </joint> <link name="axle_1"> <visual> <geometry> <mesh filename="package://meshes/axle.dae" scale="0.1 0.1 0.1"/> </geometry> </visual> <collision> <origin rpy="1.57079632679 0 0" xyz="0.0 -0.018622 0.0"/> <geometry> <cylinder length="0.0448" radius="0.0155"/> </geometry> </collision> <inertial> <origin rpy="1.57079632679 0 0" xyz="0.0 -0.018622 0.0"/> <mass value="0.0338135900491"/> <inertia ixx="7.68636440001e-06" ixy="0" ixz="0" iyy="7.68636440001e-06" iyz="0" izz="4.06185750465e-06"/> </inertial> </link> <joint name="axle_1_joint" type="continuous"> <origin xyz="-0.000105 -0.022823 -0.012904"/> <axis xyz="0 -1 0"/> <parent link="mx12w_1"/> <child link="axle_1"/> </joint> <link name="wheel_1"> <visual> <geometry> <mesh filename="package://meshes/wheel_and_rollers.dae" scale="0.1 0.1 0.1"/> </geometry> </visual> <collision> <origin rpy="1.57079632679 0 0" xyz="0 0 0"/> <geometry> <cylinder length="0.0292" radius="0.034"/> </geometry> </collision> <inertial> <origin rpy="1.57079632679 0 0" xyz="0 0 0"/> <mass value="0.131073930817"/> <inertia ixx="5.61341585248e-05" ixy="0" ixz="0" iyy="5.61341585248e-05" iyz="0" izz="9.36418376542e-05"/> </inertial> </link> <joint name="wheel_1_joint" type="fixed"> <origin xyz="-0.000023 -0.019556 -0.000006"/> <axis xyz="0 -1 0"/> <parent link="axle_1"/> <child link="wheel_1"/> </joint> <link name="roller_1_0_0"> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <sphere radius="0.02"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="0.0335103216383"/> <inertia ixx="5.36165146213e-06" ixy="0" ixz="0" iyy="5.36165146213e-06" iyz="0" izz="5.36165146213e-06"/> </inertial> </link> <joint name="roller_1_0_0_joint" type="continuous"> <origin rpy="0 -0.0 0" xyz="0.0 0.009521 -0.021319"/> <parent link="wheel_1"/> <child link="roller_1_0_0"/> </joint> <link name="roller_1_0_1"> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <sphere radius="0.02"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="0.0335103216383"/> <inertia ixx="5.36165146213e-06" ixy="0" ixz="0" iyy="5.36165146213e-06" iyz="0" izz="5.36165146213e-06"/> </inertial> </link> <joint name="roller_1_0_1_joint" type="continuous"> <origin rpy="0 -1.25663706144 0" xyz="0.0202755738709 0.009521 -0.00658793330308"/> <parent link="wheel_1"/> <child link="roller_1_0_1"/> </joint> <link name="roller_1_0_2"> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <sphere radius="0.02"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="0.0335103216383"/> <inertia ixx="5.36165146213e-06" ixy="0" ixz="0" iyy="5.36165146213e-06" iyz="0" izz="5.36165146213e-06"/> </inertial> </link> <joint name="roller_1_0_2_joint" type="continuous"> <origin rpy="0 -2.51327412287 0" xyz="0.0125309937936 0.009521 0.0172474333031"/> <parent link="wheel_1"/> <child link="roller_1_0_2"/> </joint> <link name="roller_1_0_3"> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <sphere radius="0.02"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="0.0335103216383"/> <inertia ixx="5.36165146213e-06" ixy="0" ixz="0" iyy="5.36165146213e-06" iyz="0" izz="5.36165146213e-06"/> </inertial> </link> <joint name="roller_1_0_3_joint" type="continuous"> <origin rpy="0 -3.76991118431 0" xyz="-0.0125309937936 0.009521 0.0172474333031"/> <parent link="wheel_1"/> <child link="roller_1_0_3"/> </joint> <link name="roller_1_0_4"> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <sphere radius="0.02"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="0.0335103216383"/> <inertia ixx="5.36165146213e-06" ixy="0" ixz="0" iyy="5.36165146213e-06" iyz="0" izz="5.36165146213e-06"/> </inertial> </link> <joint name="roller_1_0_4_joint" type="continuous"> <origin rpy="0 -5.02654824574 0" xyz="-0.0202755738709 0.009521 -0.00658793330308"/> <parent link="wheel_1"/> <child link="roller_1_0_4"/> </joint> <link name="roller_1_1_0"> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <sphere radius="0.02"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="0.0335103216383"/> <inertia ixx="5.36165146213e-06" ixy="0" ixz="0" iyy="5.36165146213e-06" iyz="0" izz="5.36165146213e-06"/> </inertial> </link> <joint name="roller_1_1_0_joint" type="continuous"> <origin rpy="0 -0.628318530718 0" xyz="0.0125309937936 -0.009521 -0.0172474333031"/> <parent link="wheel_1"/> <child link="roller_1_1_0"/> </joint> <link name="roller_1_1_1"> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <sphere radius="0.02"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="0.0335103216383"/> <inertia ixx="5.36165146213e-06" ixy="0" ixz="0" iyy="5.36165146213e-06" iyz="0" izz="5.36165146213e-06"/> </inertial> </link> <joint name="roller_1_1_1_joint" type="continuous"> <origin rpy="0 -1.88495559215 0" xyz="0.0202755738709 -0.009521 0.00658793330308"/> <parent link="wheel_1"/> <child link="roller_1_1_1"/> </joint> <link name="roller_1_1_2"> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <sphere radius="0.02"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="0.0335103216383"/> <inertia ixx="5.36165146213e-06" ixy="0" ixz="0" iyy="5.36165146213e-06" iyz="0" izz="5.36165146213e-06"/> </inertial> </link> <joint name="roller_1_1_2_joint" type="continuous"> <origin rpy="0 -3.14159265359 0" xyz="2.6108245111e-18 -0.009521 0.021319"/> <parent link="wheel_1"/> <child link="roller_1_1_2"/> </joint> <link name="roller_1_1_3"> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <sphere radius="0.02"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="0.0335103216383"/> <inertia ixx="5.36165146213e-06" ixy="0" ixz="0" iyy="5.36165146213e-06" iyz="0" izz="5.36165146213e-06"/> </inertial> </link> <joint name="roller_1_1_3_joint" type="continuous"> <origin rpy="0 -4.39822971503 0" xyz="-0.0202755738709 -0.009521 0.00658793330308"/> <parent link="wheel_1"/> <child link="roller_1_1_3"/> </joint> <link name="roller_1_1_4"> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <sphere radius="0.02"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="0.0335103216383"/> <inertia ixx="5.36165146213e-06" ixy="0" ixz="0" iyy="5.36165146213e-06" iyz="0" izz="5.36165146213e-06"/> </inertial> </link> <joint name="roller_1_1_4_joint" type="continuous"> <origin rpy="0 -5.65486677646 0" xyz="-0.0125309937936 -0.009521 -0.0172474333031"/> <parent link="wheel_1"/> <child link="roller_1_1_4"/> </joint> <link name="mx12w_2"> <visual> <geometry> <mesh filename="package://meshes/mx12w.dae" scale="0.1 0.1 0.1"/> </geometry> </visual> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <box size="0.0328 0.0380 0.0502"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="0.06256928"/> <inertia ixx="2.06689273909e-05" ixy="0" ixz="0" iyy="1.87493018805e-05" iyz="0" izz="1.31387145429e-05"/> </inertial> </link> <joint name="mx12w_2_joint" type="fixed"> <origin rpy="0 0 4.1888" xyz="-0.065344 0.087794 -0.032597"/> <parent link="base_link"/> <child link="mx12w_2"/> </joint> <link name="axle_2"> <visual> <geometry> <mesh filename="package://meshes/axle.dae" scale="0.1 0.1 0.1"/> </geometry> </visual> <collision> <origin rpy="1.57079632679 0 0" xyz="0.0 -0.018622 0.0"/> <geometry> <cylinder length="0.0448" radius="0.0155"/> </geometry> </collision> <inertial> <origin rpy="1.57079632679 0 0" xyz="0.0 -0.018622 0.0"/> <mass value="0.0338135900491"/> <inertia ixx="7.68636440001e-06" ixy="0" ixz="0" iyy="7.68636440001e-06" iyz="0" izz="4.06185750465e-06"/> </inertial> </link> <joint name="axle_2_joint" type="continuous"> <origin xyz="-0.000105 -0.022823 -0.012904"/> <axis xyz="0 -1 0"/> <parent link="mx12w_2"/> <child link="axle_2"/> </joint> <link name="wheel_2"> <visual> <geometry> <mesh filename="package://meshes/wheel_and_rollers.dae" scale="0.1 0.1 0.1"/> </geometry> </visual> <collision> <origin rpy="1.57079632679 0 0" xyz="0 0 0"/> <geometry> <cylinder length="0.0292" radius="0.034"/> </geometry> </collision> <inertial> <origin rpy="1.57079632679 0 0" xyz="0 0 0"/> <mass value="0.131073930817"/> <inertia ixx="5.61341585248e-05" ixy="0" ixz="0" iyy="5.61341585248e-05" iyz="0" izz="9.36418376542e-05"/> </inertial> </link> <joint name="wheel_2_joint" type="fixed"> <origin xyz="-0.000023 -0.019556 -0.000006"/> <axis xyz="0 -1 0"/> <parent link="axle_2"/> <child link="wheel_2"/> </joint> <link name="roller_2_0_0"> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <sphere radius="0.02"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="0.0335103216383"/> <inertia ixx="5.36165146213e-06" ixy="0" ixz="0" iyy="5.36165146213e-06" iyz="0" izz="5.36165146213e-06"/> </inertial> </link> <joint name="roller_2_0_0_joint" type="continuous"> <origin rpy="0 -0.0 0" xyz="0.0 0.009521 -0.021319"/> <parent link="wheel_2"/> <child link="roller_2_0_0"/> </joint> <link name="roller_2_0_1"> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <sphere radius="0.02"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="0.0335103216383"/> <inertia ixx="5.36165146213e-06" ixy="0" ixz="0" iyy="5.36165146213e-06" iyz="0" izz="5.36165146213e-06"/> </inertial> </link> <joint name="roller_2_0_1_joint" type="continuous"> <origin rpy="0 -1.25663706144 0" xyz="0.0202755738709 0.009521 -0.00658793330308"/> <parent link="wheel_2"/> <child link="roller_2_0_1"/> </joint> <link name="roller_2_0_2"> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <sphere radius="0.02"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="0.0335103216383"/> <inertia ixx="5.36165146213e-06" ixy="0" ixz="0" iyy="5.36165146213e-06" iyz="0" izz="5.36165146213e-06"/> </inertial> </link> <joint name="roller_2_0_2_joint" type="continuous"> <origin rpy="0 -2.51327412287 0" xyz="0.0125309937936 0.009521 0.0172474333031"/> <parent link="wheel_2"/> <child link="roller_2_0_2"/> </joint> <link name="roller_2_0_3"> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <sphere radius="0.02"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="0.0335103216383"/> <inertia ixx="5.36165146213e-06" ixy="0" ixz="0" iyy="5.36165146213e-06" iyz="0" izz="5.36165146213e-06"/> </inertial> </link> <joint name="roller_2_0_3_joint" type="continuous"> <origin rpy="0 -3.76991118431 0" xyz="-0.0125309937936 0.009521 0.0172474333031"/> <parent link="wheel_2"/> <child link="roller_2_0_3"/> </joint> <link name="roller_2_0_4"> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <sphere radius="0.02"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="0.0335103216383"/> <inertia ixx="5.36165146213e-06" ixy="0" ixz="0" iyy="5.36165146213e-06" iyz="0" izz="5.36165146213e-06"/> </inertial> </link> <joint name="roller_2_0_4_joint" type="continuous"> <origin rpy="0 -5.02654824574 0" xyz="-0.0202755738709 0.009521 -0.00658793330308"/> <parent link="wheel_2"/> <child link="roller_2_0_4"/> </joint> <link name="roller_2_1_0"> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <sphere radius="0.02"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="0.0335103216383"/> <inertia ixx="5.36165146213e-06" ixy="0" ixz="0" iyy="5.36165146213e-06" iyz="0" izz="5.36165146213e-06"/> </inertial> </link> <joint name="roller_2_1_0_joint" type="continuous"> <origin rpy="0 -0.628318530718 0" xyz="0.0125309937936 -0.009521 -0.0172474333031"/> <parent link="wheel_2"/> <child link="roller_2_1_0"/> </joint> <link name="roller_2_1_1"> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <sphere radius="0.02"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="0.0335103216383"/> <inertia ixx="5.36165146213e-06" ixy="0" ixz="0" iyy="5.36165146213e-06" iyz="0" izz="5.36165146213e-06"/> </inertial> </link> <joint name="roller_2_1_1_joint" type="continuous"> <origin rpy="0 -1.88495559215 0" xyz="0.0202755738709 -0.009521 0.00658793330308"/> <parent link="wheel_2"/> <child link="roller_2_1_1"/> </joint> <link name="roller_2_1_2"> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <sphere radius="0.02"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="0.0335103216383"/> <inertia ixx="5.36165146213e-06" ixy="0" ixz="0" iyy="5.36165146213e-06" iyz="0" izz="5.36165146213e-06"/> </inertial> </link> <joint name="roller_2_1_2_joint" type="continuous"> <origin rpy="0 -3.14159265359 0" xyz="2.6108245111e-18 -0.009521 0.021319"/> <parent link="wheel_2"/> <child link="roller_2_1_2"/> </joint> <link name="roller_2_1_3"> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <sphere radius="0.02"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="0.0335103216383"/> <inertia ixx="5.36165146213e-06" ixy="0" ixz="0" iyy="5.36165146213e-06" iyz="0" izz="5.36165146213e-06"/> </inertial> </link> <joint name="roller_2_1_3_joint" type="continuous"> <origin rpy="0 -4.39822971503 0" xyz="-0.0202755738709 -0.009521 0.00658793330308"/> <parent link="wheel_2"/> <child link="roller_2_1_3"/> </joint> <link name="roller_2_1_4"> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <sphere radius="0.02"/> </geometry> </collision> <inertial> <origin rpy="0 0 0" xyz="0 0 0"/> <mass value="0.0335103216383"/> <inertia ixx="5.36165146213e-06" ixy="0" ixz="0" iyy="5.36165146213e-06" iyz="0" izz="5.36165146213e-06"/> </inertial> </link> <joint name="roller_2_1_4_joint" type="continuous"> <origin rpy="0 -5.65486677646 0" xyz="-0.0125309937936 -0.009521 -0.0172474333031"/> <parent link="wheel_2"/> <child link="roller_2_1_4"/> </joint> </robot>
NVIDIA-Omniverse/urdf-importer-extension/source/apps/exts.deps.generated.kit
######################################################################################################################## # This kit file is generated by "repo precache_exts" tool. # It is an app, that contains all extensions from the repo as dependencies. It is used to: # 1. lock all versions of their dependencies (reproducible builds). # 2. precache (download) all dependencies before building. # # This file is regenerated if: # 1. Any extension is added or removed from the repo. # 2. Any extension version is updated # 3. This file is removed. # # To update version lock the same `repo build -u` flag can be used. ######################################################################################################################## [settings.app.exts.folders] '++' = ["${app}/../exts", "${app}/../extscache/"] # All local extensions built in this repo: [dependencies] "omni.importer.urdf" = {} ######################################################################################################################## # BEGIN GENERATED PART (Remove from 'BEGIN' to 'END' to regenerate) ######################################################################################################################## # Kit SDK Version: 105.1+master.120409.12382637.tc # Version lock for all dependencies: [settings.app.exts] enabled = [ ] ######################################################################################################################## # END GENERATED PART ########################################################################################################################
NVIDIA-Omniverse/urdf-importer-extension/source/apps/omni.importer.urdf.app.kit
[package] title = "URDF Importer" description = "Kit dev app with omni.importer.urdf extension enabled." version = "1.0.0" keywords = ["app"] [dependencies] "omni.app.dev" = {} "omni.usd.schema.physx" = {} "omni.importer.urdf" = {} [settings] app.window.title = "URDF Importer" app.settings.persistent = true [settings.app.exts] folders.'++' = ["${app}/../exts"] # Make extensions from this repo available. [settings.persistent.app.stage] upAxis = "Z" materialStrength = "weakerThanDescendants"
NVIDIA-Omniverse/kit-extension-sample-defectsgen/link_app.sh
#!/bin/bash set -e SCRIPT_DIR=$(dirname ${BASH_SOURCE}) cd "$SCRIPT_DIR" exec "tools/packman/python.sh" tools/scripts/link_app.py $@
NVIDIA-Omniverse/kit-extension-sample-defectsgen/link_app.bat
@echo off call "%~dp0tools\packman\python.bat" %~dp0tools\scripts\link_app.py %* if %errorlevel% neq 0 ( goto Error ) :Success exit /b 0 :Error exit /b %errorlevel%
NVIDIA-Omniverse/kit-extension-sample-defectsgen/README.md
# Defect Extension Sample ![Defect Preview](exts/omni.example.defects/data/preview.PNG) ### About This extension allows user's to generate a single defect on a target prim using images to project the defect onto the prim. Using Replicator's API the user can generate thousands of synthetic data to specify the dimensions, rotation, and position of the defect. ### Pre-req This extension has been tested to work with Omniverse Code 2022.3.3 or higher. ### [README](exts/omni.example.defects) See the [README for this extension](exts/omni.example.defects) to learn more about it including how to use it. ## Adding This Extension This folder is ready to be pushed to any git repository. Once pushed direct link to a git repository can be added to *Omniverse Kit* extension search paths. Link might look like this: `git://github.com/NVIDIA-Omniverse/kit-extension-sample-defects?branch=main&dir=exts` Notice `exts` is repo subfolder with extensions. More information can be found in "Git URL as Extension Search Paths" section of developers manual. To add a link to your *Omniverse Kit* based app go into: Extension Manager -> Gear Icon -> Extension Search Path ## Linking with an Omniverse app If `app` folder link doesn't exist or broken it can be created again. For better developer experience it is recommended to create a folder link named `app` to the *Omniverse Kit* app installed from *Omniverse Launcher*. Convenience script to use is included. Run: ``` > link_app.bat ``` If successful you should see `app` folder link in the root of this repo. If multiple Omniverse apps is installed script will select recommended one. Or you can explicitly pass an app: ``` > link_app.bat --app create ``` You can also just pass a path to create link to: ``` > link_app.bat --path "C:/Users/bob/AppData/Local/ov/pkg/create-2021.3.4" ``` # Contributing The source code for this repository is provided as-is and we are not accepting outside contributions.
NVIDIA-Omniverse/kit-extension-sample-defectsgen/tools/scripts/link_app.py
import argparse import json import os import sys import packmanapi import urllib3 def find_omniverse_apps(): http = urllib3.PoolManager() try: r = http.request("GET", "http://127.0.0.1:33480/components") except Exception as e: print(f"Failed retrieving apps from an Omniverse Launcher, maybe it is not installed?\nError: {e}") sys.exit(1) apps = {} for x in json.loads(r.data.decode("utf-8")): latest = x.get("installedVersions", {}).get("latest", "") if latest: for s in x.get("settings", []): if s.get("version", "") == latest: root = s.get("launch", {}).get("root", "") apps[x["slug"]] = (x["name"], root) break return apps def create_link(src, dst): print(f"Creating a link '{src}' -> '{dst}'") packmanapi.link(src, dst) APP_PRIORITIES = ["code", "create", "view"] if __name__ == "__main__": parser = argparse.ArgumentParser(description="Create folder link to Kit App installed from Omniverse Launcher") parser.add_argument( "--path", help="Path to Kit App installed from Omniverse Launcher, e.g.: 'C:/Users/bob/AppData/Local/ov/pkg/create-2021.3.4'", required=False, ) parser.add_argument( "--app", help="Name of Kit App installed from Omniverse Launcher, e.g.: 'code', 'create'", required=False ) args = parser.parse_args() path = args.path if not path: print("Path is not specified, looking for Omniverse Apps...") apps = find_omniverse_apps() if len(apps) == 0: print( "Can't find any Omniverse Apps. Use Omniverse Launcher to install one. 'Code' is the recommended app for developers." ) sys.exit(0) print("\nFound following Omniverse Apps:") for i, slug in enumerate(apps): name, root = apps[slug] print(f"{i}: {name} ({slug}) at: '{root}'") if args.app: selected_app = args.app.lower() if selected_app not in apps: choices = ", ".join(apps.keys()) print(f"Passed app: '{selected_app}' is not found. Specify one of the following found Apps: {choices}") sys.exit(0) else: selected_app = next((x for x in APP_PRIORITIES if x in apps), None) if not selected_app: selected_app = next(iter(apps)) print(f"\nSelected app: {selected_app}") _, path = apps[selected_app] if not os.path.exists(path): print(f"Provided path doesn't exist: {path}") else: SCRIPT_ROOT = os.path.dirname(os.path.realpath(__file__)) create_link(f"{SCRIPT_ROOT}/../../app", path) print("Success!")
NVIDIA-Omniverse/kit-extension-sample-defectsgen/tools/packman/python.sh
#!/bin/bash # Copyright 2019-2020 NVIDIA CORPORATION # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. set -e PACKMAN_CMD="$(dirname "${BASH_SOURCE}")/packman" if [ ! -f "$PACKMAN_CMD" ]; then PACKMAN_CMD="${PACKMAN_CMD}.sh" fi source "$PACKMAN_CMD" init export PYTHONPATH="${PM_MODULE_DIR}:${PYTHONPATH}" export PYTHONNOUSERSITE=1 # workaround for our python not shipping with certs if [[ -z ${SSL_CERT_DIR:-} ]]; then export SSL_CERT_DIR=/etc/ssl/certs/ fi "${PM_PYTHON}" -u "$@"
NVIDIA-Omniverse/kit-extension-sample-defectsgen/tools/packman/python.bat
:: Copyright 2019-2020 NVIDIA CORPORATION :: :: Licensed under the Apache License, Version 2.0 (the "License"); :: you may not use this file except in compliance with the License. :: You may obtain a copy of the License at :: :: http://www.apache.org/licenses/LICENSE-2.0 :: :: Unless required by applicable law or agreed to in writing, software :: distributed under the License is distributed on an "AS IS" BASIS, :: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. :: See the License for the specific language governing permissions and :: limitations under the License. @echo off setlocal call "%~dp0\packman" init set "PYTHONPATH=%PM_MODULE_DIR%;%PYTHONPATH%" set PYTHONNOUSERSITE=1 "%PM_PYTHON%" -u %*
NVIDIA-Omniverse/kit-extension-sample-defectsgen/tools/packman/packman.cmd
:: Reset errorlevel status (don't inherit from caller) [xxxxxxxxxxx] @call :ECHO_AND_RESET_ERROR :: You can remove the call below if you do your own manual configuration of the dev machines call "%~dp0\bootstrap\configure.bat" if %errorlevel% neq 0 ( exit /b %errorlevel% ) :: Everything below is mandatory if not defined PM_PYTHON goto :PYTHON_ENV_ERROR if not defined PM_MODULE goto :MODULE_ENV_ERROR :: Generate temporary path for variable file for /f "delims=" %%a in ('powershell -ExecutionPolicy ByPass -NoLogo -NoProfile ^ -File "%~dp0bootstrap\generate_temp_file_name.ps1"') do set PM_VAR_PATH=%%a if %1.==. ( set PM_VAR_PATH_ARG= ) else ( set PM_VAR_PATH_ARG=--var-path="%PM_VAR_PATH%" ) "%PM_PYTHON%" -S -s -u -E "%PM_MODULE%" %* %PM_VAR_PATH_ARG% if %errorlevel% neq 0 ( exit /b %errorlevel% ) :: Marshall environment variables into the current environment if they have been generated and remove temporary file if exist "%PM_VAR_PATH%" ( for /F "usebackq tokens=*" %%A in ("%PM_VAR_PATH%") do set "%%A" ) if %errorlevel% neq 0 ( goto :VAR_ERROR ) if exist "%PM_VAR_PATH%" ( del /F "%PM_VAR_PATH%" ) if %errorlevel% neq 0 ( goto :VAR_ERROR ) set PM_VAR_PATH= goto :eof :: Subroutines below :PYTHON_ENV_ERROR @echo User environment variable PM_PYTHON is not set! Please configure machine for packman or call configure.bat. exit /b 1 :MODULE_ENV_ERROR @echo User environment variable PM_MODULE is not set! Please configure machine for packman or call configure.bat. exit /b 1 :VAR_ERROR @echo Error while processing and setting environment variables! exit /b 1 :ECHO_AND_RESET_ERROR @echo off if /I "%PM_VERBOSITY%"=="debug" ( @echo on ) exit /b 0
NVIDIA-Omniverse/kit-extension-sample-defectsgen/tools/packman/config.packman.xml
<config remotes="cloudfront"> <remote2 name="cloudfront"> <transport actions="download" protocol="https" packageLocation="d4i3qtqj3r0z5.cloudfront.net/${name}@${version}" /> </remote2> </config>
NVIDIA-Omniverse/kit-extension-sample-defectsgen/tools/packman/bootstrap/generate_temp_file_name.ps1
<# Copyright 2019 NVIDIA CORPORATION Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. #> $out = [System.IO.Path]::GetTempFileName() Write-Host $out # SIG # Begin signature block # MIIaVwYJKoZIhvcNAQcCoIIaSDCCGkQCAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG # KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCAK+Ewup1N0/mdf # 1l4R58rxyumHgZvTmEhrYTb2Zf0zd6CCCiIwggTTMIIDu6ADAgECAhBi50XpIWUh # PJcfXEkK6hKlMA0GCSqGSIb3DQEBCwUAMIGEMQswCQYDVQQGEwJVUzEdMBsGA1UE # ChMUU3ltYW50ZWMgQ29ycG9yYXRpb24xHzAdBgNVBAsTFlN5bWFudGVjIFRydXN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dt+w7XKPAbZqHrN9elAhWJ # vpBTCEaj7dVxr1Ka4NsoPSYe0eidDBmmvGvp02J4Z1j8+ImQPKN6Hv/L8Ixaxe7V # mH4VtXIiBK8xXdi4wzO+A+qLtHEJXz3Gw8Bp3BNtlDGIUkIhVTM3Q1xcSEqhOLqo # PGdwCw9acxdXNWWPjOJkNH656Bvmkml+0p6MTGIeG4JCeRh1Wpqm1ZGSoEcXNaof # wOgj48YzI+dNqBD9i7RSWCqJr2ygYKRTxnuU # SIG # End signature block
NVIDIA-Omniverse/kit-extension-sample-defectsgen/tools/packman/bootstrap/configure.bat
:: Copyright 2019 NVIDIA CORPORATION :: :: Licensed under the Apache License, Version 2.0 (the "License"); :: you may not use this file except in compliance with the License. :: You may obtain a copy of the License at :: :: http://www.apache.org/licenses/LICENSE-2.0 :: :: Unless required by applicable law or agreed to in writing, software :: distributed under the License is distributed on an "AS IS" BASIS, :: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. :: See the License for the specific language governing permissions and :: limitations under the License. set PM_PACKMAN_VERSION=6.33.2 :: Specify where packman command is rooted set PM_INSTALL_PATH=%~dp0.. :: The external root may already be configured and we should do minimal work in that case if defined PM_PACKAGES_ROOT goto ENSURE_DIR :: If the folder isn't set we assume that the best place for it is on the drive that we are currently :: running from set PM_DRIVE=%CD:~0,2% set PM_PACKAGES_ROOT=%PM_DRIVE%\packman-repo :: We use *setx* here so that the variable is persisted in the user environment echo Setting user environment variable PM_PACKAGES_ROOT to %PM_PACKAGES_ROOT% setx PM_PACKAGES_ROOT %PM_PACKAGES_ROOT% if %errorlevel% neq 0 ( goto ERROR ) :: The above doesn't work properly from a build step in VisualStudio because a separate process is :: spawned for it so it will be lost for subsequent compilation steps - VisualStudio must :: be launched from a new process. We catch this odd-ball case here: if defined PM_DISABLE_VS_WARNING goto ENSURE_DIR if not defined VSLANG goto ENSURE_DIR echo The above is a once-per-computer operation. Unfortunately VisualStudio cannot pick up environment change echo unless *VisualStudio is RELAUNCHED*. echo If you are launching VisualStudio from command line or command line utility make sure echo you have a fresh launch environment (relaunch the command line or utility). echo If you are using 'linkPath' and referring to packages via local folder links you can safely ignore this warning. echo You can disable this warning by setting the environment variable PM_DISABLE_VS_WARNING. echo. :: Check for the directory that we need. Note that mkdir will create any directories :: that may be needed in the path :ENSURE_DIR if not exist "%PM_PACKAGES_ROOT%" ( echo Creating directory %PM_PACKAGES_ROOT% mkdir "%PM_PACKAGES_ROOT%" ) if %errorlevel% neq 0 ( goto ERROR_MKDIR_PACKAGES_ROOT ) :: The Python interpreter may already be externally configured if defined PM_PYTHON_EXT ( set PM_PYTHON=%PM_PYTHON_EXT% goto PACKMAN ) set PM_PYTHON_VERSION=3.7.9-windows-x86_64 set PM_PYTHON_BASE_DIR=%PM_PACKAGES_ROOT%\python set PM_PYTHON_DIR=%PM_PYTHON_BASE_DIR%\%PM_PYTHON_VERSION% set PM_PYTHON=%PM_PYTHON_DIR%\python.exe if exist "%PM_PYTHON%" goto PACKMAN if not exist "%PM_PYTHON_BASE_DIR%" call :CREATE_PYTHON_BASE_DIR set PM_PYTHON_PACKAGE=python@%PM_PYTHON_VERSION%.cab for /f "delims=" %%a in ('powershell -ExecutionPolicy ByPass -NoLogo -NoProfile -File "%~dp0\generate_temp_file_name.ps1"') do set TEMP_FILE_NAME=%%a set TARGET=%TEMP_FILE_NAME%.zip call "%~dp0fetch_file_from_packman_bootstrap.cmd" %PM_PYTHON_PACKAGE% "%TARGET%" if %errorlevel% neq 0 ( echo !!! Error fetching python from CDN !!! goto ERROR ) for /f "delims=" %%a in ('powershell -ExecutionPolicy ByPass -NoLogo -NoProfile -File "%~dp0\generate_temp_folder.ps1" -parentPath "%PM_PYTHON_BASE_DIR%"') do set TEMP_FOLDER_NAME=%%a echo Unpacking Python interpreter ... "%SystemRoot%\system32\expand.exe" -F:* "%TARGET%" "%TEMP_FOLDER_NAME%" 1> nul del "%TARGET%" :: Failure during extraction to temp folder name, need to clean up and abort if %errorlevel% neq 0 ( echo !!! Error unpacking python !!! call :CLEAN_UP_TEMP_FOLDER goto ERROR ) :: If python has now been installed by a concurrent process we need to clean up and then continue if exist "%PM_PYTHON%" ( call :CLEAN_UP_TEMP_FOLDER goto PACKMAN ) else ( if exist "%PM_PYTHON_DIR%" ( rd /s /q "%PM_PYTHON_DIR%" > nul ) ) :: Perform atomic rename rename "%TEMP_FOLDER_NAME%" "%PM_PYTHON_VERSION%" 1> nul :: Failure during move, need to clean up and abort if %errorlevel% neq 0 ( echo !!! Error renaming python !!! call :CLEAN_UP_TEMP_FOLDER goto ERROR ) :PACKMAN :: The packman module may already be externally configured if defined PM_MODULE_DIR_EXT ( set PM_MODULE_DIR=%PM_MODULE_DIR_EXT% ) else ( set PM_MODULE_DIR=%PM_PACKAGES_ROOT%\packman-common\%PM_PACKMAN_VERSION% ) set PM_MODULE=%PM_MODULE_DIR%\packman.py if exist "%PM_MODULE%" goto ENSURE_7ZA set PM_MODULE_PACKAGE=packman-common@%PM_PACKMAN_VERSION%.zip for /f "delims=" %%a in ('powershell -ExecutionPolicy ByPass -NoLogo -NoProfile -File "%~dp0\generate_temp_file_name.ps1"') do set TEMP_FILE_NAME=%%a set TARGET=%TEMP_FILE_NAME% call "%~dp0fetch_file_from_packman_bootstrap.cmd" %PM_MODULE_PACKAGE% "%TARGET%" if %errorlevel% neq 0 ( echo !!! Error fetching packman from CDN !!! goto ERROR ) echo Unpacking ... "%PM_PYTHON%" -S -s -u -E "%~dp0\install_package.py" "%TARGET%" "%PM_MODULE_DIR%" if %errorlevel% neq 0 ( echo !!! Error unpacking packman !!! goto ERROR ) del "%TARGET%" :ENSURE_7ZA set PM_7Za_VERSION=16.02.4 set PM_7Za_PATH=%PM_PACKAGES_ROOT%\7za\%PM_7ZA_VERSION% if exist "%PM_7Za_PATH%" goto END set PM_7Za_PATH=%PM_PACKAGES_ROOT%\chk\7za\%PM_7ZA_VERSION% if exist "%PM_7Za_PATH%" goto END "%PM_PYTHON%" -S -s -u -E "%PM_MODULE%" pull "%PM_MODULE_DIR%\deps.packman.xml" if %errorlevel% neq 0 ( echo !!! Error fetching packman dependencies !!! goto ERROR ) goto END :ERROR_MKDIR_PACKAGES_ROOT echo Failed to automatically create packman packages repo at %PM_PACKAGES_ROOT%. echo Please set a location explicitly that packman has permission to write to, by issuing: echo. echo setx PM_PACKAGES_ROOT {path-you-choose-for-storing-packman-packages-locally} echo. echo Then launch a new command console for the changes to take effect and run packman command again. exit /B %errorlevel% :ERROR echo !!! Failure while configuring local machine :( !!! exit /B %errorlevel% :CLEAN_UP_TEMP_FOLDER rd /S /Q "%TEMP_FOLDER_NAME%" exit /B :CREATE_PYTHON_BASE_DIR :: We ignore errors and clean error state - if two processes create the directory one will fail which is fine md "%PM_PYTHON_BASE_DIR%" > nul 2>&1 exit /B 0 :END
NVIDIA-Omniverse/kit-extension-sample-defectsgen/tools/packman/bootstrap/fetch_file_from_packman_bootstrap.cmd
:: Copyright 2019 NVIDIA CORPORATION :: :: Licensed under the Apache License, Version 2.0 (the "License"); :: you may not use this file except in compliance with the License. :: You may obtain a copy of the License at :: :: http://www.apache.org/licenses/LICENSE-2.0 :: :: Unless required by applicable law or agreed to in writing, software :: distributed under the License is distributed on an "AS IS" BASIS, :: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. :: See the License for the specific language governing permissions and :: limitations under the License. :: You need to specify <package-name> <target-path> as input to this command @setlocal @set PACKAGE_NAME=%1 @set TARGET_PATH=%2 @echo Fetching %PACKAGE_NAME% ... @powershell -ExecutionPolicy ByPass -NoLogo -NoProfile -File "%~dp0download_file_from_url.ps1" ^ -source "http://bootstrap.packman.nvidia.com/%PACKAGE_NAME%" -output %TARGET_PATH% :: A bug in powershell prevents the errorlevel code from being set when using the -File execution option :: We must therefore do our own failure analysis, basically make sure the file exists and is larger than 0 bytes: @if not exist %TARGET_PATH% goto ERROR_DOWNLOAD_FAILED @if %~z2==0 goto ERROR_DOWNLOAD_FAILED @endlocal @exit /b 0 :ERROR_DOWNLOAD_FAILED @echo Failed to download file from S3 @echo Most likely because endpoint cannot be reached or file %PACKAGE_NAME% doesn't exist @endlocal @exit /b 1
NVIDIA-Omniverse/kit-extension-sample-defectsgen/tools/packman/bootstrap/download_file_from_url.ps1
<# Copyright 2019 NVIDIA CORPORATION Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. #> param( [Parameter(Mandatory=$true)][string]$source=$null, [string]$output="out.exe" ) $filename = $output $triesLeft = 3 do { $triesLeft -= 1 try { Write-Host "Downloading from bootstrap.packman.nvidia.com ..." $wc = New-Object net.webclient $wc.Downloadfile($source, $fileName) $triesLeft = 0 } catch { Write-Host "Error downloading $source!" Write-Host $_.Exception|format-list -force } } while ($triesLeft -gt 0)
NVIDIA-Omniverse/kit-extension-sample-defectsgen/tools/packman/bootstrap/generate_temp_folder.ps1
<# Copyright 2019 NVIDIA CORPORATION Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. #> param( [Parameter(Mandatory=$true)][string]$parentPath=$null ) [string] $name = [System.Guid]::NewGuid() $out = Join-Path $parentPath $name New-Item -ItemType Directory -Path ($out) | Out-Null Write-Host $out # SIG # Begin signature block # MIIaVwYJKoZIhvcNAQcCoIIaSDCCGkQCAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG # KX7zUQIBAAIBAAIBAAIBAAIBADA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wGjAYMBYEFOHXgqjhkb7va8oWkbWqtJSmJJvzMC8GCSqGSIb3 # DQEJBDEiBCDvFxQ6lYLr8vB+9czUl19rjCw1pWhhUXw/SqOmvIa/VDANBgkqhkiG # 9w0BAQEFAASCAQB9ox2UrcUXQsBI4Uycnhl4AMpvhVXJME62tygFMppW1l7QftDy # LvfPKRYm2YUioak/APxAS6geRKpeMkLvXuQS/Jlv0kY3BjxkeG0eVjvyjF4SvXbZ # 3JCk9m7wLNE+xqOo0ICjYlIJJgRLudjWkC5Skpb1NpPS8DOaIYwRV+AWaSOUPd9P # O5yVcnbl7OpK3EAEtwDrybCVBMPn2MGhAXybIHnth3+MFp1b6Blhz3WlReQyarjq # 1f+zaFB79rg6JswXoOTJhwICBP3hO2Ua3dMAswbfl+QNXF+igKLJPYnaeSVhBbm6 # VCu2io27t4ixqvoD0RuPObNX/P3oVA38afiM # SIG # End signature block
NVIDIA-Omniverse/kit-extension-sample-defectsgen/tools/packman/bootstrap/install_package.py
# Copyright 2019 NVIDIA CORPORATION # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import logging import shutil import sys import tempfile import zipfile __author__ = "hfannar" logging.basicConfig(level=logging.WARNING, format="%(message)s") logger = logging.getLogger("install_package") class TemporaryDirectory: def __init__(self): self.path = None def __enter__(self): self.path = tempfile.mkdtemp() return self.path def __exit__(self, type, value, traceback): # Remove temporary data created shutil.rmtree(self.path) def install_package(package_src_path, package_dst_path): with zipfile.ZipFile(package_src_path, allowZip64=True) as zip_file, TemporaryDirectory() as temp_dir: zip_file.extractall(temp_dir) # Recursively copy (temp_dir will be automatically cleaned up on exit) try: # Recursive copy is needed because both package name and version folder could be missing in # target directory: shutil.copytree(temp_dir, package_dst_path) except OSError as exc: logger.warning("Directory %s already present, packaged installation aborted" % package_dst_path) else: logger.info("Package successfully installed to %s" % package_dst_path) install_package(sys.argv[1], sys.argv[2])
NVIDIA-Omniverse/kit-extension-sample-defectsgen/exts/omni.example.defects/config/extension.toml
[package] # Semantic Versionning is used: https://semver.org/ version = "1.1.1" # The title and description fields are primarily for displaying extension info in UI title = "Defects Generation Sample" description="Example of a replicator extension that creates material defects using a Decal Proxy Object" # Path (relative to the root) or content of readme markdown file for UI. readme = "docs/README.md" # Icon to show in the extension manager icon = "data/icon.png" # URL of the extension source repository. repository = "" # One of categories for UI. category = "Example" # Keywords for the extension keywords = ["kit", "omnigraph", "replicator", "defect", "material"] # Use omni.ui to build simple UI [dependencies] "omni.kit.uiapp" = {} "omni.ui" = {} "omni.replicator.core" = {} "omni.kit.window.file_importer" = {} "omni.kit.commands" = {} "omni.usd" = {} "omni.kit.notification_manager" = {} # Main python module this extension provides, it will be publicly available as "import omni.code.snippets". [[python.module]] name = "omni.example.defects"
NVIDIA-Omniverse/kit-extension-sample-defectsgen/exts/omni.example.defects/omni/example/defects/rep_widgets.py
# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import omni.ui as ui from .widgets import MinMaxWidget, CustomDirectory, PathWidget from .utils import * from pxr import Sdf from pathlib import Path import omni.kit.notification_manager as nm TEXTURE_DIR = Path(__file__).parent / "data" SCRATCHES_DIR = TEXTURE_DIR / "scratches" # Parameter Objects class DefectParameters: def __init__(self) -> None: self.semantic_label = ui.SimpleStringModel("defect") self.count = ui.SimpleIntModel(1) self._build_semantic_label() self.defect_text = CustomDirectory("Defect Texture Folder", default_dir=str(SCRATCHES_DIR.as_posix()), tooltip="A folder location containing a single or set of textures (.png)", file_types=[("*.png", "PNG"), ("*", "All Files")]) self.dim_w = MinMaxWidget("Defect Dimensions Width", min_value=0.1, tooltip="Defining the Minimum and Maximum Width of the Defect") self.dim_h = MinMaxWidget("Defect Dimensions Length", min_value=0.1, tooltip="Defining the Minimum and Maximum Length of the Defect") self.rot = MinMaxWidget("Defect Rotation", tooltip="Defining the Minimum and Maximum Rotation of the Defect") def _build_semantic_label(self): with ui.HStack(height=0, tooltip="The label that will be associated with the defect"): ui.Label("Defect Semantic") ui.StringField(model=self.semantic_label) def destroy(self): self.semantic_label = None self.defect_text.destroy() self.defect_text = None self.dim_w.destroy() self.dim_w = None self.dim_h.destroy() self.dim_h = None self.rot.destroy() self.rot = None class ObjectParameters(): def __init__(self) -> None: self.target_prim = PathWidget("Target Prim") def apply_primvars(prim): # Apply prim vars prim.CreateAttribute('primvars:d1_forward_vector', Sdf.ValueTypeNames.Float3, custom=True).Set((0,0,0)) prim.CreateAttribute('primvars:d1_right_vector', Sdf.ValueTypeNames.Float3, custom=True).Set((0,0,0)) prim.CreateAttribute('primvars:d1_up_vector', Sdf.ValueTypeNames.Float3, custom=True).Set((0,0,0)) prim.CreateAttribute('primvars:d1_position', Sdf.ValueTypeNames.Float3, custom=True).Set((0,0,0)) prim.CreateAttribute('primvars:v3_scale', Sdf.ValueTypeNames.Float3, custom=True).Set((0,0,0)) nm.post_notification(f"Applied Primvars to: {prim.GetPath()}", hide_after_timeout=True, duration=5, status=nm.NotificationStatus.INFO) def apply(): # Check Paths if not check_path(self.target_prim.path_value): return # Check if prim is valid prim = is_valid_prim(self.target_prim.path_value) if prim is None: return apply_primvars(prim) ui.Button("Apply", style={"padding": 5}, clicked_fn=lambda: apply(), tooltip="Apply Primvars and Material to selected Prim." ) def destroy(self): self.target_prim.destroy() self.target_prim = None class MaterialParameters(): def __init__(self) -> None: pass
NVIDIA-Omniverse/kit-extension-sample-defectsgen/exts/omni.example.defects/omni/example/defects/widgets.py
# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import omni.ui as ui from omni.kit.window.file_importer import get_file_importer from typing import List import carb import omni.usd class CustomDirectory: def __init__(self, label: str, tooltip: str = "", default_dir: str = "", file_types: List[str] = None) -> None: self._label_text = label self._tooltip = tooltip self._file_types = file_types self._dir = ui.SimpleStringModel(default_dir) self._build_directory() @property def directory(self) -> str: """ Selected Directory name from file importer :type: str """ return self._dir.get_value_as_string() def _build_directory(self): with ui.HStack(height=0, tooltip=self._tooltip): ui.Label(self._label_text) ui.StringField(model=self._dir) ui.Button("Open", width=0, style={"padding": 5}, clicked_fn=self._pick_directory) def _pick_directory(self): file_importer = get_file_importer() if not file_importer: carb.log_warning("Unable to get file importer") file_importer.show_window(title="Select Folder", import_button_label="Import Directory", import_handler=self.import_handler, file_extension_types=self._file_types ) def import_handler(self, filename: str, dirname: str, selections: List[str] = []): self._dir.set_value(dirname) def destroy(self): self._dir = None class MinMaxWidget: def __init__(self, label: str, min_value: float = 0, max_value: float = 1, tooltip: str = "") -> None: self._min_model = ui.SimpleFloatModel(min_value) self._max_model = ui.SimpleFloatModel(max_value) self._label_text = label self._tooltip = tooltip self._build_min_max() @property def min_value(self) -> float: """ Min Value of the UI :type: int """ return self._min_model.get_value_as_float() @property def max_value(self) -> float: """ Max Value of the UI :type: int """ return self._max_model.get_value_as_float() def _build_min_max(self): with ui.HStack(height=0, tooltip=self._tooltip): ui.Label(self._label_text) with ui.HStack(): ui.Label("Min", width=0) ui.FloatDrag(model=self._min_model) ui.Label("Max", width=0) ui.FloatDrag(model=self._max_model) def destroy(self): self._max_model = None self._min_model = None class PathWidget: def __init__(self, label: str, button_label: str = "Copy", read_only: bool = False, tooltip: str = "") -> None: self._label_text = label self._tooltip = tooltip self._button_label = button_label self._read_only = read_only self._path_model = ui.SimpleStringModel() self._top_stack = ui.HStack(height=0, tooltip=self._tooltip) self._button = None self._build() @property def path_value(self) -> str: """ Path of the Prim in the scene :type: str """ return self._path_model.get_value_as_string() @path_value.setter def path_value(self, value) -> None: """ Sets the path value :type: str """ self._path_model.set_value(value) def _build(self): def copy(): ctx = omni.usd.get_context() selection = ctx.get_selection().get_selected_prim_paths() if len(selection) > 0: self._path_model.set_value(str(selection[0])) with self._top_stack: ui.Label(self._label_text) ui.StringField(model=self._path_model, read_only=self._read_only) self._button = ui.Button(self._button_label, width=0, style={"padding": 5}, clicked_fn=lambda: copy(), tooltip="Copies the Current Selected Path in the Stage") def destroy(self): self._path_model = None
NVIDIA-Omniverse/kit-extension-sample-defectsgen/exts/omni.example.defects/omni/example/defects/style.py
# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import omni.ui as ui default_defect_main = { "Button": { "width": 0, "background_color": ui.color.black }, "HStack": { "padding": 5 } }
NVIDIA-Omniverse/kit-extension-sample-defectsgen/exts/omni.example.defects/omni/example/defects/extension.py
# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import omni.ext from .window import DefectsWindow class DefectsGenerator(omni.ext.IExt): WINDOW_NAME = "Defects Sample Extension" MENU_PATH = f"Window/{WINDOW_NAME}" def __init__(self) -> None: super().__init__() self._window = None def on_startup(self, ext_id): self._menu = omni.kit.ui.get_editor_menu().add_item( DefectsGenerator.MENU_PATH, self.show_window, toggle=True, value=True ) self.show_window(None, True) def on_shutdown(self): if self._menu: omni.kit.ui.get_editor_menu().remove_item(DefectsGenerator.MENU_PATH) self._menu if self._window: self._window.destroy() self._window = None def _set_menu(self, value): omni.kit.ui.get_editor_menu().set_value(DefectsGenerator.MENU_PATH, value) def _visibility_changed_fn(self, visible): self._set_menu(visible) if not visible: self._window = None def show_window(self, menu, value): self._set_menu(value) if value: self._set_menu(True) self._window = DefectsWindow(DefectsGenerator.WINDOW_NAME, width=450, height=700) self._window.set_visibility_changed_fn(self._visibility_changed_fn) elif self._window: self._window.visible = False
NVIDIA-Omniverse/kit-extension-sample-defectsgen/exts/omni.example.defects/omni/example/defects/__init__.py
# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from .extension import *
NVIDIA-Omniverse/kit-extension-sample-defectsgen/exts/omni.example.defects/omni/example/defects/utils.py
# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import omni.usd import carb import omni.kit.commands import os def get_current_stage(): context = omni.usd.get_context() stage = context.get_stage() return stage def check_path(path: str) -> bool: if not path: carb.log_error("No path was given") return False return True def is_valid_prim(path: str): prim = get_prim(path) if not prim.IsValid(): carb.log_warn(f"No valid prim at path given: {path}") return None return prim def delete_prim(path: str): omni.kit.commands.execute('DeletePrims', paths=[path], destructive=False) def get_prim_attr(prim_path: str, attr_name: str): prim = get_prim(prim_path) return prim.GetAttribute(attr_name).Get() def get_textures(dir_path, png_type=".png"): textures = [] dir_path += "/" for file in os.listdir(dir_path): if file.endswith(png_type): textures.append(dir_path + file) return textures def get_prim(prim_path: str): stage = get_current_stage() prim = stage.GetPrimAtPath(prim_path) return prim
NVIDIA-Omniverse/kit-extension-sample-defectsgen/exts/omni.example.defects/omni/example/defects/window.py
# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import carb import omni.ui as ui from omni.ui import DockPreference from .style import * from .widgets import CustomDirectory from .replicator_defect import create_defect_layer, rep_preview, does_defect_layer_exist, rep_run, get_defect_layer from .rep_widgets import DefectParameters, ObjectParameters from .utils import * from pathlib import Path class DefectsWindow(ui.Window): def __init__(self, title: str, dockPreference: DockPreference = DockPreference.DISABLED, **kwargs) -> None: super().__init__(title, dockPreference, **kwargs) # Models self.frames = ui.SimpleIntModel(1, min=1) self.rt_subframes = ui.SimpleIntModel(1, min=1) # Widgets self.defect_params = None self.object_params = None self.output_dir = None self.frame_change = None self.frame.set_build_fn(self._build_frame) def _build_collapse_base(self, label: str, collapsed: bool = False): v_stack = None with ui.CollapsableFrame(label, height=0, collapsed=collapsed): with ui.ZStack(): ui.Rectangle() v_stack = ui.VStack() return v_stack def _build_frame(self): with self.frame: with ui.ScrollingFrame(style=default_defect_main): with ui.VStack(style={"margin": 3}): self._build_object_param() self._build_defect_param() self._build_replicator_param() def _build_object_param(self): with self._build_collapse_base("Object Parameters"): self.object_params = ObjectParameters() def _build_defect_param(self): with self._build_collapse_base("Defect Parameters"): self.defect_params = DefectParameters() def _build_replicator_param(self): def preview_data(): if does_defect_layer_exist(): rep_preview() else: create_defect_layer(self.defect_params, self.object_params) self.rep_layer_button.text = "Recreate Replicator Graph" def remove_replicator_graph(): if get_defect_layer() is not None: layer, pos = get_defect_layer() omni.kit.commands.execute('RemoveSublayer', layer_identifier=layer.identifier, sublayer_position=pos) if is_valid_prim('/World/Looks/ProjectPBRMaterial'): delete_prim('/World/Looks/ProjectPBRMaterial') if is_valid_prim(self.object_params.target_prim.path_value + "/Projection"): delete_prim(self.object_params.target_prim.path_value + "/Projection") if is_valid_prim('/Replicator'): delete_prim('/Replicator') def run_replicator(): remove_replicator_graph() total_frames = self.frames.get_value_as_int() subframes = self.rt_subframes.get_value_as_int() if subframes <= 0: subframes = 0 if total_frames > 0: create_defect_layer(self.defect_params, self.object_params, total_frames, self.output_dir.directory, subframes, self._use_seg.as_bool, self._use_bb.as_bool) self.rep_layer_button.text = "Recreate Replicator Graph" rep_run() else: carb.log_error(f"Number of frames is {total_frames}. Input value needs to be greater than 0.") def create_replicator_graph(): remove_replicator_graph() create_defect_layer(self.defect_params, self.object_params) self.rep_layer_button.text = "Recreate Replicator Graph" def set_text(label, model): label.text = model.as_string with self._build_collapse_base("Replicator Parameters"): home_dir = Path.home() valid_out_dir = home_dir / "omni.replicator_out" self.output_dir = CustomDirectory("Output Directory", default_dir=str(valid_out_dir.as_posix()), tooltip="Directory to specify where the output files will be stored. Default is [DRIVE/Users/USER/omni.replicator_out]") with ui.HStack(height=0, tooltip="Check off which annotator you want to use; You can also use both"): ui.Label("Annotations: ", width=0) ui.Spacer() ui.Label("Segmentation", width=0) self._use_seg = ui.CheckBox().model ui.Label("Bounding Box", width=0) self._use_bb = ui.CheckBox().model ui.Spacer() with ui.HStack(height=0): ui.Label("Render Subframe Count: ", width=0, tooltip="Defines how many subframes of rendering occur before going to the next frame") ui.Spacer(width=ui.Fraction(0.25)) ui.IntField(model=self.rt_subframes) self.rep_layer_button = ui.Button("Create Replicator Layer", clicked_fn=lambda: create_replicator_graph(), tooltip="Creates/Recreates the Replicator Graph, based on the current Defect Parameters") with ui.HStack(height=0): ui.Button("Preview", width=0, clicked_fn=lambda: preview_data(), tooltip="Preview a Replicator Scene") ui.Label("or", width=0) ui.Button("Run for", width=0, clicked_fn=lambda: run_replicator(), tooltip="Run replicator for so many frames") with ui.ZStack(width=0): l = ui.Label("", style={"color": ui.color.transparent, "margin_width": 10}) self.frame_change = ui.StringField(model=self.frames) self.frame_change_cb = self.frame_change.model.add_value_changed_fn(lambda m, l=l: set_text(l, m)) ui.Label("frame(s)") def destroy(self) -> None: self.frames = None self.defect_semantic = None if self.frame_change is not None: self.frame_change.model.remove_value_changed_fn(self.frame_change_cb) if self.defect_params is not None: self.defect_params.destroy() self.defect_params = None if self.object_params is not None: self.object_params.destroy() self.object_params = None return super().destroy()
NVIDIA-Omniverse/kit-extension-sample-defectsgen/exts/omni.example.defects/omni/example/defects/replicator_defect.py
# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import omni.replicator.core as rep import carb from .rep_widgets import DefectParameters, ObjectParameters from .utils import * camera_path = "/World/Camera" def rep_preview(): rep.orchestrator.preview() def rep_run(): rep.orchestrator.run() def does_defect_layer_exist() -> bool: stage = get_current_stage() for layer in stage.GetLayerStack(): if layer.GetDisplayName() == "Defect": return True return False def get_defect_layer(): stage = get_current_stage() pos = 0 for layer in stage.GetLayerStack(): if layer.GetDisplayName() == "Defect": return layer, pos pos = pos + 1 return None def create_randomizers(defect_params: DefectParameters, object_params: ObjectParameters): diffuse_textures = get_textures(defect_params.defect_text.directory, "_D.png") normal_textures = get_textures(defect_params.defect_text.directory, "_N.png") roughness_textures = get_textures(defect_params.defect_text.directory, "_R.png") def move_defect(): defects = rep.get.prims(semantics=[('class', defect_params.semantic_label.as_string + '_mesh')]) plane = rep.get.prim_at_path(object_params.target_prim.path_value) with defects: rep.randomizer.scatter_2d(plane) rep.modify.pose( rotation=rep.distribution.uniform( (defect_params.rot.min_value, 0, 90), (defect_params.rot.max_value, 0, 90) ), scale=rep.distribution.uniform( (1, defect_params.dim_h.min_value,defect_params.dim_w.min_value), (1, defect_params.dim_h.max_value, defect_params.dim_w.max_value) ) ) return defects.node def change_defect_image(): projections = rep.get.prims(semantics=[('class', defect_params.semantic_label.as_string + '_projectmat')]) with projections: rep.modify.projection_material( diffuse=rep.distribution.sequence(diffuse_textures), normal=rep.distribution.sequence(normal_textures), roughness=rep.distribution.sequence(roughness_textures)) return projections.node rep.randomizer.register(move_defect) rep.randomizer.register(change_defect_image) def create_camera(target_path): if is_valid_prim(camera_path) is None: camera = rep.create.camera(position=1000, look_at=rep.get.prim_at_path(target_path)) carb.log_info(f"Creating Camera: {camera}") else: camera = rep.get.prim_at_path(camera_path) return camera def create_defects(defect_params: DefectParameters, object_params: ObjectParameters): target_prim = rep.get.prims(path_pattern=object_params.target_prim.path_value) count = 1 if defect_params.count.as_int > 1: count = defect_params.count.as_int for i in range(count): cube = rep.create.cube(visible=False, semantics=[('class', defect_params.semantic_label.as_string + '_mesh')], position=0, scale=1, rotation=(0, 0, 90)) with target_prim: rep.create.projection_material(cube, [('class', defect_params.semantic_label.as_string + '_projectmat')]) def create_defect_layer(defect_params: DefectParameters, object_params: ObjectParameters, frames: int = 1, output_dir: str = "_defects", rt_subframes: int = 0, use_seg: bool = False, use_bb: bool = True): if len(defect_params.defect_text.directory) <= 0: carb.log_error("No directory selected") return with rep.new_layer("Defect"): create_defects(defect_params, object_params) create_randomizers(defect_params=defect_params, object_params=object_params) # Create / Get camera camera = create_camera(object_params.target_prim.path_value) # Add Default Light distance_light = rep.create.light(rotation=(315,0,0), intensity=3000, light_type="distant") render_product = rep.create.render_product(camera, (1024, 1024)) # Initialize and attach writer writer = rep.WriterRegistry.get("BasicWriter") writer.initialize(output_dir=output_dir, rgb=True, semantic_segmentation=use_seg, bounding_box_2d_tight=use_bb) # Attach render_product to the writer writer.attach([render_product]) # Setup randomization with rep.trigger.on_frame(num_frames=frames, rt_subframes=rt_subframes): rep.randomizer.move_defect() rep.randomizer.change_defect_image()
NVIDIA-Omniverse/kit-extension-sample-defectsgen/exts/omni.example.defects/omni/example/defects/docs/OgnWritePrimVars.rst
.. _GENERATED - Documentation _ognomni.example.defects.WritePrimVars: OmniGraph Node omni.example.defects.WritePrimVars ================================================ omni.example.defects.WritePrimVars Properties -------------------------------------------- +---------------------------+--------------------------+ | Name | Value | +===========================+==========================+ | Version | 1 | +---------------------------+--------------------------+ | Extension | omni.example.defects | +---------------------------+--------------------------+ | Has State? | False | +---------------------------+--------------------------+ | Implementation Language | Python | +---------------------------+--------------------------+ | Default Memory Type | cpu | +---------------------------+--------------------------+ | Generated Code Exclusions | None | +---------------------------+--------------------------+ | uiName | WritePrimVars | +---------------------------+--------------------------+ | __language | Python | +---------------------------+--------------------------+ | Generated Class Name | OgnWritePrimVarsDatabase | +---------------------------+--------------------------+ | Python Module | omni.example.defects | +---------------------------+--------------------------+ omni.example.defects.WritePrimVars Description --------------------------------------------- Write Primvars to target mesh based on the decal proxy omni.example.defects.WritePrimVars Inputs ---------------------------------------- +--------------------+-----------+-------------+-----------+--------------------------------------------------------+ | Name | Type | Default | Required? | Descripton | +====================+===========+=============+===========+========================================================+ | inputs:execIn | execution | None | **Y** | exec | +--------------------+-----------+-------------+-----------+--------------------------------------------------------+ | inputs:proxy_path | string | | **Y** | Path of the Proxy object | +--------------------+-----------+-------------+-----------+--------------------------------------------------------+ | | uiName | proxy_path | | | +--------------------+-----------+-------------+-----------+--------------------------------------------------------+ | | __default | "" | | | +--------------------+-----------+-------------+-----------+--------------------------------------------------------+ | inputs:target_path | string | | **Y** | Path of the Target objects that contains the primvars | +--------------------+-----------+-------------+-----------+--------------------------------------------------------+ | | uiName | target_path | | | +--------------------+-----------+-------------+-----------+--------------------------------------------------------+ | | __default | "" | | | +--------------------+-----------+-------------+-----------+--------------------------------------------------------+ omni.example.defects.WritePrimVars Outputs ----------------------------------------- +-----------------+-----------+---------+-----------+------------+ | Name | Type | Default | Required? | Descripton | +=================+===========+=========+===========+============+ | outputs:execOut | execution | None | **Y** | exec | +-----------------+-----------+---------+-----------+------------+
NVIDIA-Omniverse/kit-extension-sample-defectsgen/exts/omni.example.defects/docs/CHANGELOG.md
# Changelog All notable changes to this project will be documented in this file. and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [1.1.1] - 2023-08-23 ### Changed - Changed annotations to use Tight Bounding Box instead of Loose - Updated ReadMe ## [1.1.0] - 2023-08-15 ### Removed - Ogn nodes, these nodes are now apart of the replicator pipeline - proxy.usd, Replicator has built in functionality in their nodes that creates the proxy - Functions in `utils.py` that are not longer being used - Region selection ### Added - Options to either use bounding boxes or segmentation - Functionality to remove new prims created by Replicator - Notificataion popup for when the prim vars are applied to the mesh ### Changed - Textures are now represented as a D, N, and R - D is Diffuse - N is Normal - R is Roughness - Default values for dimensions start at 0.1 - Output Directory UI defaults to replicator default output directory - Textures folder UI defaults to folder inside of extension with sample scratches - Updated README talking about the new images being used ## [1.0.1] - 2023-04-18 ### Changed - CustomDirectory now takes file_types if the user wants to specify the files they can filter by - Material that is applied to the prim ### Fixed - Nodes not connecting properly with Code 2022.3.3 - In utils.py if rotation is not found use (0,0,0) as default - lookat in utils.py could not subtract Vec3f by Vec3d
NVIDIA-Omniverse/kit-extension-sample-defectsgen/exts/omni.example.defects/docs/README.md
# Defects Sample Extension (omni.sample.defects) ![Defects Preview](../data/preview.png) ## Overview The Defects Sample Extension allows users to choose a texture, that represents a defect, to apply to a [Prim](https://docs.omniverse.nvidia.com/prod_usd/prod_usd/quick-start/prims.html) and generate synthetic data of the position, rotation, and dimensions of that texture. This Sample Extension utilizes Omniverse's [Replicator](https://developer.nvidia.com/omniverse/replicator) functionality for randomizing and generating synthetic data. ## UI Overview ### Object Parameters ![Object Params](../data/objparam.png) 1. Target Prim - This defines what prim the material to apply to. To get the prim path, **select** a prim in the scene then hit the **Copy button** 2. Apply - Once you have a Target Prim selected and Copied it's path, hitting Apply will bring in the proxy, decal material and create the primvar's on the Target Prim. ### Defect Parameters ![Defect Params](../data/defectparam.png) Randomizations are based on Replicator's [Distributions](https://docs.omniverse.nvidia.com/prod_extensions/prod_extensions/ext_replicator/distribution_examples.html) 1. Defect Semantic - The semantic label that will be used to represent the defect in the output file produced by Replicator. - Default Value: `defect` 2. Defect Texture Folder - A folder location that holds all the texture(s) to choose from. Textures should be in PNG format. - Default Value: data folder within the Defect Extension - Defect textures are composed of a Diffuse, Normal, and Roughness texture to represent the defect. Example shown below: Diffuse Texture | Normal Texture | Roughness Texture :-------------------------:|:-------------------------:|:-------------------------: ![](../omni/example/defects/data/scratches/scratch_0_D.png) | ![](../omni/example/defects/data/scratches/scratch_0_N.png) | ![](../omni/example/defects/data/scratches/scratch_0_R.png) 3. Defect Dimensions Width - Replicator will choose random values between the Min and Max defined (cms) - Default Value Min: `0.1` - Default Value Max: `1` 4. Defect Dimensions Length - Replicator will choose random values between the Min and Max defined (cms) - Default Value Min: `0.1` - Default Value Max: `1` 5. Defect Rotation - Replicator will choose random values between the Min and Max defined (cms) and will set that rotation. - Default Value Min: `0.1` - Default Value Max: `1` A recommended set of values using the CarDefectPanel scene is the following: - Defect Semantics: Scratch - Defect Texture: [Path to Scratchs located in Extension] - Defect Dimensions Width: Min 0.1 Max 0.2 - Defect Dimensions Length: Min 0.15 Max 0.2 - Defect Rotation: Min 0 Max 360 ### Replicator Parameters ![Rep Params](../data/repparam.png) 1. Output Directory - Defines the location in which Replicator will use to output data. By default it will be `DRIVE/Users/USER/omni.replicator_out` 2. Annotations - There are two types of annotations you can choose from: Segmentation and/or Bounding Box. You can select both of these. For other annotation options you will need to adjust the code inside the extension. 3. [Render Subframe](https://docs.omniverse.nvidia.com/prod_extensions/prod_extensions/ext_replicator/subframes_examples.html) Count - If rendering in RTX Realtime mode, specifies the number of subframes to render in order to reduce artifacts caused by large changes in the scene. 4. Create Replicator Layer - Generates the [OmniGraph](https://docs.omniverse.nvidia.com/prod_extensions/prod_extensions/ext_omnigraph.html) or Omni.Replicator graph architecture, if changes are made the user can click this button to reflect changes. This does not run the actual execution or logic. 5. Preview - **Preview** performs a single iteration of randomizations and prevents data from being written to disk. 6. Run for X frames - **Run for** will run the generation for a specified amount of frames. Each frame will be one data file so 100 frames will produce 100 images/json/npy files. ![scratch](../data/scratch.gif)
NVIDIA-Omniverse/kit-extension-sample-apiconnect/link_app.sh
#!/bin/bash set -e SCRIPT_DIR=$(dirname ${BASH_SOURCE}) cd "$SCRIPT_DIR" exec "tools/packman/python.sh" tools/scripts/link_app.py $@
NVIDIA-Omniverse/kit-extension-sample-apiconnect/link_app.bat
@echo off call "%~dp0tools\packman\python.bat" %~dp0tools\scripts\link_app.py %* if %errorlevel% neq 0 ( goto Error ) :Success exit /b 0 :Error exit /b %errorlevel%
NVIDIA-Omniverse/kit-extension-sample-apiconnect/README.md
# API Connect Sample Omniverse Extension ![preview.png](/exts/omni.example.apiconnect/data/preview.png) ### About This Sample Omniverse Extension demonstrates how connect to an API. In this sample, we create a palette of colors using the [HueMint.com](https://huemint.com/). API. ### [README](exts/omni.example.apiconnect) See the [README for this extension](exts/omni.example.apiconnect) to learn more about it including how to use it. ## [Tutorial](exts/omni.example.apiconnect/docs/tutorial.md) Follow a [step-by-step tutorial](exts/omni.example.apiconnect/docs/tutorial.md) that walks you through how to build this extension using [asyncio](https://docs.python.org/3/library/asyncio.html) and [aiohttp](https://docs.aiohttp.org/en/stable/). ## Adding This Extension To add a this extension to your Omniverse app: 1. Go into: Extension Manager -> Hamburger Icon -> Settings -> Extension Search Path 2. Add this as a search path: `git://github.com/NVIDIA-Omniverse/kit-extension-sample-apiconnect.git?branch=main&dir=exts` Alternatively: 1. Download or Clone the extension, unzip the file if downloaded 2. Copy the `exts` folder path within the extension folder - i.e. home/.../kit-extension-sample-apiconnect/exts (Linux) or C:/.../kit-extension-sample-apiconnect/exts (Windows) 3. Go into: Extension Manager -> Hamburger Icon -> Settings -> Extension Search Path 4. Add the `exts` folder path as a search path ## Linking with an Omniverse app For a better developer experience, it is recommended to create a folder link named `app` to the *Omniverse Kit* app installed from *Omniverse Launcher*. A convenience script to use is included. Run: ```bash # Windows > link_app.bat ``` ```shell # Linux ~$ ./link_app.sh ``` If successful you should see `app` folder link in the root of this repo. If multiple Omniverse apps are installed the script will select the recommended one. Or you can explicitly pass an app: ```bash # Windows > link_app.bat --app code ``` ```shell # Linux ~$ ./link_app.sh --app code ``` You can also pass a path that leads to the Omniverse package folder to create the link: ```bash # Windows > link_app.bat --path "C:/Users/bob/AppData/Local/ov/pkg/create-2022.1.3" ``` ```shell # Linux ~$ ./link_app.sh --path "home/bob/.local/share/ov/pkg/create-2022.1.3" ``` ## Attribution & Acknowledgements This extension uses the [Huemint.com API](https://huemint.com/about/). Huemint uses machine learning to create unique color schemes. Special thanks to Jack Qiao for allowing us to use the Huemint API for this demonstration. Check out [Huemint.com](https://huemint.com/) ## Contributing The source code for this repository is provided as-is and we are not accepting outside contributions.
NVIDIA-Omniverse/kit-extension-sample-apiconnect/tools/scripts/link_app.py
import os import argparse import sys import json import packmanapi import urllib3 def find_omniverse_apps(): http = urllib3.PoolManager() try: r = http.request("GET", "http://127.0.0.1:33480/components") except Exception as e: print(f"Failed retrieving apps from an Omniverse Launcher, maybe it is not installed?\nError: {e}") sys.exit(1) apps = {} for x in json.loads(r.data.decode("utf-8")): latest = x.get("installedVersions", {}).get("latest", "") if latest: for s in x.get("settings", []): if s.get("version", "") == latest: root = s.get("launch", {}).get("root", "") apps[x["slug"]] = (x["name"], root) break return apps def create_link(src, dst): print(f"Creating a link '{src}' -> '{dst}'") packmanapi.link(src, dst) APP_PRIORITIES = ["code", "create", "view"] if __name__ == "__main__": parser = argparse.ArgumentParser(description="Create folder link to Kit App installed from Omniverse Launcher") parser.add_argument( "--path", help="Path to Kit App installed from Omniverse Launcher, e.g.: 'C:/Users/bob/AppData/Local/ov/pkg/create-2021.3.4'", required=False, ) parser.add_argument( "--app", help="Name of Kit App installed from Omniverse Launcher, e.g.: 'code', 'create'", required=False ) args = parser.parse_args() path = args.path if not path: print("Path is not specified, looking for Omniverse Apps...") apps = find_omniverse_apps() if len(apps) == 0: print( "Can't find any Omniverse Apps. Use Omniverse Launcher to install one. 'Code' is the recommended app for developers." ) sys.exit(0) print("\nFound following Omniverse Apps:") for i, slug in enumerate(apps): name, root = apps[slug] print(f"{i}: {name} ({slug}) at: '{root}'") if args.app: selected_app = args.app.lower() if selected_app not in apps: choices = ", ".join(apps.keys()) print(f"Passed app: '{selected_app}' is not found. Specify one of the following found Apps: {choices}") sys.exit(0) else: selected_app = next((x for x in APP_PRIORITIES if x in apps), None) if not selected_app: selected_app = next(iter(apps)) print(f"\nSelected app: {selected_app}") _, path = apps[selected_app] if not os.path.exists(path): print(f"Provided path doesn't exist: {path}") else: SCRIPT_ROOT = os.path.dirname(os.path.realpath(__file__)) create_link(f"{SCRIPT_ROOT}/../../app", path) print("Success!")
NVIDIA-Omniverse/kit-extension-sample-apiconnect/tools/packman/python.sh
#!/bin/bash # Copyright 2023 NVIDIA CORPORATION # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. set -e PACKMAN_CMD="$(dirname "${BASH_SOURCE}")/packman" if [ ! -f "$PACKMAN_CMD" ]; then PACKMAN_CMD="${PACKMAN_CMD}.sh" fi source "$PACKMAN_CMD" init export PYTHONPATH="${PM_MODULE_DIR}:${PYTHONPATH}" export PYTHONNOUSERSITE=1 # workaround for our python not shipping with certs if [[ -z ${SSL_CERT_DIR:-} ]]; then export SSL_CERT_DIR=/etc/ssl/certs/ fi "${PM_PYTHON}" -u "$@"
NVIDIA-Omniverse/kit-extension-sample-apiconnect/tools/packman/python.bat
:: Copyright 2023 NVIDIA CORPORATION :: :: Licensed under the Apache License, Version 2.0 (the "License"); :: you may not use this file except in compliance with the License. :: You may obtain a copy of the License at :: :: http://www.apache.org/licenses/LICENSE-2.0 :: :: Unless required by applicable law or agreed to in writing, software :: distributed under the License is distributed on an "AS IS" BASIS, :: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. :: See the License for the specific language governing permissions and :: limitations under the License. @echo off setlocal call "%~dp0\packman" init set "PYTHONPATH=%PM_MODULE_DIR%;%PYTHONPATH%" set PYTHONNOUSERSITE=1 "%PM_PYTHON%" -u %*
NVIDIA-Omniverse/kit-extension-sample-apiconnect/tools/packman/packman.cmd
:: Reset errorlevel status (don't inherit from caller) [xxxxxxxxxxx] @call :ECHO_AND_RESET_ERROR :: You can remove the call below if you do your own manual configuration of the dev machines call "%~dp0\bootstrap\configure.bat" if %errorlevel% neq 0 ( exit /b %errorlevel% ) :: Everything below is mandatory if not defined PM_PYTHON goto :PYTHON_ENV_ERROR if not defined PM_MODULE goto :MODULE_ENV_ERROR :: Generate temporary path for variable file for /f "delims=" %%a in ('powershell -ExecutionPolicy ByPass -NoLogo -NoProfile ^ -File "%~dp0bootstrap\generate_temp_file_name.ps1"') do set PM_VAR_PATH=%%a if %1.==. ( set PM_VAR_PATH_ARG= ) else ( set PM_VAR_PATH_ARG=--var-path="%PM_VAR_PATH%" ) "%PM_PYTHON%" -S -s -u -E "%PM_MODULE%" %* %PM_VAR_PATH_ARG% if %errorlevel% neq 0 ( exit /b %errorlevel% ) :: Marshall environment variables into the current environment if they have been generated and remove temporary file if exist "%PM_VAR_PATH%" ( for /F "usebackq tokens=*" %%A in ("%PM_VAR_PATH%") do set "%%A" ) if %errorlevel% neq 0 ( goto :VAR_ERROR ) if exist "%PM_VAR_PATH%" ( del /F "%PM_VAR_PATH%" ) if %errorlevel% neq 0 ( goto :VAR_ERROR ) set PM_VAR_PATH= goto :eof :: Subroutines below :PYTHON_ENV_ERROR @echo User environment variable PM_PYTHON is not set! Please configure machine for packman or call configure.bat. exit /b 1 :MODULE_ENV_ERROR @echo User environment variable PM_MODULE is not set! Please configure machine for packman or call configure.bat. exit /b 1 :VAR_ERROR @echo Error while processing and setting environment variables! exit /b 1 :ECHO_AND_RESET_ERROR @echo off if /I "%PM_VERBOSITY%"=="debug" ( @echo on ) exit /b 0
NVIDIA-Omniverse/kit-extension-sample-apiconnect/tools/packman/config.packman.xml
<config remotes="cloudfront"> <remote2 name="cloudfront"> <transport actions="download" protocol="https" packageLocation="d4i3qtqj3r0z5.cloudfront.net/${name}@${version}" /> </remote2> </config>
NVIDIA-Omniverse/kit-extension-sample-apiconnect/tools/packman/bootstrap/generate_temp_file_name.ps1
<# Copyright 2023 NVIDIA CORPORATION Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. #> $out = [System.IO.Path]::GetTempFileName() Write-Host $out # SIG # Begin signature block # MIIaVwYJKoZIhvcNAQcCoIIaSDCCGkQCAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG # KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCAK+Ewup1N0/mdf # 1l4R58rxyumHgZvTmEhrYTb2Zf0zd6CCCiIwggTTMIIDu6ADAgECAhBi50XpIWUh # PJcfXEkK6hKlMA0GCSqGSIb3DQEBCwUAMIGEMQswCQYDVQQGEwJVUzEdMBsGA1UE # ChMUU3ltYW50ZWMgQ29ycG9yYXRpb24xHzAdBgNVBAsTFlN5bWFudGVjIFRydXN0 # IE5ldHdvcmsxNTAzBgNVBAMTLFN5bWFudGVjIENsYXNzIDMgU0hBMjU2IENvZGUg # U2lnbmluZyBDQSAtIEcyMB4XDTE4MDcwOTAwMDAwMFoXDTIxMDcwOTIzNTk1OVow # gYMxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRQwEgYDVQQHDAtT # YW50YSBDbGFyYTEbMBkGA1UECgwSTlZJRElBIENvcnBvcmF0aW9uMQ8wDQYDVQQL # DAZJVC1NSVMxGzAZBgNVBAMMEk5WSURJQSBDb3Jwb3JhdGlvbjCCASIwDQYJKoZI # hvcNAQEBBQADggEPADCCAQoCggEBALEZN63dA47T4i90jZ84CJ/aWUw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1t5ljhSKMYcp5lH5Z/IwP42+1ASa2bKXuh1Eh # 5Fhgm7oMLSttosR+u8QlK0cCCHxJrhO24XxCQijGGFbPQTS2Zl22dHv1VjMiLyI2 # skuiSpXY9aaOUjGCAk0wggJJAgEBMIGGMHIxCzAJBgNVBAYTAlVTMRUwEwYDVQQK # EwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20xMTAvBgNV # BAMTKERpZ2lDZXJ0IFNIQTIgQXNzdXJlZCBJRCBUaW1lc3RhbXBpbmcgQ0ECEA1C # SuC+Ooj/YEAhzhQA8N0wDQYJYIZIAWUDBAIBBQCggZgwGgYJKoZIhvcNAQkDMQ0G # CyqGSIb3DQEJEAEEMBwGCSqGSIb3DQEJBTEPFw0yMTA0MDgwOTExMDlaMCsGCyqG # SIb3DQEJEAIMMRwwGjAYMBYEFOHXgqjhkb7va8oWkbWqtJSmJJvzMC8GCSqGSIb3 # DQEJBDEiBCCHEAmNNj2zWjWYRfEi4FgzZvrI16kv/U2b9b3oHw6UVDANBgkqhkiG # 9w0BAQEFAASCAQCdefEKh6Qmwx7xGCkrYi/A+/Cla6LdnYJp38eMs3fqTTvjhyDw # HffXrwdqWy5/fgW3o3qJXqa5o7hLxYIoWSULOCpJRGdt+w7XKPAbZqHrN9elAhWJ # vpBTCEaj7dVxr1Ka4NsoPSYe0eidDBmmvGvp02J4Z1j8+ImQPKN6Hv/L8Ixaxe7V # mH4VtXIiBK8xXdi4wzO+A+qLtHEJXz3Gw8Bp3BNtlDGIUkIhVTM3Q1xcSEqhOLqo # PGdwCw9acxdXNWWPjOJkNH656Bvmkml+0p6MTGIeG4JCeRh1Wpqm1ZGSoEcXNaof # wOgj48YzI+dNqBD9i7RSWCqJr2ygYKRTxnuU # SIG # End signature block
NVIDIA-Omniverse/kit-extension-sample-apiconnect/tools/packman/bootstrap/configure.bat
:: Copyright 2023 NVIDIA CORPORATION :: :: Licensed under the Apache License, Version 2.0 (the "License"); :: you may not use this file except in compliance with the License. :: You may obtain a copy of the License at :: :: http://www.apache.org/licenses/LICENSE-2.0 :: :: Unless required by applicable law or agreed to in writing, software :: distributed under the License is distributed on an "AS IS" BASIS, :: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. :: See the License for the specific language governing permissions and :: limitations under the License. set PM_PACKMAN_VERSION=6.33.2 :: Specify where packman command is rooted set PM_INSTALL_PATH=%~dp0.. :: The external root may already be configured and we should do minimal work in that case if defined PM_PACKAGES_ROOT goto ENSURE_DIR :: If the folder isn't set we assume that the best place for it is on the drive that we are currently :: running from set PM_DRIVE=%CD:~0,2% set PM_PACKAGES_ROOT=%PM_DRIVE%\packman-repo :: We use *setx* here so that the variable is persisted in the user environment echo Setting user environment variable PM_PACKAGES_ROOT to %PM_PACKAGES_ROOT% setx PM_PACKAGES_ROOT %PM_PACKAGES_ROOT% if %errorlevel% neq 0 ( goto ERROR ) :: The above doesn't work properly from a build step in VisualStudio because a separate process is :: spawned for it so it will be lost for subsequent compilation steps - VisualStudio must :: be launched from a new process. We catch this odd-ball case here: if defined PM_DISABLE_VS_WARNING goto ENSURE_DIR if not defined VSLANG goto ENSURE_DIR echo The above is a once-per-computer operation. Unfortunately VisualStudio cannot pick up environment change echo unless *VisualStudio is RELAUNCHED*. echo If you are launching VisualStudio from command line or command line utility make sure echo you have a fresh launch environment (relaunch the command line or utility). echo If you are using 'linkPath' and referring to packages via local folder links you can safely ignore this warning. echo You can disable this warning by setting the environment variable PM_DISABLE_VS_WARNING. echo. :: Check for the directory that we need. Note that mkdir will create any directories :: that may be needed in the path :ENSURE_DIR if not exist "%PM_PACKAGES_ROOT%" ( echo Creating directory %PM_PACKAGES_ROOT% mkdir "%PM_PACKAGES_ROOT%" ) if %errorlevel% neq 0 ( goto ERROR_MKDIR_PACKAGES_ROOT ) :: The Python interpreter may already be externally configured if defined PM_PYTHON_EXT ( set PM_PYTHON=%PM_PYTHON_EXT% goto PACKMAN ) set PM_PYTHON_VERSION=3.7.9-windows-x86_64 set PM_PYTHON_BASE_DIR=%PM_PACKAGES_ROOT%\python set PM_PYTHON_DIR=%PM_PYTHON_BASE_DIR%\%PM_PYTHON_VERSION% set PM_PYTHON=%PM_PYTHON_DIR%\python.exe if exist "%PM_PYTHON%" goto PACKMAN if not exist "%PM_PYTHON_BASE_DIR%" call :CREATE_PYTHON_BASE_DIR set PM_PYTHON_PACKAGE=python@%PM_PYTHON_VERSION%.cab for /f "delims=" %%a in ('powershell -ExecutionPolicy ByPass -NoLogo -NoProfile -File "%~dp0\generate_temp_file_name.ps1"') do set TEMP_FILE_NAME=%%a set TARGET=%TEMP_FILE_NAME%.zip call "%~dp0fetch_file_from_packman_bootstrap.cmd" %PM_PYTHON_PACKAGE% "%TARGET%" if %errorlevel% neq 0 ( echo !!! Error fetching python from CDN !!! goto ERROR ) for /f "delims=" %%a in ('powershell -ExecutionPolicy ByPass -NoLogo -NoProfile -File "%~dp0\generate_temp_folder.ps1" -parentPath "%PM_PYTHON_BASE_DIR%"') do set TEMP_FOLDER_NAME=%%a echo Unpacking Python interpreter ... "%SystemRoot%\system32\expand.exe" -F:* "%TARGET%" "%TEMP_FOLDER_NAME%" 1> nul del "%TARGET%" :: Failure during extraction to temp folder name, need to clean up and abort if %errorlevel% neq 0 ( echo !!! Error unpacking python !!! call :CLEAN_UP_TEMP_FOLDER goto ERROR ) :: If python has now been installed by a concurrent process we need to clean up and then continue if exist "%PM_PYTHON%" ( call :CLEAN_UP_TEMP_FOLDER goto PACKMAN ) else ( if exist "%PM_PYTHON_DIR%" ( rd /s /q "%PM_PYTHON_DIR%" > nul ) ) :: Perform atomic rename rename "%TEMP_FOLDER_NAME%" "%PM_PYTHON_VERSION%" 1> nul :: Failure during move, need to clean up and abort if %errorlevel% neq 0 ( echo !!! Error renaming python !!! call :CLEAN_UP_TEMP_FOLDER goto ERROR ) :PACKMAN :: The packman module may already be externally configured if defined PM_MODULE_DIR_EXT ( set PM_MODULE_DIR=%PM_MODULE_DIR_EXT% ) else ( set PM_MODULE_DIR=%PM_PACKAGES_ROOT%\packman-common\%PM_PACKMAN_VERSION% ) set PM_MODULE=%PM_MODULE_DIR%\packman.py if exist "%PM_MODULE%" goto ENSURE_7ZA set PM_MODULE_PACKAGE=packman-common@%PM_PACKMAN_VERSION%.zip for /f "delims=" %%a in ('powershell -ExecutionPolicy ByPass -NoLogo -NoProfile -File "%~dp0\generate_temp_file_name.ps1"') do set TEMP_FILE_NAME=%%a set TARGET=%TEMP_FILE_NAME% call "%~dp0fetch_file_from_packman_bootstrap.cmd" %PM_MODULE_PACKAGE% "%TARGET%" if %errorlevel% neq 0 ( echo !!! Error fetching packman from CDN !!! goto ERROR ) echo Unpacking ... "%PM_PYTHON%" -S -s -u -E "%~dp0\install_package.py" "%TARGET%" "%PM_MODULE_DIR%" if %errorlevel% neq 0 ( echo !!! Error unpacking packman !!! goto ERROR ) del "%TARGET%" :ENSURE_7ZA set PM_7Za_VERSION=16.02.4 set PM_7Za_PATH=%PM_PACKAGES_ROOT%\7za\%PM_7ZA_VERSION% if exist "%PM_7Za_PATH%" goto END set PM_7Za_PATH=%PM_PACKAGES_ROOT%\chk\7za\%PM_7ZA_VERSION% if exist "%PM_7Za_PATH%" goto END "%PM_PYTHON%" -S -s -u -E "%PM_MODULE%" pull "%PM_MODULE_DIR%\deps.packman.xml" if %errorlevel% neq 0 ( echo !!! Error fetching packman dependencies !!! goto ERROR ) goto END :ERROR_MKDIR_PACKAGES_ROOT echo Failed to automatically create packman packages repo at %PM_PACKAGES_ROOT%. echo Please set a location explicitly that packman has permission to write to, by issuing: echo. echo setx PM_PACKAGES_ROOT {path-you-choose-for-storing-packman-packages-locally} echo. echo Then launch a new command console for the changes to take effect and run packman command again. exit /B %errorlevel% :ERROR echo !!! Failure while configuring local machine :( !!! exit /B %errorlevel% :CLEAN_UP_TEMP_FOLDER rd /S /Q "%TEMP_FOLDER_NAME%" exit /B :CREATE_PYTHON_BASE_DIR :: We ignore errors and clean error state - if two processes create the directory one will fail which is fine md "%PM_PYTHON_BASE_DIR%" > nul 2>&1 exit /B 0 :END
NVIDIA-Omniverse/kit-extension-sample-apiconnect/tools/packman/bootstrap/fetch_file_from_packman_bootstrap.cmd
:: Copyright 2023 NVIDIA CORPORATION :: :: Licensed under the Apache License, Version 2.0 (the "License"); :: you may not use this file except in compliance with the License. :: You may obtain a copy of the License at :: :: http://www.apache.org/licenses/LICENSE-2.0 :: :: Unless required by applicable law or agreed to in writing, software :: distributed under the License is distributed on an "AS IS" BASIS, :: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. :: See the License for the specific language governing permissions and :: limitations under the License. :: You need to specify <package-name> <target-path> as input to this command @setlocal @set PACKAGE_NAME=%1 @set TARGET_PATH=%2 @echo Fetching %PACKAGE_NAME% ... @powershell -ExecutionPolicy ByPass -NoLogo -NoProfile -File "%~dp0download_file_from_url.ps1" ^ -source "http://bootstrap.packman.nvidia.com/%PACKAGE_NAME%" -output %TARGET_PATH% :: A bug in powershell prevents the errorlevel code from being set when using the -File execution option :: We must therefore do our own failure analysis, basically make sure the file exists and is larger than 0 bytes: @if not exist %TARGET_PATH% goto ERROR_DOWNLOAD_FAILED @if %~z2==0 goto ERROR_DOWNLOAD_FAILED @endlocal @exit /b 0 :ERROR_DOWNLOAD_FAILED @echo Failed to download file from S3 @echo Most likely because endpoint cannot be reached or file %PACKAGE_NAME% doesn't exist @endlocal @exit /b 1
NVIDIA-Omniverse/kit-extension-sample-apiconnect/tools/packman/bootstrap/download_file_from_url.ps1
<# Copyright 2023 NVIDIA CORPORATION Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. #> param( [Parameter(Mandatory=$true)][string]$source=$null, [string]$output="out.exe" ) $filename = $output $triesLeft = 3 do { $triesLeft -= 1 try { Write-Host "Downloading from bootstrap.packman.nvidia.com ..." $wc = New-Object net.webclient $wc.Downloadfile($source, $fileName) $triesLeft = 0 } catch { Write-Host "Error downloading $source!" Write-Host $_.Exception|format-list -force } } while ($triesLeft -gt 0)
NVIDIA-Omniverse/kit-extension-sample-apiconnect/tools/packman/bootstrap/generate_temp_folder.ps1
<# Copyright 2023 NVIDIA CORPORATION Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. #> param( [Parameter(Mandatory=$true)][string]$parentPath=$null ) [string] $name = [System.Guid]::NewGuid() $out = Join-Path $parentPath $name New-Item -ItemType Directory -Path ($out) | Out-Null Write-Host $out # SIG # Begin signature block # MIIaVwYJKoZIhvcNAQcCoIIaSDCCGkQCAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG # KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCB29nsqMEu+VmSF # 7ckeVTPrEZ6hsXjOgPFlJm9ilgHUB6CCCiIwggTTMIIDu6ADAgECAhBi50XpIWUh # PJcfXEkK6hKlMA0GCSqGSIb3DQEBCwUAMIGEMQswCQYDVQQGEwJVUzEdMBsGA1UE # ChMUU3ltYW50ZWMgQ29ycG9yYXRpb24xHzAdBgNVBAsTFlN5bWFudGVjIFRydXN0 # IE5ldHdvcmsxNTAzBgNVBAMTLFN5bWFudGVjIENsYXNzIDMgU0hBMjU2IENvZGUg # U2lnbmluZyBDQSAtIEcyMB4XDTE4MDcwOTAwMDAwMFoXDTIxMDcwOTIzNTk1OVow # gYMxCzAJBgNVBA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aFB79rg6JswXoOTJhwICBP3hO2Ua3dMAswbfl+QNXF+igKLJPYnaeSVhBbm6 # VCu2io27t4ixqvoD0RuPObNX/P3oVA38afiM # SIG # End signature block
NVIDIA-Omniverse/kit-extension-sample-apiconnect/tools/packman/bootstrap/install_package.py
# Copyright 2023 NVIDIA CORPORATION # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import logging import zipfile import tempfile import sys import shutil __author__ = "hfannar" logging.basicConfig(level=logging.WARNING, format="%(message)s") logger = logging.getLogger("install_package") class TemporaryDirectory: def __init__(self): self.path = None def __enter__(self): self.path = tempfile.mkdtemp() return self.path def __exit__(self, type, value, traceback): # Remove temporary data created shutil.rmtree(self.path) def install_package(package_src_path, package_dst_path): with zipfile.ZipFile( package_src_path, allowZip64=True ) as zip_file, TemporaryDirectory() as temp_dir: zip_file.extractall(temp_dir) # Recursively copy (temp_dir will be automatically cleaned up on exit) try: # Recursive copy is needed because both package name and version folder could be missing in # target directory: shutil.copytree(temp_dir, package_dst_path) except OSError as exc: logger.warning( "Directory %s already present, packaged installation aborted" % package_dst_path ) else: logger.info("Package successfully installed to %s" % package_dst_path) install_package(sys.argv[1], sys.argv[2])