**YouTube: Bubble walking model and Pogo-stick running model with toe joint**

The walking and running movie clips presented above were created using MATLAB codes appended below. You may use those files freely as long as you reference author and source:

Marko Popovic, Popovic Labs website, “2D simulator platform for studies of walking and running with toe joint,” http://users.wpi.edu/~mpopovic/pages/research.html .

Do not hesitate to contact the author if you encounter any bug in the code or even better if you are able to fix the bug and/or improve the code in any way.

**The 2D Bubble Walking Model, part 1**: File WalkingModelPart1forweb generates walking trajectories with upright upper body posture visualized with MATLAB movie object. You may create an MP4 movie showing actual speed of movement by using makeMP4moviewalking1forweb which sets 120 frames per second rate.

When you run WalkingModelPart1forweb in MATLAB command line you will be asked to specify: (1) Leg length in meters, (2) Foot length in meters, (3) Stride length in foot length, (4) Leg retraction in foot length, (5) Walking speed in meters per second, and (6) Swing leg clearance height in meters.
Make sure that you specify realistic values, otherwise you won’t get realistic result.

In order to have biologically realistic dimensions and mass-inertial properties the model human body is modelled with 66 point like masses presented with circles. The Center of Mass is presented with cross and Zero Moment Point is presented with triangle (desired ZMP) and star (“actual” ZMP).
The “actual” and desired ZMP do not overlap and sometimes “actual” ZMP even leaves the ground support polygon (which is obviously physically impossible). To correct “actual” ZMP trajectory one may consider upper body rotational dynamics.

**The 2D Bubble Walking Model, part 2**: (Arms-on-the-back-like-gait) Upper body dynamics are addressed with file WalkingModelPart2forweb that should be run consecutive to WalkingModelPart1forweb. Warning: this is a multiple loop optimization and it could take a while depending on your processor and MATLAB version. This code generates walking trajectories visualized with MATLAB movie object. You may create an MP4 movie showing actual speed of movement by using makeMP4moviewalking2forweb which sets 120 frames per second rate.

In case you are interested in *“inner workings”* of the 2D Bubble Walking Model here are some details:

**The 2D Bubble Walking Model**, illustrated in Figure, consists of 5 phases: 1) swing leg retraction starting simultaneously with stance foot push-off (heel detaches from ground), 2) swing leg heel strike till stance foot take-off, 3) swing leg toe acceleration and ground clearance adjustment, 4) swing leg toe steady speed till its ground projection coincides with stance foot toe, and 5) swing leg acceleration to match initial condition (posture only).

WalkingModelPart1forweb lines 1 to 49: Sets input parameters and body mass distribution

WalkingModelPart1forweb lines 50 to 116: Calculates Phase 1

WalkingModelPart1forweb lines 117 to 229: Calculates Phase 2

WalkingModelPart1forweb lines 230 to 321: Calculates Phase 3

WalkingModelPart1forweb lines 322 to 430: Calculates Phase 4

WalkingModelPart1forweb lines 431 to 513: Calculates Phase 5

WalkingModelPart1forweb lines 514 to 548: Calculates whole body spin, torque, CM acceleration and ‘actual’ ZMP location

WalkingModelPart1forweb lines 549 to 591: Reformats data to 120 Hz sampling frequency and creates movie object M1

(__Phases 1 to 5__) (A) Hip joints coincide in sagittal plane. Hip joints move only up and down in body’s co-moving inertial frame; hip joint horizontal velocity v is constant relative to ground. (B) Desired ZMP trajectory has uniquely defined constant velocities during single and double support stance phases.

(__Phase 1__) (A) The swing leg’s retracting heel moves down along arc (defined by hip position and leg length L) with same speed v in the co-moving frame as body’s forward speed v relative to ground. During retraction the swing leg’s ankle joint angle is constant. At the moment of ground impact, the retracting foot is perpendicular to heel’s velocity relative to ground. (B) The stance foot is rotating such that heel is moving up along arc (defined by hip position and leg length) while toe is moving backward in the co-moving frame with speed v.

(__Phase 2__) (A) Following heel strike, the front heel moves backwards with speed v and the ankle angle is constant till the moment when the entire foot is in contact with ground due to rotation of thigh and shank relative to ground. After that moment, the entire foot (flat on the ground) moves backward with speed v. (B) Rear leg toe moves backward in the co-moving frame with speed v while rear leg hip angle has constant acceleration. This acceleration is obtained from the requirement that dynamical conditions for rear foot take-off are met exactly at the moment when rear toe reaches intersection of large circle (defined by hip position and leg length) and ground.

