1 Introduction

Biped human walking and running is a complicated activity involving complex motor, sensory and neural systems coordination, [1]. The description of all these processes and their coordination is an enormous task demanding detailed knowledge of many biological processes, eventually some of them unknown. The ability of humans to walk requires a long process of learning by trial and error, ultimately associated with the adaptation of several neural mechanisms during human development.

Despite the complexity of human walking, engineers, biologists, physicists, and mathematicians have joined efforts to build machines to reproduce human movements and walking. Models describing the basic features of walking and running inspired the industry to create robots to perform some human activities [2].

Two classes of models were created with entirely different dynamics to reproduce the effects of human walking and running. Walking mechanisms based on an inverted pendulum model were introduced in [3,4,5,6], while [7, 8] pioneered running models based on a spring-mass model. These models have two articulated legs simulating the hip, knees, and feet, with many parameters. These models used different mechanisms for transferring kinetic and potential energies between steps. In all cases, stride dynamics and control are computer-assisted, and all these models are non-solvable in closed form. We refer to [1, 9] for a comparative review of these models. More recently, other models of human gaiting have been derived, introducing foot motion [10] or non-articulated legs with torso segments [11].

Here, we introduce a simplified articulated two-legged robot model with mass concentrated on the hip, and foot motion is dynamically absent. This type of model mimics two-legged stilt walking. Some authors refer to this model as a kneed biped robot [12] or point foot robot [13]. For this class of simpler robot models, the different approaches consider knees with mass and elaborated control systems [12,13,14], and stochastically controlled robots [15]. In these models, stability is critical, and robots should have internal mechanisms for stability control and energy supply to restore the standing leg pendular energy. Moreover, the stride durations in horizontal surfaces are non-constant, and the mathematical models are non-solvable, making the derivation of generic dynamic properties and optimisation goals difficult. Articulated two-legged robot models able to walk on inclined planes have been introduced in [6, 16]. However, these models fail to describe gaiting along uneven surfaces.

We aim to build a solvable model for walking, leading to quantitative predictions about walking dynamics and adaptability to motion on uneven surfaces and inclined planes. The model introduced here assumes that the energy loss is due to the inelastic contact of the trailing leg with the floor at the end of each stride. The robotic leg must have an internal supply of energy that restores the pendulum energy, implying that phase space trajectories remain unchanged. We further imposed that the angle between the standing and trailing legs at the transition between consecutive strides is fixed, ensuring that gaiting in uneven terrains or inclined planes is possible without complex control mechanisms. Therefore this model is a simple proof of concept as it shows the minimal technological solutions to make robots viable.

This paper is organised as follows. In Sect. 2, we build the model for the movement of the two-legged robot along a horizontal flat surface, where the characteristics of the motion and optimisation results as a function of the robot parameter are derived. In Sect. 3, the model is extended for the motion along uneven surfaces and inclined planes. In the final section, we summarise the conclusions of the paper.

2 Motion along a flat surface

In the inverted pendulum basic model of locomotion introduced here, the two-legged robot consists of a mass m representing the hip and two massless articulated legs. One of the legs is the standing leg in no-slip contact with the floor, with a pendular movement, and the other articulated trailing leg makes the transition between strides, enabling gaiting. Between consecutive strides, the two legs interchange their roles. To fix parameters, the total length of each leg is \(\ell \), \(\ell _1\) is the distance from the hip to the knees, \(\ell _2\) is the distance from the knees to the point feet, and \(\ell =\ell _1+\ell _2\). In the following two subsections, we describe the motion of each leg separately.

2.1 The pendular motion of the standing leg

Fig. 1
figure 1

Phases of locomotion of a two-legged robot along a horizontal line, in the positive direction of the x-axis. (i) Starting position of the standing leg 1 at time \(t_0\), making an angle \(\phi _0\) with the horizontal direction. (ii) Final position of the pendulum-like motion of the standing leg at time \(t_{1-}\). At the end of a stride, the transitions between legs are made with the fixed attack angle \(\alpha \), with \(0<\alpha <\pi /2\). During the first stride, phases i) and ii), the movement of the trailing leg 2 is not represented. iii) Starting time of the second stride at time \(t_{1+}\), where the position of the trailing legs 2 is shown. At the time \(t_{1+}\), the roles of the two legs are interchanged. iv) Positions of the two legs at some instant \(t>t_{1+}\), during the second stride. The articulated motion of the trailing leg 2 is described in Sect. 2.2

