Dynamic Model of aHorse Gallop in 2DEddy BoxermanIntroduction Motivation and Related Work Materials Model Dimensions and Inertial Properties of Model Gait Poses Methods Simulation Parameters Pose Control Search Algorithm Results Analysis Conclusion and Future Work Acknowledgements References IntroductionI 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.
Note: although all renderings are of simple skeleton models, more complex inertial body properties were used in the simulation.
Motivation and Related WorkMuch 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.
MaterialsThis section describes the data and tools used for the simulation.
ModelThe horse was modeled using a 2D articulated figure.
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 ModelInertial 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.
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 PosesThe 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.
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).
The measured joint angles can also be found in the following (tab delimited text) file.
Dynamics SimulatorTo 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.
MethodsIn 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 ParametersThe 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.
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:
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 ControlHow 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 AlgorithmThe 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:
A few terms and details require explanation:
ResultsOverall, 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:
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.
AnalysisEncouragingly, various properties of the simulated gallop that were not explicitly controlled were found to conform quite closely with a real gallop:
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 WorkThe 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.
AcknowledgmentsI'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.
References[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. |