ToolModel
-
class
compas.robots.
ToolModel
(visual, frame_in_tool0_frame, collision=None, name='attached_tool', link_name=None)[source] Bases:
compas.robots.model.robot.RobotModel
Represents a tool to be attached to the robot’s flange.
- Attributes
visual (
compas.datastructures.Mesh
) – The visual mesh of the tool.frame (
compas.geometry.Frame
) – The frame of the tool in tool0 frame.collision (
compas.datastructures.Mesh
) – The collision mesh representation of the tool.name (
str
) – The name of the ToolModel. Defaults to ‘attached_tool’.link_name (
str
) – The name of the Link to which the tool is attached. Defaults toNone
.
Examples
>>> import compas >>> from compas.datastructures import Mesh >>> from compas.geometry import Frame >>> mesh = Mesh.from_stl(compas.get('cone.stl')) >>> frame = Frame([0.14, 0, 0], [0, 1, 0], [0, 0, 1]) >>> tool = ToolModel(mesh, frame)
Methods
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.
Check if geometry has been loaded.
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 a ToolModel from its data representation.
from_json
(filepath)Construct a ToolModel from the data contained in a JSON file.
from_robot_model
(robot, frame_in_tool0_frame)Creates a
ToolModel
from acompas.robots.RobotModel
instance.from_t0cf_to_tcf
(frames_t0cf)Converts frames at the robot’s flange (tool0 frame) to frames at the robot’s tool tip (tcf frame).
from_tcf_to_t0cf
(frames_tcf)Converts a list of frames at the robot’s tool tip (tcf frame) to frames at the robot’s flange (tool0 frame).
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.
Returns the name of the base link.
Returns the configurable joint names.
Returns the configurable joints.
Returns the end effector link.
Returns the name of the end effector link.
get_joint_by_name
(name)Get a joint in a robot model matching by its name.
Returns the joint types of the configurable joints.
get_joint_types_by_names
(names)Get a list of joint types given a list of joint names.
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.
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.
Iterator over the links that starts with the root link.
load_geometry
(*resource_loaders, **kwargs)Load external geometry resources, such as meshes.
Get a random configuration.
remove_joint
(name)Removes a joint to the robot model.
remove_link
(name)Removes a link to the robot model.
scale
(factor[, link])Scales the robot by factor (absolute).
to_data
()Returns the data dictionary that represents the
RobotModel
.to_json
(filepath)Serialise the data dictionary representing the tool to JSON and store in a file.
to_urdf_file
(file[, prettify])Construct a URDF file model description from a robot model.
to_urdf_string
([prettify])Construct a URDF string model description from a robot model.
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 the data of this object against its data schema (self.DATASCHEMA).
Validate the data loaded from a JSON representation of the data of this object against its data schema (self.DATASCHEMA).
Get the zero joint configuration.