Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Difficulties loading custom URDF file with URDF importer

Discussion in 'Robotics' started by matteomaggi, Sep 20, 2023.

  1. matteomaggi

    matteomaggi

    Joined:
    Sep 20, 2023
    Posts:
    2
    Hello, I am sorry if this is not the right place to ask for help about this.

    I am trying to import a custom URDF robot description that has been modeled in and exported from SolidWorks.

    Everything works fine, I open package manager, add package URDF importer from github link, create the directory with the .urdf description and all the files needed.

    It seems to be having a problem with the 9th link out of ten, beacause if I go into the description and remove the last two links the import is completed succesfully.

    When i try and import the full 10 links robot, I get this error message:

    NullReferenceException: Object reference not set to an instance of an object
    MeshProcess.VHACD.GenerateConvexMeshes (UnityEngine.Mesh mesh) (at ./Library/PackageCache/com.unity.robotics.urdf-importer@90f353e435/Runtime/VHACD/VHACD.cs:143)
    Unity.Robotics.UrdfImporter.UrdfGeometryCollision.ConvertMeshToColliders (UnityEngine.GameObject gameObject, System.String location, System.Boolean setConvex) (at ./Library/PackageCache/com.unity.robotics.urdf-importer@90f353e435/Runtime/Extensions/UrdfGeometryCollision.cs:208)
    Unity.Robotics.UrdfImporter.UrdfGeometryCollision.CreateMeshCollider (Unity.Robotics.UrdfImporter.Link+Geometry+Mesh mesh) (at ./Library/PackageCache/com.unity.robotics.urdf-importer@90f353e435/Runtime/Extensions/UrdfGeometryCollision.cs:80)
    Unity.Robotics.UrdfImporter.UrdfGeometryCollision.Create (UnityEngine.Transform parent, Unity.Robotics.UrdfImporter.GeometryTypes geometryType, Unity.Robotics.UrdfImporter.Link+Geometry geometry) (at ./Library/PackageCache/com.unity.robotics.urdf-importer@90f353e435/Runtime/Extensions/UrdfGeometryCollision.cs:48)
    Unity.Robotics.UrdfImporter.UrdfCollisionExtensions.Create (UnityEngine.Transform parent, Unity.Robotics.UrdfImporter.Link+Collision collision) (at ./Library/PackageCache/com.unity.robotics.urdf-importer@90f353e435/Runtime/Extensions/UrdfCollisionExtensions.cs:62)
    Unity.Robotics.UrdfImporter.UrdfCollisionsExtensions.Create (UnityEngine.Transform parent, System.Collections.Generic.List`1[T] collisions) (at ./Library/PackageCache/com.unity.robotics.urdf-importer@90f353e435/Runtime/Extensions/UrdfCollisionsExtensions.cs:36)
    Unity.Robotics.UrdfImporter.UrdfLinkExtensions.Create (UnityEngine.Transform parent, Unity.Robotics.UrdfImporter.Link link, Unity.Robotics.UrdfImporter.Joint joint) (at ./Library/PackageCache/com.unity.robotics.urdf-importer@90f353e435/Runtime/Extensions/UrdfLinkExtensions.cs:26)
    Unity.Robotics.UrdfImporter.UrdfRobotExtensions.ProcessJointStack (Unity.Robotics.UrdfImporter.UrdfRobotExtensions+ImportPipelineData im) (at ./Library/PackageCache/com.unity.robotics.urdf-importer@90f353e435/Runtime/Extensions/UrdfRobotExtensions.cs:132)
    Unity.Robotics.UrdfImporter.UrdfRobotExtensions+<Create>d__8.MoveNext () (at ./Library/PackageCache/com.unity.robotics.urdf-importer@90f353e435/Runtime/Extensions/UrdfRobotExtensions.cs:186)
    Unity.EditorCoroutines.Editor.EditorCoroutine+YieldProcessor.MoveNext (System.Collections.IEnumerator enumerator) (at ./Library/PackageCache/com.unity.editorcoroutines@1.0.0/Editor/EditorCoroutine.cs:80)
    Unity.EditorCoroutines.Editor.EditorCoroutine.ProcessIEnumeratorRecursive (System.Collections.IEnumerator enumerator) (at ./Library/PackageCache/com.unity.editorcoroutines@1.0.0/Editor/EditorCoroutine.cs:134)
    Unity.EditorCoroutines.Editor.EditorCoroutine.MoveNext () (at ./Library/PackageCache/com.unity.editorcoroutines@1.0.0/Editor/EditorCoroutine.cs:115)
    UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at <2e279d988b9d4542841de511fbfdf8c2>:0)


    Now, I tried googling, but I am no Unity expert by any means.
    Matter of fact I am a complete noob, and I need some help...

    I wuold love to also provide the .urdf description, but it does not have the correct extension to be uploaded...

    Thanks very much to whomever can even read this!!
     
  2. matteomaggi

    matteomaggi

    Joined:
    Sep 20, 2023
    Posts:
    2
    PS: Ill copy paste the .urdf description here. The 9th body it seems to have a problem with is actually called link_6 here.



    <?xml version="1.0" encoding="utf-8"?>
    <!-- This URDF was automatically created by SolidWorks to URDF Exporter! Originally created by Stephen Brawner (brawner@gmail.com)
    Commit Version: 1.6.0-4-g7f85cfe Build Version: 1.6.7995.38578
    For more information, please see http://wiki.ros.org/sw_urdf_exporter -->
    <robot
    name="Nozomi_quote_offset">
    <link
    name="base_link">
    <inertial>
    <origin
    xyz="-0.976952128822449 0.7141995368764 1.11307560450535"
    rpy="0 0 0" />
    <mass
    value="601.798257532047" />
    <inertia
    ixx="433.85257829397"
    ixy="-1.41911822463132E-12"
    ixz="3.26309364624037E-05"
    iyy="27.3995691362046"
    iyz="-9.99533788143174E-09"
    izz="408.569534646433" />
    </inertial>
    <visual>
    <origin
    xyz="0 0 0"
    rpy="0 0 0" />
    <geometry>
    <mesh
    filename="package://Nozomi_quote_offset/meshes/base_link.STL" />
    </geometry>
    <material
    name="">
    <color
    rgba="0.752941176470588 0.752941176470588 0.752941176470588 1" />
    </material>
    </visual>
    <collision>
    <origin
    xyz="0 0 0"
    rpy="0 0 0" />
    <geometry>
    <mesh
    filename="package://Nozomi_quote_offset/meshes/base_link.STL" />
    </geometry>
    </collision>
    </link>
    <link
    name="slitta_H">
    <inertial>
    <origin
    xyz="0.184537586416662 1.20347581028416 0.0897556003103572"
    rpy="0 0 0" />
    <mass
    value="214.230925955031" />
    <inertia
    ixx="24.7526535461065"
    ixy="0.063328498772229"
    ixz="-0.00293314915112602"
    iyy="10.7566512100351"
    iyz="0.652042463811459"
    izz="14.1843266755562" />
    </inertial>
    <visual>
    <origin
    xyz="0 0 0"
    rpy="0 0 0" />
    <geometry>
    <mesh
    filename="package://Nozomi_quote_offset/meshes/slitta_H.STL" />
    </geometry>
    <material
    name="">
    <color
    rgba="0.752941176470588 0.752941176470588 0.752941176470588 1" />
    </material>
    </visual>
    <collision>
    <origin
    xyz="0 0 0"
    rpy="0 0 0" />
    <geometry>
    <mesh
    filename="package://Nozomi_quote_offset/meshes/slitta_H.STL" />
    </geometry>
    </collision>
    </link>
    <joint
    name="J_H"
    type="prismatic">
    <origin
    xyz="-0.6955 -1.283 0"
    rpy="1.5708 0 3.1416" />
    <parent
    link="base_link" />
    <child
    link="slitta_H" />
    <axis
    xyz="0 0 1" />
    <limit
    lower="-0.01"
    upper="3.785"
    effort="0"
    velocity="0" />
    </joint>
    <link
    name="slitta_V">
    <inertial>
    <origin
    xyz="0.0103593874264156 0.0089169251174519 -0.596654298077633"
    rpy="0 0 0" />
    <mass
    value="571.324706800912" />
    <inertia
    ixx="119.885093993484"
    ixy="-0.0454910177417389"
    ixz="4.54537022145564"
    iyy="113.585661283791"
    iyz="-0.24268309190691"
    izz="14.0075223173848" />
    </inertial>
    <visual>
    <origin
    xyz="0 0 0"
    rpy="0 0 0" />
    <geometry>
    <mesh
    filename="package://Nozomi_quote_offset/meshes/slitta_V.STL" />
    </geometry>
    <material
    name="">
    <color
    rgba="0.752941176470588 0.752941176470588 0.752941176470588 1" />
    </material>
    </visual>
    <collision>
    <origin
    xyz="0 0 0"
    rpy="0 0 0" />
    <geometry>
    <mesh
    filename="package://Nozomi_quote_offset/meshes/slitta_V.STL" />
    </geometry>
    </collision>
    </link>
    <joint
    name="J_V"
    type="prismatic">
    <origin
    xyz="0 1.5448 0"
    rpy="-1.5708 0 3.1416" />
    <parent
    link="slitta_H" />
    <child
    link="slitta_V" />
    <axis
    xyz="0 0 1" />
    <limit
    lower="-0.01"
    upper="1.644"
    effort="0"
    velocity="0" />
    </joint>
    <link
    name="link_1">
    <inertial>
    <origin
    xyz="-0.0174895846138725 0.062691928315836 0.432688178189412"
    rpy="0 0 0" />
    <mass
    value="8.57625275376947" />
    <inertia
    ixx="0.0723841873510673"
    ixy="0.00724841070108022"
    ixz="0.00462058599134295"
    iyy="0.0768232701428901"
    iyz="-0.000988426497021779"
    izz="0.0820990671817108" />
    </inertial>
    <visual>
    <origin
    xyz="0 0 0"
    rpy="0 0 0" />
    <geometry>
    <mesh
    filename="package://Nozomi_quote_offset/meshes/link_1.STL" />
    </geometry>
    <material
    name="">
    <color
    rgba="0.792156862745098 0.819607843137255 0.933333333333333 1" />
    </material>
    </visual>
    <collision>
    <origin
    xyz="0 0 0"
    rpy="0 0 0" />
    <geometry>
    <mesh
    filename="package://Nozomi_quote_offset/meshes/link_1.STL" />
    </geometry>
    </collision>
    </link>
    <joint
    name="J_1"
    type="revolute">
    <origin
    xyz="0 0 -0.0022"
    rpy="1.5708 0 1.5708" />
    <parent
    link="slitta_V" />
    <child
    link="link_1" />
    <axis
    xyz="0 0 1" />
    <limit
    lower="-1.6581"
    upper="1.6581"
    effort="0"
    velocity="0" />
    </joint>
    <link
    name="link_2">
    <inertial>
    <origin
    xyz="-0.0371133750496422 -0.290222470229359 -0.155380070460717"
    rpy="0 0 0" />
    <mass
    value="8.21339476703731" />
    <inertia
    ixx="0.454383169539613"
    ixy="-0.00310499282180726"
    ixz="-0.00482683939475472"
    iyy="0.0253209955344897"
    iyz="0.00852418967741906"
    izz="0.458311726619391" />
    </inertial>
    <visual>
    <origin
    xyz="0 0 0"
    rpy="0 0 0" />
    <geometry>
    <mesh
    filename="package://Nozomi_quote_offset/meshes/link_2.STL" />
    </geometry>
    <material
    name="">
    <color
    rgba="0.792156862745098 0.819607843137255 0.933333333333333 1" />
    </material>
    </visual>
    <collision>
    <origin
    xyz="0 0 0"
    rpy="0 0 0" />
    <geometry>
    <mesh
    filename="package://Nozomi_quote_offset/meshes/link_2.STL" />
    </geometry>
    </collision>
    </link>
    <joint
    name="J_2"
    type="revolute">
    <origin
    xyz="0 0.075 0.45"
    rpy="-1.5708 0 1.5708" />
    <parent
    link="link_1" />
    <child
    link="link_2" />
    <axis
    xyz="0 0 1" />
    <limit
    lower="-1.2217"
    upper="2.5307"
    effort="0"
    velocity="0" />
    </joint>
    <link
    name="link_3">
    <inertial>
    <origin
    xyz="0.12433299869366 0.110069520285447 -0.035633280037588"
    rpy="0 0 0" />
    <mass
    value="9.66015183932132" />
    <inertia
    ixx="0.134941884847071"
    ixy="-0.0545798299472905"
    ixz="0.00473146810632039"
    iyy="0.11708506895608"
    iyz="-0.00301124639328535"
    izz="0.154293428015967" />
    </inertial>
    <visual>
    <origin
    xyz="0 0 0"
    rpy="0 0 0" />
    <geometry>
    <mesh
    filename="package://Nozomi_quote_offset/meshes/link_3.STL" />
    </geometry>
    <material
    name="">
    <color
    rgba="0.792156862745098 0.819607843137255 0.933333333333333 1" />
    </material>
    </visual>
    <collision>
    <origin
    xyz="0 0 0"
    rpy="0 0 0" />
    <geometry>
    <mesh
    filename="package://Nozomi_quote_offset/meshes/link_3.STL" />
    </geometry>
    </collision>
    </link>
    <joint
    name="J_3"
    type="revolute">
    <origin
    xyz="0 -0.64 0"
    rpy="3.1416 0 0" />
    <parent
    link="link_2" />
    <child
    link="link_3" />
    <axis
    xyz="0 0 1" />
    <limit
    lower="-3.1416"
    upper="4.6164"
    effort="0"
    velocity="0" />
    </joint>
    <link
    name="link_4">
    <inertial>
    <origin
    xyz="-0.00118684501490229 -0.0559576948697076 -0.441066411788744"
    rpy="0 0 0" />
    <mass
    value="4.60474552170887" />
    <inertia
    ixx="0.0823794599136239"
    ixy="-3.96367643761552E-05"
    ixz="0.000488708659543935"
    iyy="0.0796304696383372"
    iyz="-0.0101346372650177"
    izz="0.0125037270208908" />
    </inertial>
    <visual>
    <origin
    xyz="0 0 0"
    rpy="0 0 0" />
    <geometry>
    <mesh
    filename="package://Nozomi_quote_offset/meshes/link_4.STL" />
    </geometry>
    <material
    name="">
    <color
    rgba="0.250980392156863 0.250980392156863 0.250980392156863 1" />
    </material>
    </visual>
    <collision>
    <origin
    xyz="0 0 0"
    rpy="0 0 0" />
    <geometry>
    <mesh
    filename="package://Nozomi_quote_offset/meshes/link_4.STL" />
    </geometry>
    </collision>
    </link>
    <joint
    name="J_4"
    type="revolute">
    <origin
    xyz="0 0.195 0"
    rpy="-1.5708 0 1.5708" />
    <parent
    link="link_3" />
    <child
    link="link_4" />
    <axis
    xyz="0 0 1" />
    <limit
    lower="-3.3161"
    upper="3.3161"
    effort="0"
    velocity="0" />
    </joint>
    <link
    name="link_5">
    <inertial>
    <origin
    xyz="3.75982663994856E-05 0.0218413139484115 0.0214005788696183"
    rpy="0 0 0" />
    <mass
    value="0.367817761538396" />
    <inertia
    ixx="0.00071072131405397"
    ixy="-9.54741294395197E-10"
    ixz="9.42672321476497E-11"
    iyy="0.000671987345328899"
    iyz="0.000199207126746237"
    izz="0.000692589447298521" />
    </inertial>
    <visual>
    <origin
    xyz="0 0 0"
    rpy="0 0 0" />
    <geometry>
    <mesh
    filename="package://Nozomi_quote_offset/meshes/link_5.STL" />
    </geometry>
    <material
    name="">
    <color
    rgba="0.792156862745098 0.819607843137255 0.933333333333333 1" />
    </material>
    </visual>
    <collision>
    <origin
    xyz="0 0 0"
    rpy="0 0 0" />
    <geometry>
    <mesh
    filename="package://Nozomi_quote_offset/meshes/link_5.STL" />
    </geometry>
    </collision>
    </link>
    <joint
    name="J_5"
    type="revolute">
    <origin
    xyz="0 0 -0.7"
    rpy="-1.5708 0 3.1416" />
    <parent
    link="link_4" />
    <child
    link="link_5" />
    <axis
    xyz="0 0 1" />
    <limit
    lower="-3.1416"
    upper="3.1416"
    effort="0"
    velocity="0" />
    </joint>
    <link
    name="link_6">
    <inertial>
    <origin
    xyz="0.0110284292745101 -3.62484193550117E-07 0.188146170607963"
    rpy="0 0 0" />
    <mass
    value="5.8457794495402" />
    <inertia
    ixx="0.00635823231836702"
    ixy="5.01657022191537E-11"
    ixz="-0.000840940454321107"
    iyy="0.00719590645760103"
    iyz="-3.93680371518835E-08"
    izz="0.00441144081380384" />
    </inertial>
    <visual>
    <origin
    xyz="0 0 0"
    rpy="0 0 0" />
    <geometry>
    <mesh
    filename="package://Nozomi_quote_offset/meshes/link_6.STL" />
    </geometry>
    <material
    name="">
    <color
    rgba="0.752941176470588 0.752941176470588 0.752941176470588 1" />
    </material>
    </visual>
    <collision>
    <origin
    xyz="0 0 0"
    rpy="0 0 0" />
    <geometry>
    <mesh
    filename="package://Nozomi_quote_offset/meshes/link_6.STL" />
    </geometry>
    </collision>
    </link>
    <joint
    name="J_6"
    type="revolute">
    <origin
    xyz="0 0.075 0"
    rpy="-1.5708 0 0" />
    <parent
    link="link_5" />
    <child
    link="link_6" />
    <axis
    xyz="0 0 -1" />
    <limit
    lower="-4.7124"
    upper="4.7124"
    effort="0"
    velocity="0" />
    </joint>
    <link
    name="end_effector">
    <inertial>
    <origin
    xyz="1.39666056497845E-13 1.38222766565832E-13 -0.0050000000001833"
    rpy="0 0 0" />
    <mass
    value="0.000196349540849362" />
    <inertia
    ixx="1.94304233132181E-09"
    ixy="3.85491617408661E-33"
    ixz="-8.00538299394888E-22"
    iyy="1.94304233132181E-09"
    iyz="6.40157660994202E-21"
    izz="6.13592315154257E-10" />
    </inertial>
    <visual>
    <origin
    xyz="0 0 0"
    rpy="0 0 0" />
    <geometry>
    <mesh
    filename="package://Nozomi_quote_offset/meshes/end_effector.STL" />
    </geometry>
    <material
    name="">
    <color
    rgba="0.792156862745098 0.819607843137255 0.933333333333333 1" />
    </material>
    </visual>
    <collision>
    <origin
    xyz="0 0 0"
    rpy="0 0 0" />
    <geometry>
    <mesh
    filename="package://Nozomi_quote_offset/meshes/end_effector.STL" />
    </geometry>
    </collision>
    </link>
    <joint
    name="end_effector"
    type="fixed">
    <origin
    xyz="0.17633 0 0.44233"
    rpy="-0.7854 0 -1.5708" />
    <parent
    link="link_6" />
    <child
    link="end_effector" />
    <axis
    xyz="0 0 1" />
    </joint>
    </robot>
     
  3. mhmalmir

    mhmalmir

    Joined:
    Nov 28, 2019
    Posts:
    1
    Hello @matteomaggi ,

    Which Unity Editor version are you using?
    URDF importing with VHACD option goes wrong often in the latest versions.
    If you are sure that the URDF file is correct, I'd suggest to try downgrading your project to Unity 2020 versions.