{'fraction_non_alphanumeric': 0.03594388064529171, 'fraction_numerical': 0.010593134678364938, 'mean_word_length': 4.6521937842778796, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Contact Mode Guided Sampling-Based Planning for Quasistatic Dexterous Manipulation in 2D

The discontinuities and multi-modality introduced by contacts make manipulation planning challenging. Many previous works avoid this problem by pre-designing a set of high-level motion primitives like grasping and pushing. However, such motion primitives are often not adequate to describe dexterous manipulation motions. In this work, we propose a method for dexterous manipulation planning at a more primitive level. The key idea is to use contact modes to guide the search in a sampling-based planning framework. Our method can automatically generate contact transitions and motion trajectories under the quasistatic assumption. In the experiments, this method sometimes generates motions that are often pre-designed as motion primitives, as well as dexterous motions that are more task-specific.


I. INTRODUCTION
It is hard to estimate the set of manipulation skills used by humans or animals, and even harder to reproduce all of those skills. Byrne [1] documented 72 functionally distinct manipulation primitives used by foraging mountain gorillas. Nakamura [2] studied human grasping behaviors in grocery stores and noticed that existing taxonomies cannot categorize all the observed behaviors. Within robotics, many researchers have explored individual skills at depth, including pushing [3] [4], pivoting [5]- [7], tumbling [8], whole-body manipulation [9], extrinsic dexterity [10], grasping [11] [12], shared grasping [13], etc. Clearly, designing a high-quality robotic manipulation skill for a specific task takes significant human labor. When planning for robotic manipulation tasks, it is therefore desirable to find an approach that reduces the programming effort required and creates skills that generalize to many scenarios.
Manipulation tasks can be broken down into discrete and continuous parts. The discrete part is about the changes of contacts and their modes. For challenging manipulation problems, the planner will need to deal with the combinatorial explosion associated with making a sequence of discrete choices. Even if the sequence is known, the next challenge is to find a piecewise continuous trajectory which satisfies dynamic equations, force limits, and endpoint constraints for each piece of the sequence.
In this paper, we focus on quasistatic dexterous manipulation planning for robot/finger contact point motions in 2D (an This work was supported by the NSF Grant IIS-1909021. 1 The code is available at https://github.com/XianyiCheng/ Dexterous-Manipulation-Planning-2D. The supplementary video is available at https://youtu.be/2yYYLN3JAbs. example is shown in Figure 1), without pre-defined high-level motion primitives. To this end, we propose a sampling-based planner guided by contact modes. The guidance of contact modes is similar to the automatic generation of "motion primitives". This planner can generate solutions that cannot be found by a regular sampling-based planner, and are hard to describe as sequences of manually designed macro motion primitives. The core idea is to find all possible discrete modes through contact mode enumeration; utilizing contact mode constraints, we project randomly sampled configurations onto manifolds defined by contact modes and forward integrate towards the goal configuration on the lower-dimensional manifolds to allow efficient exploration over these continuous spaces. The contact mode guidance enables the discovery of solutions in the zero-volume manifolds in the C-space, which have zero possibility of being randomly sampled. The sampling-based nature of this method enables fast exploration over large continuous and discrete spaces to plan contact-rich motions. A random tree version of this planner is proved to be probabilistic complete in Section V-B. As a result, in Section VI, this planner shows the advantages of simplicity and speed -it requires little hand-tuning for different tasks in 2D and can generate complicated trajectories within seconds. This framework can also integrate a stability margin method [13] to pick robust motions for robot execution in Section VI-B.

II. RELATED WORK A. Dexterous Manipulation Planning
To reduce the complexity of planning through contacts, many works use predefined high-level motion primitives [14]- [18]. Often it becomes a Task and Motion Planning problem [15]. Efficient search and optimization algorithms have been developed to solve these motion sequencing/planning problems [15] [14]. Hierarchical planning [19] [16] is designed to reduce the search space by dividing the whole planning problem into sub-problems. Sampling-based planning methods like CBiRRT are developed to efficiently explore the manifolds by a variety of constraints [20] [18]. Most of the methods above require predefined states or primitives, which require extra engineering efforts given a new task or environment. Their solutions are also confined to be the combinatorics of predefined states/primitives. Contact formations [21] have been explored in [22] [23] [24] [19] to plan motions between two rigid bodies. This paper shares a similar idea with them: use contacts to decompose the search space into smaller chunks. Search and planning within contact formations are later combined into a complete solution.
If we consider each point contact as a robot instead of a finger tip, this work is also related to multi-robot/distributed manipulation [25]. The applications are mostly focused on planar manipulation. Multi-robot box-pushing [26], furniture moving [27], part reorienting [25], caging with obstacles [28], etc. have been explored in this area.
Our method can be seen as an extension of constrained sampling-based planning algorithm [18] [29]. Our method uses instantaneously enumerated contact modes to find and explore various lower-dimensional manifolds of the C-space, while a regular constrained sampling-based planner only exploits known constrained manifolds provided by the users. One can view our contact mode guidance as the automatic generation of "motion primitives".

B. Contact-rich Trajectory Optimization
Contact-Invariant Optimization methods [30] [31] produce complex whole-body and manipulation behaviors in simulation, assuming soft contacts which may violate physics laws. Dynamic manipulation planning for rigid bodies are explored in [32] [33] [34] [35]. They can plan simple manipulation actions with small numbers of contact transitions, such as pushing and pivoting. Trajectory optimization could be time-consuming and intractable without good initialization, especially when contact schedules are not specified [32], [35], [36]. To our best knowledge, there has not been any trajectory optimization method that can solve the tasks of a similar level of complexity presented in this paper.

III. PROBLEM DESCRIPTION
The inputs to our method are the start and goal configurations of the object, the geometries, and the properties of the object and the environment: 1) Object start configuration: q start ∈ SE(2). 2) Object goal: object goal configuration q goal ∈ SE (2) and the allowable goal region Q goal ⊂ SE(2). 3) Object properties: a rigid body O with known polygonal geometry (can be non-convex), and the friction coefficients between the object with environment µ env and the object with the manipulator µ mnp . 4) Environment: an environment E with known geometries. As it is 2D, the environment could either be in the horizontal plane, like a tabletop with friction, or in the vertical plane with gravity. , . . . , p mnp Nmnp ]. Our method outputs a trajectory π that moves the object from its start to goal. The trajectory is a sequence of object motions, contacts, and contact modes. The trajectory π includes: 1) Object motion: object configuration q(t) at step t.
2) Environment contacts: the set of contact points of the object with the environment. The number of environment contacts N env (t) at each step may vary. The kth environment contact is specified by its contact location p env k (t), contact normal n env k (t) and contact force λ env k (t). In practice, they are generated by the collision detection of the object and the environment.

