On the Controlling of Multi-Legged Walking Robots on Stable and Unstable Ground

In this chapter, we developed and investigated numerically a general kinematic model of a multi-legged hybrid robot equipped with a crab-like and/or mammal-like legs. To drive the robot ’ s limbs, a novel generator of gait was employed and tested. The simulation model developed in Mathematica is suitable for virtual study and visualization of the locomotion process. In contrast to our previous papers, in this study we focused especially on precise control of the position of the robot during walking in different directions. In our study we were able to simultaneously control all six spatial degrees of freedom of the robot ’ s body, as well as all the robot ’ s legs. Therefore, the investigated robot can be considered and used as a fully controlled walking Stewart platform. What is more, the used algorithm can also be successfully employed to coordinate and control all limbs of the robot on unstable or vibrating ground. As an example, it can be used to stabilize spatial position of the robot when the supporting ground becomes vibrating or unstable, and it will keep the robot stable and prevent it from falling over. Eventually, the developed simulation algorithms can be relatively simply adopted to control real constructions of different multi-legged robots.


Introduction
Different kinds of multi-legged robots are extensively investigated in the literature, since they have great importance in engineering applications [1]. In general, each legged robot can be considered as a mechatronic system with limbs connected to the main body (i.e., the robot's trunk). In such a construction of the walking machine, the robot's legs are responsible for acting as a support frame and play a key role when it comes to the locomotion process. Namely, when the limbs of the robot are controlled with a degree of autonomy, it can move within its environment and perform the planned tasks [2]. For instance, the legged machines are able to reproduce animal or human movements and substitute humans in various activities [3]. An interesting state of the art regarding the most popular hexapod robots can be found in numerous review papers. Among numerous multi-legged robots met in the literature, we can distinguish especially robots with leg structure inspired based on the anatomy of insects or mammals. Large numbers of legs with different kinematic structures are useful to overcome complex obstacles met in nature without losing stability and increase stability of the robot.
About 50 percent of the Earth's land surface is not adapted for wheeled machines. However, it can be accessed by humans and animals that can walk in those difficult and irregular terrains. Therefore, nowadays, there is a lot of interest in different kinds of robots that use legged motion inspired by walking animals found in nature. This type of motion allows to overcome obstacles, move in an omnidirectional manner, and access uneven environments, and it is fault tolerant, in comparison to crawler or wheeled vehicles. Unfortunately, legged robots are challenging in terms of controlling their locomotion. However, on the other hand, they can be used in terrains, where wheeled machines cannot perform their tasks. It is because legged robots can overcome obstacles of heights equal to the height of their limbs, while the wheeled robots can overcome obstacles of heights up to the half of the wheel radius. On the contrary to wheeled robots, where the contact between the robot's wheels and the ground usually has a continuous character, in the case of legged robots, the contact between the feet and the ground usually takes a form of contact points. It is known that a large amplitude of the ground reaction force acting on the robot's feet has a negative impact on the dynamics of the whole robot. Therefore, these forces should be minimized, if possible. This is why one of the considered issues is also related to the problem of minimization of the ground reaction forces acting on the robot's legs.
A literature review summarized in our previous papers [4][5][6][7][8][9][10][11] indicate that investigations of different types of walking machines are still challenging and focus the attention of numerous researchers. The control possibilities can be especially helpful in a natural environment of the robot, when it comes to both the navigation and obstacle avoidance. That is why, in this chapter we developed a general full parametric simulation model of a hybrid walking robot, i.e., the robot which has different numbers of the legs inspired biologically by insects, reptiles, or mammals. To drive the legs of the abovementioned robot, we employed a novel gait generator, firstly introduced in our previous paper [11]. The mentioned approach can be treated as neural networks that generate rhythmic outputs in the absence of rhythmic input. Such kinds of rhythmic motions have been found by biologists in different biological periodic processes, including swimming, running, breathing, flying, chewing, or walking. Moreover, we also used own algorithm, which is suitable for a smooth transition between different gait phases, i.e., initial, rhythmic, and terminal phases [10]. The main goal of the abovementioned studies was to obtain better both kinematic and dynamical parameters of the investigated machines during the locomotion process, which finally lead to an increase in the stability of the robot and its control possibilities. Eventually, we considered the problem of controlling the direction of the movement of the robot and control all six spatial degrees of freedom of the robot's body, i.e., three deviations and three rotations along and around three different axes, respectively. It can be useful for the walking robot and to control all robot's legs on a planar, unstable, and vibrating ground, since both the navigation and obstacle avoidance matters are particularly important for the locomotion of legged robots in the natural environment.

A brief summary of our chosen previous studies related to walking robots
Our numerical investigations related to the kinematical analysis and control of the six-legged walking robot have been initiated in the paper [4]. To control the movement of the tip of the robot leg, a nonlinear mechanical oscillator describing stick-slip mechanical vibrations has been proposed and applied as the central pattern generator (CPG). By using also three well-known mechanical oscillators (i.e., Hopf oscillator, Van der Pol oscillator, and Rayleigh oscillator), the advantages of the proposed CPG model have been illustrated and discussed. Time histories of the articulated variables in all joints of the robot's leg and its configurations during walking indicated some analogies between the characteristics of the simulated walking robot and animals found in nature. Eventually, the results obtained in that paper indicated that, from the point of view of the energy demand, the proposed model of CPG based on the stick-slip vibrations can be more efficient than other previous CPG models found in the literature.
In the next paper [5], the above-presented study has been continued regarding power consumption experimental analysis with the use of the constructed hexapod robot controlled by previously introduced CPGs. The power consumption of the constructed robot has been calculated based on the current consumption in the servo motors, which drive the robot's legs. The performed experimental investigations showed different energy demand, depending on the CPG model driving the robot's legs. By comparing the total energy demand of all servomechanisms installed in the robot for the same locomotion conditions, it has been proven that the proposed CPG model is characterized by the lowest energy demand.
The study [6] introduced dynamical modeling of the previously investigated hexapod robot walking with the tripod gait on a planar and hard ground. This type of gait is commonly used by six-legged real insects as well as six-legged walking machines met in engineering applications. Using the inverse dynamic approach and some simplifications resulting from the symmetry of the robot, vertical components of the ground reaction forces acting on the robot's legs have been estimated numerically. As a result, different time histories of the contact forces and overloads acting on the robot's legs have been detected, depending on the CPG model driving the robot's legs. Finally, the obtained information can be used for further strength analysis of the robot's legs to ensure trouble-free use and an extension of life and operational time of the robot.
On the contrary to the abovementioned papers, in Ref. [7], a new model of an octopod (eight-legged) robot has been developed and numerically simulated in order to investigate crucial kinematic parameters during locomotion with the tetrapod gait, i.e., similar gait as the tripod gait used in hexapod robots. Another wellknown CPG model has also been used (i.e., CPG model constructed based on the Toda-Rayleigh lattice). However, the main novelty of that article is a proposition of a new model of gait generator constructed based on the sine function, further referred as a SINE generator. The proposed model of gait is relatively simple in comparison with other control methods found in the literature and can be especially useful when the robot walks on planar/regular surfaces. Some advantages of the proposed SINE generator have been outlined, including the lack of the acceleration and deceleration of the robot gravity center. These advantages have a positive influence on the robot's dynamics, especially when it comes to the minimization of the ground reaction forces acting on the robot's legs and low energy consumption of the robot during walking.
Numerical investigations of the octopod robot and a novel gait generator introduced in the paper [7] have been significantly extended in Ref. [8]. Aside from computing crucial kinematic parameters of the robot, also time histories of the robot's dynamic locomotion parameters have been illustrated and discussed. The obtained dynamic parameters confirmed some advantages of the proposed SINE generator previously presented in paper [7]. Concluding, it should be mentioned that the proposed SINE generator is relatively simple in comparison with other control methods found in the literature. Especially, solving of nonlinear differential equations is not required in this model, on the contrary to all previously presented CPGs. The proposed model of the gait does not produce the unnecessary fluctuations in the center of gravity of the robot or variations in the acceleration/deceleration in the direction of the robot movement. This is why the proposed generator appears to be more efficient with respect to the energy demand than other CPGs investigated in that paper.
In the next paper [9], another kinematic/dynamic simulation model of the hexapod robot has been developed and implemented in Mathematica. On the contrary to previous crab-like hexapod/octopod robots, another kinematic model of a single robot's leg has been used. Also in that study, advantages of the proposed gait generator have been clearly emphasized, especially with regard to the kinematic parameters (displacement and velocity of the whole robot) as well as dynamic parameters (ground reaction forces and overloads acting on the robot legs). In addition, the problem of trajectory planning of the position of the robot body during the walking process has been considered. In the developed simulation model, the appropriate fluctuations of the robot in the vertical direction during the walking process can be controlled precisely. Such a control approach can be useful in the natural environment, for instance, when the robot is walking under or over obstacles.
In paper [10], novel kinematic and dynamic models of a mammal-like octopod robot have been developed and numerically investigated. In order to control the robot's legs, also new simple gait generators constructed based on a sine function have been employed and tested. The proposed models are relatively simple in comparison to other control methods found in the literature. It has been shown that the used gait generators can be useful to obtain better both kinematic and dynamic properties of motion of the whole robot. The advantages of the proposed models have been clearly emphasized, especially with regard to the crucial kinematic and dynamic parameters. Another novelty of this paper is a proposition of one model to control the initial, regular, and terminal phases of the robot gait without the need for generating additional control signals. The developed simulation model of the robot allows also to precisely control robot's vertical position. As a result, better stability of the whole robot during walking and performing the planned tasks, also on terrains characterized by a relatively low friction coefficient between the ground and the robot feet, has been detected.
The study presented in paper [11] is a significant extension of the control methods introduced in the paper [10]. To drive the robot's legs, also another nonlinear oscillator (i.e., hybrid Van der Pol-Rayleigh oscillator) has been used as a central pattern generator. Moreover, also a new, relatively simple, and efficient model has been proposed and tested. The proposed model of the gait generator is useful to obtain better both kinematic and dynamic parameters of motion of the robot walking in different directions. By changing the length and the height of a single step of the robot, the initial, rhythmic, and terminal phases of the robot gait, as in the previous paper [10], have been introduced. Using the simulation model developed in Mathematica, displacement, velocity and acceleration of the center of the robot's body, fluctuations in the zero moment point of the robot, and the ground reaction forces acting on the feet of the robot have been computed, reported, and discussed. The obtained results showed advantages of the introduced model of robot's gaits regarding fluctuations in the robot's body, the minimum value of dynamic stability margin, as well as the minimum value of a friction coefficient which is necessary to avoid slipping between the ground and the robot's feet during the walking process. Moreover, the proposed model does not produce unnecessary fluctuations in the velocity both in the vertical and horizontal (i.e., movement and lateral) directions of the robot. As a result, it has also a positive impact on the dynamical parameters of the robot. In addition, as some of the previously discussed models, the proposed gait generator is relatively simple in comparison to the other three tested CPGs constructed on the basis of the nonlinear oscillators. Finally, the employed model of gait also allowed to precisely control the vertical position of the robot during walking in different directions.
Also recently, various control strategies of the walking machines were usually tested by other researches using different commercial software such as MATLAB [2,12,13], ADAMS [12,[14][15][16], or the Open Dynamics Engine [17,18]. It shows that investigations of walking robots are still challenging for researches and focus their attention. Therefore, as it was shortly mentioned above, in this chapter we developed a general full parametric simulation model of a hybrid walking robot, i.e., the robot which can have different numbers of legs inspired biologically by insects, reptiles, or mammals. To drive the legs of the abovementioned robot, we employed central pattern generator, firstly introduced in our previous paper [11]. Moreover, we also used own algorithm, which is suitable for a smooth transition between different gait phases, i.e., initial, rhythmic, and terminal phases [10]. Eventually, we considered the problem of controlling the direction of the movement of the robot and control all six spatial degrees of freedom of the robot's body (three deviations and three rotations along and around three different axes, respectively), as well as control all robot's legs on planar, vibrating, and unstable ground. These control possibilities can be especially helpful in a natural environment of the robot, when it comes to both the navigation and obstacle avoidance.

Prototypes of different walking robots
Advances computer modeling can be useful to increase the efficiency of designed machines, by introducing required modifications to the mechanical construction, depending on the results obtained during virtual tests. Currently, numerous computer programs, such CATIA, SimDesigner, ADAMS, or SolidWorks software, support researchers in virtual prototyping of machines, including walking robots, for instance, see papers [19][20][21]. In our study we also designed different walking robots, with different numbers of limbs and their different structures. All our designs presented in Figure 1 were created in Inventor Professional 2019 software. In general, each robot consists of the main body part (trunk) and four (quadruped), six (hexapod), or eight (octopod) legs with crab-like or mammal-like structures. Following many previous researches, during modeling of all robot's legs, we were inspired by the morphology of limbs of typical insects or mammals, reduced to three main segments [2,12,[22][23][24][25][26][27]. To avoid mutual collisions between the legs, in all presented designs, the robot's legs are symmetrically distributed on two sides of the robot's body. By adopting the initial positions of individual leg's joints, different leg's configurations, which correspond to configurations of lower limbs of different animals met in nature, can be implemented [15]. In all designs presented in Figure 1, each joint of the robot's leg is actuated by Power HD AR-1201MG servomotor controlled by the pulse-width modulation (PWM) technique. This servomotor has inner closed loop feedback of the position control and a proportional controller.
Both kinematic and dynamic models of crab-like or mammal-like robots were detail presented in our previous papers [8,10,11]. On the contrary to the abovementioned references, in this study we focused only on novel mathematical formulations regarding full control of the robot on a planar, irregular, unstable, or vibrating ground, which have not been presented before. To investigate the possibility of the robot's control, we have developed a general, three-dimensional, fully parametric simulation model of a walking robot created in the Mathematica software. The created simulation model allowed us to visualize behavior of the investigated robot and control the correctness of the obtained results. Especially, we were able to control the spatial position of individual elements of the robot and the configurations of the legs. It also allowed us to better understand the obtained simulation results. Through the appropriate choosing of the parameters and configurations of the limbs, we are able to quickly generate various types of walking robots.

Kinematics of the robot
In one of the recent papers [11], we considered and investigated the problem of planning the trajectory of the robot body in the vertical direction, during walking on a planar plane in any (i.e., forward, lateral, oblique, etc.) direction. On the contrary to the mentioned paper, in this study we extended significantly the control possibility of the investigated robot, including full control of all six spatial degrees of freedom of the robot's body (i.e., three deviations and three rotations along and around three different axes, respectively), as well as control of all robot's legs on planar, nonregular, unstable, and vibrating ground. As it was mentioned before, this control possibility can be really helpful, when it comes to both the navigation and obstacle avoidance in natural environment of the robot. As a result, the presented robot can be treated as a fully controlled walking Stewart platform. The created simulation models allow to visualize the investigated robots during walking and control the correctness of the obtained results. Especially, it was able to control the spatial position of individual elements of the robot and the configurations of the legs. Finally, it allows to understand the obtained simulation results better. Figure 2 shows exemplary simulation model of a hybrid octopod robot. Four of its legs (two front and two hind) have mammal-like structures, whereas four middle legs have crab-like structures. In addition, for more general considerations, we used different initial configurations of the mammal-like legs for front and hind legs. Model of this hybrid octopod robot standing on a planar surface is presented in Figure 2.
The robot is embedded in a global coordinate system Oxyz. In addition, other local coordinate systems are fixed to the robot. The coordinate system O 0 x 0 y 0 z 0 is associated with the center of the robot's body. In turn, other local coordinate systems are associated with the robot's legs. In Figure 2 we presented only one local coordinate system O}x}y}z} fixed to the leg L1.
In general, we consider irregular and unstable ground, where a height (z-component) for the coordinates x and y for time t has the following general form: The vectors r G t ð Þ describing positions of all points on the ground in the global coordinate system Oxyz have the form where Ã T , r init G are vectors describing positions of points of the ground in the initial time, i.e., for the angles is the rotation matrix, whereas are elementary rotation matrices of the ground, respectively. All vectors r R t ð Þ of the robot in the global coordinate system Oxyz are expressed by where Δr R t ð Þ ¼ Δx R t ð Þ, Δy R t ð Þ, Δz R t ð Þ Â Ã T , r init R are vectors describing positions of points of the robot in the initial time, i.e., for the angles α R t ð Þ ¼ 0, β R t ð Þ ¼ 0, and is the rotation matrix, whereas The determination of the coordinates describing the positions of the feet of all the robot's legs requires consideration of the vectors r G t ð Þ in contact points between the robot's legs and the ground, as well as the inverse matrix R À1 R . Next, the appropriate articulated variables for all joints of the robot's legs can be determined.

