Attitude Control of Quadruped Robot Uphill Foot End Based on Inertial Measurement and LSTM Algorithm

In the field of robotics, the development of quadruped robots, often referred to as robot dogs, has gained significant attention due to their exceptional adaptability and stability in complex environments. These robot dogs are particularly useful in applications such as search and rescue, military reconnaissance, and exploration of rugged terrains. One critical challenge faced by quadruped robots is maintaining stability during uphill locomotion, where improper foot-end attitude control can lead to tipping or slipping. Traditional methods for controlling the attitude of quadruped robots often rely on precise dynamic models or predefined gait patterns, which may lack robustness in unpredictable uphill scenarios. To address this, we propose a novel approach that integrates inertial measurement units (IMUs) with Long Short-Term Memory (LSTM) algorithms to achieve precise foot-end attitude control for quadruped robots on slopes. This method enables real-time adjustment of foot position and orientation, enhancing the robot dog’s ability to traverse inclines smoothly without instability.

The core of our approach involves using IMUs equipped with accelerometers and gyroscopes to collect acceleration and angular velocity data from the quadruped robot’s legs during uphill motion. This data is processed through quaternion-based algorithms and integration to derive the robot’s attitude parameters, including pitch, roll, and yaw angles. These parameters serve as input to an LSTM model, which predicts the desired foot-end position and velocity. The predictions are then fed into a Model Predictive Control (MPC) system, along with real-time foot position and velocity from the IMUs, to compute joint torques for the swinging legs. By combining this with the robot’s kinematic model, we continuously adjust the foot-end position in the robot’s coordinate system, ensuring stable uphill locomotion for the quadruped robot. This integrated method not only prevents slippage but also optimizes the robot dog’s performance on various slope transitions, from the base to the top.

Inertial Measurement-Based Attitude Estimation for Quadruped Robots

To accurately capture the attitude of a quadruped robot during uphill motion, we employ four inertial measurement units (IMUs), each installed on one of the robot’s legs. Each IMU node includes a three-axis accelerometer and a gyroscope, which measure linear acceleration and angular velocity, respectively. The data acquisition is handled by a microcontroller, such as the MSP430F149, operating at a CPU clock frequency of 1.0 MHz. The collected data is transmitted via a 2.4 GHz wireless channel to a PC for real-time attitude estimation. This setup allows us to monitor the dynamic behavior of the robot dog’s legs, providing essential inputs for subsequent control algorithms.

The attitude estimation on the PC utilizes the quaternion method, which is computationally efficient and avoids singularities or degeneracies common in other representations. The transformation matrix from the body frame to the navigation frame is expressed using quaternions as follows:

$$ C_n^b = \begin{bmatrix} q_0^2 + q_1^2 – q_2^2 – q_3^2 & 2(q_1 q_2 – q_0 q_3) & 2(q_1 q_3 + q_0 q_2) \\ 2(q_1 q_2 + q_0 q_3) & q_0^2 – q_1^2 + q_2^2 – q_3^2 & 2(q_2 q_3 + q_0 q_1) \\ 2(q_1 q_3 – q_0 q_2) & 2(q_2 q_3 + q_0 q_1) & q_0^2 – q_1^2 + q_2^2 + q_3^2 \end{bmatrix} $$

where \( q_0, q_1, q_2, q_3 \) are the quaternion components describing the orientation. The differential equation for the quaternions is given by:

$$ \begin{bmatrix} \dot{q}_0 \\ \dot{q}_1 \\ \dot{q}_2 \\ \dot{q}_3 \end{bmatrix} = \frac{1}{2} \begin{bmatrix} 0 & -\omega_x & -\omega_y & -\omega_z \\ \omega_x & 0 & \omega_z & -\omega_y \\ \omega_y & -\omega_z & 0 & \omega_x \\ \omega_z & \omega_y & -\omega_x & 0 \end{bmatrix} \begin{bmatrix} q_0 \\ q_1 \\ q_2 \\ q_3 \end{bmatrix} $$

Here, \( \omega_x, \omega_y, \omega_z \) represent the angular velocities measured by the gyroscope in the body frame’s x, y, and z directions, respectively. The quaternion values are computed by solving this differential equation. The attitude angles—pitch (\( \gamma \)), roll (\( \theta \)), and yaw (\( \phi \))—are then derived as:

$$ \begin{bmatrix} \gamma \\ \theta \\ \phi \end{bmatrix} = \begin{bmatrix} \arctan\left( \frac{2(q_2 q_3 + q_0 q_1)}{q_0^2 – q_1^2 – q_2^2 + q_3^2} \right) \\ \arcsin\left( 2(q_0 q_2 – q_1 q_3) \right) \\ \arctan\left( \frac{2(q_1 q_2 + q_0 q_3)}{q_0^2 + q_1^2 – q_2^2 – q_3^2} \right) \end{bmatrix} $$

Additionally, the velocity of the quadruped robot is obtained by integrating the acceleration data from the accelerometer. This comprehensive attitude estimation forms the foundation for predicting the robot dog’s desired foot-end position and velocity, which are crucial for stable uphill locomotion of the quadruped robot.

LSTM-Based Prediction of Desired Foot-End Position and Velocity

Long Short-Term Memory (LSTM) networks are a type of recurrent neural network (RNN) designed to handle sequential data by capturing long-term dependencies. In our method, the time-series attitude data obtained from inertial measurements—comprising pitch, roll, and yaw angles—are fed into an LSTM model to predict the desired foot-end position and velocity for the quadruped robot. This prediction helps determine when the robot dog’s foot should contact the slope surface during uphill motion, facilitating precise attitude control. The LSTM neuron structure consists of input, forget, and output gates that regulate the flow of information, enabling the network to learn complex temporal patterns in the quadruped robot’s movement.

The forget gate \( f_t \) determines how much of the previous cell state should be retained, and is computed as:

$$ f_t = \sigma(W_f \cdot [h_{t-1}, x_t] + b_f) $$

where \( x_t \) is the input at time step \( t \), \( h_{t-1} \) is the previous hidden state, \( \sigma \) is the sigmoid function, \( W_f \) is the weight matrix, and \( b_f \) is the bias term. The cell state update involves the input gate \( i_t \) and a candidate cell state \( \tilde{C}_t \):

$$ \tilde{C}_t = \tanh(W_c \cdot [h_{t-1}, x_t] + b_c) $$
$$ C_t = f_t \cdot C_{t-1} + i_t \cdot \tilde{C}_t $$

Here, \( C_t \) is the updated cell state, and \( i_t \) is calculated similarly to the forget gate. The output gate \( o_t \) controls the exposure of the cell state to the hidden layer:

$$ o_t = \sigma(W_o \cdot [h_{t-1}, x_t] + b_o) $$
$$ h_t = o_t \cdot \tanh(C_t) $$

The LSTM model is trained to minimize the error between predicted and actual foot-end sequences. The error function \( E \) is defined as the difference between the predicted output \( h_t \) and the true sequence \( y_t \):

$$ E = | h_t – y_t | $$

During backpropagation through time, the gradients are computed to update the weights. The error gradient with respect to the cell state \( \delta_{c_t} \) is accumulated over time steps:

$$ \delta’_{c_t} = \delta_{c_t} + \delta_{h_t} \cdot o_t \cdot (1 – \tanh^2(C_t)) $$

The gradients for the gates and cell state are derived as:

$$ \delta_{i_t} = \delta_{c_t} \cdot \tilde{C}_t $$
$$ \delta_{f_t} = \delta_{c_t} \cdot C_{t-1} $$
$$ \delta_{\tilde{C}_t} = \delta_{c_t} \cdot i_t $$
$$ \delta_{C_{t-1}} = \delta_{c_t} \cdot f_t $$

These gradients are used to update the weight matrices, ensuring the LSTM model adapts to the quadruped robot’s dynamic behavior. By continuously refining the predictions, the LSTM provides accurate estimates of the desired foot-end position and velocity for the robot dog, which are essential for the subsequent model predictive control phase. This approach enhances the robustness of the quadruped robot in handling varying slope conditions.

Model Predictive Control for Uphill Foot-End Attitude Control

Model Predictive Control (MPC) is employed to regulate the foot-end attitude of the quadruped robot during uphill locomotion. The MPC controller integrates the predicted desired position and velocity from the LSTM model with real-time data from the IMUs to compute optimal control forces. The control process begins by defining the coordinate systems involved in the robot dog’s motion on a slope. As illustrated in the figure below, there are four primary coordinate systems: the robot body frame (a), world frame (b), forward motion frame (m), and slope frame (c). The relationships between these frames are crucial for determining the foot-end position.

The transformation from the slope frame to the world frame is given by:

$$ p_b^{h_t} = R_x(\upsilon_{ad}) R_y(\vartheta_{ad}) (p_c^{h_t} + p_c^h) – p_m^h $$

where \( R_x \) and \( R_y \) are rotation matrices about the horizontal and vertical axes, \( \upsilon_{ad} \) and \( \vartheta_{ad} \) are adjustment angles, \( p_b^{h_t} \) is the foot-end position in the world frame, \( p_c^{h_t} \) is the relative position in the slope frame, and \( p_c^h \) and \( p_m^h \) are the hip joint positions. The foot-end position in the robot body frame is then computed as:

$$ p_a^{h_t} = R’_x(-\upsilon_{ref}) R’_y(-\vartheta_{ref}) R’_z(-\phi_{ref}) (p_b^{h_t} + p_m^h) – p_a^h $$

Here, \( R’_x, R’_y, R’_z \) are rotation matrices for the transformation from the world to body frame, and \( \upsilon_{ref}, \vartheta_{ref}, \phi_{ref} \) are reference angles. For uphill motion, the pitch and roll angles from the IMU data equate to the adjustment angles:

$$ \upsilon_{ad} = \upsilon_{ref} = \gamma $$
$$ \vartheta_{ad} = \vartheta_{ref} = \theta $$

Simplifying these equations yields the foot-end position in the robot coordinate system:

$$ p_a^{h_t} = p_c^{h_t} + R”_x(-\gamma) R”_y(-\theta) p_m^c $$

where \( p_m^c = [0, 0, -H] \) is a constant vector ensuring the origin of the slope frame in the motion frame, with \( H \) representing the quadruped robot’s centroid height.

The MPC controller uses this position along with the LSTM-predicted desired position \( p_{ref} \) and velocity \( v_{ref} \), and the real-time foot position \( p_i \) and velocity \( v_i \) from IMUs, to calculate the optimal foot control force \( f_i \). The joint torque for the supporting legs is computed as:

$$ \Psi_i = J R_i^T f_i $$

where \( J \) is the Jacobian matrix and \( R_i^T \) is the coordinate transformation matrix. For the swinging legs, the joint torque includes both feedforward and feedback components:

$$ \Pi_i = J_i^T [K_P (p_{ref} – p_a^{h_t}) + K_d (v_{ref} – v_i)] + \tau_{i,f} $$

Here, \( K_P \) and \( K_d \) are proportional and derivative gains, and \( \tau_{i,f} \) is the feedforward torque. By iteratively applying these torques and updating the kinematic model, the MPC controller continuously adjusts the foot-end position, ensuring stable attitude control for the quadruped robot on slopes. This method allows the robot dog to adapt to changing terrain, minimizing slippage and maximizing efficiency during uphill locomotion.

Experimental Analysis and Results

To validate the effectiveness of our proposed method, we conducted experiments using a custom-built quadruped robot platform. The robot dog was equipped with high-flexibility leg structures and an advanced control system, enabling it to simulate real-world uphill motion. The core control system centered on an Upboard control板, which processed instructions from an upper computer or control handle and performed algorithm calculations to adjust the robot’s attitude in real-time. Additionally, an STM32F446 motor drive board acted as the driving device, communicating with the Upboard via CAN signals to control the rotation angle of brushless DC motors based on computed torques. The experiment involved a designed slope with varying inclines to test the robot’s performance during transitions from the base to the top.

The parameters of the quadruped robot used in the experiments are summarized in the table below. These parameters were critical for configuring the inertial measurement and control algorithms.

Parameters of the Quadruped Robot
Parameter Name Value Unit Parameter Name Value Unit
Trunk Mass 95 kg Actuator Type Brushless Motor
Lower Leg Mass 2.45 kg Battery Capacity 50 Ah
Front-Rear Hip Distance 1.2 m Battery Voltage 48 V
Hip Swing Length 0.075 m Hydraulic Oil Capacity 5 L
Left-Rear Hip Distance 0.55 m Leg Degrees of Freedom 4
Large Hip Distance 0.4 m Maximum Walking Speed 2 m/s
Hip Swing Mass 2 kg Maximum Climb Angle 30 °
Small Hip Length 0.36 m Total Weight (Estimated) ~120 kg

The IMU parameters used for data collection are detailed in the following table, highlighting the specifications of the accelerometers and gyroscopes.

Inertial Measurement Unit (IMU) Parameters
IMU Component Model Axes Measurement Range Output Sensitivity
Accelerometer LIS344ALH 3 ±8 g Voltage 650 mV/g
Gyroscope LY530AL 1 ±1250°/s Voltage 3.5 mV/(°·s⁻¹)

During the experiments, we analyzed the robot’s motion at the base and top of the slope, focusing on the vertical displacement of the center of mass and the forward position of the left front foot-end. The results demonstrated that our method enabled the quadruped robot to smoothly transition from the base to the slope surface and from the slope to the top without slipping. In contrast, comparative methods, such as those based on pitch posture adjustment or impedance and virtual models, exhibited significant slippage and instability during these transitions. Specifically, under our control, the robot dog maintained a stable center of mass with minimal vertical deviation, whereas the other methods showed pronounced displacements, indicating reduced stability. This confirms the superiority of our inertial measurement and LSTM-based approach in ensuring reliable uphill locomotion for quadruped robots.

Conclusion

In this study, we developed and validated a comprehensive method for controlling the foot-end attitude of quadruped robots during uphill locomotion using inertial measurement and LSTM algorithms. By integrating IMU data with quaternion-based attitude estimation, LSTM-based prediction of desired foot-end position and velocity, and MPC-based control, we achieved stable and adaptive performance on slopes. The experimental results demonstrated that our approach effectively prevents slippage and maintains balance during critical transition phases, such as from the base to the slope and from the slope to the top. This enhances the robot dog’s capability to navigate complex terrains, making it more suitable for real-world applications like search and rescue. Future work could focus on extending this method to other challenging environments and incorporating additional sensors for improved robustness. Overall, the combination of inertial measurement and LSTM algorithms provides a powerful framework for advancing the control of quadruped robots in dynamic conditions.

Scroll to Top