OrientationConstraint.from_frame

classmethod OrientationConstraint.from_frame(frame_WCF, tolerances_orientation, link_name, tool_coordinate_frame=None, weight=1.0)[source]

Create an OrientationConstraint from a frame on the group’s end-effector link. Only the orientation of the frame is considered for the constraint, expressed as a quaternion.

Parameters:
frame_WCF: :class:`compas.geometry.Frame`

The frame from which we create the orientation constraint.

tolerances_orientation: :obj:`list` of :obj:`float`

Error tolerances \(t_{i}\) for each of the frame’s axes in radians. If only one value is passed in the list it will be uses for all 3 axes.

link_namestr

The name of the end-effector link. Necessary for creating the position constraint.

tool_coordinate_framecompas.geometry.Frame, optional

The tool tip coordinate frame relative to the flange of the robot. If not specified, the target frame is relative to the robot’s flange.

weightfloat, optional

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

Returns:
OrientationConstraint
Raises:
ValueError

If tolerance axes given are not one or three values.

Notes

The rotation tolerance for an axis is defined by the other vector component values for rotation around corresponding axis. If you specify the tolerances_orientation 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 would only rotate by 0.01.

Examples

>>> robot = RobotLibrary.ur5()
>>> frame = Frame([0.4, 0.3, 0.4], [0, 1, 0], [0, 0, 1])
>>> tolerances_orientation = [math.radians(1)] * 3
>>> group = robot.main_group_name
>>> end_effector_link_name = robot.get_end_effector_link_name(group)
>>> OrientationConstraint.from_frame(frame, tolerances_orientation, end_effector_link_name)
OrientationConstraint('tool0', [0.5, 0.5, 0.5, 0.5], [0.017453292519943295, 0.017453292519943295, 0.017453292519943295], 1.0)