Drake
Drake C++ Documentation
Contact Modeling in Drake

# Mechanics of Solids

All objects in real life are compliant and deform under the action of external loads. Deformations, as well as motion, of real life solids are well described by the theory of continuum mechanics, which provides a complete description of the full three-dimensional state of stress and deformation given a set of external loads and boundary conditions. Broadly, how compliant a solid is depends on the material (or materials) it is made of. Factors such as microstructure, imperfections, anisotropy, etc. affect the behavior of a material. Ultimately, in continuum mechanics, the behavior of a particular material can be boiled down to its stress-strain curve, or constitutive law describing the stress/strain relationship at each point within a solid composed of that material. The simplest constitutive law is that of Hooke's law, describing the behaviour of materials which exhibit a linear-elastic region in the stress-strain curve. Materials such as steel and aluminum can be modeled as Hookean, as long as strain is within the elastic range (< 1% strain for steel for example). Other materials such as rubber are hyperelastic and are best described by a Neo-Hookean law. The stiffness of a material essentially refers to how steep this stress-strain curve is. The steeper the slope of the stress-strain curve, the stiffer a material is. For Hookean materials, this translates to a larger Young's modulus (the slope of the stress-strain curve in the linear regime).

# Contact Mechanics

Contact mechanics refers to the study of the deformations that solids undergo as the result of contact loads. The study of contact mechanics dates back to the pioneering work of Heinrich Hertz in 1882. The Hertzian theory of contact describes the loads and deformations when strains are small, the contacting surfaces are much smaller than the overall dimensions of the contacting bodies and the materials are linear (i.e. are described by the Hookean law).

In general, when two solids come into contact, they inevitably must undergo deformation in order to avoid the physical impossibility of interpenetration. This constraint is described by the Signorini boundary condition, which at each point in the contact surface imposes a complementarity constraint between normal stress and penetration (described by a gap function). Stresses on the contact surface are the result of these deformations.

Ultimately, contact forces are the result of integrating these contact stresses on the contact surface between the solids.

# Rigid Approximation of Contact

A rigid body is an approximation to the general mechanics of solids in the mathematical limit to infinite stiffness. This mathematical approximation has been used extensively in the past for the simulation of multibody systems with contact. As an approximation to the real physical system, it leads to known problems such as indeterminate systems. Consider for instance a rigid beam supported by its two end points and by a third point of support right in the middle, through its center of gravity. Under the action of its own weight, infinite solutions to the static problem exist.

Rigid contact with Coulomb friction is a common approximation used in simulation as well. It has its own limitations, most notable the possible non-existence of a solution. An example of this is the well known Painlevé paradox [Pfeiffer & Glocker, 1996], a one degree of freedom system with only one contact that, depending on the state, has an infinite number of solutions or even no solution.

It should be noted that these artifacts are a consequence of the mathematical approximations adopted and not a flaw of the original continuum mechanics theory and even much less, a flaw in the physics itself.

# Why so Rigid? Embracing Compliance

The rigid modeling of contact coupled with Coulomb friction is plagued with a wide variety of technical issues:

• Even without friction, the system can be overconstrained and the contact forces are indeterminate.
• As described above, rigid contact coupled with Coulomb friction might lead to the Painlevé paradox, where the system has no solution or infinite solutions.
• Simulating these systems requires the formulation of Non-Linear Complementarity problems (NCPs). NCPs are believed to be NP-hard [Kaufman et al., 2008] (i.e. very difficult to deal with in practice) and are often very ill conditioned numerically, leading to brittle solutions in practical software.

The literature on this topic is very rich, and there has been a great deal of effort to solve many of these problems. Unfortunately, most solutions involve the introduction of heuristics or tuning parameters hidden within the solvers that introduce yet new artifacts or trading off robustness/speed for physical accuracy.

