Drake

The behavior of a simulation with contact will depend on three factors:
The three factors are interdependent; specific choices for one factor may require supporting changes in the other factors.
Issues:
Picking a good value for vₛ
In selecting a value for vₛ
, you must ask yourself the question, "When
two objects are ostensibly in stiction, how much slip am I willing to allow?" There are two opposing design issues in picking a value for vₛ
. On the one hand, small values of vₛ
make the problem numerically stiff during stiction. Stable integration then requires either very small step sizes when using an explicit integrator, or use of an implicit integrator. Implicit integration is under development but not yet available in Drake, so a small vₛ
will require small steps, or high accuracy for the errorcontrolled RK3. On the other hand, it should be picked to be appropriate for the scale of the problem. For example, a car simulation could allow a "large" value for vₛ
of 1 cm/s (1e2 m/s), but reasonable stiction for grasping a 10 cm box might require limiting residual slip to a mm/s or less, 1e3 or 1e4 m/s. Ultimately, picking the largest viable value will allow your simulation to run faster.
Picking values for the other contact parameters
The contact model provides five parameters:
k
in N/m,d
in s/m (1/velocity),μs
, unitless,μd
, unitless,vₛ
in m/s.In a compliant model, deformation (which appears as penetration of the undeformed geometry) is part of the stable equilibrium state. Imagine a box sitting on a half plane. The stable penetration depth will, in principle, be equal to the box's weight divided by the stiffness. Appropriate stiffness for a 1 kg box is not the same as for a 1000 kg car. (In fact, with a small stiffness, the car will pass right through the ground while attempting to find the equilibrium distance.) Stiffness is the most important parameter for capturing realistic deformation of softer materials. The parameter k
is used to capture both the surface material's inherent stiffness per unit area, and the area of contact. The dissipation d
is significant primarily for impacts, where there are rapid changes in deformation.
Simulation speed using an explicit integrator is likely to be most affected by k
and vₛ
. In cases where more penetration is acceptable, you can soften k
and get better performance in exchange for lessrealistic deformation. The total contact force at equilibrium is not very sensitive to k
since the penetration will be adjusted as necessary to achieve force balance. For stiction behavior, increasing the coefficients of friction to unrealistic levels seems counterintuitively to degrade the results. The previous note discusses the importance of vₛ
.
Global contact parameters
In its current incarnation, Drake does not support perobject mechanical material properties. That means whatever parameter values you select will be the same for all contacts in the world.
Surfaceonsurface contacts
Remember that the contact detection computation produces a single point to represent contact between two collision elements. If the contact is a surface instead of a point (such as one box lying on another), the contact point will not be temporally coherent. This will lead to instability artifacts which can only be addressed through smaller time steps.
An alternative is to represent the body's contact differently. For some shapes (e.g., boxes), we can introduce two sets of collision elements: discrete "points" at the corners, and a box capturing the volume (see block_for_pick_and_place.urdf
as an example). With this strategy, the contact "points" are actually smallradius spheres. The volumecapturing box should actually be inset from those spheres such that when the box is lying on a plane (such that the logical contact manifold would be a face), only the contact points make contact, providing reliable points of contact. However, for arbitrary configurations contact with the box will provide more general contact.
Contact samples
Because of weaknesses in the current implementation of contact detection and characterization, we get best numerical performance when explicitly enumerating contact points on a body (see previous issue). However, each of those contact points are processed without any knowledge of the others. Thus, for a fixed contact force between two objects, increasing the number of explicit contact points reduces the amount of penetration needed to generate that force. If you use this technique be sure to consider that each explicit point represents a fraction of the contact area, and adjust the pointcontact stiffness to reflect that.
Choice of integrator
Empirical evidence suggests that any integrator except ExplicitEulerIntegrator can work with this contact model. Generally, the RungeKutta2Integrator and SemiExplicitEulerIntegrator require similar time steps to produce equivalent behavior. Generally, for a vₛ
value of 1e2 m/s, a timestep on the order of 1e4 is required for both of these. The errorcontrolled RungeKutta3Integrator will choose very small steps and accuracy must be set tight enough to ensure stability. An implicit integrator is currently in development and should perform much better on stictiondominated problems such as manipulator grasping.