OrientationConstraint
- class compas_fab.robots.OrientationConstraint(link_name, quaternion, tolerances=None, weight=1.0)[source]
Bases:
compas_fab.robots.constraints.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
offloat
) – The desired orientation of the link specified by a quaternion in the order of[w, x, y, z]
.tolerances (
list
offloat
, 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 to1
.
- Attributes
link_name (
str
) – The name of the link this contraint refers to.quaternion (
list
offloat
) – The desired orientation of the link specified by a quaternion in the order of[w, x, y, z]
.tolerances (
list
offloat
) – 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
__init__
(link_name, quaternion[, …])Initialize self.
copy
()Create a copy of this
OrientationConstraint
.scale
(scale_factor)Scale the
Constraint
.scaled
(scale_factor)Get a scaled copy of this
Constraint
.transform
(transformation)Transform the volume using a
compas.geometry.Transformation
.Attributes
CONSTRAINT_TYPES
List of possible constraint types.
JOINT
Joint constraint type.
ORIENTATION
Orientational constraint type.
POSITION
Positional constraint type.