MODEL
In this section, we introduce the contact mechanics and derive the motion generation method based on contact modes that are later used in our planning framework in Section V.

A. Contact Mode Constraints
Contact constraints are difficult to deal with due to the presence of multi-modality and discontinuities. The contact constraints can be modeled as complementarity constraints, and they are the main source of problems during contact implicit trajectory optimization (CITO). Assuming Coulomb's law, we break down the contact constraints into sets of linear equality and inequality constraints by enumerating all feasible contact modes of the system. Each feasible contact mode maps to a set of local dynamical equations for the system. In 2D, the set of kinematically feasible contact modes of n contacts can be defined as M ⊆ {fixed, right-slide, left-slide, separate} n by the relative motion of the object in the contact frames. All feasible 2D contact modes can be enumerated in O(n 2 ) [37].
By specifying the contact mode m ∈ M for a quasistatic system, we obtain linear constraints on object motions and contact forces. Velocity constraints: Contact velocities can be written as: where v o is the object velocity; G is the grasp map [38];q is the manipulator joint velocity and J is the manipulator's Jacobians; the 0 part is for environment contacts that have zero velocities. For point manipulator,q can be simply written as the point contact's translational velocity [ẋ 1 ,ẏ 1 , . . . ,ẋ n ,ẏ n ] and J is an identity matrix. For the ith contact, its contact mode m i indicates that its relative contact velocity v i c is constrained as: where v i c,n and v i c,t are v i c in contact normal and tangential directions respectively. Force constraints: Under Coulomb's friction law, the force constraints under a mode m i can be written as: and 3 for all the contacts, the velocity and force constraints can be written as linear equalities and inequalities: Given the desired contact mode and desired object velocity v d , we can find the closest feasible object velocity by solving a quadratic programming problem: where λ T λ is a regularization term on the contact forces. This optimization problem is subject to the contact mode constraints in Equation 4 and the static equilibrium constraints below: where v o is the object velocity; G and λ are the grasp map and contact forces for all contacts; F external include forces and torques that are not modeled in λ, such as gravity.

