Skip to content

compas_robots.model ¤

Classes¤

Axis ¤

Axis(xyz: str = '1 0 0', **kwargs)

Representation of an axis or vector.

Parameters:

  • xyz (str, default: '1 0 0' ) –

    3D coordinates of the axis, specified as a string of three space-separated floats (e.g. "1 0 0"). The axis will be normalized to unit length if it is not the zero vector

  • kwargs

    Additional attributes to be stored in the axis.

Attributes:

  • x (float) –

    X coordinate.

  • y (float) –

    Y coordinate.

  • z (float) –

    Z coordinate.

  • attr (dict) –

    Additional axis attributes.

Attributes¤

vector property ¤
vector

Vector of the axis.

Functions¤

copy ¤
copy()

Create a copy of the axis instance.

transform ¤
transform(transformation: Transformation) -> None

Transform the axis in place.

Parameters:

  • transformation (Transformation) –

    The transformation used to transform the axis.

transformed ¤
transformed(transformation: Transformation) -> Vector

Return a transformed copy of the axis.

Parameters:

  • transformation (Transformation) –

    The transformation used to transform the axis.

Returns:

  • Vector

    The transformed axis.

BoxProxy ¤

BoxProxy(obj)

Proxy class that adds URDF functionality to an instance of Box.

This class is internal and not intended to be referenced externally.

Calibration ¤

Calibration(rising=0.0, falling=0.0, reference_position=0.0)

Reference positions of the joint, used to calibrate the absolute position.

CapsuleProxy ¤

CapsuleProxy(obj)

Proxy class that adds URDF functionality to an instance of Capsule.

This class is internal and not intended to be referenced externally.

ChildLink(link)

Describes a child relation between a joint and its child link.

Collision ¤

Collision(
    geometry: LinkGeometry,
    origin: Frame | None = None,
    name: str | None = None,
    **kwargs
)

Collidable description of a link.

Parameters:

  • geometry (LinkGeometry) –

    Shape of the collidable element.

  • origin (Frame | None, default: None ) –

    Reference frame of the collidable element with respect to the reference frame of the link.

  • name (str | None, default: None ) –

    Name of the collidable element.

  • kwargs

    Non-standard attributes.

Functions¤

from_primitive classmethod ¤
from_primitive(primitive: Shape, **kwargs) -> Collision

Create collision link from a primitive shape.

Parameters:

  • primitive (Shape) –

    A primitive shape.

  • **kwargs

    The keyword arguments (kwargs) collected in a dict. These allow using non-standard attributes absent in the URDF specification.

Returns:

  • Collision

    A collision description object.

CylinderProxy ¤

CylinderProxy(obj)

Proxy class that adds URDF functionality to an instance of Cylinder.

This class is internal and not intended to be referenced externally.

Dynamics ¤

Dynamics(damping=0.0, friction=0.0, **kwargs)

Physical properties of the joint used for simulation of dynamics.

Inertia ¤

Inertia(
    ixx: float = 0.0,
    ixy: float = 0.0,
    ixz: float = 0.0,
    iyy: float = 0.0,
    iyz: float = 0.0,
    izz: float = 0.0,
)

Rotational inertia matrix (3x3) represented in the inertia frame.

Since the rotational inertia matrix is symmetric, only 6 above-diagonal elements of this matrix are specified here, using the attributes ixx, ixy, ixz, iyy, iyz, izz.

Inertial ¤

Inertial(
    origin: Frame | None = None,
    mass: Mass | None = None,
    inertia: Inertia | None = None,
)

Inertial properties of a link.

Parameters:

  • origin (Frame | None, default: None ) –

    This is the pose of the inertial reference frame, relative to the link reference frame.

  • mass (Mass | None, default: None ) –

    Mass of the link.

  • inertia (Inertia | None, default: None ) –

    3x3 rotational inertia matrix, represented in the inertia frame.

Joint ¤

Joint(
    name: str,
    type: str | int | JointType,
    parent: ParentLink | str,
    child: ChildLink | str,
    origin: Frame | None = None,
    axis: Axis | None = None,
    calibration: Calibration | None = None,
    dynamics: Dynamics | None = None,
    limit: Limit | None = None,
    safety_controller: SafetyController | None = None,
    mimic: Mimic | None = None,
    **kwargs
)

Representation of the kinematics and dynamics of a joint and its safety limits.

Parameters:

  • name (str) –

    Unique name for the joint.

  • type (str | int | JointType) –

    Joint type. May be supplied as a JointType member, a URDF type name (e.g. "revolute"), or its integer value. Stored as a JointType member.

  • origin (Frame | None, default: None ) –

    Frame defining the transformation from the parent link to the child link frame.

  • parent (ParentLink | str) –

    Parent link instance or parent link name.

  • child (ChildLink | str) –

    Child link instance or name of child link.

  • axis (Axis | None, default: None ) –

    Joint axis specified in the joint frame. Represents the axis of rotation for revolute joints, the axis of translation for prismatic joints, and the surface normal for planar joints. The axis is specified in the joint frame of reference.

  • calibration (Calibration | None, default: None ) –

    Reference positions of the joint, used to calibrate the absolute position of the joint.

  • dynamics (Dynamics | None, default: None ) –

    Physical properties of the joint. These values are used to specify modeling properties of the joint, particularly useful for simulation.

  • limit (Limit | None, default: None ) –

    Joint limit properties.

  • safety_controller (SafetyController | None, default: None ) –

    Safety controller properties.

  • mimic (Mimic | None, default: None ) –

    Used to specify that the defined joint mimics another existing joint.

  • kwargs (dict, default: {} ) –

    Non-standard attributes.