Control of the robot walking on a planar, stable, and not vibrating surface
First, we considered the robot walking at an oblique direction on a planar, stable, and not vibrating ground (i.e., z G x, y, t ð Þ¼0, In the presented simulations, we considered initial, regular, and terminal phases of gait [10]. In turn, we applied non-zero excitations of all six degrees of freedom of the robot's trunk, i.e. Δx R t ð Þ 6 ¼ 0, Δy R t ð Þ 6 ¼ 0, Configurations of both the robot's body and all its legs captured in regular time intervals are presented in Figure 3. In the considered case, the robot moves in an oblique direction with respect to the direction determined by the robot's (x'-) axis at the initial time. Changing the position of the whole robot is realized by the appropriate control of individual joints of the robot's legs. In turn, Figure 4 presents fluctuations in displacements and velocities of the robot, both in the forward (x-) and lateral (y-) direction. As can be seen, the presented time histories can be divided into three ranges, which correspond to the initial, regular, and terminal phases of the robot locomotion, respectively. Regardless of the Δx R t ð Þ, Δy R t ð Þ, Δz R t ð Þ, α R t ð Þ, β R t ð Þ, γ R t ð Þ controlling all six degrees of freedom of the robot's trunk, both x-and y-components of the robot's speed change linearly. Namely, in the initial phase of the locomotion process, both of these speeds increase linearly from zero to the maximum values. Then, in the rhythmic phase of gait, these speeds are constant over time. In turn, in the terminal phase of the locomotion process, these speeds decrease linearly from maximum values to zero. In the same time, linear deviations, as well as rotations of the robot's body in the global coordinate system, are accurately reflected based on the functions Δx R t ð Þ, Δy R t ð Þ, Δz R t ð Þ, and α R t ð Þ,β R t ð Þ,γ R t ð Þ, respectively. These simulations show that the considered robot can be used as a fully controlled walking Stewart platform. As a result, we solved the problem of controlling both the direction of the movement of the robot and the control of all six spatial degrees of freedom of the robot's body, namely, independent controlling of three deviations and three rotations along and around three different axes, respectively. As it was mentioned above, these control possibilities can be useful in the natural environment of the robot, where the navigation and obstacle avoidance are especially important.

