PolyLimb aims to create a strong and accurate visual and mathematical tool to model gait patterns for static multi-legged walkers. Given the number of legs of a walker, PolyLimb generates a dynamic, and interactive visual model, determines the angle as a function of time from a naturally-derived theoretical equation, and creates accurate gait cycle animations and visualizations. This provides the basis for exploring real-world data and extending into robotics and bio-mimicry.

Introduction

Background

Across the fields of biology, orthopedics, and robotics, biped gait patterns have been thoroughly analyzed and modelled. Our findings from biped gait research have progressed game-changing innovations in physical therapy and humanoid/prosthetic engineering. On the other hand, the gait cycles of non-biped, or multi-leg, walkers, which encompasses all walkers with three or more legs, are relatively understudied. More specifically, if given the number of legs and duration of time for a non-biped’s gait cycle, we lack the tools to graphically model or derive mathematical representations of its movement. The absence of accurate models and formulae for non-bipeds has halted improvement of multi-legged robots and prevented accurate pattern modelling of quadruped, hexapod, and arthropod creatures. Introducing these advancements would be valuable to promote further discoveries.

Objectives

This is where PolyLimb comes in. With PolyLimb, we aim to uniquely model non-biped static gait cycles through three main methods.
◼
  • Graphics-Based Interactive Multi-Leg Gait Model
  • ◼
  • Construct a walker from an
    n
    -sided regular polygon base and determine the number and location of its legs from the polygon’s vertices.
  • ◼
  • Assign the number of sides, and by association, the number of legs, to a dynamically adjustable variable
    n
    .
  • ◼
  • Derive the location of every graphic in the model from a set of calculated coordinates.
  • ◼
  • Create an n-legged, three joint structure for the lower limbs (hip, knee, ankle).
  • ◼
  • Apply RotationTransform[] and Dot Product to the joint and limb positions to replicate forward kinematics and hierarchical joint rotation.
  • ◼
  • Use dynamic variables to adjust the angle displacement, and thus the position and rotation of all joints/limbs in the model.
  • ◼
  • Generalized Angle vs. Time Formula for N-Legs
  • ◼
  • Define a parent function for angle vs. time in a gait analysis context, given the number of legs .
  • ◼
  • Use basic kinematics, algebra, and data analysis to naturally determine all unknown variables {
    A
    ,
    f
    , and ϕ}.
  • ◼
  • Create data and equation processing functions to:
  • ◼
  • Convert external data to angle vs. time equations (given number of legs)
  • ◼
  • Convert angle vs. time equations into line graphs
  • ◼
  • Convert angle vs. time equations into dynamic gait cycles using the gait model
  • ◼
  • Import, reformat, and determine angle vs. time equations uniquely from external data.
  • ◼
  • Validate natural formula accuracy by producing graphs and visualizations.
  • ◼
  • Visual Gait Cycle Diagrams
  • ◼
  • Plug the natural angle vs. time formula into the gait model and ListAnimate a dynamic gait cycle visualization.
  • ◼
  • Print out static, frame-by-frame gait cycle visualizations as well.
  • Key Terms

    ◼
  • Gait: A person’s manner of walking. It is a scientific term that is widely used in research across multiple disciplines.
  • ◼
  • Gait Cycle: The repetitive sequence of steps that make up a walker’s gait. It is a continuous, cyclical pattern that can be divided broadly in two phases: the stance phase and the swing phase. Gait cycles are generally represented by a series of images, similar to laying out the frames of a video.
  • ◼
  • Walkers: An informal term for any object, creature, or simulation that emulates the pattern of constant gait, regardless of whether they are alive or dead, tangible or fake.
  • ◼
  • Gyroscopes: A type of inertial sensor that measure tri-axial angular velocity, or change in angle as a function of time. They are especially relevant to modern gait analysis practices, both in the lab and the clinic.
  • ◼
  • Forward kinematics: A branch of kinematics that calculates an end position/coordinate based on a given change in angular orientation.
  • ◼
  • Hierarchical joint rotation: A kinematic modeling approach where each joint’s movement is defined relative to its parent joint in a structured chain. This ensures that rotating a parent joint automatically affects the positions and orientations of all its child joints, preserving realistic, dependent motion.
  • ◼
  • Amplitude
    (A)
    : The maximum angular displacement of a object/joint in degrees or radians.
  • ◼
  • Frequency
    (f)
    : The number of gait cycles per second, which is usually <1.
  • ◼
  • Phase Offset (ϕ): A constant that represents the staggered steps between legs.
  • Multi-Legged Gait Model

    This section constructs a modular, scalable multi-legged gait model designed to simulate and analyze the kinematics of real-world walkers. The overarching goal is to generate dynamic, legged systems where each limb is modeled with hierarchical joint structures (hip, knee, ankle), and each joint can be rotated independently or in coordinated patterns to study gait dynamics, transitions, and symmetry effects.
    ​
    The model begins with a static walker — a solely visual representation of legs centered on the vertices of a central polygon based on user-defined parameters like leg length, width, number of legs (
    n
    ), and foot size. By using polygon-based body plans, we establish a baseline model that allows us to replicate walkers with any number of sides/legs (quadrupeds, hexapods, arthropods, etc.).
    ​
    Building on this, the dynamic version introduces real-time, hierarchical joint rotation transformations. These rotations are applied using rotation matrices and pivot points specific to each joint, maintaining mechanically plausible limb motions. The dynamic walker can simulate coordinated gait patterns and realistic joint rotations, providing a framework to test gait strategies, transition behaviors, and leg phase relationships in multi-legged locomotion.
    ​
    This gait model provides a platform for experimenting with gait symmetry, phase offsets, and joint interactions in multi-legged systems — applicable to robotics, biomechanics, and comparative locomotion studies.

    Static Gait Model

    makeFoot uses the 30 - 60 - 90 right triangle rule as a template to calculate the positions of the six points needed to define foot prisms . The function generates a single foot based on those calculated points and is later mapped over a list of lower leg positions to create one foot for each leg.
    Takes the lowerLegCorner and offsets its y-coordinate by legHalfSize, establishes two starting points for the prism. footSize represents the length of the shortest side (x), the other sides are scaled accordingly based on the 1:
    3
    :2 ratio.
    In[]:=
    makeFoot[lowerlegCorner_, legHalfSize_, footSize_]:=​​ Prism​​ {lowerlegCorner[[1]], lowerlegCorner[[2]] + legHalfSize, lowerlegCorner[[3]]},​​ {lowerlegCorner[[1]], (lowerlegCorner[[2]] + legHalfSize) - (1/2*footSize), lowerlegCorner[[3]] - (1/2 * footSize * Sqrt[3])},​​ {lowerlegCorner[[1]],(lowerlegCorner[[2]] + legHalfSize) + (3/2 * footSize), lowerlegCorner[[3]] - (1/2 * footSize * Sqrt[3])},​​ {lowerlegCorner[[1]] + (2 * legHalfSize), lowerlegCorner[[2]] + legHalfSize, lowerlegCorner[[3]]},​​ {lowerlegCorner[[1]] + (2 * legHalfSize), (lowerlegCorner[[2]] + legHalfSize) - (1/2 * footSize), lowerlegCorner[[3]] - (1/2 * footSize * Sqrt[3])},​​ {lowerlegCorner[[1]] + (2*legHalfSize), (lowerlegCorner[[2]] + legHalfSize) + (3/2 * footSize), lowerlegCorner[[3]] - (1/2 * footSize * Sqrt[3])}​​ 
    renderGraphicsS takes 3D graphic shapes as input and displays them together within a single region, along with a regular polygon base. It is used later on to assemble all components of the static walker into one rendered scene, making it possible to view the full model in one space.
    Converts all input shapes into region-compatible objects and uses RegionUnion to merge them with the polygon base. Displays the result as a region.
    In[]:=
    renderGraphicsS[hipJoint_, upperLeg_, kneeJoint_, lowerLeg_, ankleJoint_, feet_, nsides_]:=​​ Region​​ RegionUnion​​ RegionProduct​​ RegularPolygon[nsides],​​ Line[{{0.5},{0}}],​​ DiscretizeGraphics[Graphics3D[hipJoint]],​​ DiscretizeGraphics[Graphics3D[upperLeg]],​​ DiscretizeGraphics[Graphics3D[kneeJoint]],​​ DiscretizeGraphics[Graphics3D[lowerLeg]],​​ DiscretizeGraphics[Graphics3D[ankleJoint]],​​ DiscretizeGraphics[Graphics3D[feet]]​​  ​​ 
    modelWalkersStatic takes in the number of sides nsides and generates a static walker based on the vertices of a regular polygon with nsides number of legs. It calculates the positions of joints, legs, and feet from these vertex coordinates. The function outputs a 3D static model. Key variables include nsides (primary), legLength, legXYSize, and footLength (all adjustable, but the walker remains static)
    Takes an integer nsides and parameters for legLength, legXYSize, and footLength, generates nsides evenly spaced 3D coordinates around a unit circle, constructs model composed of upper and lower leg cuboids, spherical joints at hips, knees, and ankles, and custom foot structures, renders the complete structure as a 3D region.
    In[]:=
    modelWalkersStatic[nsides_Integer, legLength_, legXYSize_, footLength_]:=​​ Module{coords, legHalfSize, hipJoint, upperLegCorners, upperLeg, kneeJoint, lowerLegCorners, lowerLeg, ankleJoint, feet, lowerleglength, footSize},​​ ​​ coords = Append[#,0]& /@ CirclePoints[{0,0},1,nsides];​​ legHalfSize = 12 * legXYSize;​​ lowerleglength = legLength;​​ footSize = 12 * footLength;​​ ​​ upperLegCorners = ({# - {legHalfSize, legHalfSize, legLength}, # + {legHalfSize, legHalfSize, 0}})& /@ coords;​​ upperLeg = Cuboid[# - {legHalfSize, legHalfSize, legLength}, # + {legHalfSize, legHalfSize, 0}]& /@ coords;​​ ​​ lowerLegCorners=({# - {legHalfSize, legHalfSize, 2 * legLength}, # + {legHalfSize, legHalfSize, -1 * legLength}})& /@ coords;​​ lowerLeg = Cuboid[# - {legHalfSize, legHalfSize, 2 * legLength}, # + {legHalfSize, legHalfSize, -1 * legLength}]& /@ coords;​​ ​​ hipJoint = Sphere[#,0.15]&/@coords;​​ kneeJoint = Sphere[{#+legHalfSize}, 0.15]& /@ upperLegCorners[[All, 1]];
    ​
    ​
    ankleJoint = Sphere[{#+legHalfSize}, 0.15]& /@ lowerLegCorners[[All,1]];​​ ​​ feet = makeFoot[#, legHalfSize, footSize]&/@lowerLegCorners[[All,1]];​​ ​​ renderGraphicsS[hipJoint, upperLeg, kneeJoint, lowerLeg, ankleJoint, feet, nsides]​​ 
    This code displays the static walker using modelWalkersStatic and defines a few dynamic variables through Manipulate[], namely the number of sides (nsides), leglength, legxysize, footlength, pre-sets value restrictions and increments.
    In[]:=
    Manipulate[​​modelWalkersStatic[nsides,leglength,legxysize,footlength],​​{{nsides,3,"Number of Sides"},3,20,1},​​{{leglength,0.5,"Upper/Lower Leg Length"},0.5,2},​​{{legxysize,0.1,"Width/Length of Leg"},0.05,0.15,0.05},​​{{footlength,0.5,"Foot Length"},0.2,1,0.05},​​SaveDefinitions->True]
    Out[]=
    ​
    Number of Sides
    Upper/Lower Leg Length
    Width/Length of Leg
    Foot Length

    Dynamic Gait Model

    cuboidToPolygons takes the bottom-left and top-right corner coordinates of a cuboid and converts them into the full set of vertex coordinates needed to define six individual polygons. These six polygons together form a 3D shape visually identical to the original cuboid. The key advantage of this approach is that using polygons, rather than cuboids, makes the final graphics-rendering code easier to manage. Additionally, Polygons allows easier dynamic joint rotations — something difficult to achieve with cuboids due to their minimal point specification.
    Converts the two corner points of a cuboid into its eight vertices and returns six polygonal faces by explicitly connecting the appropriate vertex indices.
    makeFoot uses the 30 - 60 - 90 right triangle rule as a template to calculate the positions of the six points needed to define foot prisms . The function generates a single foot based on those calculated points and is later mapped over a list of lower leg positions to create one foot for each leg.
    createRotationTransform implements the concept of hierarchical joint rotation through forward kinematics to simulate the movement of a multi-jointed leg system. In a kinematic chain with three joints — the hip, knee, and ankle — the movement of each segment depends on the rotation and position of the joint above it. The hip joint rotates first, setting the position and orientation of the upper leg. The knee joint then rotates relative to this new position, determining the movement of the lower leg. Finally, the ankle joint rotates relative to the lower leg’s updated orientation, positioning the foot. The function formalizes this process by applying rotation transformations at each joint, one after the other, preserving the mechanical hierarchy and allowing for realistic, joint-dependent motion. This function is applied in a later program to rotate joints relative to one another.
    Generates sequential X, Y, and Z axis rotation transforms about a pivot point from a list of angles (in degrees) and composes them into a single combined transformation.
    renderGraphicsD takes 3D graphic shapes as input, maps specified geometric transformations over them, and displays them together within a single mesh region, along with a regular polygon base. It is used later on to assemble all components of the dynamic walker into one rendered scene, making it possible to view the full dynamic model in one space.
    Transforms joints and limbs using input parameters, converts input shapes into mesh region-compatible objects, uses RegionUnion to merge them with the polygon base. Displays the result as a Mesh Region.
    modelWalkersDynamic takes in the number of sides nsides and generates a polygon body based on the vertices of a regular polygon with nsides number of legs. It calculates the positions of joints, legs, and feet from these vertex coordinates. It applies custom rotation transformations at the hip, knee, and ankle using provided angle matrices to simulate dynamic, time-varying movement. Each rotation is propagated hierarchically and replicated per polygon face to maintain consistent transformations. The function outputs a 3D dynamic walker model. By adjusting the angle magnitudes of the joints in different directions, the user can rotate and move the limbs and joints of the walker.
    Builds a dynamic n-legged walker by generating 3D polygon limbs, spherical hip joints, and pivot points, applies per-joint, per-leg rotation transforms from angle matrices, repeating transforms per polygon, and renders the rotated 3D walker model using Mesh Region.

    Angle vs. Time Formula

    Processing Functions

    We created three processing functions to translate between different methods of information storage and aid in the application of our theoretical function on our gait model. The first function takes raw gyroscope data and converts into an angle vs. time equation. The second function converts angle vs. time equations into graphs. The last function takes in angle vs. time equations and applies them to the gait model.
    Determines the number of legs and duration of time of the data, calculates the phase offset based on the input parameter, restructures the data into an association and replaces all data values with extracted features.
    Plots the thetaEquations as a function of time for each individual joint in each individual leg.
    Extracts time-dependent hip, knee, and ankle angles from thetaEquations for each leg at time t, structures them into per-joint 3D rotation vectors, and feeds them into modelWalkiesDynamic to render the dynamically posed walker.

    Personal Analysis

    Unlike humans, non-bipeds utilize many different gait patterns during movement. Thus, we must begin deriving this equation by establishing a set of common, universalizable gait patterns to compute within. After extensive research, I settled on the trot/tripod, and pace gait patterns.
    ​
    The trot gait pattern can be generalized as a gait cycle divided into two alternating phases, also known as anti-phase. In the first phase, one group of legs — typically composed of diagonal or alternate legs on either side of the body — moves in unison while the remaining legs remain stationary to provide support. In the second phase, the roles reverse: the stationary legs now move together while the others support the body. This alternating movement continues cyclically, creating a balanced gait.
    ​
    Some visual representations of the trot gait pattern are shown below. All red points take the first step, and all blue points take the second step.
    The pace gait pattern can be generalized as a gait cycle divided into two symmetrical phases. In the first phase, one group of legs — typically composed of vertically adjacent legs on the same side of the body — moves in unison while the remaining legs remain stationary to provide support. In the second phase, the roles reverse: the stationary legs now move together while the others support the body. This symmetrical movement continues cyclically, creating a balanced gait.
    ​
    Some visual representations of the pace gait pattern are shown below. All red points take the first step, and all blue points take the second step.
    Here is the programmed version of these phase-offset equations in a function.
    Example Usage
    Maximum angle displacements per joint in nested list form.
    Example: {2, 10} = {2 legs, 10 Degrees Max Displacement}
    Fitting the nested lists to all three models and displaying the outputs as tables.
    Cycle frequency in nested list form.
    Fitting the nested list to all three models and displaying the output as a table.
    Here is the final, programmed version of our naturally-derived angle vs. time model:

    Pattern Validation and Function Generalization

    Before moving on to applying our theoretical, naturally derived model onto our gait model and generating visualizations, we have to validate accuracy by checking for a definite wave pattern in the function’s output. So, we graphed our theoretical model with varying gait patterns and number of legs to check for any inconsistencies using the equationToGraph function. The results are below.
    Pace, 4 legs
    Trot, 8 legs
    After reviewing the graphs, a clear pattern emerged — all of them, regardless of the number of legs or gait pattern, displayed a consistent wave-like form, confirming the model’s accuracy in capturing the gait cycle dynamic.

    Visualizations

    Last but not least, the project culminates in the generation of gait cycle visualizations — a powerful and widely used tool in both biomedical engineering and robotics for analyzing and optimizing locomotion. Using the processing functions, the derived natural formula, and the dynamic walker model, we generated detailed gait cycle visuals by simply inputting our preferred gait pattern and number of legs. This step represents the final, most impactful phase of the project, offering a view of how well the model captures complex, multi-legged movement over time. These visualizations not only validate the system’s accuracy but also demonstrate its potential for future expansion into gait analysis and robotics.
    This is an animated gait cycle visualization. It pulls the natural formula using equationToEquation and runs it through equationToModel using Table. The output is encompassed in ListAnimate, which creates a frame-by-frame animation. Using equationToEquation and equationToModel, we can animate infinite variations of multi-legged walkers.
    These are unanimated frame-by-frame gait cycle visualizations. This type of gait cycle visual is more traditional and common in research, robotics, and medicine. Each chunk of code is generating a gait cycle with a different pattern and/or different number of legs. Using equationToEquation and equationToModel, we can generate gait cycle diagrams for infinite variations of multi-legged walkers.
    Trot, 3 legs
    Pace, 4 legs
    Trot, 5 legs

    Conclusion

    As previously stated, although the biped gait cycle is extensively documented, analyzed, and modeled, gait cycle modeling for multi-legged walkers — both visually and mathematically — remains an under-explored and largely undocumented field. Having access to visual and mathematical models capable of simulating gait for an arbitrary number of legs would be groundbreaking for robotics, biology, engineering, and related fields.
    ​
    PolyLimb aimed to address this gap by creating a dynamic graphic gait model capable of modeling any number of legs, and this effort was wholly successful. The gait model uses hierarchical joint rotation and forward kinematics to precisely control the angles at each of the three joints on every leg. The user has full control over the joint rotations and can increase the number of legs in the model while maintaining accuracy and structural correctness.
    ​
    We also determined a theoretical model to calculate angle changes as a function of time based on the number of legs — a topic that has seen very little prior exploration. This effort was equally successful. Using a parent function, we calculated phase offsets for two different gait patterns and applied scientifically established amplitude and frequency values, fitting them to a power model to predict gait dynamics for any number of legs.
    ​
    Finally, we combined these models to generate complete gait cycle visualizations for specified gait patterns and leg counts. The resulting gait cycles were highly accurate, and our plotted formula outputs revealed a consistent, wave-like pattern that verified the model’s correctness.
    ​
    Altogether, all three of our primary goals were achieved, and we successfully developed a set of powerful tools for gait analysis, robotics, and biomechanics at large.

    Future Directions

    Moving forward, we plan to extend the model to simulate dynamic movement. We’d also like to incorporate real-world biomechanical and robotic data in validation to improve accuracy. Additionally, we aim to develop a stability algorithm that accounts for center of mass and implausible orientations to enhance model reliability. Lastly, we hope to apply this framework in robotics, enabling adaptable, biologically inspired multi-legged robot locomotion.

    References

    ◼
  • Zhang, T., Li, G., & Zhang, Y. (2021). Adaptive admittance control scheme with virtual reality interaction for robot-assisted lower limb strength training. Machines, 9(11), 301. [http://dx.doi.org/10.3390/machines9110301)
  • ◼
  • Modenese, L., & Phillips, A. T. (2012). A model of the lower limb for analysis of human movement. Annals of Biomedical Engineering, 40(5), 1162–1174. [https://doi.org/10.1007/s10439-009-9852-5)
  • ◼
  • Kubow, T., & Full, R. J. (1999). Gait optimization for multi-legged walking robots, with application to a lunar hexapod. (Stanford University PhD Dissertation). [https://purl.stanford.edu/px063cb7934)
  • ◼
  • Azizi, R., et al. (2017). A finite element model of the lower limb during stance phase of gait cycle including the muscle forces. BioMedical Engineering Online, 16(1), 145. [https://doi.org/10.1186/s12938-017-0428-6)
  • ◼
  • Raibert, M., & Hodgins, J. (1991). Gaits and gait transitions for legged robots. The International Journal of Robotics Research, 7(2), 43–61. [https://www.ri.cmu.edu/publications/gaits-and-gait-transitions-for-legged-robots/)
  • ◼
  • Collins, S. H., et al. (1972). Some properties of regularly realizable gait matrices. Mathematical Biosciences, 14(1–2), 99–110. [ https://doi.org/10.1016/0025-5564(72)90033-8)
  • ◼
  • Hirose, S., & Umetani, Y. (1986). A study of the gait control of a quadruped walking vehicle. IEEE Journal of Robotics and Automation, 2(4), 271–281. [ https://doi.org/10.1109/JRA.1986.1087040)
  • ◼
  • Buehler, M., et al. (1989). Leg-ankle-foot system for investigating sensor-based legged locomotion. Proceedings of the IEEE/RSJ International Workshop on Intelligent Robots and Systems, 1, 177–182. [ https://doi.org/10.1109/IROS.1989.637970)
  • ◼
  • Song, S. M., & Waldron, K. J. (1987). The optimally stable ranges of 2n-legged wave gaits. IEEE Transactions on Robotics and Automation, 3(4), 330–338. [https://doi.org/10.1109/21.105087)
  • ◼
  • McGhee, R. B., et al. (1985). Force and motion management in legged locomotion. Proceedings of the 24th IEEE Conference on Decision and Control, 1187–1193. [https://doi.org/10.1109/CDC.1985.268463)
  • Acknowledgements

    I’d first like to extend thanks to my mentor group, including my mentor Joseph Brennan and my group-mates. I wouldn’t have received the guidance necessary to accomplish this milestone without them. Additionally, I’d like to thank the teaching assistants that helped me along the way, including Bertie Bennet and Anoushka Muchhal. I’d also like to thank the Wolfram Summer Research Program as a whole, including directors Rory Foulger, Eryn Gillam, and Megan Davis. Last but not least, I’d like to thank Stephen Wolfram for his amazing initiative and gifting us such a powerful computing language.