Attributes:

Attributes¤

current_transformation property ¤
current_transformation

Current transformation of the joint.

Functions¤

calculate_continuous_transformation ¤
calculate_continuous_transformation(position: float) -> Rotation

Returns a transformation of a continuous joint.

A continuous joint rotates about the axis and has no upper and lower limits.

Parameters:

  • position (float) –

    Angle in radians

Returns:

  • Rotation

    Transformation of type rotation for the continuous joint.

calculate_fixed_transformation ¤
calculate_fixed_transformation(position: float) -> Transformation

Returns an identity transformation.

The fixed joint is is not really a joint because it cannot move. All degrees of freedom are locked.

Returns:

calculate_floating_transformation ¤
calculate_floating_transformation(position: float) -> Transformation

Returns a transformation of a floating joint.

A floating joint allows motion for all 6 degrees of freedom.

calculate_planar_transformation ¤
calculate_planar_transformation(position: float) -> Transformation

Returns a transformation of a planar joint.

A planar joint allows motion in a plane perpendicular to the axis.

calculate_prismatic_transformation ¤
calculate_prismatic_transformation(position: float) -> Translation

Returns a transformation of a prismatic joint.

A prismatic joint slides along the axis and has a limited range specified by the upper and lower limits.

Parameters:

  • position (float) –

    Translation movement in meters.

Returns:

  • Transformation

    Transformation of type translation for the prismatic joint.

calculate_revolute_transformation ¤
calculate_revolute_transformation(position: float) -> Rotation

Returns a transformation of a revolute joint.

A revolute joint rotates about the axis and has a limited range specified by the upper and lower limits.

Parameters:

  • position (float) –

    Angle in radians.

Returns:

  • Transformation of type rotation for the revolute joint.
calculate_transformation ¤
calculate_transformation(position: float) -> Transformation

Returns the transformation of the joint.

This function calls different calculate_*_transformation depends on self.type

Parameters:

  • position (float) –

    Position in radians or meters depending on the joint type.

is_configurable ¤
is_configurable()

Returns True if the joint can be configured, otherwise False.

is_scalable ¤
is_scalable()

Returns True if the joint can be scaled, otherwise False.

scale ¤
scale(factor: float) -> None

Scale the joint origin and limit (only if scalable) by a given factor.

Parameters:

  • factor (float) –

    Scale factor.

transform ¤
transform(transformation: Transformation) -> None

Transform the joint in place.

Parameters:

  • transformation (Transformation) –

    The transformation used to transform the joint.

JointType ¤

Supported joint types as defined by URDF.

Members carry an integer value (used for storage and comparison) and a URDF-compatible string representation accessible via urdf_name. The enum can be constructed from either form:

Examples:

>>> JointType.REVOLUTE.urdf_name
'revolute'
>>> JointType.from_urdf("prismatic") is JointType.PRISMATIC
True
>>> JointType(0) is JointType.REVOLUTE
True

Attributes¤

urdf_name property ¤
urdf_name

The URDF-compatible string representation of the joint type.

Functions¤

from_urdf classmethod ¤
from_urdf(name: str) -> JointType

Return the JointType matching a URDF type name.

Parameters:

  • name (str) –

    URDF joint type name, e.g. "revolute".

Raises:

  • ValueError

    If name is not a known URDF joint type.

Limit ¤

Limit(
    effort: float = 0.0,
    velocity: float = 0.0,
    lower: float = 0.0,
    upper: float = 0.0,
    **kwargs
)

Joint limit properties.

Parameters:

  • effort (float, default: 0.0 ) –

    Maximum joint effort.

  • velocity (float, default: 0.0 ) –

    Maximum joint velocity.

  • lower (float, default: 0.0 ) –

    Lower joint limit (radians for revolute joints, meter for prismatic joints).

  • upper (float, default: 0.0 ) –

    Upper joint limit (radians for revolute joints, meter for prismatic joints).

Functions¤

scale ¤
scale(factor: float) -> None

Scale the upper and lower limits by a given factor.

Parameters:

  • factor (float) –

    Scale factor.

Link(
    name: str,
    type: str | None = None,
    visual: Iterable[Visual] | None = (),
    collision: Iterable[Collision] | None = (),
    inertial: Inertial | None = None,
    **kwargs
)

Link represented as a rigid body with an inertia, visual, and collision features.

