1 Introduction

Quadruped robots offer unique superiors over biped or multi-legged robots in terms of stability and avoidance of mechanical complexity. These superiors allow quadruped robots to meet the requirements of various applications, including disaster response, military mission, and planetary exploration [1,2,3]. Specifically, motion generation of quadruped robots is a prerequisite for task realization. Yet, it remains an enormous challenge for quadruped robots due to their intrinsic high redundancy and floating-based dynamics [4].

In the literature, there are lots of works devoted to developing motion generation schemes for legged robots. Early studies started with simplified models, such as Linear Inverted Pendulum Models (LIPM) [5] and spring-loaded inverted pendulum models [6], for legged locomotion [7]. LIPM is one of the simplest models to explain legged balance and thorough mathematical analysis [8]. Kajita is the first to use the LIPM and cart-table model in the field of biped robot motion generation[9]. Subsequently, it has been widely used to generate walking motion for legged robots [10, 11].

Due to the existence of internal and external dynamics constraints and model errors, Model Predictive Control (MPC) iteratively solves model-based optimization problems by predicting the future evolution for the typically constrained systems. Thereby, MPC approaches have good robustness against disturbances and model errors, which are used for biped [12] and quadruped robots [13].

In recent years, complicated dynamics models have been introduced for motion generation [14]. Taking multi-contact scenarios into account, approaches based on the complicated dynamics have emerged as a solution to generate a feasible Center of Mass (CoM) trajectory, angular momentum, and contact forces [15]. Contact sequences can even be optimized simultaneously [16]. However, overly complicated models or optimization algorithms may lead to slow convergence or local minima which limits their use in real applications [17].

Inspired by humans and mammals, a Central Pattern Generator (CPG) can generate natural motions for legged robots to produce stable rhythmic motion using nonlinear oscillators [18]. A CPG-based Motion imitation by learning from animal actions has been studied considering the differences in size, range of motion, and achievable joint torques [19].

Due to the multi-contact locomotion of the quadruped robots, the motion generation algorithms based on inverted pendulum models are usually applied for biped robots [20]. With the concept of the virtual leg, quadruped symmetric gaits can be abstract to a virtual leg. This allows biped and quadruped robots to map to each other in motion generation. Therefore, LIPM and MPC programming algorithms widely used on biped robots are gradually applied to the gait planning of quadruped robots [21, 22].

Compared with other motion generation approaches with complicated models and algorithms, the motion generation framework with simplified model and MPC has the advantages of simple construction, linearity analysis, and high robustness. Therefore, it is widely used for legged locomotion.

In [23], we presented a LIPM-based MPC scheme for quadruped Lateral-Sequence (L-S) walk that generate feasible motions. However, this approach has no been extended to other quadruped symmetric gaits, such as the classic trot gaits, to form a unified motion generation scheme. Besides, the reference Center of Pressure (CoP) is fixed, which restricts the disturbance resistance of the quadruped robot.

In this paper, LIPM is employed for quadruped motion generation through gait pattern conversion based on the virtual leg concept. The trajectories of the CoM and footholds are generated simultaneously. In comparison to prior work [23], the CoP constraint region is extended and linearized specifically for the quadruped trot gait. With the conservative CoP constraints proposed for L-S walk, our approach enables a unified motion generation for quadruped robots, maintaining the same linear constraints and Quadratic Programming (QP) formulation. Another distinguishing feature from prior work is the theoretical calculation of reference CoPs. Leveraging the current state and the LIPM enhances the robustness of the motion generation against disturbances. Additionally, bézier curves are applied to the foot-end trajectory generation during the swing phase, contributing to the formulation of a unified motion generation scheme for both quadruped L-S walk and trot gaits. Finally, the effectiveness of the proposed scheme is validated by simulations and experiments.

The main contributions of this paper are as follows:

  • We present a unified scheme that can tackle the problem of motion generation for both quadruped L-S walk and trot gaits.

  • The extended and conservative linearizations of the CoP constraint allow the L-S walk and trot gaits to be formulated in a unified QP optimization.

  • MPC and foothold adaptation with refined reference CoP make the quadruped locomotion robust against unexpected disturbances.

The rest of this paper is organized as follows: Sect. 2 briefly introduces the state-space dynamics of the LIPM during the predictive horizon. The gait pattern conversion from quadruped L-S walk and pure trot gaits to biped ones, including details on CoP constraints linearization, is described in Sect. 3. Section 4 elaborates the MPC formulation with foothold adaptation and swing phase trajectory planning in detail. The results are presented in Sect. 5, followed by conclusion and future work in Sect. 6.

2 Model Formulation

