Main Content

writenode

Generate XML DOM node for rigid body tree robot model

Since R2023b

Description

xmlNode = writenode(exporter) generates an XML DOM node for the rigid body tree robot model specified in the urdfExporter object exporter.

example

xmlNode = writenode(___,Name=Value) specifies additional options using one or more name-value arguments in addition to the input arguments in the previous syntax.

Examples

collapse all

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

collapse all

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")

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

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

collapse all

XML DOM node, returned as a matlab.io.xml.dom.Document object.

Version History

Introduced in R2023b

See Also

Objects

Functions