Dynamic Model of a

Horse Gallop in 2D

Eddy Boxerman


        Motivation and Related Work
        Dimensions and Inertial Properties of Model
        Gait Poses
        Simulation Parameters
        Pose Control
        Search Algorithm
Conclusion and Future Work


I did this project for Michiel van de Panne's animation course at UBC in the term of Winter 2002.

The goal of the project was to model the dynamics (forces, torques) of a horse gallop on computer, and to determine a stable control strategy for a sustained gallop. The scope of the simulation was restricted to 2D, although in principle the method expands naturally to 3D.

An animation is worth a thousand words. The following two animations demonstrate the results of the project.

animation of stable gallop
animation of horse wiping out
A few cycles of a stable gallop
A gallop becoming unstable

Note: although all renderings are of simple skeleton models, more complex inertial body properties were used in the simulation.


Motivation and Related Work

Much can be learned from studying the graceful motion of animals. The topic of animal motion control touches upon such disciplines as control theory, biomechanics, robotics, artificial intelligence, and computer animation. A good overview of the problem, from a computer science perspective, can be found in [6].

Traditionally, computer animation relies on techniques such as key framing and motion capture. However, the former can be tedious and time consuming while the latter is difficult to generalize to differing models, motions and environments. Dynamic simulation has the potential to produce realistic animations in a more automated fashion.

Dynamic simulations of animals gaits (including horses) such as walking and trotting have been done [7]. In fact, as an intermediate step in this project, I simulated a horse trot. However, the trot is a simpler (symmetric along the sagittal plane) and more stable gait than the gallop. To the best of my knowledge, a dynamic simulation of a horse gallop had not yet been accomplished.



This section describes the data and tools used for the simulation.



The horse was modeled using a 2D articulated figure.

Visualization of horse model used in simulation
(segment numbers identified in table below)

Muscle actions are simply modeled as joint torques over time. Model dimensions, inertial properties, and target motion data were gathered from various sources. The model was then simulated on computer in an attempt to achieve a stable control strategy for a sustained gallop.


Dimensions and Inertial Properties of Model

Inertial properties of the various body segments were extracted from [1]. Slight modifications were made to conform to the model being used. The following table contains the inertial parameters that were used in the simulations.

Body Segment
Segment Number
Length (m)
Mass (kg)
Center of Gravity (m)
Moment of Inertia (kg*m^2)
Shoulder (x 2)
Ante brachium (x 2)
Metacarpus (x 2)
Digit forelimb (x 2)
Thigh (x 2)
Crus (x 2)
Metatarsus (x 2)
Digit hind limb (x 2)

Note: Center of gravity is the distance of a segment's COG (along its axis) as measured from its parent link. The Trunk segment's COG is directly at its midpoint.


Gait Poses

The first successful sequential photographs of rapidly moving objects were taken by Muybridge [2]. A main focus of his work was horse gaits. A twelve frame sequence of a horse gallop (Plate 67) was used to define the target poses of the simulation.

A horse gallop stride in 12 phases (taken from [2])

Body segment lengths and joint angles were extracted directly from the photographs with a trusty ruler and protractor. While this does not yield precise values, it suffices for this purpose. In fact, since a reasonably stable gallop was produced, it demonstrates the technique's power to overcome relatively poor initial data.

The following animation displays a rendering of the extracted data. Note that this is not the result of a physical simulation, but merely a projection of the poses against a ground plane (notice how the torso remains perfectly horizontal).

Visualization of pose data extracted from [2]

The measured joint angles can also be found in the following (tab delimited text) file.


Dynamics Simulator

To simulate the system dynamics, I employed Michiel van de Panne's 2D dynamics simulator. First a "dynamics compiler" - given a description of a 2D articulated figure - produces a symbolic description of the equations of motion in the form of a 'C' procedure. The procedure is then linked with a dynamics engine which, when executed, calculates the system state (forces, torques, rectilinear and angular positions and velocities) over time. The engine simulates ground reaction forces using a penalty based method.

For the purposes of this project, I expanded the simulator to accept additional simulation parameters such as: target poses for the articulated figure, joint stiffnesses, etc. For the purposes of running test suites as well as monitoring and organizing results, I wrote several perl scripts. I also wrote a C++/OpenGL utility for rendering and capturing the animations.



In the context of this project, modeling a stable gallop consists of finding the correct combination of parameters for the simulation. The problem then becomes one of searching for a solution in some high dimensional space. To this end many simulations were executed with varying parameters, guided by an optimization scheme and rejection criteria.


Simulation Parameters

The following parameters are used in the horse simulation. The Min and Max columns identify the ranges of values that are legal (may be attempted) for each parameter.