We consider segmented constant jerks of the CoM as the control input to smooth the trajectory of the CoM and CoP. With the computational efficiency advantage of the simplified model, we introduce a low-dimensional point-mass model to abstract the full-body dynamics of the legged robots. The equation of motion for this point-mass model is:

$$\begin{aligned} \varvec{\dot{x}}(t) =&\begin{bmatrix} \varvec{0} &{} \varvec{I} &{} \varvec{0}\\ \varvec{0} &{} \varvec{0} &{} \varvec{I} \\ \varvec{0} &{} \varvec{0} &{} \varvec{0} \\ \end{bmatrix} \varvec{x}(t) + \begin{bmatrix} \varvec{0} \\ \varvec{0} \\ \varvec{I} \\ \end{bmatrix} \varvec{u}(t) \nonumber \\ \varvec{y}(t) =&\begin{bmatrix} \varvec{I}&\varvec{0}&-\frac{z_{com}}{\ddot{z}_{com} + \textrm{g}} \varvec{I} \end{bmatrix} \varvec{x}(t) \end{aligned}$$
(1)

where \({\varvec{x}(t)} = [x_{com}(t),y_{com}(t),\dot{x}_{com}(t),\dot{y}_{com}(t),\ddot{x}_{com}(t), \ddot{y}_{com}(t)]^T\) represents the state vector of the point-mass model. [\(x_{com}, y_{com}, z_{com}]^T\) is the position of the CoM. Superscript \(^T\) indicates matrix transpose. \(\varvec{u}(t) = [\dddot{x}_{com}(t), \dddot{y}_{com}(t)]^T\) is the input vector which denotes the CoM’s jerk. \(\varvec{y}(t) = [x_{cop}(t),y_{cop}(t)]^T\) is the output vector, which represents the position of the CoP on the ground. \(\varvec{I}\) is the identity matrix of size 2\(\times\)2. \(\textrm{g}\) is a constant gravitational acceleration.

When the height of the CoM varies as a predefined function of time, \((z_{com}(t), \dot{z}_{com}(t), \ddot{z}_{com}(t))\), the CoP dynamics are Linear Time-Variant (LTV). In general, the height \(z_{com}(t)\) of the CoM is often assumed to be constant, making the CoP dynamics (1) Linear Time-Invariant (LTI). The dynamics of the point-mass becomes linear, namely the LIPM, being allowed to formulate the LIPM-based MPC scheme.

In order to simplify the mathematical description of the structure/motion parameters of the LIPM and reduce the dependence of the model analysis results on the parameters, the intrinsic parameters of the system can be reduced to a minimal set of dimensionless parameters by dimensional analysis. The dimensionless variables are set as follows:

$$\begin{aligned}{} & {} \overline{t} = \frac{t}{T}_{c}, \quad {\overline{x}/\overline{y}_{cop}}=\frac{{x/y_{cop}}}{z_{com}} , \quad {\overline{x}/\overline{y}_{com}} =\frac{{x/y_{com}}}{z_{com}} \nonumber \\{} & {} \dot{\overline{x}}/\dot{\overline{y}}_{com} = \frac{{\dot{x}/\dot{y}_{com}}}{z_{com}} T_{c}, \quad {\ddot{\overline{x}}/\ddot{\overline{y}}}_{com}=\frac{{\ddot{x}/\ddot{y}_{com}}}{z_{com}}T_{c}^2 \end{aligned}$$
(2)

where \(\overline{\square }\) denotes the dimensionless variable. x/y represents x or y. Thereby, \({\overline{x}/\overline{y}_{cop}}=\frac{{x/y_{cop}}}{z_{com}}\) equals to \({\overline{x}_{cop}}=\frac{{x_{cop}}}{z_{com}}\) and \({\overline{y}_{cop}}=\frac{{y_{cop}}}{z_{com}}\). \(T_{c} = \sqrt{{z_{com}}/{\textrm{g}}}\) denotes the time constant for the LIPM.

Therefore, the dynamics of the LIPM can be reformulated in the following discrete-time state-space model with a constant sampling interval T:

$$\begin{aligned} \varvec{\overline{x}}(k+1)= & {} \varvec{A} \varvec{\overline{x}}(k) + \varvec{B} \varvec{u}(k) , \nonumber \\ \varvec{\overline{y}}(k)= & {} \varvec{C} \varvec{\overline{x}}(k) \end{aligned}$$
(3)

where state matrix \(\varvec{A}\), input vector \(\varvec{B}\) and output matrix \(\varvec{C}\) can be expressed as:

$$\begin{aligned} \varvec{A}= & {} \begin{bmatrix} 1 &{} 0 &{} T &{} 0 &{} T^2/2 &{} 0 \\ 0 &{} 1 &{} 0 &{} T &{} 0 &{} T^2/2 \\ 0 &{} 0 &{} 1 &{} 0 &{} T &{} 0 \\ 0 &{} 0 &{} 0 &{} 1 &{} 0 &{} T \\ 0 &{} 0 &{} 0 &{} 0 &{} 1 &{} 0 \\ 0 &{} 0 &{} 0 &{} 0 &{} 0 &{} 1 \end{bmatrix}, \nonumber \\ \varvec{B}= & {} \begin{bmatrix} T^3/6 \\ T^3/6 \\ T^2/2 \\ T^2/2 \\ T \\ T \end{bmatrix} , \quad \varvec{C} = \begin{bmatrix} 1 &{} 0 &{} 0 &{} 0 &{} -1 &{} 0 \\ 0 &{} 1 &{} 0 &{} 0 &{} 0 &{} -1 \end{bmatrix} \end{aligned}$$
(4)

Assuming that at the sampling instant \(k_i\), \(k_i>0\), the state \(\varvec{\overline{x}}(k_i)\) provides the current plant information, which is available through direct measurement or state estimation. Given the predictive horizon, the future control, predicted state, and output variables are denoted by:

$$\begin{aligned} \begin{aligned} \varvec{U}(k)&= \begin{bmatrix} \varvec{u}(k_i \mid k_i)^T&\varvec{u}(k_i+1 \mid k_i)^T&\cdots&\varvec{u}(k_i+N-1 \mid k_i)^T \end{bmatrix}^T \\ \varvec{X}(k+1)&= \begin{bmatrix} \varvec{\overline{x}}(k_i+1 \mid k_i)^T&\varvec{\overline{x}}(k_i+2 \mid k_i)^T&\cdots&\varvec{\overline{x}}(k_i+N \mid k_i)^T \end{bmatrix}^T \\ \varvec{Y}(k+1)&= \begin{bmatrix} \varvec{\overline{y}}(k_i+1 \mid k_i)^T&\varvec{\overline{y}}(k_i+2 \mid k_i)^T&\cdots&\varvec{\overline{y}}(k_i+N \mid k_i)^T \end{bmatrix}^T \end{aligned} \end{aligned}$$
(5)

where N is the length of the predictive horizon. \(\varvec{\overline{x}}(k_i+m \mid k_i)\) is the predicted state variable at \(k_i+m\) with given current plant information \(\varvec{\overline{x}}(k_i)\).

Using the set of the future control variables, the predicted state and output variables can be calculated sequentially based on the dynamics (3) recursively. During the predictive horizon NT, the states of CoM and CoP can be described in a compact matrix form as:

$$\begin{aligned} \begin{aligned} \varvec{X}(k+1)&= \begin{bmatrix} \varvec{A} \\ \varvec{A}^2 \\ \vdots \\ \varvec{A}^N \end{bmatrix}\varvec{\overline{x}}(k) + \begin{bmatrix} \varvec{A}^0\varvec{B} &{} 0 &{} \cdots &{} 0 \\ \varvec{A}^{2-1}\varvec{B} &{} \varvec{B} &{} \cdots &{} 0 \\ \vdots &{} \vdots &{} \ddots &{} \vdots \\ \varvec{A}^{N-1}\varvec{B} &{} \varvec{A}^{N-2}\varvec{B} &{} \cdots &{} \varvec{B} \\ \end{bmatrix} \varvec{U}(k) \\ \varvec{Y}(k+1)&= \begin{bmatrix} \varvec{CA} \\ \varvec{CA}^2 \\ \vdots \\ \varvec{CA}^{N} \end{bmatrix}\varvec{\overline{x}}(k) + \begin{bmatrix} \varvec{CA}^0\varvec{B} &{} 0 &{} \cdots &{} 0 \\ \varvec{CA}^{2-1}\varvec{B} &{} \varvec{CA}^{2-2}\varvec{B} &{} \cdots &{} 0 \\ \vdots &{} \vdots &{} \ddots &{} \vdots \\ \varvec{CA}^{N-1}\varvec{B} &{} \varvec{CA}^{N-2}\varvec{B} &{} \cdots &{} \varvec{CA}^{0}\varvec{B} \\ \end{bmatrix} \varvec{U}(k) \end{aligned} \end{aligned}$$
(6)

3 Unified Gait Pattern Conversion

For two most common gait patterns in quadruped mammals, L-S walk (hind-limb footfall followed by the ipsilateral forelimb) and pure trot (trot gait with a duty factor of 50%) gaits, are typically symmetric gaits characterized by all legs have equal contact duration. These quadruped gait patterns can be converted to simpler biped patterns. This work converts the L-S walk and trot gaits of the quadruped robot equivalently to biped ones for uniform motion generation. The gait pattern conversion between the quadruped and biped robots can be depicted in Fig. 1.

