PositionConstraint

class compas_fab.robots.PositionConstraint[source]

Bases: Constraint

Constrains a link to be within a certain bounding volume.

Parameters:
link_namestr

The name of the link this contraint refers to.

bounding_volumeBoundingVolume

The volume this constraint refers to.

weightfloat, optional

A weighting factor for this constraint. Denotes relative importance to other constraints. Closer to zero means less important. Defaults to 1.

Examples

>>> from compas.geometry import Sphere
>>> from compas_fab.robots import PositionConstraint
>>> from compas_fab.robots import BoundingVolume
>>> bv = BoundingVolume.from_sphere(Sphere(0.5, point=[3,4,5]))
>>> pc = PositionConstraint('link_0', bv, weight=1.)
Attributes:
link_namestr

The name of the link this contraint refers to.

bounding_volumeBoundingVolume

The volume this constraint refers to.

weightfloat

A weighting factor for this constraint. Denotes relative importance to other constraints. Closer to zero means less important.

Methods

copy

Create a copy of this PositionConstraint.

from_box

Create a PositionConstraint from a compas.geometry.Box.

from_frame

Create a PositionConstraint from a frame on the group's end-effector link.

from_mesh

Create a PositionConstraint from a compas.datastructures.Mesh.

from_point

Create a PositionConstraint from a point.

from_sphere

Create a PositionConstraint from a compas.geometry.Sphere.

scale

Scale the bounding_volume uniformely.

transform

Transform the bounding_volume using a compas.geometry.Transformation.

Inherited Methods

ToString

Converts the instance to a string.

from_json

Construct an object of this type from a JSON file.

from_jsonstring

Construct an object of this type from a JSON string.

scaled

Get a scaled copy of this Constraint.

sha256

Compute a hash of the data for comparison during version control using the sha256 algorithm.

to_json

Convert an object to its native data representation and save it to a JSON file.

to_jsonstring

Convert an object to its native data representation and save it to a JSON string.

validate_data

Validate the data against the object's data schema.