OrientationConstraint

class compas_fab.robots.OrientationConstraint[source]

Bases: Constraint

Constrains a link to be within a certain orientation.

Parameters:
link_namestr

The name of the link this contraint refers to.

quaternionlist of float

The desired orientation of the link specified by a quaternion in the order of [w, x, y, z].

toleranceslist of float, optional

Error tolerances \(t_{i}\) for each of the frame’s axes. If only one value is passed it will be used for all 3 axes. The respective bound to be achieved is \((a_{i} - t_{i}, a_{i} + t_{i})\). Defaults to [0.01, 0.01, 0.01].

weightfloat, optional

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

Notes

The rotation tolerance for an axis is defined by the other vector component values for rotation around corresponding axis.

If you specify the tolerance vector with [0.01, 0.01, 6.3], it means that the frame’s x-axis and y-axis are allowed to rotate about the z-axis by an angle of 6.3 radians, whereas the z-axis can only change 0.01.

Examples

>>> from compas.geometry import Frame
>>> from compas_fab.robots import OrientationConstraint
>>> frame = Frame([1, 1, 1], [0.68, 0.68, 0.27], [-0.67, 0.73, -0.15])
>>> oc = OrientationConstraint("link_0", frame.quaternion)
Attributes:
link_namestr

The name of the link this contraint refers to.

quaternionlist of float

The desired orientation of the link specified by a quaternion in the order of [w, x, y, z].

toleranceslist of float

Error tolerances \(t_{i}\) for each of the frame’s axes. If only one value is passed it will be used for all 3 axes. The respective bound to be achieved is \((a_{i} - t_{i}, a_{i} + t_{i})\).

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 OrientationConstraint.

from_frame

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

transform

Transform the 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.

scale

Scale the Constraint.

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.