Constraint-based robot knot tying