In Fig. 1, the succession of phases of locomotion of the two-legged robot is represented. The different stages of motion have the following characteristics:

  1. i)

    The motion starts at time \(t=t_0\), with the standing leg 1 making the angle \(\phi (t_0)=\phi _0>\pi /2\) with the horizontal direction, and \(0\le \phi (t) \le \pi \). The motion is in the positive direction of the x-axis. In the first phase of the movement, the initial angular speed of the standing leg 1 is such that \(\dot{\phi }(t_0)<0\), but its absolute value should be large enough for the leg to reach the vertical position at \(\phi =\pi /2\).

  2. ii)

    Position of the standing leg at the transition time between strides at \(t=t_{1-}>t_0\), where the attack angle \(\phi (t_{1-})=\alpha \), with \(0<\alpha <\pi /2\), is a fixed parameter. Between times \(t_0\) and \(t_{1-}\), the movement of the standing leg is pendular.8

  3. iii)

    Position of the standing and trailing legs at \(t=t_{1+}\). The trailing leg upholds on the ground, making an angle \(\pi -\alpha \) with the horizontal direction and an angle \(\alpha \) for the standing leg. The trailing leg makes inelastic contact with the ground and dissipates energy. At time \(t=t_{1+}\), the trailing leg becomes the standing leg (\(2\rightarrow 1\)) and vice versa (\(1\rightarrow 2\)). For the movement to be effective, the two-legged robot must have a source of energy to compensate for the energy dissipated in the inelastic shock with the ground so that the energy of the pendular movement is conserved. The angle \(\beta =\pi -2\alpha \) measures the relative maximal opening of the two legs during a stride.

  4. iv)

    Position of the standing and trailing legs at some time \(t>t_{1+}\). The trailing leg has an articulated movement independent of the movement of the standing leg. During a stride, the leg segment \(\ell _1\) of the trailing leg moves in the direction of the motion, and the leg segment \(\ell _2\) makes a more complex movement that will be described in Sect. 2.2.

In polar coordinates, the equation of motion of the standing leg during phases (i) and (ii) is

$$\begin{aligned} \ddot{\phi }+\frac{g}{\ell } \cos \phi =0, \end{aligned}$$
(1)

which has a total energy

$$\begin{aligned} H=\frac{1}{2}m\ell ^2 {\dot{\phi }}^2+m {g}{\ell } \sin \phi , \end{aligned}$$
(2)

where \(0\le \phi \le \pi \), \(\dot{\phi }\in {\mathbb R}\) and g is the acceleration of gravity. In the range of variation of \(\phi \), the differential equation (1) has only one unstable fixed point with coordinates \((\phi ,\dot{\phi })=(\pi /2,0)\).

