Move Until Contact
SUMMARY
Move Until Contact performs controlled motion along a direction until contact is detected.
This skill supports contact-sensitive tasks such as insertion, probing, alignment, and guarded approach operations.
SUPPORTED ROBOTS
This skill is currently supported on Universal Robots only.
The Skill
contacted = robot.move_until_contact(
cartesian_speed=[0, 0, -0.02, 0, 0, 0],
direction=[0, 0, 0, 0, 0, 0],
acceleration=0.1,
)The Code
Example 1: Move downward until contact with omnidirectional detection
Move the TCP downward at 0.02 m/s and stop on contact detected from any direction.
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()
robot.connect(ip=robot_ip)
contacted = robot.move_until_contact(
cartesian_speed=[0, 0, -0.02, 0, 0, 0],
direction=[0, 0, 0, 0, 0, 0],
acceleration=0.1,
)
if contacted:
logger.info("Contact detected — robot stopped.")
robot.disconnect()Example 2: Move downward until contact with directional detection
Restrict contact detection to the Z axis by setting the direction vector to match the approach direction.
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()
robot.connect(ip=robot_ip)
contacted = robot.move_until_contact(
cartesian_speed=[0, 0, -0.02, 0, 0, 0],
direction=[0, 0, -1, 0, 0, 0],
acceleration=0.1,
)
if contacted:
logger.info("Contact detected along Z — robot stopped.")
robot.disconnect()The Explanation of the Code
move_until_contact moves the TCP linearly at the commanded cartesian_speed until the controller detects a contact force. The call blocks until contact is detected and returns True. If no contact occurs and the move is aborted (e.g. joint limit reached), False is returned.
Cartesian speed. cartesian_speed is a 6D vector [xd, yd, zd, rxd, ryd, rzd] specifying the desired TCP velocity. Position components are in m/s; rotational components are in deg/s. Set unused components to zero to constrain the approach to the intended direction.
Contact direction. direction is a 6D vector defining which directions trigger a contact stop, expressed in the robot base frame. Setting all elements to zero detects contacts from any direction. Setting a specific axis (e.g. [0, 0, -1, 0, 0, 0]) restricts detection to that axis only — useful when the approach path runs close to a surface that should not trigger a stop.
Acceleration. acceleration is the TCP acceleration in m/s². Keep it low (e.g. 0.1) for delicate contact tasks to avoid large impact forces on touchdown.
Return value. The method returns True if contact was detected and False otherwise. Always check the return value before proceeding with post-contact operations.
How to Tune the Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
cartesian_speed | list[float] or np.ndarray | — | Desired TCP velocity [xd, yd, zd, rxd, ryd, rzd]. Position in m/s; rotation in deg/s. |
direction | list[float] or np.ndarray | — | Contact detection direction [x, y, z, rx, ry, rz] in the base frame. All zeros detects contact from any direction. |
acceleration | float | 1.4 | TCP acceleration in m/s². |
Approach speed
Use low approach speeds (0.01–0.05 m/s) for precision contact tasks such as part insertion or surface probing to minimise impact force on contact.
WARNING
move_until_contact raises a RuntimeError if the robot is not connected or if the RTDE command fails. Always call connect before use and wrap calls in a try/except block in production code.
Where to Use the Skill
- Surface probing — Detect the surface of a workpiece by moving the TCP toward it at low speed
- Guarded approach — Approach a target position and stop safely when an obstacle is encountered
- Part insertion — Drive a part into a socket or fixture and stop when the part seats
- Calibration — Touch known reference surfaces to determine their position in the robot frame
When Not to Use the Skill
Do not use Move Until Contact when:
- Continuous force control is required after contact — use Move in Force Mode to apply and regulate force once contact is established
- The approach path involves obstacles — this skill moves linearly without collision awareness; plan a clear approach path upstream
- High-speed approach is needed — fast impacts generate large contact forces; use trajectory planning with controlled deceleration instead