Number of occurrences
Segment Length
Used values as given above

Length of a segment (in meters) in the articulated figure (although there are 19 segments, symmetry reduces the number to 11)

Segment Mass
Used values as given above
Mass of a segment (in kg) in the articulated figure
Segment COG
Used values as given above
Center of gravity of a segment (in meters) in the articulated figure
Segment Moment of Inertia
Used values as given above
Moment of inertia of a segment (in kg*m^2) in the articulated figure
Segment Joint Angle
+/-0.5 from targets in pose file
Target angle (in radians) of a given segment for a given pose (12 poses * 18 controlled joints = 216 parameters)
Initial Joint Positions
The horse's pose at the beginning of the simulation. This is set to the angles as defined by the first pose in the cycle.
Initial Joint Velocities
Fixed at 0
The horse's angular joint velocities at the beginning of the simulation.
Joint KS
Spring control constant (muscle stiffness, in N/m) of each joint (although there are 18 joints, symmetry reduces the number to 10)
Joint KD
Damping control constant (friction, in N*s/m) of each joint
Ground KS
Spring constant (in N/m) used for figure-ground interactions
Ground KD
Damping constant (in N*s/m) used for figure-ground interactions
Target time increment (in seconds) between poses
FIxed at 0.0002
Time step (in seconds) of simulation
Initial Velocity
Horizontal velocity (in m/s) of horse torso (midpoint) at start of simulation
Initial Height
Vertical position (in meters) of horse torso (midpoint) at start of simulation
Initial Torso Angle
Angle (in radians) of horse torso (wrt horizontal) at start of simulation
Simulation Time
Time (in seconds) for which to run simulation (in simulation time, not real time). As more stable gaits are produced, higher values are attempted. A perfectly stable gait would run forever.
Joint Limit
Fixed at 2.0
Maximum value (in radians) by which a joint's current angle can deviate from its target angle. If this value is exceeded by any joint at any time, the current simulation trial is rejected.
Torso Limits
Fixed at 1.0
If the absolute value of the horse torso's angle (in radians wrt horizontal) exceeds this value at any time, the current simulation trial is rejected.
COG Limits

Fixed at min = 0.8 and max = 1.8

If the vertical position (in meters) of the horse's COG (torso midpoint) exceeds these boundaries at any time, the current simulation trial is rejected.
Joint Velocity Limit
Maximum absolute angular velocity permissible for a joint (in radians/s). If this value is exceeded by any joint at any time, the current simulation trial is rejected. This is to trap numerical instabilities.


This gives a total of 311 parameters, a high dimensional space to search. In order to reduce this number, I made the following assumptions and adjustments:

  • Segment lengths, masses, COGs and moments of inertia are, as stated above, held fixed to the values extracted from sources. This seems reasonable since there probably exists a horse (somewhere) which has those exact properties and which can gallop. What remains is to determine the other parameters for that horse's specific gallop. This reduces the number of parameters by 44. Moreover, whenever these properties are changed, the system must recompile the dynamics procedures for the horse model; avoiding this compilation phase decreases the time required to run each simulation.
  • Initial Joint Velocities are all set to 0, reducing the number of parameters by 18. This was an initial assumption that was never revisited over the course of the project. In retrospect, maybe this should be changed.
  • For the initial search phase, all Joint KS and Joint KD values are held equal. Although each joint will have its own muscle properties, the initial goal is to simply find the correct order of magnitude for these parameters - and making them all equal is sufficient to accomplish this. This reduces the number of parameters by 18 for the initial phases of the search.
  • For the initial search phase, the Segment Joint Angle deviation (+/-0.5 radians) is set to zero. This holds the poses fixed to the measured values. This reduces the number of parameters by 216 for the initial phases of the search. How can this reduction be justified? Essentially, ballpark figures for the joint angles are already known, whereas values for other parameters such as DTpose and Ground KS are not. Holding the "known" values fixed while searching for some ballpark values for the "unknown" parameters seems reasonable - and in practice worked well.

Thus for the initial phases of the search, the number of parameters in the search space is reduced to 15. In addition, some of these values have limited ranges (or are held fixed). This greatly reduces the size of the search space. Eventually, the number of parameters is increased to 249.

Another question is how to choose the Min and Max values for each parameter. This was done by spending some time (under an hour) experimenting and witnessing what values were clearly unreasonable. For instance, choosing a DTpose value of 0.01 caused the horse model to flail manically; and a value of 0.5 allowed the horse to fall before it barely moved. To be safe, the ranges chosen were even larger than what seemed reasonable after experimentation. Automating this process may not be entirely possible, since some minimum and maximum (or mean and standard deviation) values must always be chosen for the ranges.


