PositionConstraint.from_frame

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

Create a PositionConstraint from a frame on the group’s end-effector link. Only the position of the frame is considered for the constraint.

Parameters:
frame_WCFcompas.geometry.Frame

The frame from which we create position and orientation constraints.

tolerance_positionfloat

The allowed tolerance to the frame’s position (defined in the robot’s units).

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

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

Returns:
PositionConstraint

Examples

>>> robot = RobotLibrary.ur5()
>>> frame = Frame([0.4, 0.3, 0.4], [0, 1, 0], [0, 0, 1])
>>> tolerance_position = 0.001
>>> group = robot.main_group_name
>>> end_effector_link_name = robot.get_end_effector_link_name(group)
>>> PositionConstraint.from_frame(frame, tolerance_position, end_effector_link_name)                                 
PositionConstraint('tool0', BoundingVolume(2, Sphere(Point(0.400, 0.300, 0.400), 0.001)), 1.0)