OrientationConstraint

class compas_fab.robots.OrientationConstraint(link_name, quaternion, tolerances=None, weight=1.0)[source]

Bases: Constraint

Constrains a link to be within a certain orientation.

Parameters
  • link_name (str) – The name of the link this contraint refers to.

  • quaternion (list of float) – The desired orientation of the link specified by a quaternion in the order of [w, x, y, z].

  • tolerances (list of float, optional) – Error tolerances ti 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].

  • weight (float, optional) – A weighting factor for this constraint. Denotes relative importance to other constraints. Closer to zero means less important. Defaults to 1.

Attributes
  • link_name (str) – The name of the link this contraint refers to.

  • quaternion (list of float) – The desired orientation of the link specified by a quaternion in the order of [w, x, y, z].

  • tolerances (list of float) – Error tolerances ti 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})\).

  • weight (float) – A weighting factor for this constraint. Denotes relative importance to other constraints. Closer to zero means less important.

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)

Methods

copy

Create a copy of this OrientationConstraint.

transform

Transform the volume using a compas.geometry.Transformation.

Inherited Methods

scale

Scale the Constraint.

scaled

Get a scaled copy of this Constraint.