The Simulink Ground-Contact Model
To support some degree of physical interaction between a rigid-body system and
its environment, Spatial_v2 provides a Simulink block to
calculate the forces acting on an identified set of points due to contact with
a compliant ground plane. This block is based around the
function gcontact. Three other
functions support the use of this
block: gcPosVel, which calculates the
positions and velocities of the identified set of
points; Fpt, which converts linear forces acting
at specified points into equivalent spatial or planar forces;
and gcFD, which converts the resulting matrix of
spatial or planar forces into the format required in the f_ext argument
of the forward-dynamics functions. The complete ground-contact model can
be found in Simulink tutorial example 7,
from where it can be copied and adapted.
The model works in both 2-D and 3-D Euclidean spaces, its behaviour being
essentially the same in both cases. In 2-D space, the ground plane is
defined to be the x axis; the y axis points up; and each point is identified
by its x and y coordinates. In 3-D space, the ground plane is defined to
be the x-y plane; the z axis points up; and each point is identified by its x,
y and z coordinates. You use the 2-D ground-contact model with any
system model based on planar arithmetic; and you use the 3-D ground-contact
model with any system model based on spatial arithmetic.
How the Model Works
The compliant ground model resembles the one described in Section 11.8
of RBDA, except that the model used here is
nonlinear. More particularly, the compliant ground model is closely
based on the model described
& Featherstone (2010), except that the model used here is for points
rather than spheres.
- Every point has a given position and velocity, and the purpose of the
ground model is to calculate the forces acting on the points.
- Each point is considered in isolation. The force acting on any one
point depends only on the motion of that one point.
- The ground is modelled as a massless, nonlinear spring-damper
system, with compliance in both the normal and tangent directions.
The normal compliance gives rise to a normal force, whereas the tangential
compliance gives rise to a tangential force that is subject to an upper
limit determined by the friction cone.
- Any point that is above the ground plane is not in contact with it, and
experiences no forces.
- Any point that is below the ground plane may or may not be in contact with
it, depending on its velocity. If such a point is travelling upwards
faster than the natural recovery rate of the ground then it experiences no
ground-reaction force and is deemed not to be in contact with the
- For this reason, each point is classified as being either in contact or
not in contact according to the forces acting on it: a point is in contact
if it experiences a nonzero force, otherwise it is not in contact.
- Each in-contact point can be further classified according to whether it
is sticking (due to friction) or not sticking
(i.e., slipping). Thus, every point is always in exactly one
of the following three states at any given instant: sticking, slipping, or
not in contact.
- The sticking status of an in-contact point is determined as follows.
First, the normal component of ground reaction force is calculated; then the
tangent component is calculated on the assumption that the point is
sticking. The result is then tested against the friction cone.
If the calculated tangent force falls outside the friction cone then it is
truncated to the surface of the friction cone and the point is classified as
slipping. Otherwise, the point is sticking.
- Simulink's zero-crossing detection facility is used to detect the
precise moment when any point changes its state.
How to Use it
Step 1: Identify the set of contact points.
You must first identify the set of points in your model that will experience
forces if they come into contact with the ground. We shall call
them ground-contact points. The number and distribution of
ground-contact points will depend on circumstances. For example, if you
want to study bipedal walking in a humanoid with rectangular feet, then eight
points will probably be enough: one at each corner of each foot. On the
other hand, if you want to investigate the unrestricted rolling behaviour of a
polyhedral approximation to a disc (as in Simulink tutorial example 7), then
every vertex of the polyhedron must be included in the set. Each
ground-contact point is characterized by two quantities: the body
number of the body to which it belongs, and its coordinates in the
local coordinate system of that body (x and y coordinates if the system model
uses planar arithmetic, otherwise x, y and z coordinates).
Step 2: Add them to your model.
Add a new field, called gc, to your system
model data structure. This field is a data structure containing
fields called body and point, such that body(i) is the
body number of the body to which ground-contact point number i belongs,
and point(:,i) contains the coordinates of point i. Points
can be listed in any order.
Step 3: Copy and adapt Simulink
tutorial example 7 (from spatial_v2/simulink).
This involves several sub-steps, depending on your circumstances.
- Replace references to rollingdisc
with references to your own model. Remember to do this also in the
Simulink model workspace initialization m-code (which is where important
model-wide parameters like npt are defined). You will probably
also want to change the names of some blocks.
- If your model is planar, then there are several dimensions in the 'ground'
subsystem that will need to be altered. There is some guidance on what
to do in some of the documentation blocks.
- If your model is not a floating-base system, or if it is but you don't
want to use FDfb, or if you do want to
use FDfb but your model consists of more than
one body, then you will have to make changes to the way the dynamics is
calculated in the 'disc'
subsystem. Example 2 shows how to
calculate the dynamics using FDab,
and Example 5 shows how to
use FDfb when there is more than one body in
- Change the stiffness, damping and friction coefficients in the 'Ground'
block to values appropriate for your experiment. Bear in mind that
these numbers describe the total compliance between the bodies in your
system and the ground. For example, if your ground is made of
concrete, but your robot has soft rubber feet, then the stiffness
coefficient must be chosen to model the compliance in the feet.
Another thing to bear in mind is that if several points are making contact
with the ground simultaneously then they act like a set of springs in
parallel, so their collective contact stiffness is greater than that of any
one individual point. Here are a few formulae that might help:
- If you want a compression of d metres to result in a force
of F Newtons, then the stiffness coefficient
- D/K is the time constant of the unloaded ground—it recovers
from a lost contact at a rate of exp(Kt/D). The larger you
make K/D, the bouncier your contacts will be, but Simulink will
have to take smaller integration time steps.
- A safe (non-slip) floor has a friction coefficient of about 0.5.
Page last modified: June 2012
Author: Roy Featherstone