B. Projected Forward Integration
Starting from an object configuration, all reachable configurations under a contact mode form a manifold with boundary in the object configuration space. However, this manifold does not has explicit representation since the contact mode only provides linear velocity and force constraints (a) The gray solid block shows the start pose of the object with two blue manipulator contacts (both fixed) and two yellow environment contacts (contact mode: separate, left slide). In goal configuration 1, the block is 180 degree flipped (the dotted green block). Its closest configuration on the contact mode manifold is the solid light green block, as current mode is interrupted by new contact with the table. For goal configuration 2 (the dotted red block), its closest configuration is shown as the solid light red block.  for each point on the manifold, thus we cannot directly project a configuration onto this manifold. In this section, we describe an iterative method that finds the closest reachable configuration to a goal configuration on a contact mode manifold, as visualized in Figure 2.
Given a desired configuration q d , forward integration moves towards q d on the contact mode manifold by iteratively integrate v o computed in Equation 5 through the Euler method: where h is the length of the time-steps, T r is the rigid body transformation computed from the body velocity hv o k , applied on q k [38]. At each timestep, the desired velocity v d is computed as the body velocity between q k and q rand in the twist coordinate [38], and environment contacts are updated by collision checking. The forward integration stops when: (1) v o k is zero: q k is the closest configuration on the contact manifold to q d (2) No feasible v o k : the static equilibrium cannot be maintained anymore (3) Collision: the fingers collide with the environment, or new objectenvironment contacts are made. In the simulation, we use linear interpolation to go back to zero contact distances.

22:
return The following property states that this forward integration process is a projection operation. Property 1. The forward integration process described in Section IV-B is a projection operator P (·) to a manifold M which has the following properties: 1) P (q) = q if and only if q ∈ M 2) If q ∈ M is the closest point to q 1 / ∈ M, P (q 1 ) = q.

V. CONTACT MODE GUIDED SAMPLING BASED PLANNING
While the exploit of contact modes can be used in different planning frameworks, we adopt a rapidly exploring random tree (RRT) as the high-level planning framework (Algorithm 1). During the EXTEND process of RRT, our method project the randomly sampled object configuration onto the contact mode manifolds of its nearest node. This ensures random sampling on zero-volume manifolds in the C-space. As the proofs show in Section V-B, a random tree version of our method (Algorithm 2) is probabilistic complete.

A. Planning Framework
Our planner is presented in Algorithm 1. An object configuration q rand is drawn from the configuration space through SAMPLE-OBJECT-CONFIG function, where q rand has user defined possibility p of being a random sample and 1−p of being q goal . For q rand , its nearest neighbor q near in the tree T is found through a weighted SE(2) metric: where w r is the weight that indicates the importance of rotation in the tasks. Then the properties of node q near , previous finger contacts c mnp near and environment contacts c env near , are obtained from T . Function CONTACT-MODE-ENUMERATION enumerates all possible environment contact modes M for q near (manipulator contact modes are always fixed). Under each environment contact mode m ∈ M, the EXTEND function is performed. The EXTEND function projects the q rand onto the contact mode manifold through the forward integration process and switch the manipulator contacts if necessary. If EXTEND is successful, a new node q new and a new edge between q new and q near will be added to T . In the EXTEND function, we first check the feasibility of the motion towards q rand through function CLOSEST-FEASIBLE-VEL, by solving the quadratic programming problem in Equation 5. If there exists a non-zero solution, the motion is feasible and previous manipulator contacts can remain unchanged. If the motion is not feasible, or the finger contacts collide with the environment, CHANGE-MANIP-CONTACT tries to relocate a random number of manipulator contacts to randomly sampled collision-free contact locations. The relocation is successful if static equilibrium can still be maintained without the relocating finger contacts. The outputs are new manipulator contacts c mnp new . Finally, q new is computed by function FORWARD-INTEGRATE as described in Section IV-B.
Besides the main algorithm shown above, we can evaluate the robustness of a motion to force disturbance under the specified contact mode by the stability margin score in [13]. This stability margin can be used to filter out potentially unstable motions in the planning process -only a node with enough stability margin will be added to the tree. The plans for real robot experiments in Section VI-B are generated this way. It can also be used to select better manipulator contacts in CHANGE-MANIP-CONTACT.

