Describe the bug
When loading a Revolute or Prismatic joint where the child link is missing <inertial> tags, a MissingComponentException exception is thrown.
To Reproduce
Steps to reproduce the behavior:
Load the example URDF below using URDF-Importer
The program crashes and a MissingComponentException is thrown: There is no 'ArticulationBody' attached to the "linkB" game object, but a script is trying to access it.
Uncommenting the <inertial> block loads the URDF correctly.
Console logs / stack traces
UnityEngine.MissingComponentException: There is no 'ArticulationBody' attached to the "linkB" game object, but a script is trying to access it.
You probably need to add a ArticulationBody to the game object "linkB". Or your script needs to check if the component is attached before using it.
at (wrapper managed-to-native) UnityEngine.ArticulationBody.set_jointType(UnityEngine.ArticulationBody,UnityEngine.ArticulationJointType)
at Unity.Robotics.UrdfImporter.UrdfJointRevolute.Create (UnityEngine.GameObject linkObject) [0x00012] in Library/PackageCache/com.unity.robotics.urdf-importer@9956ce5368/Runtime/UrdfComponents/UrdfJoints/UrdfJointRevolute.cs:28
at Unity.Robotics.UrdfImporter.UrdfJoint.AddCorrectJointType (UnityEngine.GameObject linkObject, Unity.Robotics.UrdfImporter.UrdfJoint+JointTypes jointType) [0x00034] in /Library/PackageCache/com.unity.robotics.urdf-importer@9956ce5368/Runtime/UrdfComponents/UrdfJoints/UrdfJoint.cs:113
at Unity.Robotics.UrdfImporter.UrdfJoint.Create (UnityEngine.GameObject linkObject, Unity.Robotics.UrdfImporter.UrdfJoint+JointTypes jointType, Unity.Robotics.UrdfImporter.Joint joint) [0x00000] in /Library/PackageCache/com.unity.robotics.urdf-importer@9956ce5368/Runtime/UrdfComponents/UrdfJoints/UrdfJoint.cs:89
at Unity.Robotics.UrdfImporter.UrdfLinkExtensions.ImportLinkData (Unity.Robotics.UrdfImporter.UrdfLink urdfLink, Unity.Robotics.UrdfImporter.Link link, Unity.Robotics.UrdfImporter.Joint joint) [0x0007a] in /Library/PackageCache/com.unity.robotics.urdf-importer@9956ce5368/Runtime/Extensions/UrdfLinkExtensions.cs:62
at Unity.Robotics.UrdfImporter.UrdfLinkExtensions.Create (UnityEngine.Transform parent, Unity.Robotics.UrdfImporter.Link link, Unity.Robotics.UrdfImporter.Joint joint) [0x00051] in Library/PackageCache/com.unity.robotics.urdf-importer@9956ce5368/Runtime/Extensions/UrdfLinkExtensions.cs:31
at Unity.Robotics.UrdfImporter.UrdfRobotExtensions.ProcessJointStack (Unity.Robotics.UrdfImporter.UrdfRobotExtensions+ImportPipelineData im) [0x00056] in Library/PackageCache/com.unity.robotics.urdf-importer@9956ce5368/Runtime/Extensions/UrdfRobotExtensions.cs:132
at Unity.Robotics.UrdfImporter.UrdfRobotExtensions.CreateRuntime (System.String filename, Unity.Robotics.UrdfImporter.ImportSettings settings) [0x00015] in Library/PackageCache/com.unity.robotics.urdf-importer@9956ce5368/Runtime/Extensions/UrdfRobotExtensions.cs:215
Expected behavior
IMO the program shouldn't crash. The joint could be ignored and not added to the structure, and thus not
controllable, since it misses <inertial> info for correct simulation. A warning about this should be logged.
The reason to not crash is that there are URDFs with joints that don't
need to be controlled directly: some parallel grippers contain joints
whose purpose is to be mimicked by other, physical joints. The
controlling joint doesn't need <inertial> info, only the mimic one.
This behaviour is similar to Gazebo, which also ignores links
without inertial info.
Describe the bug When loading a Revolute or Prismatic joint where the child link is missing
<inertial>
tags, aMissingComponentException
exception is thrown.To Reproduce Steps to reproduce the behavior:
MissingComponentException
is thrown:There is no 'ArticulationBody' attached to the "linkB" game object, but a script is trying to access it.
<inertial>
block loads the URDF correctly.Console logs / stack traces
Expected behavior IMO the program shouldn't crash. The joint could be ignored and not added to the structure, and thus not controllable, since it misses
<inertial>
info for correct simulation. A warning about this should be logged.The reason to not crash is that there are URDFs with joints that don't need to be controlled directly: some parallel grippers contain joints whose purpose is to be mimicked by other, physical joints. The controlling joint doesn't need
<inertial>
info, only the mimic one.This behaviour is similar to Gazebo, which also ignores links without inertial info.
Environment:
Example URDF