Pose Control

How are the measured poses (joint angles) used to achieve the gallop motion? Essentially, the poses are used as control targets for the joint angles of the articulated figure at any given point in time.

The 12 poses of the gait are cyclical in nature and the poses are separated by a time interval defined by DTpose. At time = 0, the target angles are exactly those defined by pose 1; at time = DTpose, the angles are defined by the values at pose 2; and so on. When in between two poses (at time = 0.3 * DTpose for instance), linear interpolation between the two poses is done to calculate the target angles.

Once the target joint angles are known for the current simulation time, basic PD control is used to "force" the horse model through the desired configurations. For a given time step in the simulation:

Control Torque = KS * (joint_target - joint_position) + KD * joint_velocity

Spring and damping constants for each joint are defined by the Joint KS and Joint KD parameters. Shortest paths are always used between target and current joint positions (so for example 1.9*PI and 0.1*PI are only 0.2*PI radians apart). Also, since target joint velocities are not known, the damping component of the control serves merely to dampen the system; this is needed for stability. Note that although this is considered closed-loop control from a robotics perspective, in this context (animation) we refer to it as open-loop control. Here the distinction is that, although the horse model "knows" and reacts to its current internal state (joint angles, etc.), it uses no information about its environment. For example, the horse continues to cycle through its gallop motions even if it falls on its back in the simulation - thus it is not closed-loop.


Search Algorithm