B. Probabilistic Completeness
Let Q be the object configuration space, in our case Q ⊆ SE(2). We denote B d δ (q) as an open d-dimensional ball of radius δ centered at q ∈ R n . Let U be the parameter space of N finger contacts on the object surface. Definition 1. A quasistatic trajectory π : [0, t T ] → Q × U is with clearance δ so that: at every point π(t i ), there exists an open ball B di+N δ (π(t i )) on the Cartesian product of its d i -dimensional contact mode manifold Q mi and the manipulator contact set U , where static equilibrium of the object can be maintained.
We assume that there exists a trajectory π : [0, t T ] → Q × U with clearance δ. The trajectory begins at q start and terminates at q goal . The trajectory also captures discrete changes including adjacent contact mode transitions, contact encounters, and finger contact switches: there is a point on the trajectory at every discrete change. We prove that if such trajectory exists, a random tree framework shown in Algorithm 2 is probabilistic complete of finding it. Lemma 1. Suppose that RRT has reached π (t i ) ∈ B di+N δ (π(t i )), π (t i+1 ) ∈ B di+1+N δ (π(t i+1 )) under contact mode m i+1 has nonzero probability of being sampled.

Algorithm 2 Contact Mode Based Manipulation Random Tree Planner (probabilistic complete)
Input: qstart, q goal Output: tree T 1: T .add-node(qstart) 2: while (Goal region has not been reached) do 3: qr ← SAMPLE-OBJECT-CONFIG(q goal ) 4: for qn ∈ T do Iterate every node T .add-node(qnew) 14: T .add-edge(qn, qnew) 15: return T Proof.(Sketch) There are three possible situations for π(t i+1 ), we prove them all have nonzero sampling probability: (1)The contact state in π(t i+1 ) doesn't change. The set of contact modes M i = M i+1 . There is no manipulator contact switch. (2)There is a manipulator contact switch u i , u i+1 ∈ U , u i = u i+1 . (3)Only the contact state is changed M i = M i+1 (encounter new environment contacts).
Situation (1): As Algorithm 2 iterate every possible contact mode for every existing node, contact mode m i+1 will be visited with possibility 1. A random sample x rand is drawn and project onto the manifold for m i+1 through forward integration in IV-B. By Theorem 5 in [18], the projection sampling using a project operator with Property 1 covers the manifold, which means the probability to place a sample into B di+1+N δ (π(t i+1 )) is nonzero. Situation (2): Since static equilibrium will be maintained within clearance δ. The probability of the manipulator contacts to be resampled from to B N δ (u i+1 ) is nonzero. Situation (3): New environment contacts are encountered at the boundaries of the contact mode manifold. As described in Section IV-B, linear interpolation is perform to go back to the boundary when penetration happens. The linear interpolation is also a projection operator with Property 1. By Theorem 5 in [18], the probability to place a sample into B di+1+N δ (π(t i+1 )) is nonzero. Theorem 1. If there exist a trajectory satisfying Definition 1, the probability of Algorithm 2 to find a trajectory within its clearance is nonzero.
Proof. (Sketch) At t 0 , we have x 0 = x start and the initial manipulator contacts u 0 are randomly sampled in U (line 8, Algorithm 2). The probability of the initial sample to be within B 3+N δ (π(t 0 )) is nonzero (|B 2 δ |/|U|). By Lemma 1, there is nonzero probability of reach from B di+N δ (π(t i )) to B di+1+N δ (π(t i+1 )). By proof of induction, the probability of Algorithm 2 finding a solution is nonzero.