As the inverted pendulum Eq. (1) is Hamiltonian, the energy is conserved, and the phase space curves have the equation \(\dot{\phi }=\pm \sqrt{2 E_0/(m \ell ^2)-2 g \sin \phi /\ell }\), where \(E_0\) is the initial energy of the two-legged robot. If \(E_0\ge mg\ell :=E_c\), the phase space curves are defined for \(\phi \in [0,\pi ]\). If \(0\le E_0< E_c\), the phase space curves are defined for \(\phi \in [0,\arcsin (E_0/E_c]\cup [\pi -\arcsin ( E_0/E_c,\pi ]\). In Fig. 2a), we show the phase space curves of the Eq. (1) of the inverted pendulum.

Fig. 2
figure 2

a Phase space curves of Eq. (1), for several energy values \(H=E_0\). b Periodic phase space curve of the standing leg obeying condition (3), with \(g= 9.8\) ms\(^{-2}\), \(\ell =1\) m, \(m=80\) kg, initial energy \(E_0=900\) J, \(\alpha =(\pi /2-0.5)\) rad and \(\phi _0=\pi /2+0.5=(\pi -\alpha )\) rad, which corresponds to the relative maximal opening of the two legs during a stride \(\beta =1\) rad\(=57.3^{\circ }\). The number 1 indicates the initial state of the standing leg, and the number 2 indicates its final state. The arrow indicates the instantaneous change of the trailing to the standing leg, the effect of the energy control mechanism (Eqs. (10)-(11)), and the direction of circulation in the phase space. The phase space curves with energy \(E_c=mg\ell =784\) J, defining the limiting energy necessary for the existence of gaiting, are also represented

For the two-legged robot to start to move and reach the vertical position, the energy deposited in the initial conditions of the pendulum has to obey the condition \(E_0> E_c\). To complete phases i–iii in Fig. 1, by (2), this energy condition leads to

$$\begin{aligned} {\dot{\phi }_0}^2>2\frac{g}{\ell } (1-\sin \phi _0 ). \end{aligned}$$
(3)

In the case of planar motion and for simplicity, it can be assumed that \(\phi _0=(\pi -\alpha )\), and therefore the condition (3) reduces to \({\dot{\phi }_0}^2>2\frac{g}{\ell } (1-\cos \beta /2 )\), where \(\beta =\pi -2\alpha \).

We now calculate the angular speed of the trailing leg at the instant of time \(t_{1+}\). By (2), with \(E_0\) being the initial energy of the standing leg, by conservation of energy, the angular velocity of the trailing leg is

$$\begin{aligned} {\dot{\phi }}(t_1+)={\dot{\phi }}(t_1-)=-\sqrt{2E_0/(m\ell ^2)-2\frac{g}{\ell } \sin \alpha }, \end{aligned}$$
(4)

where the angle \({\phi }(t_{1-})\) is measured relative to the contact point of the standing leg, and \({\phi }(t_{1+})\) is measured relative to the contact point of the trailing leg.

If the initial conditions obey the inequality (3), due to the relationship (4), the robot has a periodic movement along the positive direction of the x-axis (Fig. 2b).

By (2), the duration of one stride is

$$\begin{aligned} T(\phi _0,\alpha ,E_0)&= -\int _{\phi _0}^{\alpha }\frac{d\phi }{\sqrt{2E_0/(m\ell ^2)-2\frac{g}{\ell } \sin \phi }}\\ &=\frac{2}{A}\left( F\left( \frac{\pi -2\alpha }{4},-4\frac{g/\ell }{A^2}\right) -F\left( \frac{\pi -2\phi _0}{4},-4\frac{g/\ell }{A^2}\right) \right) , \end{aligned}$$
(5)

where \(A=\sqrt{2E_0/(m\ell ^2)-2g/\ell }\) and F(xm) is the elliptic integral of the first kind. For the case \(\phi _0=(\pi -\alpha )\),

$$\begin{aligned} T(\pi -\alpha ,\alpha ,E_0)=\frac{4}{A}F\left( \frac{\pi -2\alpha }{4},-4\frac{g/\ell }{A^2}\right) . \end{aligned}$$
(6)

As each stride has length \(a_0=2 \ell \cos \alpha \), the two-legged robot speed during a stride is

$$\begin{aligned} v_m=a_0/T(\pi -\alpha ,\alpha ,E_0)=\frac{\ell \cos \alpha }{2}A\ F\left( \frac{\pi -2\alpha }{4},-4\frac{g/\ell }{A^2}\right) . \end{aligned}$$
(7)

In Fig. 3, we show the duration of the stride of the two-legged robot model along a horizontal surface as a function of the energy \(E_0\) and its speed, for several values of the maximum opening of the legs \(\beta \). This shows that the speed of a stride increases as the energy \(E_0\) or the maximal opening angle \(\beta \) increases.

Fig. 3
figure 3

a Duration of a stride of the two-legged robot model along a horizontal surface as a function of energy \(E_0\), calculated from (6), for several values of \(\beta \). b Speed of a stride as a function of energy \(E_0\), calculated from (7), for several values of \(\beta \). The simulation parameters are \(\phi _0=(\pi -\alpha )=(\pi +\beta )/2\), \(g= 9.8\) ms\(^{-2}\), \( m=80\) kg and \(\ell =1\) m

In Fig. 4, we show the speed of the two-legged robot as a function of the opening of the legs \(\beta \), for several values of the initial energy \(E_0\). So, for each initial energy \(E_0\), there is an angular opening of the legs that maximises the speed of the two-legged robot. The greater the energy \(E_0\), the smaller the angular opening of the legs to maximise the two-legged robot speed.

Fig. 4
figure 4

Speed of a two-legged robot as a function of the opening of the two legs \(\beta \), for several values of the initial energy \(E_0\). The dashed line indicates the maximum value for the speed of the two-legged robot. The simulation parameters are \(\phi _0=(\pi -\alpha )=(\pi +\beta )/2\), \(g= 9.8\) ms\(^{-2}\), \( m=80\) kg and \(\ell =1\) m

For gaiting to be effective, we must impose conservation of energy in the transition of the trailing leg to the standing leg (\(t_{1-}\rightarrow t_{1+}\)). The two-legged robot must have an energy supply system to compensate for the energy lost during the impact with the floor of the trailing leg. This impact is assumed to be inelastic.

At the transition from the trailing to the standing leg, the velocity of the hip mass m is

$$\begin{aligned} \begin{array}{lcl}\displaystyle \textbf{v}(t_{1-})&{}\displaystyle =&{}\displaystyle \ell \dot{\phi }(t_{1-}) (-\sin \phi (t_{1-})\ \textbf{e}_x+\cos \phi (t_{1-})\ \textbf{e}_y)\\ \displaystyle &{}\displaystyle =&{}\displaystyle \ell \dot{\phi }(t_{1-}) (-\sin \alpha \ \textbf{e}_x+\cos \alpha \ \textbf{e}_y). \end{array} \end{aligned}$$
(8)

In the collision with the floor, energy is lost, and the component of \(\textbf{v}(t_{1-})\) along the direction of the trailing leg 2 is absorbed by the ground (inelastic shock). At the instant of time \(t_{1+}\), the direction of the trailing leg 2 is

$$\begin{aligned} \textbf{d}=\cos (\pi -\alpha )\ \textbf{e}_x+\sin (\pi -\alpha )\ \textbf{e}_y. \end{aligned}$$

As the projection of \(\textbf{v}(t_{1-})\) along \(\textbf{d}\) is \(\textbf{v}(t_{1-}).\textbf{d}\), immediately after the shock of the trailing leg with the floor, the velocity of the mass m of the hip is

$$\begin{aligned} \begin{array}{lcl} \textbf{v}'&{}=&{}\textbf{v}(t_{1-})-(\textbf{v}(t_{1-}).\textbf{d})\ \textbf{d}\\ &{}=&{} \ell \dot{\phi }(t_{1-}) \left( \sin \alpha \cos 2\alpha \ \textbf{e}_x+\cos \alpha \cos 2\alpha \ \textbf{e}_x\right) . \end{array} \end{aligned}$$
(9)

So, and as \(\dot{\phi }(t_{1-}) <0\), we have two cases

$$\begin{aligned} \begin{array}{lcl} v_x'\ge 0, \ v_y'\ge 0 &{}\quad \hbox {for}\quad &{} \pi /4\le \alpha<\pi /2\quad \hbox {or}\quad \beta \le \pi /2\\ v_x'<0,\ v_y'<0 &{}\quad \hbox {for}\quad &{} 0\le \alpha <\pi /2\quad \hbox {or}\quad \beta >\pi /2. \end{array} \end{aligned}$$

In the first case, the hip velocity is in the direction of motion after the shock. In the second case, the velocity is directed opposite to the motion. Thus, for the energy of the pendular movement to be conserved in the transitions between strides, it is necessary to compensate for the energy lost in the shock by some mechanism internal to the two-legged robot.

Let \(E_p\) be the energy to be replenished in the transition between strides. If \((v_x'\ge 0, v_y'\ge 0)\), by (8), (9) and (4), then

$$\begin{aligned} E_p&= \frac{1}{2}mv^2-\frac{1}{2}m \textbf{v}^{\prime 2}= \frac{1}{2}m\ell ^2 \dot{\phi }(t_1 -)^2 (1-\cos ^2 (2 \alpha ))\\ &= (E_0-mg \ell \sin \alpha )\sin ^2 (2 \alpha )=(E_0-mg \ell \cos \beta /2 )\sin ^2 ( \beta ).\end{aligned}$$
(10)

If \((v_x'<0,\ v_y'<0)\), as the velocity after the impact has a direction contrary to the direction of the movement and, to maintain gaiting, it is necessary to supply to the mass m the energy

$$\begin{aligned} E_p&=E_0-mg\ell \sin \alpha +\frac{1}{2}m v^{\prime 2}\\ &=E_0-mg\ell \sin \alpha + \frac{1}{2}m\ell ^2 \dot{\phi }(t_1-)^2 \cos ^2 (2 \alpha )\\ &= E_0-mg\ell \sin \alpha +(E_0-mg \ell \sin \alpha )\cos ^2 (2 \alpha )\\ &= (E_0-mg \ell \cos \beta /2 )(1+\cos ^2 (\beta )). \end{aligned}$$
(11)

In Fig. 5, we show the energy \(E_p\) necessary to maintain a stride on a flat surface at the transition time \(t_{1-}\rightarrow t_{1+}\), as a function of \(\beta \). Therefore, the larger the stride, the larger the energy replenishment.

Due to the structure of phase space orbits shown in Fig. 2b and assuming that the energy supply is replenished at each stride, the two-legged robot model presented here is stable, as slight variations in the initial conditions and robot parameters lead to neighbouring closed trajectories in phase space.

Fig. 5
figure 5

Energy necessary to maintain a stride on a flat surface at the transition \(t_{1-}\rightarrow t_{1+}\), as a function of \(\beta =\pi -2\alpha \). \(E_p\) has been calculated by (10) and (11). The simulation parameters are \(\phi _0=(\pi -\alpha )=(\pi +\beta )/2\), \(g= 9.8\) ms\(^{-2}\), \( m=80\) kg and \(\ell =1\) m

2.2 Trailing leg movement

In this model of a robotic leg, during phases i–iii of Fig. 1, the trailing leg has a movement that cannot collide with the floor, and its role alternates with the standing leg.

We further impose that, during one stride, the movement of the foot tip of the trailing leg has three phases, as shown in Fig. 6. In the first phase, the foot of the trailing leg retracts in the opposite direction of motion, while the knee and hip progress in the direction of movement. In the second phase, the foot of the trailing leg moves in the direction of motion until the trailing leg is wholly stretched and makes an angle \(\beta \) relative to the standing leg. Finally, the foot of the trailing leg rotates backwards until the foot tip touches the ground. During this movement, the knee of the trailing leg always moves in the direction of motion. During one stride, the knee of the trailing leg has two phases.

Fig. 6
figure 6

Motion of a two-legged robot during one step. Thin lines represent the movement of the trailing leg. Dotted lines represent the movement of the standing leg. The three phases of the movement of the foot tip of the trailing leg are shown by thick lines. The dashed lines show the knee movement. The retraction and progression movements of the trailing leg foot tip are necessary to maintain a periodic planar motion so that the foot tip does not have contact with the floor. On flat surfaces, the duration of a stride is \(T(\phi _0,\alpha , E_0)\). The first phase of the foot movement of the trailing leg has duration \(\gamma _f T\), the second phase has duration \((\gamma _k-\gamma _f) T\), and the third phase has duration \((1-\gamma _k) T\). The simulation parameters are \((x_0,y_0)=(0,0)\), \(\phi _0=110^{\circ }\), \(\alpha =70^{\circ }\), \(E_0=800\) J, \(g= 9.8\) ms\(^{-2}\), \(m=80\) kg, \(\ell =1\) m, \(\ell _1=0.5\) m, \( \gamma _f=0.1\), \(\gamma _k=0.8\) and \(\alpha _r=-40^{\circ }\)

To describe the movement of the trailing leg during a stride, we consider the rotation matrix

$$\begin{aligned} R(\omega ,t)=\begin{pmatrix} \cos \omega t &{} -\sin \omega t \\ \sin \omega t &{} \cos \omega t \end{pmatrix}. \end{aligned}$$
(12)

Let \(t_0\) (Fig. 1) be the initial time of a stride and \((x_0,y_0)\) the coordinates of the support point of the standing leg. The positions of the hip, knee and trailing leg foot tip are \((x_h,y_h)\), \((x_k,y_k)\) and \((x_f,y_f)\), respectively.

First phase of the movement of the knee of the trailing leg. During a stride, the first phase of the movement of the knee of the trailing leg has coordinates

$$\begin{aligned} \begin{pmatrix}{x}_k(t)\\ {y}_k(t)\end{pmatrix}= \begin{pmatrix}{x}_h(t)\\ {y}_h(t)\end{pmatrix}+\ell _1 R(\omega _k,t-t_0) \begin{pmatrix} \cos \phi _1\\ \sin \phi _1\end{pmatrix}, \end{aligned}$$
(13)

where \({x}_h(t)=x_0+\ell \cos \phi (t)\), \({y}_h(t)=y_0+\ell \sin \phi (t)\) and \(\phi (t) \) is solution of equation (1), for the initial condition \(\phi _0=\phi (t_0)\) and \((t-t_0)\in [0,\gamma _k T(\phi _0,\alpha , E_0)]\). The angle \(\phi _1=(\pi +\alpha )\) is the orientation of the trailing leg at the beginning of the stride, measured relative to the position of the hip (Fig. 6). The new parameter \(\gamma _k <1\) describes the duration of the first movement of the knee of the trailing leg, measured as a fraction of the time of one step. Consider the new angle

$$\begin{aligned} \phi _2=\pi +\beta +\arctan \frac{(y_h(\gamma _k T(\phi _0,\alpha , E_0))-y_0)}{(x_h(\gamma _k T(\phi _0,\alpha , E_0))-x_0)}, \end{aligned}$$
(14)

describing, at time \(t=\gamma _k T(\phi _0,\alpha , E_0)\), the orientation of the segment \(\ell _1\) of the trailing leg, measured relative to the position of the hip. Thus, from the condition \(\omega _k\gamma _k T(\phi _0,\alpha , E_0)=(\phi _2-\phi _1)\) (Fig. 6), it follows that

$$\begin{aligned} \omega _k=(\phi _2-\phi _1) /(\gamma _k T(\phi _0,\alpha , E_0))>0, \end{aligned}$$
(15)

where \(\omega _k\) and \(\phi _2\) are determined by the choices of \(\gamma _k\) and the remaining stride parameters. In Fig. 6, in dashed lines, we represent the first phase of movement of the knee of the trailing leg, calculated by (13)-(15).

First and second phase of the movement of the trailing leg foot tip. During the first phase of the movement of the foot of the trailing leg, its coordinates are

$$\begin{aligned} \begin{pmatrix}{x}_{f_1}(t)\\ {y}_{f_1}(t)\end{pmatrix}= \begin{pmatrix}{x}_k(t)\\ {y}_k(t)\end{pmatrix}+\ell _2 R(\omega _{f_1},t-t_0) \begin{pmatrix} \cos (2\pi -\phi _0)\\ \sin (2\pi -\phi _0)\end{pmatrix}, \end{aligned}$$
(16)

where \(\omega _{f_1}<0\) is a parameter to be determined, the new parameter \(\gamma _f\) is such that \(0<\gamma _f<\gamma _k\), and \((t-t_0)\in [0,\gamma _f T(\phi _0,\alpha , E_0)]\). The maximum angle of retraction of the foot of the trailing leg, measured relative to the initial position of the standing leg, is

$$\begin{aligned} -\pi<\alpha _{r}<0. \end{aligned}$$
(17)

Thus, from the condition \(\omega _{f_1}\gamma _f T(\phi _0,\alpha , E_0)=\alpha _r\), it follows that

$$\begin{aligned} \omega _{f_1}= \alpha _r /(\gamma _f T(\phi _0,\alpha , E_0))<0, \end{aligned}$$
(18)

where \(\omega _{f_1}\) is determined by the choices of \(\gamma _f\), \(\alpha _r\) and the remaining stride parameters (Fig. 6).

In the time interval \(t-t_0\in [\gamma _f T(\phi _0,\alpha , E_0),\gamma _kT(\phi _0,\alpha , E_0)]\) — second phase of the movement of the foot of the trailing leg, the foot of the trailing leg has the trajectory

$$\begin{aligned} \begin{pmatrix}{x}_{f_2}(t)\\ {y}_{f_2}(t)\end{pmatrix}&= \begin{pmatrix}{x}_k(t)\\ {y}_k(t)\end{pmatrix}\\ &\quad +\ell _2 R(\omega _{f_2},t-\gamma _f T(\phi _0,\alpha , E_0 )) \begin{pmatrix} \cos (\phi _1+\alpha _r)\\ \sin (\phi _1+\alpha _r)\end{pmatrix}, \end{aligned}$$
(19)

where

$$\begin{aligned} \omega _{f_2}=(\phi _2-\phi _1-\alpha _r) /((\gamma _k-\gamma _f) T(\phi _0,\alpha , E_0))>0. \end{aligned}$$
(20)

In Fig. 6, the thick line represents the foot movement of the trailing leg foot tip, calculated by (16)–(20).

Second phase of movement of the knee and third phase of movement of the foot of the trailing leg. In this case, the movement occurs during the time interval \(t-t_0\in [\gamma _k T(\phi _0,\alpha , E_0),T(\phi _0,\alpha ,E_0)]\) and the knee has coordinates

$$\begin{aligned} \begin{pmatrix}{x}_{k2}(t)\\ {y}_{k2}(t)\end{pmatrix}= \begin{pmatrix}{x}_h(t)\\ {y}_h(t)\end{pmatrix}+\ell _1 \begin{pmatrix} \cos (\phi _3(t))\\ \sin (\phi _3(t))\end{pmatrix}, \end{aligned}$$
(21)

where

$$\begin{aligned} \phi _3(t)=\pi +\beta +\arctan ((y_h(t)-y_0)/(x_h(t)-x_0)). \end{aligned}$$

Likewise, the movement of the foot has coordinates

$$\begin{aligned} \begin{pmatrix}{x}_{f_3}(t)\\ {y}_{f_3}(t)\end{pmatrix}= \begin{pmatrix}{x}_h(t)\\ {y}_h(t)\end{pmatrix}+\ell \begin{pmatrix} \cos (\phi _3(t))\\ \sin (\phi _3(t))\end{pmatrix}. \end{aligned}$$
(22)

A sufficient condition for the effectiveness of a stride of the two-legged robot is that \(y_{f_1}(t)>0\), for every \(t\in (t_0,\gamma _fT(\phi _0,\alpha , E_0)]\), and \(y_{f_2}(t)\ge 0\), for every \(t\in [\gamma _f T(\phi _0,\alpha , E_0),\gamma _k T(\phi _0,\alpha , E_0)]\). These two conditions depend on the choice of the stride parameters. There can be no retraction in the first phase of the foot tip of the trailing leg. With a different choice of parameters, the foot movement of the trailing leg does not necessarily have a retraction movement (Fig. 7), although \(\alpha _r<0\).

Fig. 7
figure 7

Motion of the foot tip of the trailing leg showing no retraction. The simulation parameters are \((x_0,y_0)=(0,0)\), \(\phi _0=110^{\circ }\), \(\alpha =70^{\circ }\), \(E_0=800\) J, \(g= 9.8\) ms\(^{-2}\), \(m=80\) kg, \(\ell =1\) m, \(\ell _1=0.5\) m; a) \(\gamma _f=0.2\), \(\gamma _k=0.7\) and \(\alpha _r=-20^{\circ }\); b) \(\gamma _f=0.6\), \(\gamma _k=0.7\) and \(\alpha _r=-80^{\circ }\). If \(\gamma _f=\gamma _k<1\), the second phase of the movement of the foot of the trailing leg is instantaneous