In other words, given the rear toe and rear knee position, one can solve for rear heel position. Hence, one could calculate the position of shank + foot center of mass. Condition that torques on shank + foot about knee joint in knee joint non-inertial reference frame due to gravity and inertial forces exactly balance each other signals that rear leg’s ground reaction force is zero. The rear leg hip angle acceleration is chosen such that this condition is exactly met at the end of Phase 2. This acceleration is automatically uniquely determined.

(__Phase 3__) (A) Stance foot is moving backwards with constant speed v. (B) The initial swing leg toe velocity is equal to the velocity of middle of the rear foot at the end of Phase 2. Hence, just after the take-off condition is met the foot velocity is perpendicular to rear foot. After that, both the angle and magnitude of toe’s velocity change in linear fashion based on distance from desired ground foot clearance. When toe’s desired altitude h is reached the toe’s velocity angle is zero and toe’s velocity magnitude is equal to roughly estimated toe’s travel till initial pose of Phase 1 is reached divided by time it will take to reach that position (this time is equal to time needed for stance foot, moving backward with constant speed v, to reach intersection of big circle and ground). During this phase the rear foot is not rotating (the ankle angle is changing though a little bit).

(__Phase 4__) (A) Stance foot moves backwards with constant speed v. (B) Swing leg ankle joint is fixed and toe moves with constant speed at altitude h. This phase lasts till vertical alignment of swing and stance toes.

(__Phase 5__) (A) Stance foot moves backwards with constant speed v. (B) Swing leg accelerate such that in required time the initial posture of Phase 1 can be met.

**The Pogo-Stick Running Model with toe joint**: File RunningModelforweb generates running trajectories visualized with MATLAB movie object. You may create an MP4 movie showing actual speed of movement by using makeMP4movierunningforweb which sets 200 frames per second rate.

You may set various parameters of the model at very beginning of RunningModelforweb code including: (1) leg length (Leg [m]), (2) foot length (f [m]), (3) desired stride (sm [m]) and stride STD (se [m]), (4) desired speed (vm [m/s]) and speed STD (ve [m/s]), (5) desired CM apex (ymam [m]) and CM apex STD (ymae [m]), (6) upper body compression factor (a), (7) CM-hip scaling factor, see explanation below, for the first half of the stance phase (b1), (8) CM-hip scaling factor, see explanation below, for the second half of the stance phase (b2), and (9) upper body leaning angle factor, see explanation below, (cu).

Make sure that you specify realistic values, otherwise you won’t get realistic result.

In case you are interested in *“inner workings”* of the Pogo-Stick Running Model with toe joint here are some details:

The center of mass dynamics is modelled as well-known spring mass model. Specifically, the net ground reaction force is modelled as force due to constant stiffness linear spring compressed between CM and Center of Pressure (CP) coinciding with ZMP for flat level ground. Here, it is assumed that ZMP is moving during the ground contact phase at constant speed relative to stance foot. Specifically, it is assumed that ZMP moves from “toe joint” (assumed at 2/3-foot distance from heel) to toes.

The stance leg thigh is assumed to be aligned with line connecting ZMP and CM to enforce proper transfer of ground reaction forces onto CM. The stance hip change of height is then modeled as scaled version of stance CM change of height with two scaling factors characterizing first and second half of support phase that user can independently specify. In practice, the most biologically resembling running solutions are obtained with unit scaling factors. The stance hip trajectory is then translated to minimal height allowing positive solution for the stance heel height subject to condition that toes are flat on the ground throughout the support phase.

The upper body leaning angle can be specified by the user. The most biologically resembling running solutions are obtained for leaning angles smaller or equal to stance leg thigh angle at the moment of “force” take-off. At “force” take-off toe-joint ceases to be in the contact with ground. Shortly after that moment toes are still in the contact with ground, till “real” take-off, but, as assumed here, no substantial forces are exchanged between the body and the ground during that short period of time.

The upper body mass compression can be also specified by the user. The most biologically resembling running solutions are obtained for compressions in the range 0f 70%—90% relative to straight upright posture.

Given stance leg and upper body trajectory the 3 DoF swing leg trajectory (assuming foot flat) can be now obtained based on minimization of distance between desired and actual CM and spin angular momentum. Alternatively, one can enforce foot perpendicular to shank and optimize CM alone. Later approach allows for model inconsistent non-zero torques. However, those can be iteratively corrected by extra dynamics of more detailed upper body model (e.g. arms swinging).

Finally, the stance leg at the “real” take-off is smoothly connected to swing leg at the stance leg impact moment and other leg trajectory is obtained based on the previously described optimization procedure.