RobotModel

class compas.robots.RobotModel(name, joints=[], links=[], materials=[], **kwargs)[source]

Bases: compas.base.Base

RobotModel is the root element of the model.

Instances of this class represent an entire robot as defined in an URDF structure.

In line with URDF limitations, only tree structures can be represented by this model, ruling out all parallel robots.

Attributes
  • name – Unique name of the robot.

  • joints – List of joint elements.

  • links – List of links of the robot.

  • materials – List of global materials.

  • root – Root link of the model.

  • attr – Non-standard attributes.

Methods

__init__(name[, joints, links, materials])

Initialize self.

add_joint(name, type, parent_link, child_link)

Adds a joint to the robot model.

add_link(name[, visual_meshes, …])

Adds a link to the robot model.

compute_transformations(joint_state[, link, …])

Recursive function to calculate the transformations of each joint.

find_children_joints(link)

Returns a list of all children joints of the link.

find_parent_joint(link)

Returns the parent joint of the link or None if not found.

forward_kinematics(joint_state[, link_name])

Calculate the robot’s forward kinematic.

from_data(data)

Construct the compas.robots.RobotModel from its data representation.

from_json(filepath)

Construct an object from serialised data contained in a JSON file.

from_urdf_file(file)

Construct a robot model from a URDF file model description.

from_urdf_string(text)

Construct a robot model from a URDF description as string.

get_base_link_name()

Returns the name of the base link.

get_configurable_joint_names()

Returns the configurable joint names.

get_configurable_joints()

Returns the configurable joints.

get_end_effector_link()

Returns the end effector link.

get_end_effector_link_name()

Returns the name of the end effector link.

get_joint_by_name(name)

Get a joint in a robot model matching by its name.

get_joint_types()

Returns the joint types of the configurable joints.

get_link_by_name(name)

Get a link in a robot model matching by its name.

iter_chain([start, end])

Iterator over the chain of all elements between a pair of start and end elements.

iter_joint_chain([link_start_name, …])

Iterator over the chain of joints between a pair of start and end links.

iter_joints()

Iterator over the joints that starts with the root link’s children joints.

iter_link_chain([link_start_name, link_end_name])

Iterator over the chain of links between a pair of start and end links.

iter_links()

Iterator over the links that starts with the root link.

load_geometry(*resource_loaders, **kwargs)

Load external geometry resources, such as meshes.

scale(factor[, link])

Scales the robot by factor (absolute).

to_data()

Returns the data dictionary that represents the RobotModel.

to_json(filepath)

Serialize the data representation of an object to a JSON file.

transformed_axes(joint_state)

Returns the transformed axes based on the joint_state.

transformed_frames(joint_state)

Returns the transformed frames based on the joint_state.

validate_data()

Validate the data of this object against its data schema (self.DATASCHEMA).

validate_json()

Validate the data loaded from a JSON representation of the data of this object against its data schema (self.DATASCHEMA).