In analysed cases, the two-legged robot motion on a flat surface is periodic and can be extended to \(t\in {\mathbb R}\). To visualise the movement of the two-legged robot, in Fig. 8, we show the positions of the two legs during one stride on a flat surface.

Fig. 8
figure 8

Temporal evolution of the position of the two-legged robot during one stride. As the surface is flat, this stride extends to a gaiting motion. The simulation parameters are \((x_0,y_0)=(0,0)\), \(\phi _0=110^{\circ }\), \(\alpha =70^{\circ }\), \(E_0=800\) J, \(g= 9.8\) ms\(^{-2}\), \(m=80\) kg, \(\ell =1\) m, \(\ell _1=0.5\) m, \( \gamma _f=0.4\), \(\gamma _k=0.7\) and \(\alpha _r=-80^{\circ }\). The duration of a stride is \(T=0.84\) s, and its length is 0.68 m

In the Supplementary Material, we present a video of the motion of the two-legged robot on a horizontal surface (robot-flat.mp4), showing the reversibility of the biped motion.

The stride is expected to adapt to the motion on uneven surfaces with the model just developed for horizontal surfaces. Thus, the minimum distance from the foot of the trailing leg to the floor

$$\begin{aligned} d_f(\gamma _f,\gamma _k)=\min _{t\in [\gamma _f T, \gamma _k T]}y_{f_2}(t) \end{aligned}$$
(23)

