Contact

Declare the touching a move is allowed to do with contact() and only(), as a scope or for one move; everything not named stays collision-checked.

Every move is collision-checked: no part of the arm, its gripper or what it holds may come near anything else. Grasping, placing and pushing a lid all need the fingers to touch something. contact() is how a skill declares that touching. Everything it does not name stays fully checked.

As a scope or for one move

contact(arm, *targets, parts="fingers", floor=None, side_floor=None)

As a with block, the contact applies to every move of arm inside the block:

move_arm(ARM, grasp.preapproach(0.10))              # open the scope in free space
with contact(ARM, plate_id, source_id):              # the fingers may touch the plate and its stand
    move_arm(ARM, grasp, straight_line=True, tcp_speed=0.03)
    set_gripper(ARM, grasp.width)
    attach(ARM, plate_id, snap_anchor="grasp_short")
    move_relative(ARM, (0.0, 0.0, 0.10), tcp_speed=0.08)

As allow=, it applies to that one move:

move_arm(ARM, above, straight_line=True, tcp_speed=0.08, allow=contact(ARM, plate_id))

Open a scope at the pre-approach pose, in free space, so that the moves inside it are the ones that make contact. Scopes nest. While a scope is open, it also applies when the other arm moves: the arm in contact is held where it is and still checked.

Targets

TargetWhat may be touched
an object (id, name, SkillObject)the object, what sits in or on it, and what it sits on
an Anchorthe anchor's object and what sits in or on it
"table"a named support surface of the cell
only(obj)that object alone, not what sits on it or what it sits on
only(obj, "drawer")one link of an articulated object alone

An object target covers all of its links, a lid or a door included. Inside the scope, the simulator lets the fingers and the held plate pass through a closed lid that the real robot would hit. Before placing into or picking from something with a lid, read its joint and raise if it is not open:

if get_articulation(shaker_id)["lid_joint"] < 1.6:  # the shaker's open angle is 1.666 rad
    raise SkillError("the shaker lid is not open: open it first")

Parts

parts names which parts of the arm may touch the targets. One name or a tuple of several; where they overlap, the most permissive rule holds.

partsWhat may touch each target
"fingers" (default)the fingers and fingertips; the rest of the gripper may come within 5 mm; the held object may touch
"palm"the gripper body without its fingers
"gripper"the whole gripper
"held"the object the arm holds
"arm"the arm's links
"camera"the wrist camera
"stand"the wrist camera's mount
"side"as "fingers", and the arm's links, camera and mount may come within 5 mm (side_floor changes this)
a part nameone part of the arm by its name, such as "link2"

floor=f turns "may touch" into "may come within f metres": those parts are still checked, against a smaller clearance. With "fingers", the fingers and fingertips stay unchecked and floor applies to the rest of the gripper and the held object. A part name the arm does not have raises ValueError when a move uses the contact.

allow = contact(ARM, tool, parts="gripper")                     # a tool seated against the palm
allow = contact(ARM, block, parts="held", floor=0.002)          # the held plate may come 2 mm from a block

With no targets, contact(arm, parts=(a, b), floor=f) lets two or more parts of the same arm come close to each other (two links folded together).

An allow= value can be one contact(...) or a list of several.

Typical uses

  • Grasp: a scope on the object and what it stands on, from the pre-approach to the lift.
  • Place: a scope on the destination and the held object, around the descent and the release.
  • Retreat after release: the open fingers still touch the object they let go. Allow it on the retreat move, or keep the retreat inside the scope. Without it the move is refused before it starts with a message saying the arm starts in contact with the object.
  • Lids and doors: a scope on the instrument for the grasp, the arc and the release.

Did this page help you?