As an example, constraint softening is introduced "...to control the sponginess and springiness..." (quoting from the [ODE User Guide]). This strategy is used to improve the numerics of the solver, which no longer approximates a true rigid system, but a compliant one. Similarly, Interior Point (IP) methods for general NCPs or more recently Incremental Potential Contact (IPC) in [Li et al., 2020], introduce barrier functions to handle constraints. These barriers can only be solved to a finite accuracy, at which the solution is essentially compliant (even if stiff). This is discussed in more detail in [Castro et al., 2023].

## Compliance in Robotics

Many robots are actually compliant in the real hardware — robotic grippers and fingers are padded to improve grasping efficiency, and robot feet as those commonly found in quadrupeds and humanoid robots have rubber surfaces. Therefore, compliance must be modeled if our goal is physical accuracy to close the sim2real gap.

## Embracing Compliance

The discussion above can be probably summarized as follows:

1. The rigid approximation of contact leads to fundamental problems in the mathematics and ill-conditioned numerics in software.
2. Real physical systems are compliant, even if stiff.
3. Numerical techniques to deal with ill conditioning essentially boil down to introducing compliance at some level deep within the solver.

It is for these reasons that in Drake we embrace compliance, to provide accurate modeling of the physics of contact but also as a means to mitigate numerical problems associated with rigid approximations of contact. Within this framework, rigid contact can be approximated with very stiff compliance. As shown in [Castro et al., 2023] this technique is very effective even at very high stiffness values, beyond what it is really needed to model hard materials such as steel. In this way the modeling of contact is transparent to users, with physical parameters to control compliance and no need for hidden parameters in our solvers.

Read more about Drake's modeling of compliant contact in the next section, Modeling Compliant Contact.

Next topic: Modeling Compliant Contact

# References

• [Anitescu, 2006] Anitescu, M., 2006. Optimization-based simulation of nonsmooth rigid multibody dynamics. Mathematical Programming, 105, pp.113-143.
• [Castro et al., 2019] Castro, A.M., Qu, A., Kuppuswamy, N., Alspach, A. and Sherman, M., 2020. A transition-aware method for the simulation of compliant contact with regularized friction. IEEE Robotics and Automation Letters, 5(2), pp.1859-1866.
• [Castro et al., 2022] Castro, A.M., Permenter, F.N. and Han, X., 2022. An unconstrained convex formulation of compliant contact. IEEE Transactions on Robotics, 39(2), pp.1301-1320.
• [Castro et al., 2023] Castro, A., Han, X. and Masterjohn, J., 2023. A Theory of Irrotational Contact Fields. arXiv preprint https://arxiv.org/abs/2312.03908
• [Pfeiffer & Glocker, 1996] Pfeiffer, F., Glocker, C. (1996). Multibody Dynamics with Unilateral Contacts. Germany: Wiley.
• [Hunt and Crossley 1975] Hunt, K.H. and Crossley, F.R.E., 1975. Coefficient of restitution interpreted as damping in vibroimpact. Journal of Applied Mechanics, vol. 42, pp. 440–445.
• [Kaufman et al., 2008] Kaufman, D.M., Sueda, S., James, D.L. and Pai, D.K., 2008. Staggered projections for frictional contact in multibody systems. In ACM SIGGRAPH Asia 2008 papers (pp. 1-11).
• [Li et al., 2020] Li, M., Ferguson, Z., Schneider, T., Langlois, T.R., Zorin, D., Panozzo, D., Jiang, C. and Kaufman, D.M., 2020. Incremental potential contact: intersection-and inversion-free, large-deformation dynamics. ACM Trans. Graph., 39(4), p.49.
• [ODE User Guide] Smith, R., 2005. Open dynamics engine. https://ode.org/ode-latest-userguide.pdf
• [Todorov, 2014] Todorov, E., 2014, May. Convex and analytically-invertible dynamics with contacts and constraints: Theory and implementation in mujoco. In 2014 IEEE International Conference on Robotics and Automation (ICRA) (pp. 6054-6061). IEEE.

## Modules

Modeling Compliant Contact

Modeling of Dry Friction