Fig. 1
figure 1

Gaits pattern conversion between the L-S walk, pure trot of the quadrupeds and the biped ones. HR (Hind-Right), FR (Front-Right), HL (Hind-Left) and FL (Front-Left) represents the leg index for quadruped robots. R (Right) and L (Left) represent the leg index for biped robots

The gait patterns of the L-S walk and pure trot of the quadrupeds can be conveniently corresponded to that of the bipeds. The sequence of contacts reads from left to right, where the blue and orange bars indicate stance and swing phases of the leg i. HR (Hind-Right), FR (Front-Right), HL (Hind-Left) and FL (Front-Left) represents the leg index for quadruped robots. R (Right) and L (Left) represent the leg index for biped robots. The Anterio-Posterior Sequence (APS) stride cycle is represented by the orange arrow, showing the logical coordination between legs. Starting with the HR leg lift, the dotted rectangle bounded the stride period.

Footfalls transition of the L-S walk gait in the order HR-FR-HL-FL, is mainly observed in the low-speed locomotion of animals. The gray shaded areas indicate the four-foot contact phases for quadruped robots. The trot is a typical rapid two-beat diagonal gait where the two diagonal legs take off and move forward while the other two supporting legs support the torso simultaneously, and then alternate. There is no four-foot contact for pure trot gait. In the case of the walking trot gait (with four-foot contact phases), its corresponding gait pattern conversion is the same as that of the L-S walk gait. The step sequences of these gaits are demonstrated at the top of the gait pattern diagram. Solid and hollow circles represent the foot-ends during the stance and swing phase, respectively. Without special instructions, L-S walk refers to as walk, and pure trot refers to as trot hereafter.

To clearly demonstrate the similar behavior of the quadrupeds and bipeds, the motion evolution of the CoM, CoP, and footholds for walk and trot gaits is depicted in Fig. 2.

Fig. 2
figure 2

Motion evolution of quadruped walk and trot gaits converted into that of bipeds (LIPM with finite-sized foot)

For quadruped L-S walk gait, the quadruped robot keeps at least three feet on the ground and keeps its CoP (red dot) inside the triangle formed by those contact feet. As shown in the left graph, the HR will move forward to replace the FR foothold. During the exchange, the CoP constraint region is converted from triangle 1 to triangle 2. Then it repeats the process on the left side. Through moving one side at a time, the L-S walk gait allows the trajectory of the CoM (black dashed curve) rock left and right periodically to maintain balance with its weight shifted to the currently steady side.

A peculiarity of the trot gait is that the FR and HL legs move in the same way, as do the FL and HR legs. Right and left diagonals alternate in supporting the torso to move it forward as the supporting legs follow a progression from front to back. The diagonal is defined for the involved hind leg (right/left). The quadruped robot works from one pair of diagonals to the other pair. The CoP is restricted to the line segment between the diagonal contact feet. During the left diagonal feet support, the right diagonal feet will move forward from \(\circ\) to \(\bullet\).

It should be noted that not only does the CoM rock from left to right under walk gait, but the trajectory of the CoM also sways slightly with smaller amplitudes under trot gait. The phenomenon can be observed in Fig. 6. The behavior is similar to that of a biped robot in walk gait. With the concept of the virtual leg, the quadruped walk and trot gaits are considered as equivalents to biped walking, which can be easily abstracted to the dynamics of the LIPM. It is assumed that the right/left legs (front and hind) of the quadruped L-S walk are regarded as the right/left virtual leg of the biped. The CoP constrained region is the intersection area of these supporting triangles.

In order to formulate the walk and trot gaits of the quadruped robot uniformly as a problem of linear MPC motion generation, the CoP constraint is linearized by decoupling in the x/y direction. As shown in Fig. 2, the green rectangle represents a simple linearization of the CoP constraint and can be treated as finite-sized virtual feet of the bipeds. The red \(\times\) mark denotes the geometric center of the virtual foot. To be emphasized, the CoP constraint is a conservative linearization for L-S walk gait. However, for trot gait, the CoP constraint is an extended linearization that needs to be updated to guarantee that the CoP is on the support-foot diagonal. The details of the CoP update are depicted in Fig. 3.

Fig. 3
figure 3

CoP position updated under trot gait. \(\bigstar\) denotes the optimal CoP position calculated by MPC. \(\bullet\) denotes the modified CoP position, which is the point of the intersection of the diagonal green line segment restricted by CoP constraints (green dashed rectangle) and perpendicular passing through that optimal CoP position

To make sense, the optimal CoP positions are mapped to the perpendicular feet of the green line segment between the diagonal contact feet. The distance between the optimal and modified CoP positions is considered as an inherent error in the MPC optimization. It is essential to update the optimal CoP due to the inherent constraints of diagonally supported point feet, preventing the exact attainment of the optimal position. Therefore, the modification accounts for the reality of the quadruped locomotion, ensuring a more accurate representation in the MPC optimization process. The extended linearization of the CoP constraints under quadruped trot gait is validated by simulations and experiments in section V.

4 Motion Generation with Adaptive Footholds

4.1 Model Predictive Control

For the given reference CoM position \({x/y}_{com}^{ref}(k_i)\), velocity \(\dot{x}/\dot{y}_{com}^{ref}(k_i)\), and CoP \(x/y_{cop}\) signals at sampling instant \(k_i\), within the predictive horizon, the goal of the predictive control system is to make the predicted states of the CoM and CoP as close as possible to the reference with minimum efforts. By decoupling dynamics in x and y directions, we formulate a cost function \(\varvec{J}\) that reflects the control input as:

$$\begin{aligned} {\varvec{J_{X/Y}}}= & {} \frac{\varvec{w_1}}{2} \left\| \varvec{\dot{X}/\dot{Y}}_{com}(k+1) - \varvec{\dot{X}/\dot{Y}}_{com}^{ref}(k+1) \right\| _2^2 \nonumber \\{} & {} \quad + \frac{\varvec{w_2}}{2} \left\| \varvec{X/Y}_{cop}(k+1) - \varvec{X/Y}_{cop}^{ref}(k+1) \right\| _2^2 \nonumber \\{} & {} \quad + \frac{\varvec{w_3}}{2} \left\| {\varvec{U_{X/Y}}}(k) \right\| _2^2 \end{aligned}$$
(7)

where the first term is linked to the objective of minimizing the errors between the predicted velocities of the CoM and the reference ones, while the second term reflects the CoP errors penalty over the predictive horizon. The third term considers the minimum jerks of the CoM. \(\varvec{w_i}\) is a weight coefficient.

Instead of tracking the predefined CoP and footholds, the online motion can be generated robustly with foothold adaptation. In this work, we define reference CoP positions according to the current and following several footholds (geometric centers of the virtual feet) over the predictive horizon. Therefore, the following footholds can be introduced as another decision variable for optimization. The reference CoP vector for the MPC can be formulated as:

$$\begin{aligned} \varvec{X/Y}_{cop}^{ref}(k+1) = \varvec{V}(k+1)\varvec{p}_{x/y}^0 + \varvec{\tilde{V}}(k+1)\varvec{\tilde{P}}_{x/y}(k) \end{aligned}$$
(8)

with

$$\begin{aligned} \varvec{\tilde{P}}_{x/y}(k) = \begin{bmatrix} \varvec{p}_{x/y}^1&\cdots&\varvec{p}_{x/y}^m \end{bmatrix}^T \end{aligned}$$
(9)
$$\begin{aligned} \begin{aligned} \varvec{V}(k+1)= & {} \begin{bmatrix} 1&\dots&1&0&\dots&0&0&\dots&0 \end{bmatrix}^T \\ \varvec{\tilde{V}}(k+1)= & {} \begin{bmatrix} 0 &{} \dots &{} 0 &{} 1 &{} \dots &{} 1 &{} 0 &{} \dots &{} 0 \\ 0 &{} \dots &{} 0 &{} 0 &{} \dots &{} 0 &{} 1 &{} \dots &{} 1 \\ &{} &{} &{} &{} &{} &{} &{} &{} \ddots \\ \end{bmatrix}^T \end{aligned} \end{aligned}$$
(10)

where \(\varvec{p}_{x/y}^{i}\) indicates the following \(i^{th}\) foothold. Vector \(\varvec{V}(k+1)\in \mathbb {R}^N\) and matrix \(\varvec{\tilde{V}}(k+1)\in \mathbb {R}^{N\times m}\) select the center of the virtual feet for each sampling interval \(k_i\) within the predictive horizon. m denotes the number of the next steps over the predictive horizon. The predictive horizon for this work is defined as the duration of the three steps. In the case of trot gait, there are 5 sample intervals in each step, so \(N=15\). A series of discrete CoM positions and footholds in the sagittal plane over the predictive horizon are depicted in Fig. 4.

Fig. 4
figure 4

A series of discrete CoM positions and footholds in the sagittal plane over predictive horizon

With the current foothold being the origin and the estimated CoM position, a set of the reference CoM positions (gray bullets \(\bullet\)) can be therefore calculated via LIPM dynamics. Large bullets indicate the instantaneous CoM positions that occurs at the step switch. It is assumed that there is no instantaneous effect on the CoM position and velocity. The blue dashed line indicates the instantaneous leg state of the LIPM at the step switch. The blue bullets (\(\bullet\)) indicate the following footholds.

It should be noted that the reference CoP should be carefully defined for better performance. Due to the relationship between CoM and CoP in the equation of motion of a LIPM, given a fixed duration of the stance phase \(T_{st}\) and the CoM states \(x_{com}^{b,i}\), \(\dot{x}_{com}^{b,i}\) at the beginning of \(i^{th}\) step in the sagittal plane, the reference CoP position can be uniquely determined analytically [24].

$$\begin{aligned} p_{x}^{ref,i}= & {} -\frac{w_a (\bar{C}-1)}{D}(x_{com}^{f,i}-\bar{C}x_{com}^{b,i}-T_c \bar{S} \dot{x}_{com}^{b,i}) \nonumber \\{} & {} - \frac{w_b\bar{S}}{T_c D}(\dot{x}_{com}^{f,i} -\frac{\bar{S}}{T_c} x_{com}^{b,i} - \bar{C}\dot{x}_{com}^{b,i}), \quad i \in \{1,2,3\} \end{aligned}$$
(11)

with

$$\begin{aligned} D &=w_a(\bar{C}-1)^2 + w_b(\bar{S}/T_c)^2 \\ \bar{C} &= cosh(t/T_c) \\ \bar{S} &= sinh(t/T_c) \\ \end{aligned}$$
(12)

where \(w_a\) and \(w_b\) are positive weights. Superscript \(^b\) and \(^f\) denote the beginning and final conditions. It should be emphasized that the final velocity, also called the reference CoM velocity, gradually increases or decreases depending on the user’s command, but remains constant at each step.

The linear MPC problem can be reformulated as a canonical convex QP as:

$$\begin{aligned} \begin{aligned} {\varvec{J_{X/Y}}} = arg \min _{\varvec{U}} \quad \frac{1}{2} \varvec{U}^T\varvec{H}&\varvec{U} + \varvec{f}^T \varvec{U} \\ s.t. \qquad \qquad \varvec{C_E}&\varvec{U} + \varvec{c_E} = 0 \\ \varvec{C_I}&\varvec{U} + \varvec{c_I} \ge 0 \end{aligned} \end{aligned}$$
(13)

where \(\varvec{f}\) and \(\varvec{H}\) are the gradient and Hessian matrix of the objective function. \(\varvec{C_E}\), \(\varvec{c_E}\), \(\varvec{C_I}\) and \(\varvec{c_I}\) describe the equality and inequality constraints.

The decision variables are:

$$\begin{aligned} \varvec{U} = \begin{bmatrix} \varvec{U}_{x/y}(k)^T&\varvec{\tilde{P}}_{x/y}(k)^T \end{bmatrix}^T \end{aligned}$$
(14)

To be emphasized, the constraints related to the CoP and foothold range are represented approximately in the form of linear constraints, maintaining a linear MPC formulation. Given the linear CoP constraints represented by the green rectangle as depicted in Fig. 3, the linear CoP constraints can be expressed according to (3) and (14). Likewise, the maximum step range in Cartesian space is conservatively linearized with the specified step duration. As a result, the expressions for the following i th footholds can be derived based on the \(i-1{th}\) footholds (or current foothold for the first foothold) and the maximum step range. The decision variables can be optimized independently in the x and y directions. In general, convex optimization is implemented using the qpOASES library [25].

4.2 Swing Phase Trajectory

After optimizing the CoM jerk and the footholds, the footholds can be reconstructed based on the motion evolution illustrated in Fig. 2. Therefore, the foot-end trajectories of the swing phase are designed using a bézier curve.

$$\begin{aligned} \begin{aligned}&{p}(\breve{t}) = \sum _{j=0}^{n} B^{n}_{j}(\breve{t}) {p}_{j}, \quad \breve{t} \in [0,1] \\&B^{n}_{j}(\breve{t}) = C_{n}^{j}\breve{t}^{j}(1-\breve{t})^{n-j} \end{aligned} \end{aligned}$$
(15)

where \(p_j\) represents the \(j^{th}\) control point. Initial \(p_0\) and final \(p_n\) control points represent the coordinates of the liftoff and touchdown positions (adjacent footholds of the quadruped robot) in each step. n is the degree of the bézier curve. \(\breve{t}\) is the normalization parameter, which ranges from 0 to 1. \(B^{n}_{j}(\breve{t})\) is a Bernstein polynomial function with \(C_{n}^{j} = \frac{n!}{(n-j)!j!}\).

The bézier curve starts at the initial control point and ends at the final control point, which can be calculated by MPC optimization. To ensure the integrity and consistency of the backswing, forward swing, retraction, and downward motion of the foot-end trajectory, ten coordinate points are defined here to form a set of control points for shaping the foot-end trajectory. The degree of the bézier curve is therefore 9.

Since the control points are independent, we can calculate the derivative of a bézier curve directly by differentiating its Bernstein function:

$$\begin{aligned} {p}'(\breve{t}) = \sum _{j=0}^{n} \frac{dB^{n}_{j}(\breve{t})}{d\breve{t}} {p}_{j} = n(B^{n-1}_{j-1}(\breve{t})-B^{n-1}_{j}(\breve{t})) ({p}_{j+1}-{p}_{j}) \end{aligned}$$
(16)

To smooth the liftoff velocities of the foot-end and avoid significant touchdown impacts, the liftoff and touchdown velocities should be set to zero. In this case, the control points \(p_{1}\) and \(p_{8}\) are equal to the initial and final control points in the z direction. In addition, the mammals feature the reaching the foot-end farther out to the footholds. Foot-end backswing after liftoff reduces the commutation impact of the joint, while retraction before touchdown reduces the contact impact [26]. Following this feature, the control points can be set as illustrated in Table 1.

Table 1 Coordinates of the control points

\(p_{lo}\) and \(p_{td}\) represent the coordinates of the liftoff and touchdown positions. \(h_{swing}\) denotes the height of foot-end trajectory. The foot-end trajectory during the swing phase in the sagittal plane can be depicted in Fig. 5. It is important to highlight that the actual footholds may deviate from the desired positions, influenced by factors like actuator tracking errors, early touchdown, etc. In this work, such discrepancies are regarded as disturbances to the system. In the subsequent control cycle, adjustments are implemented based on the estimated states to bring the system back on track.

Fig. 5
figure 5

Bézier-based foot-end trajectory during the swing phase in the sagittal plane with increasing velocity from 0 to 1 m/s

5 Results

To validate the proposed unified motion generation scheme, this section presents a series of tests in simulations and experiments carried out on a physical prototype, EHbot [27]. In this work, related duration parameters were defined for motion generation, as illustrated in Table 2.

Table 2 Related duration valve for motion generation

Note that the parameters are set based on the biped gait pattern, as shown in Fig. 1. Thereby, the duration of the double supporting phases is 0.2 s. The parameters for quadruped robots can be determined by gait pattern conversion.

First, similar to our previous work implemented in quadruped L-S walk gait, the proposed motion generation scheme is simulated under trot gait. The reference velocity was increased from 0 to 0.3 m/s and then gradually decreased to 0. The top view of the CoM, CoP states, and the virtual feet are depicted in Fig. 6.

Fig. 6
figure 6

Top view of the CoM, CoP states and the virtual feet during varying forward trotting

The green dashed rectangle indicates the CoP constraint (virtual biped foot) of the first step with the size of \(0.15L_{l} \times 0.15L_{w}\). \(L_{l}\) = 1.0 m denotes the distance between quadruped front and hind feet under the normal standing condition. While \(L_{w}\) = 0.35 m is the distance between left and right feet of the quadruped prototype, EHbot. The blue and green circles are the foot-ends of the left and right diagonals, while the blue and green line segments represent the left and right virtual feet, respectively. Blue and green cross marks denote the geometric centers of the virtual feet, which is the optimal footholds calculated by the MPC. CoM trajectory is indicated by the black line. The optimal CoP positions are updated to the modified CoP positions, denoted by red bullets on the diagonal segments.

It can be seen that the trajectory of the CoM rocks between left and right during the left and right diagonals alternately supporting the torso. The position and velocity profiles of the CoM are depicted in Fig. 7.

Fig. 7
figure 7

CoM position and velocity profiles with velocity 0–0.5–0 m/s gradually changed

The black and blue lines denote the profiles of the CoM position and velocity, separately. It can be seen that the CoM velocity first increases and then gradually decreases. The non-smooth velocity trajectory of the CoM may result from the combination of (1) discrete CoM positions with finite sampling intervals, and (2) restricted diagonal CoP constraint.

In the second validation, unexpected disturbances are imposed to demonstrate the robustness of the proposed scheme. In this test, velocities disturbances with an amplitude of 0.2 m/s in the x and y directions are introduced during quadruped L-S walk and trot gait. Figure 8 shows the top view of the CoM, CoP states, and virtual feet with quadruped L-S walk gait.

Fig. 8
figure 8

Top view of the CoM, CoP states and the virtual feet during quadruped walking with unexpected velocities disturbances in x and y directions

The size of the CoP constraint region is \(0.05L_{l} \times 0.15L_{w}\). Compared to previous work, the CoP constraint region is set smaller. However, the adaptive and stable motion is still achieved under 0.2 m/s velocity disturbances due to the careful definition of the reference CoP position. After exerting the disturbance at 6.1 s (The purple dashed-dotted line), the generated motion is robust to unexpected disturbances with the foothold adaptation. The corresponding position and velocity profiles of the CoM are depicted in Fig. 9.

Fig. 9
figure 9

CoM position and velocity profiles in the x and y directions with unexpected velocity disturbances

The velocity profiles clearly show the variation of the velocity trajectory of the CoM after exerting velocity disturbances of 0.2 m/s in the x and y directions. It can be seen that despite the instantaneous and dramatic change in CoM velocity, the velocity recovers to normal after about one step.

In addition, unexpected velocity disturbances were exerted on the quadruped trot gait to further validate the effectiveness of the proposed scheme, as depicted in Fig. 10.

Fig. 10
figure 10

Top view of the CoM, CoP states and the virtual feet during quadruped trotting with unexpected velocities disturbances in x and y directions

Similarly, the significant foothold adaptation can be observed after the disturbances are exerted. The geometric center of the virtual foot was shifted laterally by about 0.11 m. Note that the displacement of the CoM also occurs by a similar distance. The velocity recovers after about one step. It can be demonstrated that the proposed motion generation scheme with foothold adaptation has the ability to be robust to unexpected disturbances. The corresponding position and velocity profiles of the CoM are depicted in Fig. 11.

Fig. 11
figure 11

The CoM position and velocity trajectories in the x and y directions during trotting with unexpected velocities. The purple dashed-dotted line denotes the instant when the disturbances is exerted

To compare the performance of the unified motion generation scheme proposed in this work with previous work, the third validation further performs the proposed motion generation on a physical quadruped robot, EHbot, with L-S walk gait (Fig. 12). With the same speed command used in the previous work, the quadruped moves forward at low speed and then stops after several steps. Under the same circumstances (IMU, prototype, computer, etc.), pitch and roll angle profiles of the torso are depicted in Fig. 13.

Fig. 12
figure 12

Experimental results of the EHbot moves forward and then stop with L-S walk gait. The gray shaded area indicates the acceleration duration

The profiles of the torso pitch and roll angles are shown in black and red, respectively. The maximum pitch angle fluctuates from \(-\)0.018 rad to 0.027 rad, and that of the roll angle fluctuates from \(-\)0.04 rad to 0.042 rad. The maximum pitch and roll amplitudes of the fluctuations in quadruped L-S walk gait are no more than 0.05 rad and 0.085 rad, respectively, which is significantly smaller than the maximum amplitudes of 0.07 rad for the pitch angle and 0.12 rad for the roll angle in previous work. It can be seen that the maximum pitch and roll angles occur during the quadruped moves forward. Then the pitch and roll angles fluctuate within a narrow range.

Furthermore, the unified motion generation scheme was subsequently performed on the quadruped prototype with trot gait. Unexpected forces were exerted through lateral kicks at the middle of the torso. Figure 13 depicts the torso angle profiles during the EHbot trotting with three unexpected lateral kicks.

Fig. 13
figure 13

Experimental results when EHbot was kicked (blue shaded area) laterally three times

The blue shaded area indicates the duration of the lateral force exerted during the quadruped trotting in place. Approximately equivalent recovery duration can be seen from the roll angle profile, which recovers about one step (0.5 s) after the lateral forces were exerted.

Figure 14 depicts the experimental snapshots with walk and trot gaits mentioned above, and demonstrates the effectiveness of the proposed unified motion generation approach.

Fig. 14
figure 14

Snapshots of the walk and trot gaits of the quadruped prototype, EHbot

6 Conclusion and Future Work

This paper presents a unified motion generation scheme for two typically symmetric gaits, quadruped L-S walk and pure trot gaits. Based on the gait pattern conversion and CoP constraint linearization, the motion generation of the typical gaits can be solved by a unified LIPM-based MPC formulation. Besides, foothold adaptation is introduced to the MPC optimization. The proposed scheme ensures that the quadrupeds are able to generate robust motion online, not only in the simulations with 0.2 m/s disturbances, but also in the lateral kicks experiments. In comparison to previous work, the results demonstrate that the maximum torso angle amplitude with walk gait is reduced by about 25%, which proves the superiority of the proposed motion generation scheme.

While the current motion generation scheme has only been validated on flat terrain and two typical gaits, our goal is to develop a unified motion generation scheme to further extend the quadruped robots with more symmetric gaits, including jumping, and stable online gait transitions over rough terrain. Other issues not tackled in this work are the rotation of the yaw angle and angular momentum of the system. Future research will focus on the destination based on generalized dynamics that allows for simultaneous walking, jumping, gait transitions, and angular momentum considerations.