has been analysed as a function of \(\gamma _f\) and for various values of \(\gamma _k\) and \(\alpha _r\). As shown in Fig. 9, in some cases, there is a choice of the parameters \(\gamma _f\), \(\gamma _k\) and \(\alpha _r\) to keep the foot tip of the trailing leg away from the floor.

Fig. 9
figure 9

Minimum distance from the foot tip of the trailing leg to the floor (23), during one stride, as a function of \(\gamma _f\), for several values of \(\gamma _k\) and \(\alpha _r\). The remaining parameters of the simulation are \((x_0,y_0)=(0,0)\), \(\phi _0=110^{\circ }\), \(\alpha =70^{\circ }\), \(E_0=800\) J, \(g= 9.8\) ms\(^{-2}\), \(m=80\) kg, \(\ell =1\) m and \(\ell _1=0.5\) m

3 Motion on non-planar surfaces and inclined planes

To reach the final support position without touching the floor, the trailing leg is articulated at the knee (Figs. 7 and 8). The same model can be applied to consecutive strides on non-planar surfaces, described by continuous and differentiable functions \(y= f(x)\), with \(x\in {\mathbb R}\), deviating slightly from the horizontal line. Let

$$\begin{aligned} d_{sr}=\max _{x\in {\mathbb R}} f(x)-\min _{x\in {\mathbb R}} f(x)<\infty \end{aligned}$$
(24)

