top of page

Legged Robots: Keeping Legs Moving

Last time we wrote about keeping the balance. That is the initial problem which appears when we attempt to control our legged robots. Balance is extremely important, but it’s only the tip of the iceberg. In this article we will look closer on the mechanics of walking — how to achieve moving forward simultaneously with balancing. Also, we will look at how we can mimic nature during developing various types of gaits.

How are we walking?

Walking is an obvious activity for all of us. We just move our feet and we walk. Quite simple — we are doing it every day automatically, without thinking about many details:

  • Which leg should I move forward now? Left or right?

  • How high should I lift my foot?

  • How to synchronize my feet movements?

  • What is the optimal trajectory for my foot?

  • Which muscles should I use to make my legs move?

  • How powerful should the movement of my legs be to walk as fast as I want?

  • What/when I want to run or jump?

That list could be much, much longer. The main conclusion is that synthesizing gait isn’t a trivial problem. For people and animals it’s easy because we have motor neurons and a central pattern generator in the lowest level part of the brain. Let’s change the context from neurology to robotics and look at how we can engineer the gait.

The overview of the gait generation presents the picture below:

Source: Dutta, S., Parihar, A., Khanna, A. et al. Programmable coupled oscillators for synchronized locomotion. Nat Commun 10, 3299 (2019).

(Reverse) Engineering the gait

We have many sources of inspiration for how the gait should look like. You can go for a walk to the park and observe people with their pets, watch tutorials about horse riding for beginners or videos with funny dogs on youtube. When you focus on how they walk you will observe that the gait is organised and easy to describe.

The analysis lead us to conclude that:

  • usually animals pair their legs into synchronized groups,

  • time of every step is divided into swing (protraction) and support (retraction) phases.

The most research about gait classification was done with humans (of course) and horses. As we mostly focus on quadrupedal locomotion in this series, let’s stick with a horse as our example. When someone says ‘trot’, ‘gallop’ or other fancy word for walking/running, we instinctively think of horses. This is correct, but some other animals such as elephants or donkeys can do it too, and so can quadrupedal robots.

Source: Weele, Ko & Banning, Erik. (2001). Mode interaction in horses, tea, and other nonlinear oscillators: The universal role of symmetry. American Journal of Physics — AMER J PHYS. 69. 10.1119/1.1378014.

How to program walking?

During programming of our machine, we have many tasks which have to happen simultaneously. In this article we are focusing on the legs movement and proper synchronization of limbs.

First choice is leg trajectory shape. We need a predefined trajectory that will be used as the reference for the foot. In simple words, we need a set of points that define where the foot will be during a single step. There are plenty of ways we can create it. Depending on our choice, there will be differences in generality, number of variables needed to configure trajectory, movement smoothness, energy efficiency and many other parameters.

To generate leg trajectories we can use a mathematical description of any curve that can approximate the shape of letter D.

In the picture above there are few examples of trajectories. One of frequently used curves to describe trajectories are Bezier curves. You can play with them here.

When we have trajectories and we know where we wish to place our feet in space, we need to do math again. We have coordinates in metres(for example: desired foot position X = 0.1m and Y = 0.08m), but our motors can only take angle reference.

The solution is a function called inverse kinematics, which lets us calculate the joint angles based on the desired position in the metric coordinate system. It’s a set of equations based frequently on geometric relationships between parts of our leg mechanism. You can find an example for a simple mechanism here (page 97). It is possible to use more advanced motion planners that also generate reference velocity or torque based on the leg dynamics or additional real/virtual compliance in our control system. All depends on how advanced the control of leg swing we aim.

Last but not least, we have to deal with synchronization and coupling between legs. To solve this problem we have to schedule if the leg has to perform protraction or retraction movement. Depending on available sensor data, we can use information about contacts between foot and ground. That lets us plan gait via contacts. Another simpler way is scheduling with usage of time. There are also possibilities to mix those two approaches.

Independently what we choose, to achieve walking, we have to control scheduled behavior in the real time. When one group of legs does the protraction movement, the other has to do retraction movement while taking care about balance.

Scheduling the gait lets us easily implement various types of gait by simple changes in leg groups or the timing. For example, our robot can trot, gallop or pace depending on chosen gait settings by mixing groups of legs which act as one. Example of different gait sequences(referenced to cat, but legged robot is almost the same, just the other hardware) are presented below:


This article presented the basics of leg trajectory planning and gait synthesizing. That is the base for building more complex and general legged robot control algorithms. Described aspects of leg level control do not address the higher level task — how the leg’s trajectory is connected with movement of the whole robot. It’s the next big topic that we will present in one of the next articles. Stay tuned and be ready for next pieces of knowledge from the world of the legged robots.

If you are interested in this topic and want more specific information feel free to contact us or leave a comment.

CEO and Co-founder at MAB Robotics


bottom of page