Notebooks
and code for optimization of a pendulum-like model of locomotion.
Dynamical model performs walking tasks specified by optimal control.
Human experiments to test model are described in publications.
This notebook
demonstrates a dynamic optimization for taking short walking bouts of
varying length. The model starts and ends at standing rest, and
self-selects (optimizes) the steps to minimize an energy-time objective.
Energy is expressed as the total push-off work performed by the model,
and time is the total duration of the walk, scaled by a time valuation
constant
This notebook demonstrates a dynamic optimization for walking on uneven terrain. The model plans ahead for upcoming steps, and determines a trajectory of push-offs and forward walking speed that minimizes the energy and time expended for the terrain. Energy is the push-off work performed by the model, and the time duration is set to equal the time to walk the same distance on flat ground. Human experimental data and code are available in a separate repository. Additional Matlab optimization code is also available in a sub-directory of this repository.
The “simplest walking model” (Kuo 2002) models the legs as simple pendulums. There is a point mass for the body, and infinitesimal point masses for the feet. For the present publications, walking speed varies by relatively small amounts, for which modulation of the swing leg is treated as having low cost. For increasing speeds and step frequencies, the model’s swing leg cost increases sharply (Kuo 2001).
The optimization is performed withj the Julia language, a fully open-source language. It uses open-source packages for optimization (JuMP and for model dynamics DynLoco). The emphasis here is on simplicity and code readability. The Julia code provides a minimal demonstration of the mechanics and optimization approach. The entire tool chain is open source.
Users are invited to view the notebooks and source code in this repository. Motivated individuals may also wish to execute and modify the code themselves, which necessitates installation of Julia.
- Clone or download this repository. From GitHub page, Code -> Clone or
Download ZIP, to create
simplelocomotionmodel
directory. - Install Julia according to the Getting Started guide
- The Jupyter notebooks also require installation of
Jupyter. Assuming a
Python installation, Jupyter may be
installed with
pip
orconda
. - Run Julia from the
simplelocomotionmodel
directory - Install packages using package manager, from the Julia prompt:
Using Pkg
Pkg.activate(".")
activates an environment with relevant packages. The environment is described by the.toml
files in the current directory (i.e.simplelocomotionmodel
) and lists the relevant packages. This includes the dynamic walking model DynLoco.Pkg.instantiate()
downloads and installs packages (can take several minutes)
- The Jupyter notebooks have file extension
ipynb
and can be opened and executed with a variety of viewers. A recommended workflow uses the VS Code editing environment, which can open, execute, and render Jupyter notebooks.
The model equations are implemented in the
DynLoco package with Julia. This
package is automatically installed with the present repository’s
environment (see instantiate
above). All other dependencies are within
the Julia packages and managed with the environment, so that no
additional management is necessary. Jupyter notebooks are generated with
Quarto, with source provided in .qmd
files.
Quarto is not necessary to open and interact with Jupyter notebooks.
Carlisle, Rebecca Elizabeth, and Arthur D Kuo. 2023. “Optimization of Energy and Time Predicts Dynamic Speeds for Human Walking.” Edited by Gordon J Berman. eLife 12 (February): e81939. https://doi.org/10.7554/eLife.81939.
Darici, Osman, and Arthur D. Kuo. 2022. “Humans Plan for the Near Future to Walk Economically on Uneven Terrain.” arXiv 2207.11224 (July). https://doi.org/10.48550/arXiv.2207.11224.
Kuo, Arthur D. 2001. “A Simple Model of Bipedal Walking Predicts the Preferred Speed-Step Length Relationship.” Journal of Biomechanical Engineering 123 (3): 264–69.
———. 2002. “Energetics of Actively Powered Locomotion Using the Simplest Walking Model.” Journal of Biomechanical Engineering 124 (1): 113–20.
Please file an issue for bugs or problems. Pull requests are welcomed.