be the surface roughness parameter. Assume that \(d_{sr}\) is less than the minimum distance from the foot of the trailing leg to the ground during the second phase of the movement of the foot of the trailing leg. That is,

$$\begin{aligned} d_{sr}<d_f=\min _{t\in [\gamma _f T, \gamma _k T]}y_{f_2}(t) \end{aligned}$$
(25)

Imposing further that \(|f'(x)|<\tan \alpha \), for all \(x\in {\mathbb R}\), the standing leg can not have another contact with the floor except at the supporting point.

Fig. 10
figure 10

Position of the two-legged robot on a non-horizontal surface described by the function \(y=f(x)\ge 0\). When the two feet are simultaneously supported, the robotic leg forms an isosceles triangle with angles \(\alpha \) and \(\beta \), where \(\beta +2\alpha =\pi \). The distance between the two feet are \(\ell _b=\ell \sqrt{2-2\cos \beta }\)

Consider that the movement on a non-planar surface is described by a continuous and differentiable function \(y=f(x) \ge 0\), with \(|f'(x)|<\tan \alpha \). In the transition between strides, the two legs of the robot are supported on a non-planar floor, and the robot has the geometry of an isosceles triangle with angles such that \(\beta +2\alpha =\pi \) (Fig. 10). Let \((x_0,y_0=f(x_0))\) be the initial coordinates of the foot of the standing leg. By a simple calculation,

$$\begin{aligned} \left\{ \begin{array}{l} x_m=x_0-\ell \cos (\alpha +r)+\ell \cos (\phi _{0}+r)\\ y_m=y_0-\ell \sin (\alpha +r)+\ell \sin (\phi _{0}+r), \end{array}\right. \end{aligned}$$
(26)

where r is an angle dependent on the shape of the surface (Fig. 10), determined by the condition

$$\begin{aligned} y_m=f(x_m). \end{aligned}$$
(27)

The angle \(\phi _{0}'=\phi _{0}+r\), calculated at each transition between strides, replaces the angle \(\phi _0\) of the Fig. 1 (Fig. 10). Therefore, the initial angle of the trailing leg, measured relative to the hip position, is

$$\begin{aligned} \phi _{12}=\pi +\phi _{0}'-\beta . \end{aligned}$$
(28)

The motion of the robotic leg starts with the position of both feet determined by (26)–(28).

Starting from the initial positions of the two legs with fixed \(\beta \), the movement proceeds according to the rules determined in the previous section. The time of a stride is estimated by (5), and there is a new stride time calculated during each stride. As, by (22), the coordinates of the trailing leg foot tip are \((x_{f_3}(t),y_{f_3}(t))\), with \(t\ge \gamma _k T(\phi _{02},\alpha , E_0)\), the foot tip hit the ground at the new instant of time \(t=T_f\) determined by the condition

$$\begin{aligned} y_{f_3}(t)=f(x_{f_3}(t)), \end{aligned}$$
(29)

with \(t\ge \gamma _k T(\phi _{02},\alpha , E_0)\). Therefore, you can use the model from the previous section where the duration of strides \(T_f\) varies from stride to stride, depending on the shape of the surfaces.

Consider a surface described by the function

$$\begin{aligned} {\tilde{f}}(x)=d(1+\sin (\omega x))/2, \end{aligned}$$
(30)

where the roughness parameter (24) of this surface is \(d_{sr}=d\). In Fig. 11, we show the gait movements on this non-planar surface.

Fig. 11
figure 11

Temporal evolution of the position of the two-legged robot on a non-planar surface described by the function (30), with the choice \(d=0.1\) m and \(\omega =4\) Hz. The simulation parameters are \((x_0,y_0)=(0,f(0))\), \(\phi _0=110^{\circ }\), \(\alpha =70^{\circ }\), \(E_0=800\) J, \(g= 9.8\) ms\(^{-2}\), \(m=80\) kg, \(\ell =1\) m, \(\ell _1=0.5\) m, \(\gamma _f=0.45\), \(\gamma _k=0.5\) and \(\alpha _r=-80^{\circ }\). With the data from Fig. 9, by (25), \(d_f=0.108>d_{sr}=d\), and \(f'(x)=d\omega /2=0.2<\tan \alpha =2.75\)

Fig. 12
figure 12

Temporal evolution of the position of the two-legged robot on a continuous and piecewise linear surface. The shape of the surface is described by the function (31), with \(k=0.12\). The parameters of the robotic leg are the same as in Fig. 11

In Fig. 12, we show the movement of the two-legged robot on inclined plane surfaces described by the function

$$\begin{aligned} g(x)=\left\{ \begin{array}{ll} &{}k (x+1)\quad \hbox {if}\quad x\le 2\\ -&{}k(x-5)\quad \hbox {if}\quad x\ge 2.\end{array}\right. \end{aligned}$$
(31)

In the Supplementary Material, we show two videos of the motion of the two-legged robot on a non-planar surface (robot-sin.mp4) and inclined planes (robot-inc.mp4).

4 Conclusions

The two-legged robot mimics the motion of the articulated legs of biped motion, and the energy loss is exclusively associated with the inelastic contact of the legs with the floor. We have not considered the musculoskeletal mechanic control and energy supply in human walking. In the model, feet are absent, an important contribution to the verticality and stability of human walking. The degrees of freedom of the articulated legs introduce the possibility of walking and running on uneven surfaces without any learning and adaption systems, essential for human-type walking.

Even with these simplifications, the solvable walking model introduced leads to the following conclusions:

  1. (a)

    The articulated two-legged robot motion along a flat surface is possible provided that the initial angular speed of the standing leg obeys the condition \({\dot{\phi }_0}^2>2\frac{g}{\ell } (1-\cos \beta /2 )\), or, equivalently, that the initial pendulum energy obeys the condition \(E_0 >mg\ell \), where m is the mass of the two-legged robot, \(\ell \) is the length of the legs, and g is the acceleration of gravity.

  2. (b)

    The robotic leg must have an internal energy supply mechanism to receive the energy \(E_p\) in the transition between steps, calculated in (10) and (11). The energy cost of walking after n steps is \(E_0+(n-1)E_p\).

  3. (c)

    The speed of stride of the two-legged robot is

    $$\begin{aligned} v_m=\frac{\ell \cos \alpha }{2}A\ F\left( \frac{\pi -2\alpha }{4},-4\frac{g/\ell }{A^2}\right) . \end{aligned}$$

    where F is the elliptic integral of the first kind and \(A=\sqrt{2E_0/(m\ell ^2)-2g/\ell }\). Under these conditions, gaiting is stable along horizontal surfaces, and the motion is reversible in time, modelling the different types of biped motion, as in the cases of humans and flamingos.

  4. d)

    For each value of the pendular energy \(E_0\) of the two-legged robot, there is a value of the opening angle \(\beta \) that maximises the robot speed (Fig. 4). Moreover, the larger the strides, the larger the energy necessary to maintain gaiting, and the greater the energy \(E_0\), the smaller the angular opening of the legs to maximise the two-legged robot speed.

  5. e)

    The articulated two-legged robot can move along uneven smooth surfaces and inclined planes, provided that the distance from the tip of the trailing leg to the ground during the second phase of the foot movement is larger than the roughness of the ground (24). The distance from the tip of the trailing leg to the ground can be adjusted by choosing robot parameters (Fig. 7).

In conclusion, the solvable model of a two-legged robot presented here describes the main features of the different types of biped motion and allows for plasticity and adaptability of gaiting, depending on eight independent parameters (m, \(\ell _1\), \(\ell _2\), \(E_0\), \(\alpha \), \(\gamma _f\), \(\gamma _k\) and \(\alpha _r\)). This model is stable, as minor initial conditions and robot parameter variations lead to neighbouring closed trajectories in phase space.