A. Experiment Validation
We test our planner on several 2D scenarios that need dexterous strategies. Figure 3 gives an overview of all scenarios. All scenarios are designed based on real-world manipulation applications and observations of human manipulation behaviors, to show that our planner has the potentials to address such problems, or automatically plan similar behaviors. Table  I provides the planning statistics for all the problems under 10 random runs performed on a personal computer with Intel Core i7-6560U 2.2GHz CPU. No parameter has been specifically tuned for any problem above. Our results show that this planner is suitable for a variety of 2D manipulation tasks. We visualize one representative solution of each problem in Figure 4. Please check our supplementary video for all solutions for the 10 random runs of each problem. Problem 1: Move and Pivot a Block. A two-point manipulator needs to move and pivot a heavy block that it cannot directly pick up. This planner consistently generates the strategies of first pushing and then pivoting the block. As summarized in Table I, it can get all solutions at around 0.3 seconds with a small number of total nodes explored. Problem 2: Pick up a Blade. The manipulator cannot contact the short edges of a blade-like object. A common strategy used by humans is to slide the object out of the edge of the table to expose its bottom surface for grasping. Our planner is able to consistently generate similar strategies shown in Figure 4(2) at about 2 seconds (Table I) Problem 3: Unpacking. The hardest part of picking up wellpacked objects is the first object. The small gaps prevent two fingers from picking up the first object directly. As shown in Figure 4(3), this method plans to push the object to create a wider gap that lets the fingers slide up the object from one side. Similar strategies have been observed in decluttering actions in human grasping [2]. Problem 4: Move a Block up to the Cliff. A single-point manipulator needs to take a block up to a cliff, as shown in Figure 3. Only given the start and goal object configuration, our planner successfully generates strategies of push on the floor, push along the cliff, and pivot under gravity. Problem 5: Manipulator's Obstacle Course. This problem shows our planner capability for planning over longer horizons. Due to force limits, the manipulator needs to get the object through a simple 'obstacle course' without picking it up. This planner can plan different strategies with many contact switches to get through the obstacles, by using the contacts with the environment. Problem 6: In-hand Manipulation for Non-Convex Object This is a simplified in-hand manipulation scenario to show that our method works for non-convex polytopic-shape objects and can generate plans that are not even intuitive to human. As shown in Figure 3, the blue rectangle is the palm, and the workspace of each fingertip is a half side of the hand. The goal is to flip the T-shape object 180 degrees with respect to the palm. The planned strategy is to use the palm as extra support to change finger locations. Due to The start configurations (green, "S") and the goal configurations (red, "G") for each test problems. Problem 1-6 are in the 2D gravity plane. Problem 7 is a planar manipulation problem.
(1)  the sampling-based planning nature, the redundant motion problem is obvious here. Trajectory optimization can be used to smoothen the motions as shown in the video. Problem 7: Narrow Passage for Planar Pushing Our method is also general enough for planar manipulation. The problem is to push the object through the narrow hallway with one contact. As shown in the video and Figure 4, our planner consistently generates the strategies of utilizing the environment contacts to move and reorient the object.

B. Robot Experiments
We validate our plans of Problem 4 and 5 on an ABB IRB-120 robot with a point-finger. The plans are generated by Algorithm 1 with a stability margin filter as describe in Section V-A. The plans are executed by a hybrid force velocity controller [13]. The experiments are presented in Figure 5 and in the supplementary video.

VII. CONCLUSION AND DISCUSSION
In this paper, we propose a contact mode guided samplingbased 2D manipulation planning framework which generates quasistatic motion trajectory and contact transitions. This method has the potentials to be used in hand manipulation where contact points are fingertips, and in multi-robot manipulation where contact points are mobile robots. One limitation of this method is that every motion needs to be quasistatic, which makes our algorithm fails to plan simple dynamic motions like releasing the fingers to drop the object. While quasi-dynamic or dynamic formulations may double the dimensions of the search space, one potential solution is to perform short periods of dynamic simulation between two quasi-static states under some special circumstances. This planner can also be augmented by local planners for fingertip placement and fingertip sliding. Moreover, the contact mode guidance can also be applied on other possibly more efficient constrained sampling-based planning frameworks [29].