robot_designer_plugin.export.urdf.generic.urdf_tree module

Module for importing robots specified in the URDF file format.

class robot_designer_plugin.export.urdf.generic.urdf_tree.URDFTree(connected_joints, connected_links, robot=None)[source]

Bases: object

A class that parses and represents a robot described by a URDF file. The data is stored in a tree of linked instances of this class. Therefore, a root element (or several) has to be detectable in the file excluding closed kinematic loops at the moment. Each instance represents a blender/RobotDesigner bone that is a compound of joint and link. It uses a document object model (DOM) created by generateDS.py (in version 2.14a – the newest that does not depend on the lxml module, which is not included in blender).

add()[source]

Creates and adds another URDFTree instance to this node. Do not add children to the subtree manually as references are not created then. Note that if there is no robot member defined yet (i.e., you are exporting), it will be created automatically. :param link: a urdf_dom link element :param joint: a urdf_dom joint element :return: a reference to the newly created URDFTree instance.

add_collisionmodel(file_name, scale_factor=(1.0, 1.0, 1.0))[source]

Add a collision model to a mesh object

Parameters

file_name (string) – name of the mesh object for which the col_model is generated

Returns

string: Collision file that is used in the urdf

add_inertial()[source]

Add a inertial definition to a link object

Returns

string: reference to inertial object

add_joint_control_plugin()[source]

Adds a reference to the generic control plugin of the NRP backend.

Returns

Reference to the plugin type defined in the URDF

add_joint_controller(control_plugin)[source]

Add a controller definition to a robot object

Returns

string: reference to inertial object

add_mesh(file_name, scale_factor=(1.0, 1.0, 1.0))[source]

Adds a mesh to current segment.

Parameters

file_name (string) – Name of the file

Returns

build(link, joint=None, depth=0)[source]

Recursive function that builds up the tree representation of the robot. You do not have to call it manually ( Called by parse). :param link: The link the kinematics subtree starts with :param joint: The joint connecting to the previous link (if any)

static create_empty(name, base_link_name='base_link')[source]

Creates an empty tree object.

Parameters

name (string) – the name of the robot the tree is representing the model of.

Returns

The tree instance.

static parse(file_name)[source]

Parses a URDF file and builds up a tree representing the kinematic structure of a robot. Explanation: The URDF file format stores links (i.e., rigid bodies) and joints (i.e., connection between links) in a flat structure (as opposed to a tree data structure). Links have no references while joints refer to the NAMES of have exactly one parent (link) and child (link). This method first resolves these cross references and calls the recursive URDFTree.build() method to create a tree-like data structure representing the kinematic tree(s) of the robot. :param file_name: the name of the file to open

set_defaults()[source]

Adds defaults to missing values.

show(depth=0)[source]

Prints the kinematic tree to the command line (for debugging). This function serves as an example for export export. :param depth: the depth of the kinematics sub tree for indention

write(file_name)[source]

Should only be called on the root element. :param file_name: :return:

robot_designer_plugin.export.urdf.generic.urdf_tree.set_value(l)[source]

helper function that creates a string out of a list of floats :param l: python list of floats :return: string representing the list