importrobot
Import rigid body tree model from URDF, Xacro, SDF file, text, or Simscape Multibody model
Syntax
Description
This function imports a robot model from a URDF file, Xacro file, SDF file,
robot description text, or a Simscape™
Multibody™ model as a rigidBodyTree
object.
Note
To load predefined, ready-to-use, robot models from the Robotics System Toolbox™ Robot Library, use the loadrobot
function.
URDF, Xacro, or SDF Import
returns a robot
= importrobot(filename
)rigidBodyTree
object by parsing
the Unified Robot Description Format (URDF), XML Macros (Xacro), or Simulation
Description Format (SDF) file specified by filename
.
specifies options using one or more name-value arguments in addition to any
combination of input arguments from previous syntaxes. For example,
robot
= importrobot(___,Name=Value
)importrobot("iiwa14.urdf",CollisionDecomposition=true)
imports a KUKA LBR iiwa 14 robot and decomposes the collision meshes of the
robot using voxelized hierarchical approximate convex decomposition
(V-HACD).
Use the URDF, Xacro, or SDF Import name-value argument to import a model from URDF, Xacro, or SDF file, or text.
Simscape Multibody Model Import
[
imports a Simscape
Multibody model and returns an equivalent robot
,importInfo
] = importrobot(model
)rigidBodyTree
object and
information about the import in importInfo
. Only fixed,
prismatic, revolute joints, and floating joints are supported in the output
rigidBodyTree
object.
[
specifies options using one or more name-value pair arguments in addition to the
Simscape
Multibody model from the previous syntax. Use the Simscape Multibody Model Import name-value pairs to
import a model that uses other joint types, constraint blocks, or variable
inertias.robot
,importInfo
] = importrobot(___,Name,Value
)
Examples
Input Arguments
Output Arguments
Limitations
importrobot
does not support importing robot models from URDF files that contain the mimic tag.
Tips
When importing a robot model with visual meshes, the importrobot
function searches for the .stl
or .dae
files to
assign to each rigid body using these rules:
The function searches the raw mesh path for a specified rigid body from the URDF, Xacro, or SDF file. References to ROS packages have the
package:\\<pkg_name>
removed.Absolute paths are checked directly with no modification.
Relative paths are checked using the following directories in order:
User-specified
MeshPath
Current folder
MATLAB® path
The folder containing the URDF, Xacro, or SDF file
One level above the folder containing the URDF, Xacro, or SDF file
The file name from the mesh path in the URDF, Xacro, or SDF file is appended to the
MeshPath
input argument.
If the mesh file is still not found, the parser ignores the mesh file and returns a
rigidBodyTree
object without
visual.
References
[1] Mammou, Khaled, et al. “Voxelized Hierarchical Approximate Convex Decomposition - V-HACD Version 4.” GitHub, October 24, 2022. https://github.com/kmammou/v-hacd.
Extended Capabilities
Version History
Introduced in R2017aSee Also
rigidBodyTree
| rigidBodyTreeImportInfo
| loadrobot
| vhacdOptions