Control of the robot standing on not vibrating and unstable ground
In this subsection we considered the problem of control of the robot on not vibrating but unstable ground. Figure 5 presents configurations of the robot standing on unstable ground (i.e., z G x, y, t ð Þ6 ¼ 0), captured in regular time intervals. To better illustrate the process of controlling individual legs of the robot on unstable  ground, we assumed that As a result, we can observe the process of stabilizing the linear and angular positions of the robot, when the supporting ground becomes unstable. As we can see, at any time, the robot is supported by all eight legs, through the appropriate changing of the configurations of its all legs, depending on the changes of the ground. It has a positive effect on the robot's stable position. Concluding, it should be emphasized that the presented control algorithm also works for Δx R t ð Þ, Δy R t ð Þ, Δz R t ð Þ 6 ¼ 0 and α R t ð Þ, β R t ð Þ, γ R t ð Þ 6 ¼ 0. As a result, the considered construction can play a role of a mobile Stewart platform also on unstable ground.

Control of the robot standing on stable and vibrating ground
In this subsection, we considered the control problem of the robot, which is standing on vibrating ground. As in previous subsection, to better illustrate the process of controlling individual legs of the robot, we also assumed that Δx R t ð Þ ¼ , full, both linear and angular, spatial stabilization of the robot's trunk). In turn, we have taken non-zero harmonic excitations of the ground, i.e., Δx G t ð Þ 6 ¼ 0,Δy G t ð Þ 6 ¼ 0,Δz G t ð Þ 6 ¼ 0, and α G t ð Þ 6 ¼ 0,β G t ð Þ 6 ¼ 0, γ G t ð Þ 6 ¼ 0. Simulation results captured in regular time intervals are presented in Figure 6. As can be seen, as in previous cases, in each time the robot is supported by all eight legs, thanks to the appropriate changing of the configurations of its all legs, depending on the vibrating ground. As a result, the robot keeps its position and orientation in the global coordinate system, regardless of the vibrating ground, also increasing its stability. The presented control algorithm also works for Δx R t ð Þ, Δy R t ð Þ, Δz R t ð Þ 6 ¼ 0 and α R t ð Þ, β R t ð Þ, γ R t ð Þ 6 ¼ 0. As a result, the considered construction can play a role of a mobile Stewart platform also on vibrating ground.

