Start Contact Detection
SUMMARY
Start Contact Detection arms the robot controller's asynchronous contact detection. Once started, the controller monitors for unexpected contact during motion. Poll with Read Contact Detection to check whether contact has been detected, and call Stop Contact Detection to disarm and retrieve the final result.
This skill is typically paired with an asynchronous move command to allow motion to be interrupted on contact.
SUPPORTED ROBOTS
This skill is currently supported on Universal Robots only. Calling this method on other robot brands will raise a NotImplementedError.
The Skill
robot.start_contact_detection(direction=[])The Code
Example: Move and Detect Contact
Start an asynchronous Cartesian move, arm contact detection, poll for contact, then stop.
import time
from loguru import logger
from telekinesis.synapse.robots.manipulators import universal_robots
robot_ip = "192.168.1.2" # replace with your robot's IP
robot = universal_robots.UniversalRobotsUR10E()
# Connect
robot.connect(ip=robot_ip)
current = robot.get_cartesian_pose()
target = list(current)
target[2] += 0.05
robot.set_cartesian_pose(target, speed=0.05, acceleration=0.5, asynchronous=True)
robot.start_contact_detection()
logger.info("Contact detection started. Moving toward target...")
for _ in range(50):
if robot.read_contact_detection():
logger.info("Contact detected!")
break
time.sleep(0.05)
contact = robot.stop_contact_detection()
logger.success(f"Contact detected: {contact}")
# Disconnect
robot.disconnect()The Explanation of the Code
start_contact_detection arms the contact detection subsystem on the controller. The optional direction parameter constrains detection to a specific Cartesian direction (3-element vector [dx, dy, dz]); passing an empty list (default) enables detection in all directions. After calling this skill, use read_contact_detection in a polling loop to check for contact in real time, and stop_contact_detection to disarm and return the final boolean result.
How to Tune the Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
direction | list[float] | [] | Optional 3-element Cartesian direction [dx, dy, dz] to limit detection. Empty list enables omnidirectional detection. |
Return Value
| Type | Description |
|---|---|
bool | True if contact detection was successfully armed, False otherwise. |
Where to Use the Skill
- Assembly insertion — Detect the moment a part makes contact with a mating feature
- Surface probing — Stop motion when the TCP touches a surface
- Collision avoidance — React to unexpected contact during free-space moves
When Not to Use the Skill
Do not use Start Contact Detection when:
- You need force-torque data after contact — use Get Actual TCP Force to read wrench values
- The move is synchronous — contact detection is intended for use with asynchronous moves so the Python process can poll while motion continues

