gait2d is a dynamic model that contains the essential elements for simulating human gait in the sagittal plane. The model has been used in earlier forms by Ackermann and van den Bogert (2010) [Ackermann2010] and by Gerritsen et al. (1998) [Gerritsen1998]. The main features of the model are:
- Seven body segments
- Fast execution
Model dynamics and outputs are twice differentiable with respect to all inputs, which is important for certain numerical methods for simulation and optimal control. The model is intended for education and basic research. The model can be used for studies such as Ackermann and van den Bogert (2010) and Geyer and Herr (2010) [Geyer2010].
The included Autolev model was originally written by Ton van den Bogert and adapted by Jason K. Moore. The SymPy Mechanics model was created by Jason to match the Autolev model results for use with PyDy and opty.
The cythonized Autolev C code takes about 5 micro seconds per rhs eval and the PyDy Cython version takes about 15 microseconds (the PyDy version is slower because of the Python level linear solve on the full mass matrix, but only for forward dynamics).
This package has not yet been released to PyPi, so install from the development source:
git clone https://github.com/csu-hmc/gait2d cd gait2d conda env create -f gait2d-dev.yml conda activate gait2d-dev python -m pip install --no-deps --no-build-isolation --editable .
See examples/run.py
.
To manually build the Autolev model and make use of it in Python:
$ cd algait2d $ al gait2de.al $ python autolevclean.py $ cd .. $ python setup.py build_ext --inplace $ python >>> from algait2de import gait2de >>> gait2de.evaluate_autolev_rhs(...)
The model is planar (xy plane) and there are seven rigid bodies. All rotations are defined to be about the z axis. When all configuration variables are set to zero, the model is standing upright and the trunk's hip joint is at the inertial origin with the human facing in the positive x direction.
- Trunk (A):
ma
: mass [kg]ia
: moment of inertia about mass center wrt to the trunk reference frame [kg*m^2]xa
: local x location of mass center wrt to the hip joint [m]ya
: local y location of mass center wrt to the hip joint [m]
- Right Thigh (B)
mb
: mass [kg]ib
: moment of inertia about mass center wrt to right thigh reference frame [kg*m^2]xb
: local x location of mass center wrt to the hip joint [m]yb
: local y location of mass center wrt to the hip joint [m]lb
: joint to joint segment length [m]
- Right Shank (C)
mc
: mass [kg]ic
: moment of inertia about mass center wrt to right shank reference frame [kg*m^2]xc
: x location of mass center wrt to the knee joint [m]yc
: y location of mass center wrt to the knee joint [m]lc
: joint to joint segment length [m]
- Right Foot (D)
md
: mass [kg]id
: moment of inertia about mass center wrt to right foot reference frame [kg*m^2]xd
: local x location of mass center wrt to the ankle joint [m]yd
: local y location of mass center wrt to the ankle joint [m]hxd
: local x location of heel wrt to the ankle joint [m]txd
: local x location of toe wrt to the ankle joint [m]fyd
: local y location of heel and toe relative to ankle joint [m]
- Left Thigh (E)
me
: mass [kg]ie
: moment of inertia about mass center wrt to left thigh reference frame [kg*m^2]xe
: local x location of mass center wrt to the hip joint [m]ye
: local y location of mass center wrt to the hip joint [m]le
: joint to joint segment length [m]
- Left Shank (F)
mf
: mass [kg]if
: moment of inertia about mass center wrt to left shank reference frame [kg*m^2]xf
: x location of mass center wrt to the knee joint [m]yf
: y location of mass center wrt to the knee joint [m]lf
: joint to joint segment length [m]
- Left Foot (G)
mg
: mass [kg]ig
: moment of inertia about mass center wrt to left foot reference frame [kg*m^2]xg
: local x location of mass center wrt to the ankle joint [m]yg
: local y location of mass center wrt to the ankle joint [m]hxg
: local x location of heel wrt to the ankle joint [m]txg
: local x location of toe wrt to the ankle joint [m]fyg
: local y location of heel and toe relative to ankle joint [m]
- Other constants
kc
: ground contact stiffness [N/m^3]cc
: ground contact damping [s/m]mu
: friction coefficientvs
: velocity constant [m/s]g
: acceleration due to gravity [m/s^2]
qax, qay
: location of trunk hip joint relative to inertial originqa
: angle of trunk relative to inertial reference frame,qa=0
makes trunk standing upright andqa>0
leans trunk backwardsqb
: angle of right thigh relative to trunk (hip),qb=0
makes thigh aligned with trunk andqb>0
abducts the hipqc
: angle of right shank relative to right thigh (knee),qc=0
makes shank aligned with thigh andqc>0
extends the kneeqd
: angle of right foot relative to right shank (ankle),qd=0
makes foot 90 deg to shank andqd>0
dorsiflexes the footqe
: angle of left thigh relative to trunk (hip),qe=0
makes thigh aligned with trunk andqe>0
abducts the hipqf
: angle of left shank relative to left thigh (knee),qf=0
makes shank aligned with thigh andqf>0
extends the kneeqg
: angle of left foot relative to left shank (ankle),qg=0
makes foot 90 deg to shank andqg>0
dorsiflexes the foot
Fax, Fay
: "hand of god", forces acting on the trunk mass center relative to inertial originTa
: "hand of god", torque acting on trunk relative to inertial frameTb
: hip joint torque,Tb>0
extends the hipTc
: knee joint torque,Tc>0
abducts the kneeTd
: ankle joint torque,Td>0
plantarflexes the footTe
: hip joint torque,Te>0
extends the hipTf
: knee joint torque,Tf>0
abducts the kneeTg
: ankle joint torque,Tg>0
plantarflexes the foot
[Gerritsen1998] | Gerritsen, K. G. M., Bogert, A. J. van den, Hulliger, M., & Zernicke, R. F. (1998). Intrinsic Muscle Properties Facilitate Locomotor Control—A Computer Simulation Study. Motor Control, 2(3), 206–220. https://doi.org/10.1123/mcj.2.3.206 |
[Ackermann2010] | Ackermann, M., & van den Bogert, A. J. (2010). Optimality principles for model-based prediction of human gait. Journal of Biomechanics, 43(6), 1055–1060. https://doi.org/10.1016/j.jbiomech.2009.12.012 |
[Geyer2010] | Geyer, H., & Herr, H. (2010). A Muscle-Reflex Model that Encodes Principles of Legged Mechanics Produces Human Walking Dynamics and Muscle Activities. Neural Systems and Rehabilitation Engineering, IEEE Transactions On, 18(3). https://doi.org/10.1109/TNSRE.2010.2047592 |