Application of the developed simulation model
The proposed algorithm for controlling all robot's legs during standing or walking for different cases was tested using a simulation model created in the Mathematica software. The possibilities of the Mathematica concerning 3D animation of simulated objects are available in the recent versions of this environment (in this paper we used Mathematica 11.2 version). Thanks to the developed visualization, we can observe exactly the configuration of all robot legs at any time, and this can be treated as a virtual experiment. The most recent versions of the Mathematica program also allow relatively simple operation of different microcontrollers connected to a computer such as Arduino Uno or Raspberry Pi. Moreover, simpler versions of Mathematica can also be installed in the internal memory of the mentioned Raspberry Pi microcontroller. As a result, using both the appropriate microcontroller and motor drivers, it is possible to directly apply the calculated articulated variables into joints of all robot's legs. It is schematically shown in Figure 7. These tasks will be the goal of our further research related to the problem

Conclusions
In this paper, a general model of a multi-legged robot has been developed and numerically investigated in Mathematica environment. The investigated robot was driven by a novel generator of gait proposed in our previous study. Using the developed simulation model, we performed some virtual experiments regarding locomotion process and stabilization of the position and orientation of the robot on unstable and vibrating ground. The obtained results show that the presented control possibility can be employed for full control of the robot position and orientation in space, also during locomotion of the robot. As a result, the robot can be used as a fully control walking Stewart platform. The most recent versions of Mathematica software allow to communicate with different microcontrollers, including Arduino Uno and Raspberry Pi. As a result, the developed simulation model can be relatively simply and successfully adopted to control the constructed prototypes of different kinds of multi-legged machines.