The search algorithm used is similar in nature to that found in [6] with a few adaptations to the problem at hand. It begins with a global search of the parameter space, followed by local searches of promising regions that were discovered by the global search. It is arguably related to such algorithms as simulated annealing and greedy optimization. The pseudo code is as follows:

  • Simulation Time <- 2.0 seconds
  • Randomly generate parameters (use full ranges) and evaluate via simulation for 1000 sets.For any simulation that is not rejected, add that set of parameters to the successful trial database
  • Perturbation Factor <- 0.3
  • Repeat until trials converge (or you're fed up waiting)
    • For each of the 10 best trials
      • Perturb the parameter set of the given trial and evaluate via simulation. If it is not rejected and the optimization metric is higher than the original's, update the parameter set and continue searching.
    • Simulation Time = Simulation Time * 1.5
    • Perturbation Factor = Perturbation Factor / 3
  • Output best parameter sets

A few terms and details require explanation:

  • Rejected Simulation: this refers to any simulation in which the horse model violates a rejection criteria. These are defined by the Joint Limit, Torso Limit, COG Limit and Joint Velocity Limit parameters defined above. For instance, if the model violates the Torso (angle) limit, it is probably about to flip over - definitely an unsuccessful gallop. More subtle is the Joint Limit criteria: if at any time any joint deviates from its target angle by more than a threshold value, the gait is rejected. Before implementing this restriction, I observed some interesting and successful (relatively fast) gaits, but they did not resemble a horse gallop! By adding this restriction, only gaits that are similar to the gallop are accepted.
  • Perturbation Factor: This value controls the percentage of the Min / Max range that is explored through randomization. For instance, when Perturbation Factor = 0.05, the perturbed parameters will only deviate from the current set's by up to 5% of the ranges as defined in the parameter table. It is initialized to 0.3 once the algorithm begins its local searches. As more and more successful parameter sets are found, this value decreases, shrinking the perturbation ranges and refining the local search.
  • Simulation Time: Finding a long-term stable gait is a delicate matter [5]. It is much easier to find one that is stable for a short period of time. Hence, the algorithm begins its global search for gaits that are stable for at least 2 seconds. At each stage of the search, the Simulation Time is increased to ensure that the gaits become stable for longer periods of time - ideally forever.
  • Optimization Metric: the criteria used to judge a (non-rejected) parameter set is simply distance traveled. This was chosen over velocity so that parameter sets that were run for different Simulation Times can be compared against one another; ie. when comparing a fast but unstable gait to a slower but longer-term stable gait, the more stable gait should be chosen.



Overall, the results obtained from the approach described were good. Some animations are provided.

Over several runs of the search algorithm, the most successful gallop found was stable for 22.77 seconds of simulation time, or for approximately 86 gait cycles. The parameter set for this simulation can be found in the following file. For convenience, some interesting values are presented in the following table:

Simulation Time
22.77 seconds
Distance Traveled.
418.45 meters
0.022 seconds
Initial Horizontal Velocity
15.939 m/s
Avg. Joint Stiffness
~8000 N/m
Ground Stiffness
21950 N/m

In general, production of stable gaits lasting up to 10 seconds was quite common. No indefinitely stable gait was found. The question remains open as to whether an indefinitely stable, open-loop gallop exists.

As for simulation performance, it runs in approximately real-time. ie. it requires about 10 seconds to execute a simulation that models 10 seconds of simulation time. Typically, gaits that were stable for 2-3 seconds could be found within a few minutes of searching; and gaits that were stable for 10 seconds required about 1-2 hours of searching.



Encouragingly, various properties of the simulated gallop that were not explicitly controlled were found to conform quite closely with a real gallop:

  • Frame Rate: the most stable simulated gait's DTpose parameter (time between poses) was 0.022. Muybridge gives a measured frame rate of 0.22 seconds/frame. These values are identical!
  • Gallop Velocity: the most stable simulated gait covered 418.45 meters in 22.77 seconds, or galloped at an average velocity of 18.38 m/s. Muybridge cites the gallop to cover thirteen and three-quarter inches per frame, where the inter-frame time is 0.022 seconds. This gives a velocity of 15.88 m/s. These values differ by 16%.

An additional metric which would prove useful for analysis is foot-fall timing of the simulated gaits; which could provide quantitative evidence that the simulated gallop has the same phase characteristics as a real gallop. Unfortunately time did not permit this.

An aspect that should be reconsidered is that all initial angular joint velocities were set to zero for the simulations. However, the initial state of the system should in fact represent a point in the steady state of a horse galloping. In retrospect, appropriate initial velocity ranges should have been chosen and these parameters should have been randomized as well. While this would have increased the number of search parameters by 18, perhaps these too could have been postponed until later phases of the search (as the poses themselves were).


Conclusion and Future Work

The results of this project are encouraging and lay a solid foundation to work from. The technique in theory could be applied to any creature-gait combination that is symmetric in the sagittal plane. Other interesting animal subjects in Muybridge's book include baboons, gazelles, dogs, kangaroos and ostriches!

The technique applied here should generalize naturally to three dimensions. This entails more complicated simulation techniques and higher dimensional spaces, but the approach and algorithm should remain essentially the same.

As already mentioned, initial angular joint velocities should not be assumed to equal zero. This in itself may be causing the initially successful gaits not to converge to stable long-term gaits.

Currently, the optimization criteria used to judge the success of a gait - and to choose a parameter set to locally search - is based on distance traveled. Another alternative is to consider energy expenditure; or distance traveled. per energy expended. This may prove useful since it is generally accepted that animal gaits use energy efficiently.

Of course, closing the loop could provide an indefinitely stable gait. Various techniques that decouple or linearize the complexity of this problem can be found in [3] and [4]. The work here involves finding a few key simulation states to monitor and a few control parameters that could be adjusted "in-simulation" to compensate for the state divergence. A good candidate for states to monitor may be foot-fall timings, which could be compared to actual gallop timings. Indirect control over the timings may be achieved via modifying the model's compliance (Joint KS parameters) temporarily, or by adjusting the interpolation parameter accordingly (ie. if the target pose is in a post foot-fall condition, but the foot-fall in the simulation has not yet occurred, the interpolating parameter could be "slowed down" to wait for the foot-fall to occur).

Fleshing out of the skeleton-rendering would yield more attractive results of course.



I'd like to thank Michiel van de Panne for his help and suggestions during this project; as well as for allowing me to use his simulator.



[1] Buchner, H.H.F., Savelberg, H.H.C.M., Schamhardt, H.C. and Barneveld A. (1997) Inertial Properties of Dutch Warmblood Horses. JOURNAL OF BIOMECHANICS 30(6) pp 653-658

[2] Muybridge, E.J. (1887). Animal Locomotion.

[3] Laszlo, J. F., van de Panne, M., Fiume, E. (1996) Limit Cycle Control and its Application to the Animation of Balancing and Walking, SIGGRAPH 96 Conference Proceedings (ACM Computer Graphics), 155-162.

[4] Playter, R. (2000) Physics-based simulations of running using motion capture. SIGGRAPH 2000 Course Notes, Course #33

[5] van de Panne, M. Lamouret, A. (1995) Guided Optimization for Balanced Locomotion. Computer Animation and Simulation '95 -- Proceedings of the 6th Eurographics Workshop on Simulation and Animation, Springer Verlag. Maastricht, Netherlands, 165-177.

[6] van de Panne, M. (2000) Control for Simulated Human and Animal Motion. IFAC Annual Reviews in Control 2000, 24(1), Elsevier Science Ltd., 189-199.

[7] Villanova, J., Guinot, J-C., Neveu, P., Gasc, J-P. (2000) Quadrupedal Mammal Locomotion Dynamics 2D Model. Proceedings of the 2000 IEEE/RSJ International Conference on Intelligent Robots and Systems.