writenode
Description
generates an XML DOM node for the rigid body tree robot model specified in the xmlNode
= writenode(exporter
)urdfExporter
object exporter
.
specifies additional options using one or more name-value arguments in addition to the input
arguments in the previous syntax.xmlNode
= writenode(___,Name=Value
)
Examples
Generate and Modify Robot Details in XML DOM Node
This example shows how to load a robot as a rigidBodyTree
model and generate an XML DOM node from it. You also modify the robot details in the XML DOM node and write the modified details in the URDF file.
Load a rigidBodyTree
robot model. The rigidBodyTree
object contains kinematic and dynamic constraints and visual meshes for the specified robot geometry.
robotRBT = importrobot("iiwa7.urdf");
Create a URDF exporter object.
exporter = urdfExporter(robotRBT);
Get robot details in the XML DOM node.
node = exporter.writenode();
Get specific joint element from the robot element.
jn0 = node.getElementsByTagName(... "robot").item(0).getElementsByTagName(... "joint").item(0);
Add a mimic element to the specified joint element.
jn0.appendChild(node.createElement("mimic"));
Write the modified details in URDF file format.
writer = matlab.io.xml.dom.DOMWriter;
writeToFile(writer,node,"iiwa7.urdf")
Input Arguments
exporter
— URDF exporter
urdfExporter
object
URDF exporter specified as a urdfExporter
object.
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Example: xmlNode =
writenode(exporter,RobotName="abbIrb120")
RobotName
— Robot name attribute
"Robot"
(default) | string scalar | character vector
Robot name attribute corresponding to the robot name
tag in the
generated URDF file, specified as a string scalar or character vector. The function
returns as a valid robot model name such as "abbIrb120"
,
"abbIrb120T"
, "abbIrb1600"
.
Example: "abbIrb120"
Data Types: char
| string
AbsoluteTolerance
— Maximum permissible difference in exported values
sqrt(eps)
(default) | positive scalar
Maximum permissible difference in the values under tags in exported URDF,
specified as a positive scalar. The default value is sqrt(eps)
,
where eps
returns the distance from 1.0
to the
next largest double-precision number, which is equal to
2-52
. For more information, see
eps
.
Data Types: single
| double
Output Arguments
xmlNode
— XML DOM node
matlab.io.xml.dom.Document
object
XML DOM node, returned as a matlab.io.xml.dom.Document
object.
Version History
Introduced in R2023b
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)