Motion constraints reference

You can constrain the motion of your machine using the motion service’s built-in constraint options. Constraints are passed as arguments to the Move method.

The following constraints are available:

Linear constraint

The linear constraint (LinearConstraint) forces the path taken by component_name to stay within line_tolerance_mm of the straight line from the start to the goal. If line_tolerance_mm is 0, the default, the planner doesn’t check the path against the line. If orientation_tolerance_degs is set, the orientation along the path stays within that angle of the start or goal orientation, whichever is closer. This has the following sub-options:

Parameter NameTypeDefaultDescription
line_tolerance_mmfloat0Max linear deviation from straight-line between start and goal, in mm. Only checked when greater than 0, so 0 turns the check off.
orientation_tolerance_degsfloat0Max angular distance, in degrees, between the current orientation and the closer of the start or goal orientation. Only checked when greater than 0, so 0 turns the check off.

Example usage:

# Move a gripper with a linear constraint
moved = await motion.move(
    component_name=my_gripper,
    destination=PoseInFrame(
        reference_frame="my_frame",
        pose=goal_pose),
    world_state=worldState,
    constraints={
        Constraints(
            linear_constraint=[LinearConstraint(line_tolerance_mm=0.2)])
    },
    extra={})

You can find more information in the Python SDK Docs.

// Move a gripper with a linear constraint
myConstraints := &servicepb.Constraints{LinearConstraint: []*servicepb.LinearConstraint{&servicepb.LinearConstraint{}}}

moved := motionService.Move(
    context.Background(),
    myGripperResourceName,
    NewPoseInFrame("myFrame", myGoalPose),
    worldState,
    myConstraints,
    nil
    )

You can find more information in the Go SDK Docs.

Orientation constraint

The orientation constraint (OrientationConstraint) places a restriction on the orientation change during a motion, such that the orientation during the motion does not deviate from the direct rotation between start and goal by more than a set amount. The direct rotation is the shortest arc between the two orientations, also known as the Slerp path. This is similar to the orientation_tolerance_degs option in the linear constraint, but without any path restrictions, and with a tolerance that follows the whole arc instead of only the start and goal. If set to zero, any deviation from the direct rotation is rejected, so a movement with identical starting and ending orientations will hold that orientation throughout the movement. This differs from the linear constraint, where 0 turns the orientation check off.

Parameter NameTypeDefaultDescription
orientation_tolerance_degsfloat0Max angular distance, in degrees, between the current orientation and the direct rotation from the start orientation to the goal orientation. 0 rejects any deviation.
ignore_thetaboolfalseWhen true, deviation is measured between orientation vectors alone, disregarding rotation about the component’s own pointing axis. Use this for payloads symmetric about that axis (for example, an open container that spills when tipped but not when spun).

Example usage:

# Move a gripper with an orientation constraint
moved = await motion.move(
    component_name=my_gripper,
    destination=PoseInFrame(
        reference_frame="my_frame",
        pose=goal_pose),
    world_state=worldState,
    constraints=Constraints(orientation_constraint=[OrientationConstraint()]),
    extra={})

You can find more information in the Python SDK Docs.

// Move a gripper with an orientation constraint
myConstraints := &servicepb.Constraints{OrientationConstraint: []*servicepb.OrientationConstraint{&servicepb.OrientationConstraint{}}}

moved := motionService.Move(
    context.Background(),
    myGripperResourceName,
    NewPoseInFrame("myFrame", myGoalPose),
    worldState,
    myConstraints,
    nil
    )

You can find more information in the Go SDK Docs.

Next steps

Constraints are used in the following tutorials: