Motion-Control Strategy for a Heavy-Duty Transport Hexapod Robot on Rugged Agricultural Terrains

: Legged agricultural transportation robots are efﬁcient tools that can autonomously transport goods over agricultural terrain, and their introduction helps to improve the efﬁciency and quality of agricultural production. Their effectiveness depends on their adaptability to different environmental conditions, which is especially true for heavy-duty robots that exert ground forces. Therefore, this study proposes a motion-control strategy for a heavy-duty transport hexapod robot. Two critical tasks were accomplished in this paper: (1) estimating the support surface angle based on the robot’s foot position and body posture, and accordingly determining the motion constraint conditions on this support surface and the body posture based on energy optimization; (2) proposing an adaptive fuzzy impedance algorithm for real-time force–position composite control for adjusting foot position, in order to reduce the steady-state force tracking error caused by terrain stiffness, thus ensuring body stability through tracking of variable foot-end forces. An element of hardware in the loop control platform for a 3.55-ton device was designed and compared with the current popular force-control methods under different external contact terrains. The results show that the proposed control method can effectively reduce force errors, establish support forces faster on less-stiff environments, and reduce the torso tilt during phase switching.


Introduction
As robots continue to expand their role within agricultural settings, there has been extensive research on agricultural robots [1].The primary research focus has largely been on wheeled and tracked mobile robots [2].These robots accomplish various tasks through the integration of multiple sensor technologies such as computer vision, radar, GPS, and audio signals [3,4].In agricultural activities, most of which are on unstructured terrain often accompanied by rugged and steep road surfaces, compared with other types of robots, the main advantage of legged robots given the unstructured terrain is their excellent terrain adaptability, together with the corresponding top-loading platforms, which can play a good role in the development of agricultural production [5].On an unstructured terrain, studying the posture of legged robots is crucial for their adaptation to the environment.Adjusting their posture to suit the terrain can improve their adaptation ability.To achieve this, Song et al. [6] proposed a quasi-static climbing gait that enhances the movement of a robot on complex terrain.This gait enables the robot to climb steps that are 3.9 times the length of its legs.Lee [7] conducted a study on a hexapod adaptive suspension vehicle (ASV) by analyzing the robot's body posture on various inclines.A hexapod robot can traverse surfaces at different inclination levels by adjusting its torso height and posture.However, owing to the inherent variability in the end position of the foot and the susceptibility of legged robots to external environmental factors, controlling their motion on unstructured terrain has become a subject of extensive research [8,9].A hexapod robot can traverse surfaces at different inclination levels by adjusting its torso height and posture.Boston Dynamics [10] developed the Little Dog, a four-legged robot that optimizes its stance to maximize the movement space while ensuring that its torso does not collide with the ground.However, achieving energy efficiency is challenging for legged robots with high loads [11].A poor distribution of foot forces can lead to energy wastage, out-of-range joint moments, and even mechanical structural damage.Therefore, rational movement is necessary to reduce energy consumption.
Impedance control [12] is a widely used robotic control technique that adjusts the force-feedback error based on the relationship between the contact force and the robot's foot-end position.Zhu [13,14] proposed a hybrid sliding film control algorithm for a hydraulic quadrupedal robot based on impedance control which resulted in improved control accuracy.Subsequently, Wang [15] developed a whole-body control architecture that included impedance control to reduce the impact of contact between the legs of a six-legged robot and the environment, thus enabling smoother contact.However, conventional impedance control models are prone to steady-state errors during force tracking owing to uncertainties associated with the environmental parameters of the terrain [16].Several approaches have been explored to mitigate such errors, with some focusing on controlling the model reference [17][18][19][20][21].For instance, Roveda [17] proposed a method to estimate the environmental stiffness and adjust the controller gain to compensate for unknown environmental stiffness, whereas Deng [18] employed an extended Kalman filter to estimate force-tracking errors.Wang [20] introduced an impedance-estimation method for estimating contact in an uncalibrated environment.However, none of these methods demonstrated satisfactory force-tracking performance under time-varying forces.Furthermore, because the aforementioned methods rely on the estimation of environmental impedance parameters, they inevitably incur errors when addressing complex and variable environments.
Researchers have explored the use of variable impedance control methods based on reinforcement learning and optimization-based approaches.Chao and Yang estimated human stiffness dynamics using a dynamic motion primitive (DMP) [22] and a Markov model with Gaussian mixed regression [23], respectively.Zhang, et al. [24] proposed a convolutional neural network (CNN) supervised-learning method to calibrate the force estimation algorithm.Modares [25] transformed the optimal parameter search problem for impedance models into a linear quadratic regulator (LQR) problem.However, these methods require extensive data collection or calculations that negatively affect the real-time tracking of the time-varying forces of a robot.
In conclusion, the current impedance-control techniques for legged robots face difficulties in achieving the desired tracking of time-varying forces in complex environments, particularly when considering real-time performance.Previous studies have demonstrated that adaptive architectures provide high robustness in uncertain dynamic systems [26][27][28].Therefore, an adaptive motion strategy was proposed for complex terrains by adapting a robot torso pose to the instant terrain considering motion constraints and energy-optimal conditions under the support surface of the terrain.Subsequently, positional maintenance was achieved through adaptive fuzzy impedance control as follows: (1) A terrain-adaptive motion strategy was proposed, one which improves the stability of the robot's motion process by estimating the angle of the support surface on the current terrain, setting up corresponding reaction mechanisms, and analyzing the energy consumption of different positions on the same support surface to select the most energy-efficient motion posture.(2) The contact force dynamics were used to describe the influence of parameters such as environmental stiffness on the impedance model, and an adaptive fuzzy impedance control strategy based on force-position control was proposed to mitigate the impact of the external environment on impedance control.
(3) The efficacy of the proposed control strategy in complex environments was verified through comparative experiments.
This paper is organized as follows: In Section 2, we present the motion model and terrain estimation algorithm for an agricultural transportation robot with terrain adaptation on the rugged terrains of agriculture.Section 3 presents an adaptive impedance system that includes terrain-adaptive control and fuzzy parameter-adjustment methods.In Section 4, we present an experimental validation of the proposed method.Finally, Section 5 concludes the study.

Terrain-Adaptive Methods
The hexapod robot structure depicted in Figure 1 consists of two main components: the torso and the legs.The legs and torso's mounting positions are elliptically distributed, and each leg comprises a hip joint, thigh, and shin connected by a rotating pair between two adjacent segments, and a calf and foot-end connected by a ball hinge.An electro-hydraulic control system was selected as the transmission system, and integrated with low-impact motion trajectory planning to complete the trajectory planning.The robot can carry four people and can traverse over 1 m obstacles and across 1.2 m trenches, as well as achieve 40 • longitudinal climbing and 30 • lateral climbing.The robot movement includes two phases: swing and support.During the swing phase, the legs of the robot can be treated as single-leg tandem mechanisms, whereas during the support phase, the legs and the torso form parallel mechanisms.The position of the robot changes when it switches between the two phases of motion.Defined based on the established coordinate system shown in Figure 1, the coordinate transformation matrix formula for joint i can be obtained using the D-H parameter method, and the D-H parameters of the robot's single leg are shown in Table 1.
Agriculture 2023, 13, x FOR PEER REVIEW 3 of 23 (3) The efficacy of the proposed control strategy in complex environments was verified through comparative experiments.
This paper is organized as follows: In Section 2, we present the motion model and terrain estimation algorithm for an agricultural transportation robot with terrain adaptation on the rugged terrains of agriculture.Section 3 presents an adaptive impedance system that includes terrain-adaptive control and fuzzy parameter-adjustment methods.In Section 4, we present an experimental validation of the proposed method.Finally, Section 5 concludes the study.

Terrain-Adaptive Methods
The hexapod robot structure depicted in Figure 1 consists of two main components: the torso and the legs.The legs and torso's mounting positions are elliptically distributed, and each leg comprises a hip joint, thigh, and shin connected by a rotating pair between two adjacent segments, and a calf and foot-end connected by a ball hinge.An electro-hydraulic control system was selected as the transmission system, and integrated with lowimpact motion trajectory planning to complete the trajectory planning.The robot can carry four people and can traverse over 1 m obstacles and across 1.2 m trenches, as well as achieve 40° longitudinal climbing and 30° lateral climbing.The robot movement includes two phases: swing and support.During the swing phase, the legs of the robot can be treated as single-leg tandem mechanisms, whereas during the support phase, the legs and the torso form parallel mechanisms.The position of the robot changes when it switches between the two phases of motion.Defined based on the established coordinate system shown in Figure 1, the coordinate transformation matrix formula for joint i can be obtained using the D-H parameter method, and the D-H parameters of the robot's single leg are shown in Table 1.
The transformation matrix of the foot-end of leg j of the hexapod robot relative to the torso coordinate system is expressed as: The transformation matrix of the foot-end of leg j of the hexapod robot relative to the torso coordinate system is expressed as:

Terrain Estimation
The overall terrain-perception process of the robot is as depicted in Figure 2. Initially, the controller detects the force signal from the foot-end force sensor, determining whether the foot-end has reached the support state based on whether the force exceeds the stable force threshold for foot grounding.Subsequently, the position of the foot-end in the support state relative to the body coordinate system is calculated through the displacement sensor of the hydraulic cylinder.The position of the supporting leg end relative to the body coordinate system is then recorded and, based on the body posture angle gathered by the IMU, the position information of the foot-end under the body coordinate system is transformed into the world coordinate system.Lastly, using the foot-end information under the world coordinate system, a plane fitting method is applied to fit the terrain information, thereby estimating the local terrain information where the hexapod robot is currently situated.

Terrain Estimation
The overall terrain-perception process of the robot is as depicted in Figure 2. Initially, the controller detects the force signal from the foot-end force sensor, determining whether the foot-end has reached the support state based on whether the force exceeds the stable force threshold for foot grounding.Subsequently, the position of the foot-end in the support state relative to the body coordinate system is calculated through the displacement sensor of the hydraulic cylinder.The position of the supporting leg end relative to the body coordinate system is then recorded and, based on the body posture angle gathered by the IMU, the position information of the foot-end under the body coordinate system is transformed into the world coordinate system.Lastly, using the foot-end information under the world coordinate system, a plane fitting method is applied to fit the terrain information, thereby estimating the local terrain information where the hexapod robot is currently situated.To simplify the calculation of terrain estimates, a reference coordinate system, denoted by OB-XBYBZB, was established to quantitatively convert the foot-end position information when characterizing the local terrain.As illustrated in Figure 3, Origin B of the reference coordinate system c coincides with Origin C of the torso coordinate system OC-XCYCZC, whereas its x-, y-, and z-axis directions align with those of the reference coordinate system OW-XWYWZW.The positional transformation of the torso is referenced to the world coordinate system OB-XBYBZB, and the transformation matrix of the torso coordinate system with respect to the world coordinate system is given by Equation (2).
where γ, α, and β denote the yaw, pitch, and roll angles, respectively, of the torso coordinate system in the world coordinate system, as measured by the inertial measurement unit (IMU).To simplify the calculation of terrain estimates, a reference coordinate system, denoted by O B -X B Y B Z B , was established to quantitatively convert the foot-end position information when characterizing the local terrain.As illustrated in Figure 3, Origin B of the reference coordinate system c coincides with Origin C of the torso coordinate system O C -X C Y C Z C , whereas its x-, y-, and z-axis directions align with those of the reference coordinate system O W -X W Y W Z W .The positional transformation of the torso is referenced to the world coordinate system O B -X B Y B Z B , and the transformation matrix of the torso coordinate system with respect to the world coordinate system is given by Equation (2).
where γ, α, and β denote the yaw, pitch, and roll angles, respectively, of the torso coordinate system in the world coordinate system, as measured by the inertial measurement unit (IMU).For any leg of the six-legged robot, the coordinates of the foot-end position relative to the world coordinate system can be derived using Equation (3).
The location information of the support foot was regarded as the terrain location feature point in the terrain information, and a single-plane fitting method was employed to fit these terrain location feature points.The primary plane-fitting equation was as follows: where a0, a1, and a2 represent the coefficients of the plane equation.The coefficients of the primary plane expression were determined using the leastsquares method based on the coordinates of the foot-end position of the hexapod robot in the support phase.The solution equation is as follows: where sj3 is the number of legs in a supported state, and the number of legs in different gaits varies, and is obtained based on trajectory planning.By segmenting the terrain slope based on the ground-pitch and side-inclination angles, an equation for estimating the slope of an unexplored terrain was obtained:

Torso Safety Dimension Constraints
The robot must avoid collisions between its torso and the environment when traversing complex terrain.Thus, when the terrain slope varies significantly, it is necessary to establish a geometric constraint between the robot torso safety zone dimensions and the terrain slope.The solid box in Figure 3 represents the torso profile of the robot, while the dashed line represents the minimum allowable torso safety zone dimensions for a sixlegged robot with torso length l height w, and width h.The ground-pitch and groundside-tilt angles, φx and φy, were estimated.
To ensure that the torso is not interfered with by the terrain, point D must remain above the slope throughout the motion.The torso attitude angle and geometric constraints For any leg of the six-legged robot, the coordinates of the foot-end position relative to the world coordinate system can be derived using Equation (3).
The location information of the support foot was regarded as the terrain location feature point in the terrain information, and a single-plane fitting method was employed to fit these terrain location feature points.The primary plane-fitting equation was as follows: where a 0 , a 1 , and a 2 represent the coefficients of the plane equation.
The coefficients of the primary plane expression were determined using the leastsquares method based on the coordinates of the foot-end position of the hexapod robot in the support phase.The solution equation is as follows: where ], s j3 is the number of legs in a supported state, and the number of legs in different gaits varies, and is obtained based on trajectory planning.
By segmenting the terrain slope based on the ground-pitch and side-inclination angles, an equation for estimating the slope of an unexplored terrain was obtained:

Torso Safety Dimension Constraints
The robot must avoid collisions between its torso and the environment when traversing complex terrain.Thus, when the terrain slope varies significantly, it is necessary to establish a geometric constraint between the robot torso safety zone dimensions and the terrain slope.The solid box in Figure 3 represents the torso profile of the robot, while the dashed line represents the minimum allowable torso safety zone dimensions for a six-legged robot with torso length l height w, and width h.The ground-pitch and ground-side-tilt angles, ϕ x and ϕ y , were estimated.
To ensure that the torso is not interfered with by the terrain, point D must remain above the slope throughout the motion.The torso attitude angle and geometric constraints facili-tated the determination of the coordinates of point D relative to the reference coordinate Substituting the coordinates from Equation (7) into Equation (4) yields the constraint equation for a safe torso zone size.
Thus, when the torso-pitch, cross-roll, ground-pitch, and ground-side-tilt angles are β, α, ϕ x , and ϕ y , respectively, the constraint relationship between the torso position and the terrain environment can be obtained by combining Equations ( 6) and ( 9) as follows: The robot needs to adjust its torso posture to change its direction of motion when there are obstacles in the motion's path.An RGB-D camera is installed directly in front of the robot's centroid in the x direction.The distance between the obstacle and the robot is calculated based on depth information when the target obstacle is detected.Then, by adjusting the posture of the torso, obstacle avoidance actions are performed in advance, as shown in Figure 4a.R is the safe distance to adjust the yaw angle of the torso.The calculation formula for torso deflection angle δ is as follows: δ= arccos b r /2 + w 2 /2 x dr 2 + y dr 2 − arctan y dr x dr + l (11) where x dr and y dr are the positions of obstacles relative to camera coordinates, and their border dimensions are b r and h r ; w 2 is the safe size of the robot's zone, and l 2 is the distance from the camera to the centroid.
facilitated the determination of the coordinates of point D relative to the reference coordinate system OW-XWYWZW.
Substituting the coordinates from Equation (7) into Equation (4) yields the constraint equation for a safe torso zone size.
Thus, when the torso-pitch, cross-roll, ground-pitch, and ground-side-tilt angles are β, α, φx, and φy, respectively, the constraint relationship between the torso position and the terrain environment can be obtained by combining Equations ( 6) and ( 9) as follows: The robot needs to adjust its torso posture to change its direction of motion when there are obstacles in the motion's path.An RGB-D camera is installed directly in front of the robot's centroid in the x direction.The distance between the obstacle and the robot is calculated based on depth information when the target obstacle is detected.Then, by adjusting the posture of the torso, obstacle avoidance actions are performed in advance, as shown in Figure 4a.R is the safe distance to adjust the yaw angle of the torso.The calculation formula for torso deflection angle  is as follows: where xdr and ydr are the positions of obstacles relative to camera coordinates, and their border dimensions are br and hr; w2 is the safe size of the robot's zone, and l2 is the distance from the camera to the centroid.

Stability Constraints on Inclined Terrain
This study proposes a normalized energy stability margin (NESM) as a criterion for assessing the stability of a robot on an inclined terrain.The NESM method considers the center of mass of the robot, the locations of the support feet's ends, and the slope of the terrain.
As shown in Figure 4b, the center-of-mass location in the reference coordinate system is denoted by B O G ( B x G , B y G , B z G ).The adjacent foot-end points of the robot for legend positions leg1 and leg3 are denoted as A 1 ( B x 13 , B y 13 , B z 13 ) and A 3 ( B x 33 , B y 33 , B z 33 ), respectively.The point S O G is the projection of the center-of-mass on the slope surface S, and B O G forms a vertical line with Line A 1 A 3 .The intersection point of B O G and the vertical line is N ( B x N , B y N , B z N ).Point B O Gh is the highest point that B O G can reach by rotating around the support edge A 1 A 3 .The angle between B O Gh and the horizontal plane is denoted as θ.The angle between the support boundary c and the horizontal plane is denoted as α, and M is the intersection point of the perpendicular line from the center-of-mass B O G to the straight line B O Gh N.
The expression for the line A 1 A 3 can be found from the following linear formula: The distance from point B O G to line A 1 A 3 was calculated using the following formula: where The normal vector of the vertical plane A 1 A 3 B O Gh passing through the straight-line c is as follows: The vector of line B O G N can be found when the coordinates of N and B O G are known.
The angle between A 1 A 3 and the horizontal plane ξ i can be determined similarly.The degree of stability with A 1 A 3 as the boundary condition can be calculated from the definition of NESM, as follows: Based on the definition of NESM, the minimum value of the degree of stability for each adjacent support boundary was considered.Thus, the stability margin is defined as: The robot was considered stable when E > 0, with a larger E indicating greater stability.Therefore, when optimizing the poses of the robot, a stability margin threshold E min should be set, and the stability margin at any moment of the motion should be greater than E min .

Adaptive Attitude in Terms of Energy Consumption
The hydraulic driving force of the legs of the hexapod robot was calculated, with Legs 1, 3, and 5 serving as support legs.Based on the leg structure and the planned foot force trajectory, the position of the foot-end relative to the base joint and the magnitudes of the large and small leg drive forces were analyzed for a constant foot-end force; the results for Leg 5 are shown in Figure 5a,b.Because the hexapod robot leg is hydraulically driven, the driving force of the hydraulic system is determined by the maximum load, which is given by the force on the side with the higher force.The relationships between the hydraulic-system drive force F and the geometric parameters H 0 and B 0 are shown in Figure 5c.It was observed that when B 0 is greater than 0.65 m and less than 1.75 m, the hydraulic system driving force F changes uniformly; with an increase in H 0 , it initially decreases and subsequently increases, and it gradually increases with an increase in B 0 .

Adaptive Attitude in Terms of Energy Consumption
The hydraulic driving force of the legs of the hexapod robot was calculated, with Legs 1, 3, and 5 serving as support legs.Based on the leg structure and the planned foot force trajectory, the position of the foot-end relative to the base joint and the magnitudes of the large and small leg drive forces were analyzed for a constant foot-end force; the results for Leg 5 are shown in Figure 5a,b.Because the hexapod robot leg is hydraulically driven, the driving force of the hydraulic system is determined by the maximum load, which is given by the force on the side with the higher force.The relationships between the hydraulic-system drive force F and the geometric parameters H0 and B0 are shown in Figure 5c.It was observed that when B0 is greater than 0.65 m and less than 1.75 m, the hydraulic system driving force F changes uniformly; with an increase in H0, it initially decreases and subsequently increases, and it gradually increases with an increase in B0.In this study, we analyzed the impact of the center-to-ground height H of the hexapod robot torso form, torso-pitch angle α, and roll angle β on the energy consumption during a four-legged support movement (Leg 1, Leg 2, Leg 4, and Leg 5) across different terrains.Three terrain scenarios (φx = 5°, φy =30°; φx = 10°, φy =20°; and φx = 10°, φy =10°) were investigated.
The results shown in Figure 6 indicate that when the pitch angle φy of the terrain is small, and the α and β values are close to the terrain slope, the robot consumes less energy during one gait cycle.As the terrain slope decreases, the torso of the robot becomes parallel to the incline, resulting in an increased side-swing cylinder force and a reduced force on the thigh and lower leg cylinders.However, the cylinder pressure remained high at the base junction because the thigh and leg cylinders primarily supported the weight of the robot.The output pressure of the hydraulic system depends on the maximum load, resulting in minimal energy consumption at this stage.As per the analysis in Figure 5, the force required to maintain system balance varies under different postures.When the torso stance was not parallel to the support surface, a difference was observed in Czj3 between the endpoints of the feet of the support legs in the torso coordinate system, which exacerbated the uneven output force of the hydraulic cylinders of each support leg and increased the energy consumption of the hydraulic system.In contrast, when the terrain slope angle was large, the maximum output pressure of the hydraulic system depended on the output pressure of the lateral swing cylinders, resulting in an increase in the output pressure of the hydraulic system.In this study, we analyzed the impact of the center-to-ground height H of the hexapod robot torso form, torso-pitch angle α, and roll angle β on the energy consumption during a four-legged support movement (Leg 1, Leg 2, Leg 4, and Leg 5) across different terrains.Three terrain scenarios (ϕ x = 5 • , ϕ y =30 • ; ϕ x = 10 • , ϕ y =20 • ; and ϕ x = 10 • , ϕ y =10 • ) were investigated.
The results shown in Figure 6 indicate that when the pitch angle ϕ y of the terrain is small, and the α and β values are close to the terrain slope, the robot consumes less energy during one gait cycle.As the terrain slope decreases, the torso of the robot becomes parallel to the incline, resulting in an increased side-swing cylinder force and a reduced force on the thigh and lower leg cylinders.However, the cylinder pressure remained high at the base junction because the thigh and leg cylinders primarily supported the weight of the robot.The output pressure of the hydraulic system depends on the maximum load, resulting in minimal energy consumption at this stage.As per the analysis in Figure 5, the force required to maintain system balance varies under different postures.When the torso stance was not parallel to the support surface, a difference was observed in C zj3 between the endpoints of the feet of the support legs in the torso coordinate system, which exacerbated the uneven output force of the hydraulic cylinders of each support leg and increased the energy consumption of the hydraulic system.In contrast, when the terrain slope angle was large, the maximum output pressure of the hydraulic system depended on the output pressure of the lateral swing cylinders, resulting in an increase in the output pressure of the hydraulic system.As the center-to-ground height of the torso form increased, the energy consumption initially decreased and then increased.This is because the maximum force of the hydraulic system decreased and then increased with the variations in height H.Moreover, as height H increased, the range of available torso-pitch and roll angles also increased, which were constrained by the torso safety zone size and drive hydraulic-cylinder position limits.When the terrain slope increased, the stability constraint became dominant, restricting the torso's attitude and reducing the range of selectable attitudes.
Different levels of energy consumption were observed for different terrains and body postures.On a rough terrain, the individual support legs required unique footing points, and legs with higher posture forces experienced smaller foot-end force distributions to minimize the energy usage of the overall system.Therefore, we optimized the postures, with the objectives of reduced energy consumption and increased use of the torso's kinematics, and selected the appropriate torso postures so that the hydraulic drive force would be as small as possible and the torso's workspace would be as large as possible.The optimization method was to collect multiple sets of simulation data as samples and use them to train a BP neural network model.The input was the terrain angle formed by the supporting feet and the initial height of the body, and the output was the body posture angle with the lowest energy consumption.

Attitude Adaptive Adjustment
Figure 7 presents the overall control diagram of this study, which primarily includes terrain perception, trajectory planning, and controller components.The environment perception component comprises the terrain perception discussed in Section 2.1, as well as the obstacle detection based on the vision module.Following this, corresponding trajectory planning is conducted according to the perceived environment, mainly including safety constraints, stability control, and energy-optimal posture adjustment, as discussed in Section 2.2.Lastly, tracking control is performed on the foot-end force and cylinder position based on the trajectory planning.As the center-to-ground height of the torso form increased, the energy consumption initially decreased and then increased.This is because the maximum force of the hydraulic system decreased and then increased with the variations in height H.Moreover, as height H increased, the range of available torso-pitch and roll angles also increased, which were constrained by the torso safety zone size and drive hydraulic-cylinder position limits.When the terrain slope increased, the stability constraint became dominant, restricting the torso's attitude and reducing the range of selectable attitudes.
Different levels of energy consumption were observed for different terrains and body postures.On a rough terrain, the individual support legs required unique footing points, and legs with higher posture forces experienced smaller foot-end force distributions to minimize the energy usage of the overall system.Therefore, we optimized the postures, with the objectives of reduced energy consumption and increased use of the torso's kinematics, and selected the appropriate torso postures so that the hydraulic drive force would be as small as possible and the torso's workspace would be as large as possible.The optimization method was to collect multiple sets of simulation data as samples and use them to train a BP neural network model.The input was the terrain angle formed by the supporting feet and the initial height of the body, and the output was the body posture angle with the lowest energy consumption.

Attitude Adaptive Adjustment
Figure 7 presents the overall control diagram of this study, which primarily includes terrain perception, trajectory planning, and controller components.The environment perception component comprises the terrain perception discussed in Section 2.1, as well as the obstacle detection based on the vision module.Following this, corresponding trajectory planning is conducted according to the perceived environment, mainly including safety constraints, stability control, and energy-optimal posture adjustment, as discussed in Section 2.2.Lastly, tracking control is performed on the foot-end force and cylinder position based on the trajectory planning.A force-position composite control was employed to maintain body-posture stability during motion.The control method for the leg is the integration of an outer-loop adaptive fuzzy impedance algorithm with an inner-loop position control.The impedance controller generates the position correction ΔX based on the difference ΔF between the contact force F and the desired force Fr, and the motion position Xr is subsequently adjusted with the position correction ΔX.This enables the six-legged robot to maintain its body posture on a complex terrain by tracking the force.
In this study, the inner-loop position control utilized a neural network controller.A neural network controller, which continuously learns through feedback errors, was selected as the position controller; it gradually assumes the dominance of the control behavior.The outputs of the neural network control are as follows: ( ) ( ) where uf(t) is the output of the PD control and un(t) is the output of the neural network model.
In the early stages of control, the feedback controller plays a predominant role, with the untrained neural network controller continuously learning through feedback errors.This is a process of simultaneous control and learning, possessing the ability to adapt to changes in the object and the environment.In this study, a three-layer feed-forward network has been utilized as the controller.The input-output relationship of the controller can be described as: where is the input vector of the network where r is the reference input; et is the tracking error; ( ) T HI W t are the weight matrices from the output layer to the hidden layer and the hidden layer to the input layer of the neural network controller; and ( ) is the input bias of the hidden layer unit.The learning rules of the network weights can be derived according to the feedback error learning method, as: where ( ) t  is the learning rate; to avoid oscillations in the system, the following adaptive adjustment of the learning rate is used: A force-position composite control was employed to maintain body-posture stability during motion.The control method for the leg is the integration of an outer-loop adaptive fuzzy impedance algorithm with an inner-loop position control.The impedance controller generates the position correction ∆X based on the difference ∆F between the contact force F and the desired force Fr, and the motion position X r is subsequently adjusted with the position correction ∆X.This enables the six-legged robot to maintain its body posture on a complex terrain by tracking the force.
In this study, the inner-loop position control utilized a neural network controller.A neural network controller, which continuously learns through feedback errors, was selected as the position controller; it gradually assumes the dominance of the control behavior.The outputs of the neural network control are as follows: where u f (t) is the output of the PD control and u n (t) is the output of the neural network model.In the early stages of control, the feedback controller plays a predominant role, with the untrained neural network controller continuously learning through feedback errors.This is a process of simultaneous control and learning, possessing the ability to adapt to changes in the object and the environment.In this study, a three-layer feed-forward network has been utilized as the controller.The input-output relationship of the controller can be described as: where X I = {r, e(t), . . . ,e(t − m + 1)} is the input vector of the network where r is the reference input; et is the tracking error; W T OH (t)W T H I (t) are the weight matrices from the output layer to the hidden layer and the hidden layer to the input layer of the neural network controller; and θ H (t) is the input bias of the hidden layer unit.The learning rules of the network weights can be derived according to the feedback error learning method, as: where η(t) is the learning rate; to avoid oscillations in the system, the following adaptive adjustment of the learning rate is used: When the output of the PD feedback controller is smaller than the set threshold, the learning of the neural network ends temporarily, and the neural network controller completely replaces the feedback controller, controlling the system.

Adaptive Impedance Control
The position-based impedance control model can be conceptualized as a virtual spring model.Mathematically, the impedance control model can be expressed as a function of the robot forces, as follows: where M d , B d , and K d are the target inertia, target damping, and target stiffness matrices of the impedance control model for the robot, respectively; ∆F = F r − F, ∆X = X − X r .F and F r represent the actual and desired contact forces, respectively, and X and X r represent the actual and desired positions, respectively.When the foot-end of the robot is in contact with the environment, the impedance outer-loop control generates a position compensation value.This value represents an integrated control object consisting of the terrain environment and the foot-end of the robot.The contact model between the foot-end and the terrain environment can be simplified as follows: where the stiffness matrix (M e ), damping matrix (B e ), and stiffness matrix of the environment (K en ) are fundamental parameters used to describe the interaction of a legged robot with its surrounding terrain.X and X e indicate the terrain positions.
When the foot-end maintains stable contact with the terrain, the small acceleration and velocity terms in the equation do not significantly affect the foot-end force (F) and can therefore be disregarded.
To simplify the contact model between the foot-end and the terrain environment, this study proposes using a spring model that considers the environmental stiffness (K e ), which is equivalent to the leg stiffness (K l ) and terrain environment stiffness (K en ) in series.
In this study, we focused on the force in the z-direction, and the following equations were obtained from Equation (25): x e (27) After substituting Equation (27) into Equation (24), the following equation is obtained: where q = f z r + k z e x e − k z e x r and owing to the uncertainty of the terrain location, an estimation of environmental position xe is utilized.By setting the desired trajectory x r = e , q = f z r + k z e ηx e .The error function of the force is obtained according to Equation ( 28): Subsequently, the error equation for the steady-state force is: When f r is a constant force, the steady-state force error is: Equation ( 31) shows that to achieve zero steady-state force error in impedance control, either condition k z d = 0 or f z r = k z e ηx e must be satisfied.However, for a hexapod robot navigating a complex environment, it is challenging to measure the exact equivalent environmental stiffness (k e ) and position (x e ), which makes it difficult to satisfy the condition f z r = k z e ηx e in practice.The center-of-gravity of the hexapod robot changed as it walked, resulting in a time-varying force at the foot-end.When f r is a time-varying force, the steadystate force error still exists, even if k z d = 0 is set.To mitigate this error, this study proposes an adaptive compensation algorithm to enhance the foot-end tracking performance against time-varying expected forces in the face of environmental uncertainty.Specifically, an adaptive compensation term is introduced into the control scheme.
where ς is the adaptive learning rate and k is the sampling period of the controller.Assuming k z d = 0 and incorporating the adaptive compensation term, the impedance model can be reformulated as follows: The steady-state force error equation can be re-derived as follows: Expanding the Γ(t), the first term of the expansion is set to zero, after which the expansion is applied to Equations (33) and (34).
This equation can be transformed using Laplace to obtain the transfer function for the steady-state force error.
The stability condition of the system can be determined using the Rouse stability criterion.
By substituting the constant force expectation and variable expectation force into the steady-state force error function as input signals, the corresponding table for the steadystate force error can be obtained, as shown in Table 2.The proposed adaptive strategy enables force tracking to achieve convergence and eliminate steady-state errors.Figure 8c shows that as the target impedance inertia parameter m d decreases, the response speed increases, while the regulation time and overshoot decrease.However, when the overshoot approaches a zero value, m d decreases again, leading to a decrease in the response speed and an increase in the time required to reach a steady state.Figure 8b indicates that increasing b d results in a decrease in the response speed and regulation time, whereas the absence of an overshoot leads to a decline in the response speed.However, when an overshoot is absent, increasing b d leads to a decrease in the response speed.Figure 8a reveals that changes in the environmental stiffness parameters result in significant variations in the force-tracking performance.Therefore, we proposed a real-time self-adaptive fuzzy algorithm to adjust the impedance model parameters based on the error information determined between the expected and actual contact forces.This approach enhances the force-tracking performance of the impedance controller under different environmental parameters, thereby improving the adaptability of a six-legged robot to its surroundings.
Agriculture 2023, 13, x FOR PEER REVIEW 13 of 23 Figure 8 depicts the joint simulation system constructed using MATLAB/Simulink and Adams to analyze the influence of md, bd, and ke on the control performance of the system.Figure 8c shows that as the target impedance inertia parameter md decreases, the response speed increases, while the regulation time and overshoot decrease.However, when the overshoot approaches a zero value, md decreases again, leading to a decrease in the response speed and an increase in the time required to reach a steady state.Figure 8b indicates that increasing bd results in a decrease in the response speed and regulation time, whereas the absence of an overshoot leads to a decline in the response speed.However, when an overshoot is absent, increasing bd leads to a decrease in the response speed.Figure 8a reveals that changes in the environmental stiffness parameters result in significant variations in the force-tracking performance.Therefore, we proposed a real-time selfadaptive fuzzy algorithm to adjust the impedance model parameters based on the error information determined between the expected and actual contact forces.This approach enhances the force-tracking performance of the impedance controller under different environmental parameters, thereby improving the adaptability of a six-legged robot to its surroundings.The primary challenge in creating an impedance control system involves the selection of appropriate impedance control parameters to improve adaptability to varying environments.Therefore, we proposed a real-time self-adaptive fuzzy algorithm [29] to adjust the impedance model parameters based on the error information determined between the expected and actual contact forces.
The fuzzy control rules for the proposed method are as follows.When the error and error-change rate between the desired force at the foot-end and the contact force are significant, the target damping parameter should be small to enhance the system response.Conversely, when the error and error change rate between the desired force at the footend and contact force are negligible, the target damping parameter should be large to minimize the overshoot of the system and suppress its oscillation.Because the target in- The primary challenge in creating an impedance control system involves the selection of appropriate impedance control parameters to improve adaptability to varying environments.Therefore, we proposed a real-time self-adaptive fuzzy algorithm [29] to adjust the impedance model parameters based on the error information determined between the expected and actual contact forces.
The fuzzy control rules for the proposed method are as follows.When the error and error-change rate between the desired force at the foot-end and the contact force are significant, the target damping parameter should be small to enhance the system response.Conversely, when the error and error change rate between the desired force at the footend and contact force are negligible, the target damping parameter should be large to minimize the overshoot of the system and suppress its oscillation.Because the target inertia parameter md is sensitive to the dynamic response, and the effects of md and b d on the control system are relatively similar, we adjusted the target damping parameter b d to reduce the complexity of the control system.The input of the fuzzy controller is the error E f between the expected force f r at the foot-end and the contact force F, and the rate of change Ec f of the force error is calculated using Equation (38).The output of the fuzzy controller is an increment in the target damping parameter of the impedance controller.
where κ represents the sampling period.
The theoretical domain of the input and output quantities of the fuzzy controller is considered as [−1, 1], and the corresponding normalization coefficients transform the ranges of the input and output quantities into the theoretical domain interval.The output of the fuzzy controller is an increment in the target damping parameter of the impedance controller.
where E fmax , E fmin , Ec fmax , Ec fmin , ∆b max , and ∆b min are the maximum and minimum values of E f , Ec f and ∆b, respectively.The fuzzy inference process, as shown in Figure 9, involves dividing the various input and output quantities of the fuzzy controller into seven fuzzy levels [NB, NM, NS, ZE, PS, PM, PB], which increase in order from NB to PB.The Gaussian-type subordination function was selected as the subordination function.The fuzzy control rules and image of the affiliation function for the target damping parameter adjustment were established according to the principle of target damping parameter adjustment.The parallel method was used for fuzzy inference, and the center-of-gravity method was used for defuzzification.The increment of the normalized target damping parameter ∆ b was obtained.
Agriculture 2023, 13, x FOR PEER REVIEW 14 of 23 and bd on the control system are relatively similar, we adjusted the target damping parameter bd to reduce the complexity of the control system.The input of the fuzzy controller is the error Ef between the expected force fr at the foot-end and the contact force F, and the rate of change Ecf of the force error is calculated using Equation (38).The output of the fuzzy controller is an increment in the target damping parameter of the impedance controller. () where  represents the sampling period.
The theoretical domain of the input and output quantities of the fuzzy controller is considered as [−1, 1], and the corresponding normalization coefficients transform the ranges of the input and output quantities into the theoretical domain interval.The output of the fuzzy controller is an increment in the target damping parameter of the impedance controller.
The fuzzy inference process, as shown in Figure 9, involves dividing the various input and output quantities of the fuzzy controller into seven fuzzy levels [NB, NM, NS, ZE, PS, PM, PB], which increase in order from NB to PB.The Gaussian-type subordination function was selected as the subordination function.The fuzzy control rules and image of the affiliation function for the target damping parameter adjustment were established according to the principle of target damping parameter adjustment.The parallel method was used for fuzzy inference, and the center-of-gravity method was used for defuzzification.The increment of the normalized target damping parameter b  was obtained.

Force Tracking Experiment
To the ability of the force-tracking algorithm to operate on real robots on different terrains, this study conducted experimental investigations on terrain obstacles of varying environmental stiffness.The torso height of the robot was set to 0.4 m above the ground, the gait period was 2 s.The experimental setup involved using the five legs of the hexapod robot as supports while moving the remainder leg within three different terrain environments: hard ground, soft foam ground, and soil.The movements included swing, contact, and foot force tracking.The force-tracking curves in different terrain environments displayed different responses, as shown by the experimental results.In hard-terrain environments, where the landing impact was greater, both foot force tracking algorithms exhibited faster responses, as shown in Figure 10e,f.The adaptive compensation algorithm (AD) for force tracking showed a response process similar to that of the traditional impedance control (IC), owing to the large equivalent terrain stiffness of the hard terrain, which resulted in a small steady-state error.On the soft-foam terrain (Figure 10c,d), where the impact force when the foot-end falls to the ground is low, the IC algorithm tracking of the desired acceleration force showed a state of nonconvergence of the force steady-state error.However, as the leg was compressed, the equivalent environmental stiffness gradually increased, and the steady-state error decreased.The AD algorithm improved the response speed and exhibited a relatively small steady-state force error.As shown in Figure 10a,b, the impact force on the foot-end hitting the ground is negligible on the soil.Owing to the lower equivalent stiffness of the soil terrain environment, the response of the IC algorithm becomes slower, and the steady-state force error in force tracking increases.The steady-state error decreases as the soil is compressed, and the equivalent environmental stiffness increases.The AD algorithm tracks the slope expectation force with a faster response rate and convergence in the steady-state error of force for tracking the acceleration expectation The force-tracking curves in different terrain environments displayed different responses, as shown by the experimental results.In hard-terrain environments, where the landing impact was greater, both foot force tracking algorithms exhibited faster responses, as shown in Figure 10e,f.The adaptive compensation algorithm (AD) for force tracking showed a response process similar to that of the traditional impedance control (IC), owing to the large equivalent terrain stiffness of the hard terrain, which resulted in a small steady-state error.On the soft-foam terrain (Figure 10c,d), where the impact force when the foot-end falls to the ground is low, the IC algorithm tracking of the desired acceleration force showed a state of nonconvergence of the force steady-state error.However, as the leg was compressed, the equivalent environmental stiffness gradually increased, and the steady-state error decreased.The AD algorithm improved the response speed and exhibited a relatively small steady-state force error.As shown in Figure 10a,b, the impact force on the foot-end hitting the ground is negligible on the soil.Owing to the lower equivalent stiffness of the soil terrain environment, the response of the IC algorithm becomes slower, and the steady-state force error in force tracking increases.The steady-state error decreases as the soil is compressed, and the equivalent environmental stiffness increases.
The AD algorithm tracks the slope expectation force with a faster response rate and convergence in the steady-state error of force for tracking the acceleration expectation force.The performance of the force-tracking effect is better than that of the IC, which not only improves the response speed, but also results in a relatively small force-steady-state error.However, the adaptive fuzzy (AF) algorithm demonstrated performance in force tracking, resulting in a better response speed and reduced force overshoot.Overall, the introduction of the response process increased the amount of overshoot in the system response compared with that without the AD.The introduction of the AF algorithm resulted in relatively better tracking of slope forces at the foot-end of the leg.

Experimental Studies and Discussion
The experimental platform utilized for the study of the six-legged robot discussed in this study is depicted in Figure 11.The hexapod had a total mass of 3.55 metric tons, with an electrohydraulic servo mechanism based on hydraulic propulsion.Once the desired trajectory was established, the corresponding current value was input to the servo valve to regulate the movement of the hydraulic cylinder associated with the valve, which was equipped with a built-in displacement sensor to provide feedback regarding its position.A hydraulic pump supplied by Danfoss offered a maximum output pressure of 31 MPa.
Agriculture 2023, 13, x FOR PEER REVIEW 16 of 23 The AD algorithm tracks the slope expectation force with a faster response rate and convergence in the steady-state error of force for tracking the acceleration expectation force.The performance of the force-tracking effect is better than that of the IC, which not only improves the response speed, but also results in a relatively small force-steady-state error.However, the adaptive fuzzy (AF) algorithm demonstrated improved performance in force tracking, resulting in a better response speed and reduced force overshoot.Overall, the introduction of the response process increased the amount of overshoot in the system response compared with that without the AD.The introduction of the AF algorithm resulted in relatively better tracking of slope forces at the foot-end of the leg.

Experimental Studies and Discussion
The experimental platform utilized for the study of the six-legged robot discussed in this study is depicted in Figure 11.The hexapod had a total mass of 3.55 metric tons, with an electrohydraulic servo mechanism based on hydraulic propulsion.Once the desired trajectory was established, the corresponding current value was input to the servo valve to regulate the movement of the hydraulic cylinder associated with the valve, which was equipped with a built-in displacement sensor to provide feedback regarding its position.A hydraulic pump supplied by Danfoss offered a maximum output pressure of 31 MPa.The robot features a force sensor and an attitude and heading reference system to enable monitoring of the vehicle's status.The distributed visual perception system was set up using the Nvidia Jetson Nano processor and the PyTorch framework.The YOLOv5 algorithm [30] was used as a neural network algorithm.The categories of obstacles were set as tree trunks, people, cars, and boulder.The samples of relevant detection results are shown in Figure 10, and the information of obstacles was transmitted to the motion controller through serial communication.Following calibration, the error between the The robot features a force sensor and an attitude and heading reference system to enable monitoring of the vehicle's status.The distributed visual perception system was set up using the Nvidia Jetson Nano processor and the PyTorch framework.The YOLOv5 algorithm [30] was used as a neural network algorithm.The categories of obstacles were set as tree trunks, people, cars, and boulder.The samples of relevant detection results are shown in Figure 10, and the information of obstacles was transmitted to the motion controller through serial communication.Following calibration, the error between the obstacle coordinates obtained from the vision module and the actual coordinates was found to be less than 8 mm.This level of precision enables the supply of obstacle information for the obstacle-avoidance strategy outlined in Section 2.2.1.The control approach involves a hardware-in-the-loop system that utilizes an embedded control host powered by the VxWorks operating system with a control cycle of 1 ms and real-time data transmission facilitated UDP communication to the host computer.The multi-sensor data type and driver configurations were established on the PCI board, and the program's real-time simulation model and driver were developed using MATLAB/Simulink.The simulation program was coded using Microsoft Visual Studio.The structure of the neural model in this experiment was set as 3 × 8 × 1, the initial weights of the neural network were randomly selected within [−0.1, 0.1], the learning rate was set as 0.07, and the value range of the neuron selection sigmoid activation function was [−1, 1].The parameters of the adaptive fuzzy impedance were set to be the same as the experimental parameters in Section 3.3.
First, the effect of the force-position composite control algorithm on the posture of the torso during motion was compared.The experimental scenario is shown in Figure 12.The full cycle consisted of three steps, with two legs for swing in each step and the remaining four legs for support.This gait style is more suitable for complex terrain, because it has higher stability than three-legged support.The base junction foot-end phase began at an initial height of −0.4 m, and the motion step length was 0.8 m.Each step took 3 s, with a 0.3 m lift in the z-direction when swinging.The motion trajectory of the robot used a low-impact foot-end trajectory method that facilitated the initial position and velocity constraints by employing acceleration as a sinusoidal function.
the obstacle-avoidance strategy outlined in Section 2.2.1.The control approach involves a hardware-in-the-loop system that utilizes an embedded control host powered by the VxWorks operating system with a control cycle of 1 ms and real-time data transmission facilitated through UDP communication to the host computer.The multi-sensor data type and driver configurations were established on the PCI board, and the program's real-time simulation model and driver were developed using MATLAB/Simulink.The simulation program was coded using Microsoft Visual Studio.The structure of the neural model in this experiment was set as 3 8 1 , the initial weights of the neural network were ran- domly selected within [−0.1, 0.1], the learning rate was set as 0.07, and the value range of the neuron selection sigmoid activation function was [−1, 1].The parameters of the adaptive fuzzy impedance were set to be the same as the experimental parameters in Section 3.3.First, the effect of the force-position composite control algorithm on the posture of the torso during motion was compared.The experimental scenario is shown in Figure 12.The full cycle consisted of three steps, with two legs for swing in each step and the remaining four legs for support.This gait style is more suitable for complex terrain, because it has higher stability than three-legged support.The base junction foot-end phase began at an initial height of −0.4 m, and the motion step length was 0.8 m.Each step took 3 s, with a 0.3 m lift in the z-direction when swinging.The motion trajectory of the robot used a low-impact foot-end trajectory method that facilitated the initial position and velocity constraints by employing acceleration as a sinusoidal function.The trajectory of the leg on one side of the hexapod robot during position-based control relative to its initial stance in the forward Y-direction and vertical Z-direction is shown in Figure 13a.Each side of the robot has two support-legs and one swing-leg involved in each gait cycle, and the force on each leg is shown in Figure 13b, where the right front (RF) leg and right middle (RM) leg step on the obstacle at 2.73 s and 5.45 s, respectively.The larger force generated when the obstacle is stepped on also affects the forces on the other legs, which has a greater impact on the torso stance of the body.During the support process, owing to the uncertainty of the terrain, the position of the center-of-mass changes accordingly at different slopes, leading to a large deviation in the force of each leg from the expected force, when the posture of the robot torso is influenced by the environment.The robot's torso posture is shown in Figure 13c, and due to the irregular terrain of the landing point, the robot's roll and pitch angles have undergone significant changes.Figure 13d,e show the z-direction coordinates of the legs in the force-position control situation and the forces acting on the legs; it can be seen that when the obstacles are encountered during the swing phase at 2.65 s and 5.68 s, the sensor detects the changes in force and The trajectory of the leg on one side of the hexapod robot during position-based control relative to its initial stance in the forward Y-direction and vertical Z-direction is shown in Figure 13a.Each side of the robot has two support-legs and one swing-leg involved in each gait cycle, and the force on each leg is shown in Figure 13b, where the right front (RF) leg and right middle (RM) leg step on the obstacle at 2.73 s and 5.45 s, respectively.The larger force generated when the obstacle is stepped on also affects the forces on the other legs, which has a greater impact on the torso stance of the body.During the support process, owing to the uncertainty of the terrain, the position of the center-of-mass changes accordingly at different slopes, leading to a large deviation in the force of each leg from the expected force, when the posture of the robot torso is influenced by the environment.The robot's torso posture is shown in Figure 13c, and due to the irregular terrain of the landing point, the robot's roll and pitch angles have undergone significant changes.Figure 13d,e show the z-direction coordinates of the legs in the force-position control situation and the forces acting on the legs; it can be seen that when the obstacles are encountered during the swing phase at 2.65 s and 5.68 s, the sensor detects the changes in force and avoids the obstacles by adjusting the displacement in the z-direction, which is adjusted to avoid the movement of the entire vehicle.In the support phase, the change in the displacement in the z-direction is adjusted according to the change in the support force, thus ensuring that the desired force of the leg to the torso support agrees better, and that the foot-end force can fluctuate around the desired force achieve dynamic equilibrium.The posture of the robot's trunk is shown in Figure 13f, and it can be seen that the robot can maintain stability of the trunk after a brief adjustment during phase switching.This indicates that the control method proposed in this article can enable the robot to maintain the target attitude while moving in complex terrain.
Agriculture 2023, 13, x FOR PEER REVIEW 18 of 23 avoids the obstacles by adjusting the displacement in the z-direction, which is adjusted to avoid the movement of the entire vehicle.In the support phase, the change in the displacement in the z-direction is adjusted according to the change in the support force, thus ensuring that the desired force of the leg to the torso support agrees better, and that the footend force can fluctuate around the desired force to achieve dynamic equilibrium.The posture of the robot's trunk is shown in Figure 13f, and it can be seen that the robot can maintain stability of the trunk after a brief adjustment during phase switching.This indicates that the control method proposed in this article can enable the robot to maintain the target attitude while moving in complex terrain.To validate the posture optimization method adapted for various terrains, experiments were conducted using two types of terrains: the hillside, with a pitch angle of 10°, and asphalt pavements which had a pitch angle of 14°, as shown in Figure 14.Experiments were conducted with the hexapod robot walking on a slope at different trunk center-ofmass heights (H) and trunk pitch angles (φy).The robot's total energy consumption for each stride was determined through the pressure and flow of the hydraulic system.The system's working pressure was obtained through a pressure sensor, and the working flow was calculated based on the cylinder displacement.As shown in Figure 15, it can be observed that under two slope conditions, the energy consumption of the hexapod robot with the growth of H exhibits a trend of initially decreasing and then increasing.Moreover, as the trunk pitch angle increases, the energy consumption gradually decreases.At a terrain pitch angle of φy = 10° and a trunk center-of-mass height of H = 400 mm, the minimum energy consumption occurred when the trunk pitch angle was at 10°.The theoretically calculated result was 34.2 kJ, while the experimental result was 36.1 kJ.When the estimated slope was at a pitch angle of φy = 14°, the minimum energy consumption of the hexapod robot occurred at a trunk center-of-mass height of H = 400 mm and a trunk pitch angle of 14°.The theoretical result was 33.1 kJ, and the experimental result was 35.0 kJ.The actual energy consumption of the robot hydraulic system in each step is shown in Table 3.These results indicate a certain discrepancy between the theoretically calculated energy consumption and the actual values.This discrepancy is due to additional energy consumption caused by pressure shocks and position errors during the actual motion process.However, the trend of energy consumption changes with posture being observed in To validate the posture optimization method adapted for various terrains, experiments were conducted using two types of terrains: the hillside, with a pitch angle of 10 • , and asphalt pavements which had a pitch angle of 14 • , as shown in Figure 14.Experiments were conducted with the hexapod robot walking on a slope at different trunk center-of-mass heights (H) and trunk pitch angles (ϕ y ).The robot's total energy consumption for each stride was determined through the pressure and flow of the hydraulic system.The system's working pressure was obtained through a pressure sensor, and the working flow was calculated based on the cylinder displacement.As shown in Figure 15, it can be observed that under two slope conditions, the energy consumption of the hexapod robot with the growth of H exhibits a trend of initially decreasing and then increasing.Moreover, as the trunk pitch angle increases, the energy consumption gradually decreases.At a terrain pitch angle of ϕ y = 10 • and a trunk center-of-mass height of H = 400 mm, the minimum energy consumption occurred when the trunk pitch angle was at 10 • .The theoretically calculated result was 34.2 kJ, while the experimental result was 36.1 kJ.When the estimated slope was at a pitch angle of ϕ y = 14 • , the minimum energy consumption of the hexapod robot occurred at a trunk center-of-mass height of H = 400 mm and a trunk pitch angle of 14 • .The theoretical result was 33.1 kJ, and the experimental result was 35.0 kJ.The actual energy consumption of the robot hydraulic system in each step is shown in Table 3.These results indicate a certain discrepancy between the theoretically calculated energy consumption and the actual values.This discrepancy is due to additional energy consumption caused by pressure shocks and position errors during the actual motion process.However, the trend of energy consumption changes with posture being observed in actual walking is consistent with the theoretically calculated energy consumption, thereby validating the effectiveness of the posture optimization strategy proposed in this study.To validate the performance of the proposed self-adaptive fuzzy impedance control method for actual robot motion, we conducted a comparative analysis of the proposed method with the impedance control method (ICM) used in the previous reference [15].As shown in Figure 14, the robot fell into the hillside pavement while moving, indicating that    To validate the performance of the proposed self-adaptive fuzzy impedance control method for actual robot motion, we conducted a comparative analysis of the proposed method with the impedance control method (ICM) used in the previous reference [15].As shown in Figure 14, the robot fell into the hillside pavement while moving, indicating that  To validate the performance of the proposed self-adaptive fuzzy impedance control method for actual robot motion, we conducted a comparative analysis of the proposed method with the impedance control method (ICM) used in the previous reference [15].As shown in Figure 14, the robot fell into the hillside pavement while moving, indicating that the hillside pavement was less stiff than the rigid asphalt pavement Because terrain uncertainty has a significant impact on the comparative study results, a transition phase was added in the phase-switching process by introducing a six-legged co-supported gait before the switching phases, and a constant force was set as the expected force of the support leg during this phase.
The experimental results are shown in Figure 16.The right rear (RR) leg of the robot was the focus of this study, and a three-step motion was used.The movements proceeded as follows: 1-2 s of the swing phase, where the expected force is zero; 2-2.5 s of the transition phase, where the RR leg serves as the support for the next phase of the gait, and the expected force is constant at 6000 N; and 2.5-5 s of the support phase, where the expected force is obtained through trajectory planning and foot force distribution algorithms, resulting in a variable force at variable acceleration.As shown in Figure 16a, both control algorithms exhibit faster responses on hard terrain.The steady-state error in the force did not differ significantly.Figure 16b,c shows the displacement compensation of the two control algorithms and the pitch angle of the robot body in the z-direction at this stage.The tilt angle of the robot body is smaller during the switching phase, and the control effects of the two algorithms are approximately the same.
Agriculture 2023, 13, x FOR PEER REVIEW 20 of 23 the hillside pavement was less stiff than the rigid asphalt pavement Because terrain uncertainty has a significant impact on the comparative study results, a transition phase was added in the phase-switching process by introducing a six-legged co-supported gait before the switching phases, and a constant force was set as the expected force of the support leg during this phase.The experimental results are shown in Figure 16.The right rear (RR) leg of the robot was the focus of this study, and a three-step motion was used.The movements proceeded as follows: 1-2 s of the swing phase, where the expected force is zero; 2-2.5 s of the transition phase, where the RR leg serves as the support for the next phase of the gait, and the expected force is constant at 6000 N; and 2.5-5 s of the support phase, where the expected force is obtained through trajectory planning and foot force distribution algorithms, resulting in a variable force at variable acceleration.As shown in Figure 16a, both control algorithms exhibit faster responses on hard terrain.The steady-state error in the force did not differ significantly.Figure 16b, c show the displacement compensation of the two control algorithms and the pitch angle of the robot body in the z-direction at this stage.The tilt angle of the robot body is smaller during the switching phase, and the control effects of the two algorithms are approximately the same.The performance of legged robots is significantly affected on hillside terrain, where the ground stiffness is low.The experimental results depicted in Figure 16d show that, during the transition phase, the ICM is more sensitive to the environment, causing a slower response while tracking the constant force and resulting in force-tracking errors of constant-force tracking during the gait time.In the support phase, the traditional impedance method establishes the target support force in 0.43 s, while the AF control algorithm proposed in this study establishes the target support force in 0.16 s.Both control algorithms exhibit improved desired force-tracking effects, because the robot compressed the soil during the motion, owing to self-weight.This improved the terrain stiffness, particularly by adding a transition phase, thereby reducing the steady-state error.As shown in Figure 16f, in the low-stiffness environments and during phase switching, the maximum tilt angle of the body is 0.37°, whereas the maximum tilt angle of the impedance control is 0.88°.Because of the small compensation amount of the ICM during phase switching, the body experienced a brief tilt instability caused by the low stiffness of the ground, thereby failing to establish support in time.The performance of legged robots is significantly affected on hillside terrain, where the ground stiffness is low.The experimental results depicted in Figure 16d show that, during the transition phase, the ICM is more sensitive to the environment, causing a slower response while tracking the constant force and resulting in force-tracking errors of constantforce tracking during the gait time.In the support phase, the traditional impedance method establishes the target support force in 0.43 s, while the AF control algorithm proposed in this study establishes the target support force in 0.16 s.Both control algorithms exhibit improved desired force-tracking effects, because the robot compressed the soil during the motion, owing to self-weight.This improved the terrain stiffness, particularly by adding a transition phase, thereby reducing the steady-state error.As shown in Figure 16f, in the low-stiffness environments and during phase switching, the maximum tilt angle of the body is 0.37 • , whereas the maximum tilt angle of the impedance control is 0.88 • .Because of the small compensation amount of the ICM during phase switching, the body experienced a brief tilt instability caused by the low stiffness of the ground, thereby failing to establish support in time.
The rugged terrain and asphalt pavement are considered as soft and hard terrain, respectively, and the experimental results are shown in Table 4.The results demonstrated that the AF algorithm exhibits improved performance in force tracking when the terrain environment is relatively "soft", whereas the performance improvement of the AF algorithm is less significant when the terrain environment is "hard".Moreover, it was observed that the convergence process of the ICM for force tracking becomes slower as the terrain environment becomes relatively "soft", whereas the AF algorithm demonstrates better performance in improving force tracking in such environments and exhibits certain adaptability to the terrain.However, compared with the single-leg study, overall tracking performance of the robot experiment decreased and fluctuated owing to the influences of the position-control accuracy and rigid-flexible coupling characteristics of the heavy-duty robot itself, as well as force-tracking errors caused by uncertainties.

Conclusions
In this paper, we propose a motion strategy for agricultural transportation robots operating on complex terrains.The premise of the motion strategy looks to torso safety and stability constraints based on the terrain estimation of the support surface, and a visual recognition system to ensure the safe passage of the robot on different terrains.Moreover, force analysis of the hydraulic leg drive was conducted to establish the correspondence between the driving force and the motion posture.It can be concluded that adjusting the robot's posture can reduce the energy consumption of robot movements.A control method combining force and position was subsequently proposed, maintaining the target posture of the robot's torso through force tracking.To address the problem of tracking time-varying forces in uncertain environments, an adaptive-fuzzy impedance algorithm was developed to eliminate steady-state errors.The proposed control strategy was validated by building a real-time simulation system for a heavy-duty six-legged robot and comparing it with an existing model.Experimental and simulation results showed that the robot maintained the stability of its locomotor posture by tracking the forces on each leg, and the proposed control strategy achieved convergence and shorter response times on various terrains.The proposed control method is able to reduce the adjustment time of the system by 58% and the deflection error of the structure by 62.8% when the stiffness of the external environment is low.
Several issues remain to be resolved before the advent of the widespread use of multilegged hydraulic robots.These include the fact that hydraulic drive units in swing and support states require different driving forces, but the solution provided by a single-pump hydraulic systems fails to satisfy the differing requirements of multiple legs, leading to energy loss.Another issue is that the flexible deformation of the legs in large-sized, heavyload robots makes force tracking difficult for the system.Therefore, in the near future, we plan to modify the structure of our hydraulic system and optimize our control algorithms to overcome these challenges.

Figure 3 .
Figure 3. Diagram of reference coordinate system.

Figure 3 .
Figure 3. Diagram of reference coordinate system.

Figure 4 .
Figure 4. (a) Yaw angle adjustment of the torso; (b) sketch of the NESM solution.

Figure 4 .
Figure 4. (a) Yaw angle adjustment of the torso; (b) sketch of the NESM solution.

Figure 5 .
Figure 5. Analysis of hydraulic drive forces for the legs.(a) Thigh cylinder.(b) Shin cylinder.(c) Hydraulic driven force.

Figure 5 .
Figure 5. Analysis of hydraulic drive forces for the legs.(a) Thigh cylinder.(b) Shin cylinder.(c) Hydraulic driven force.

Figure 6 .
Figure 6.Relationship between posture and energy consumption on different terrains.

Figure 6 .
Figure 6.Relationship between posture and energy consumption on different terrains.

Figure 7 .
Figure 7. Diagram of motion strategy for heavy-duty hexapod robot.

Figure 7 .
Figure 7. Diagram of motion strategy for heavy-duty hexapod robot.

Figure 8
Figure 8 depicts the joint simulation system constructed using MATLAB/Simulink and Adams to analyze the influence of m d , b d , and k e on the control performance of the system.Figure8cshows that as the target impedance inertia parameter m d decreases, the response speed increases, while the regulation time and overshoot decrease.However, when the overshoot approaches a zero value, m d decreases again, leading to a decrease in the response speed and an increase in the time required to reach a steady state.Figure8bindicates that increasing b d results in a decrease in the response speed and regulation time, whereas the absence of an overshoot leads to a decline in the response speed.However, when an overshoot is absent, increasing b d leads to a decrease in the response speed.Figure8areveals that changes in the environmental stiffness parameters result in significant variations in the force-tracking performance.Therefore, we proposed a real-time self-adaptive fuzzy algorithm to adjust the impedance model parameters based on the error information determined between the expected and actual contact forces.This approach enhances the force-tracking performance of the impedance controller under different environmental parameters, thereby improving the adaptability of a six-legged robot to its surroundings.

Figure 8 .
Figure 8. Analysis of the influence of impedance parameters.

Figure 8 .
Figure 8. Analysis of the influence of impedance parameters.

Figure 9 .
Figure 9. Flowchart of the fuzzy-logic control.Figure 9. Flowchart of the fuzzy-logic control.

Figure 9 .
Figure 9. Flowchart of the fuzzy-logic control.Figure 9. Flowchart of the fuzzy-logic control.
The inertia parameter was set to md = 100 kg, and the input quantity ranges of the fuzzy controllers E f and Ec f were [−5000, −5000] and [−1000, 1000], respectively.The initial value of the damping parameter was bd = 2000 N/(m/s), and the output damping parameter adjustment range was [−5000, 5000].Figure 10 illustrates the experimental results of the robot on different terrains by comparing different forcetracking algorithms.1000], respectively.The initial value of the damping parameter was bd = 2000 N/(m/s), and the output damping parameter adjustment range was [−5000, 5000].Figure 10 illustrates the experimental results of the robot on different terrains by comparing different forcetracking algorithms.

Figure 10 .
Figure 10.Performance of force tracking for different environmental stiffnesses.(a) Slope force tracking in soft soil terrain.(b) Slope force tracking in soft foam terrain.(c) Slope force tracking in hard terrain.(d) Acceleration force tracking in soft soil terrain.(e) Acceleration force tracking in soft foam terrain.(f) Acceleration force tracking in hard terrain.

Figure 10 .
Figure 10.Performance of force tracking for different environmental stiffnesses.(a) Slope force tracking in soft soil terrain.(b) Slope force tracking in soft foam terrain.(c) Slope force tracking in hard terrain.(d) Acceleration force tracking in soft soil terrain.(e) Acceleration force tracking in soft foam terrain.(f) Acceleration force tracking in hard terrain.

Figure 11 .
Figure 11.Experimental platform for heavy-duty transport robot.

Figure 11 .
Figure 11.Experimental platform for heavy-duty transport robot.

Figure 12 .
Figure 12.The motion process of the hexapod robot in complex terrain.

Figure 12 .
Figure 12.The motion process of the hexapod robot in complex terrain.

Figure 13 .
Figure 13.Comparison of motion states for mixed force-position control.(a) End-of-foot tracking by position control.(b) Force at the end of the foot controlled by position (c) Angle of the trunk controlled by position.(d) End-of-foot tracking via position-force control.(e) End-of-foot force tracking via position-force control.(f) Angle of the torso via position-force control.

Figure 13 .
Figure 13.Comparison of motion states for mixed force-position control.(a) End-of-foot tracking by position control.(b) Force at the end of the foot controlled by position (c) Angle of the trunk controlled by position.(d) End-of-foot tracking via position-force control.(e) End-of-foot force tracking via position-force control.(f) Angle of the torso via position-force control.

Agriculture 2023 ,
13, x FOR PEER REVIEW 19 of 23actual walking is consistent with the theoretically calculated energy consumption, thereby validating the effectiveness of the posture optimization strategy proposed in this study.

Figure 14 .
Figure 14.Experimental scenarios in different stiffness environments.

Figure 15 .
Figure 15.Performance comparison of different force-tracking algorithms.

Figure 14 .
Figure 14.Experimental scenarios in different stiffness environments.

Figure 14 .
Figure 14.Experimental scenarios in different stiffness environments.

Figure 15 .
Figure 15.Performance comparison of different force-tracking algorithms.

Figure 15 .
Figure 15.Performance comparison of different force-tracking algorithms.

Figure 16 .
Figure 16.Performance comparison of different force tracking algorithms.(a) force tracking in hard terrain, (b) position compensation in hard terrain, (c) torso angle in hard terrain, (d) force tracking in soft terrain, (e) position compensation in soft terrain, (f) torso angle in soft terrain.

Figure 16 .
Figure 16.Performance comparison of different force tracking algorithms.(a) force tracking in hard terrain, (b) position compensation in hard terrain, (c) torso angle in hard terrain, (d) force tracking in soft terrain, (e) position compensation in soft terrain, (f) torso angle in soft terrain.

Table 1 .
D-H parameter of the leg.

Table 1 .
D-H parameter of the leg.

Table 2 .
Steady-state error table for force tracking.

Table 3 .
Table of actual energy consumption.

Table 3 .
Table of actual energy consumption.

Table 3 .
Table of actual energy consumption.

Table 4 .
Table of force-tracking performance.