Parameters:

  • name (str) –

    Name of the link itself.

  • type (str | None, default: None ) –

    Link type. Undocumented in URDF, but used by PR2.

  • visual (Iterable[Visual] | None, default: () ) –

    Visual properties of the link.

  • collision (Iterable[Collision] | None, default: () ) –

    Collision properties of the link. This can be different from the visual properties of a link.

  • inertial (Inertial | None, default: None ) –

    Inertial properties of the link.

  • kwargs

    Non-standard attributes.

LinkGeometry ¤

LinkGeometry(
    box: Box | None = None,
    cylinder: Cylinder | None = None,
    sphere: Sphere | None = None,
    capsule: Capsule | None = None,
    mesh: MeshDescriptor | None = None,
    **kwargs
)

Geometrical description of the shape of a link.

Parameters:

  • box (Box | None, default: None ) –

    A box shape primitive.

  • cylinder (Cylinder | None, default: None ) –

    A cylinder shape primitive.

  • sphere (Sphere | None, default: None ) –

    A sphere shape primitive.

  • capsule (Capsule | None, default: None ) –

    A capsule shape primitive.

  • mesh (MeshDescriptor | None, default: None ) –

    A descriptor of a mesh.

  • **kwargs

    The keyword arguments (kwargs) collected in a dict. These allow using non-standard attributes absent in the URDF specification.

Attributes:

  • shape (object) –

    The shape of the geometry

  • attr (keyword arguments) –

    Additional attributes

Examples:

>>> box = compas.geometry.Box(1)
>>> geo = LinkGeometry(box=box)

Mass ¤

Mass(value)

Represents a value of mass usually related to a link.

Material ¤

Material(
    name: str | None = None, color: Color | None = None, texture: Texture | None = None
)

Material description.

Parameters:

  • name (str | None, default: None ) –

    The name of the material.

  • color (Color | None, default: None ) –

    The color of the material.

  • texture (Texture | None, default: None ) –

    The filename of the texture.

Examples:

>>> c = Color(1, 0, 0)
>>> material = Material("wood", c)
>>> material = Material("aqua")
>>> color = material.get_color()
>>> print(color)
Color(red=0.0, green=1.0, blue=1.0, alpha=1.0)

Functions¤

get_color ¤
get_color() -> Color | None

Get the RGBA color array of the material.

Returns:

  • Color of the material.

Examples:

>>> material = Material("aqua")
>>> color = material.get_color()
>>> print(color)
Color(red=0.0, green=1.0, blue=1.0, alpha=1.0)

MeshDescriptor ¤

MeshDescriptor(filename: str, scale: str = '1.0 1.0 1.0', **kwargs)

Description of a mesh.

Parameters:

  • filename (str) –

    The mesh' filename.

  • scale (str, default: '1.0 1.0 1.0' ) –

    The scale factors of the mesh in the x-, y-, and z-direction.

  • **kwargs

    The keyword arguments (kwargs) collected in a dict. These allow using non-standard attributes absent in the URDF specification.

Attributes:

  • filename (str) –

    The mesh' filename.

  • scale ([float, float, float]) –

    The scale factors of the mesh in the x-, y-, and z-direction.

  • meshes (list[[Mesh]]) –

    List of COMPAS geometric meshes.

Examples:

>>> m = MeshDescriptor("link.stl")

Mimic ¤

Mimic(joint, multiplier=1.0, offset=0.0)

Description of joint mimic.

ParentLink(link)

Describes a parent relation between a joint its parent link.

SafetyController ¤

SafetyController(
    k_velocity, k_position=0.0, soft_lower_limit=0.0, soft_upper_limit=0.0
)

Safety controller properties.

SphereProxy ¤

SphereProxy(obj)

Proxy class that adds URDF functionality to an instance of Sphere.

This class is internal and not intended to be referenced externally.

Texture ¤

Texture(filename: str)

Texture description.

Parameters:

  • filename (str) –

    The filename of the texture.

Attributes:

  • filename (str) –

    The filename of the texture.

Examples:

>>> t = Texture("wood.jpg")

Visual ¤

Visual(
    geometry: LinkGeometry,
    origin: Frame | None = None,
    name: str | None = None,
    material: Material | None = None,
    **kwargs
)

Visual description of a link.

Parameters:

  • geometry (LinkGeometry) –

    Shape of the visual element.

  • origin (Frame | None, default: None ) –

    Reference frame of the visual element with respect to the reference frame of the link.

  • name (str | None, default: None ) –

    Name of the visual element.

  • material (Material | None, default: None ) –

    Material of the visual element.

  • kwargs

    Non-standard attributes.

Functions¤

from_primitive classmethod ¤
from_primitive(primitive: Shape, **kwargs) -> Visual

Create visual link from a primitive shape.

Parameters:

  • primitive (Shape) –

    A primitive shape.

  • **kwargs

    The keyword arguments (kwargs) collected in a dict. These allow using non-standard attributes absent in the URDF specification.

Returns:

  • Visual

    A visual description object.

get_color ¤
get_color() -> Color | None

Get the RGBA color array assigned to the link.

Only if the link has a material assigned.

Returns:

  • Color | None

    If the link has a material assigned, return its color.