*Article* **The Hybrid Position/Force Walking Robot Control Using Extenics Theory and Neutrosophic Logic Decision**

**Ionel-Alexandru Gal , Alexandra-Cătălina Ciocîrlan and Luige Vlădăreanu \***

Institute of Solid Mechanics of the Romanian Academy, 15 C. Mille, 010141 Bucharest, Romania; alexandru.gal@imsar.ro (I.-A.G.); alexandra.ciocirlan@imsar.ro (A.-C.C.)

**\*** Correspondence: luige.vladareanu@vipro.edu.ro; Tel.: +40-21-315-7478

**Abstract:** This paper presents a hybrid force/position control. We developed it for a hexapod walking robot that combines multiple bipedal robots to increase its load. The control method integrated Extenics theory with neutrosophic logic to obtain a two-stage decision-making algorithm. The first stage was an offline qualitative decision-applying Extenics theory, and the second was a real-time decision process using neutrosophic logic and DSmT theory. The two-stage algorithm separated the control phases into a kinematic control method that used a PID regulator and a dynamic control method developed with the help of sliding mode control (SMC). By integrating both control methods separated by a dynamic switching algorithm, we obtained a hybrid force/position control that took advantage of both kinematic and dynamic control properties to drive a mobile walking robot. The experimental and predicted results were in good agreement. They indicated that the proposed hybrid control is efficient in using the two-stage decision algorithm to drive the hexapod robot motors using kinematic and dynamic control methods. The experiment presents the robot's foot positioning error while walking. The results show how the switching method alters the system precision during the pendulum phase compared to the weight support phase, which can better compensate for the robot's dynamic parameters. The proposed switching algorithm directly influences the overall control precision, while we aimed to obtain a fast switch with a lower impact on the control parameters. The results show the error on all axes and break it down into walking stages to better understand the control behavior and precision.

**Keywords:** hybrid position/force control; sliding mode control; decision method; neutrosophic logic; extension set

#### **1. Introduction**

Worldwide, practical robot applications are diversifying more and more in the new world of robotics, automation, and artificial intelligence [1]. Researchers and engineers are working on developing solutions and solving problems for all kinds of robots. This research will enhance human motion and workspace investigation through different sensors and automate tasks for unattended robots [2]. Into this category falls every type of robot control method that can improve robot control and behavior, with or without autonomous capabilities [3]. For a robot to be capable of accomplishing a designated task, it must reject most of the uncertainties and disturbances within the work environment. The robot must also handle information from several sensors and fuse the data to reach a close decision to the truth value.

Most mobile robots combine kinematic and dynamic control methods to solve such a problem, each designated for certain joints in the robot structure. However, for a highly versatile robot structure, a hybrid position/force method is used. Although the technique is not new, having begun with Raibert and Craig [4], it has the attention of robotic control research, and it continues to bring adaptability to the robots using it. In recent years, different approaches have been researched. Zhang et al. [5] created a hybrid control method

**Citation:** Gal, I.-A.; Ciocîrlan, A.-C.; Vl ˘ad ˘areanu, L. The Hybrid Position/Force Walking Robot Control Using Extenics Theory and Neutrosophic Logic Decision. *Sensors* **2022**, *22*, 3663. https://doi.org/ 10.3390/s22103663

Academic Editor: Gregor Klancar

Received: 18 March 2022 Accepted: 9 May 2022 Published: 11 May 2022

**Publisher's Note:** MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

**Copyright:** © 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/).

that could adjust the joint dynamic parameters online. The process allowed rough modeling of the robot parameters and left the fine-tuning to the control algorithm. A similar approach used a neural network to autocalibrate the control parameters [6]. Still, not all hybrid methods can use mechanical parameters because they increase the system's complexity. For a robot with a simple structure for which the kinematic or dynamic equations are easier to define, a classic approach to hybrid control can be easier to implement. Some examples include the hybrid method with impedance control [7] or even the backstepping method with a Hamilton controller [8]. Applications of the hybrid control method can be found in all types of robots, from a robot used for mechanical tests [9] to an upper limb rehabilitation robot [10]. Because of its versatility, the hybrid position/force control was chosen as the primary control method for the walking robot.

As we know, hybrid control combines a kinematic control method for joints that do not require compensation of weight and inertia and a dynamic control method that can handle these parameters and reject environmental disturbances. The kinematic approach is used for positioning control of the robot and the dynamic approach for the force and torque control. Consequently, a classic proportional-integrative-derivative (PID) regulator was chosen for the position control and a sliding mode control (SMC) method [11] for the force and torque control. The main reason for using a SMC method was its robustness in the presence of external disturbances and uncertainties. Many scientists have used the control method to improve industrial robot trajectory [12], mobile robot trajectory in dynamic environments [13], n-link serial manipulator control [14], balance control of a two-wheel robot [15], and even airplane fuselage inspection [16]. SMC is not a perfect control method, and it has drawbacks, one of which is the chattering effect that it can introduce. New research is published every year [17] on eliminating the chattering impact in a general manner or for a specific robot structure or purpose.

Using multiple regulators or control methods on the same robot structure can separate the robot joints statically into two categories, starting with the design of the control law. However, this is not desirable if one needs to build a versatile robot. Hence, a realtime decision method must determine the degree of freedom (joints) controlled by each method. A combination of techniques and control methods was thus selected. The first one, Extenics [18] or extension logic [19], entails defining the control parameters and robot properties or abilities and is used by scientists to configure problem-solving algorithms [18] and even design toys for children with special needs [20].

For the proposed robot structure, Extenics helped ease the process of organizing the parameters of each control method and provided the offline means of solving potential conflicts, uncertainties, or mismatching of sensor data and regulators.

Neural networks [21,22] were considered for the decision method, but the process of training the network was too extensive for the proposed robot. Another possibility was using swarm optimization [23] to predict what the robot needs in terms of control methods. This also overcomplicated the control system, and it should be handled in future work. For the presented robot, neutrosophic logic [24] and the Dezert–Smarandache Theory (DSmT) [25] were chosen. DSmT combined with Extenics is used to manage decision making [20] and provides excellent results by combining the mapping process of Extension logic with the sensor fusion of DSmT in uncertain and contradictory conditions. As an extension of fuzzy logic, neutrosophic logic and DSmT have been used by researchers to develop applications [26] for aviation parking [27], multi-UAV surveillance [28], obstacle avoidance in unknown environments [29], and environmental detection and estimation [30].

A different approach in designing the decision algorithm of a hybrid system is using time triggers or an event-driven mechanism [31] with an event generation mechanism [32] to ensure control of the system at the precise times of important defined events. This approach is safe for robots in a known environment, but it can fail or make inconsistent decisions for robots moving inside unknown and unstructured environments.

To develop a mobile walking robot, one can reference many highly advanced robots, some designed by renowned institutes [33], that use dynamic control methods to provide

stability and error rejection for the control architecture. While efficient mathematical solutions [34] are desired for a control law to give it low computational requirements, these can be difficult to obtain when the robot model is complex. Moreover, the dynamic control of any robot must overcome external disturbances [35] and reject any influence from other sources, including within the sensor information.

Here, we propose and describe a mobile walking robot hybrid position/force control that can be used within a group of linked robots. The research aim to obtain a control algorithm and method using both kinematic and dynamic control methods and an intelligent switching method between them. As a result, several experiments were conducted to improve the performance of the developed hybrid control, taking advantage of the extension set and neutrosophic logic. The extension set and neutrosophic logic were used to enhance the decision making required by the hybrid control, the first as an offline set of characteristics to extend the system's definition, and the second as an online switching mechanism that works with uncertain and contradictory information. The resulting hybrid control using a two-stage decision algorithm was a robot control method that took advantage of the best properties of the kinematic and dynamic control laws while the robot was fulfilling its tasks in uncertain environments. The data fusion provided by the neutrosophic theory in contradictory or uncertain conditions improved the decision switching mechanism, while the overall reference tracking of the robot did not decrease. The computational requirements of the proposed hybrid control were reduced because of the kinematic control method when the robot did not require dynamic compensation.

The paper is divided into six main sections. Section 2 provides a visual description of the robot used in the experiments. Section 3 presents the offline decision using the extension set, while Section 4 presents the decision method based on neutrosophic logic that takes advantage of DSmT [25]. The hybrid control is presented in Section 5 with an in-depth analysis of the kinematic (Section 5.1) and SMC dynamic (Section 5.2) control methods. Sections 6 and 7 contain the conducted experiments and simulations with the obtained results. In the end, Section 8 presents this paper's conclusions.

#### **2. System Description**

Figure 1 presents the robot structure. The robot was a hexapod [36], and its design was selected to avoid stability problems. Future research will consider the stability of a single bipedal mobile walking robot. As can be seen, the robot platform was divided into three modules, resulting in a modular robot that could be further extended or reconfigured. Figure 1b presents the kinematic structure of the hexapod robot leg. Each leg had three degrees of freedom, ensuring the 3D positioning of the foot.

**Figure 1.** The robot structure: (**a**) the hexapod walking robot; (**b**) kinematic structure of the robot leg.

In the robot structure, aluminum was considered for rectangular bars with height, width, and length dimensions *hi* × *wi* × *li* and weight *mi*. *hi* and *wi* with the dimensions of *hi* = 3 cm and *wi* = 3 cm. Table 1 presents the robot dimensions used in the testing and simulations presented throughout the paper.



*li* and *ri* represent, respectively, leg segment dimensions and the distance from the joint axis to the center of mass for each leg segment, and *mi* is the segment's mass.

#### **3. Extenics Theory and Extension Set Applied to Robots**

Extenics is a scientific field that uses modeling and formal methods to extend elements or physical objects. The models and methods are then used to solve contradictory problems that cannot be solved in their defined form and conditions [37,38].

Because contradictory problems are omnipresent in any field, Extenics aims to define a set of methods that allows solving contradictory issues using virtual simulation with the help of computers.

The central parts of extension theory are the base element theory, extension set theory, and extension logic [39].

The fundamental element used to describe objects in extension theory is defined as:

$$M = \begin{pmatrix} \mathbf{O}\_{\mathfrak{m}\_{\prime}} \mathbf{c}\_{\mathfrak{m}\_{\prime}} \mathbf{v}\_{\mathfrak{m}\_{\prime}} \end{pmatrix} \tag{1}$$

where *M* is the object element for which *Om* is the object, *cm* is the characteristic, and *vm* is the measure. If one characteristic exists, the other matter element can be of only one dimension. If the object has more characteristics, however, the multidimension matter element is be defined as:

$$M = \begin{bmatrix} O\_{m\prime} & c\_{m1\prime} & v\_{m1} \\ & c\_{m2\prime} & v\_{m2} \\ & & \vdots & \vdots \\ & & c\_{mm\prime} & v\_{mn} \end{bmatrix} = (O\_{m\prime}C\_{m\prime}V\_{m}).\tag{2}$$

If a hybrid control is used, then a multidimension matter element is used, described by many characteristics specific to the chosen control methods.

For a hybrid position/force control, the following matter element can be defined:


*R*<sup>2</sup> =

By using Extenics principle 2.2 [40], which Ren et al. [18] used to design low carbon products, the object from Equation (3) can be extended and decomposed into two matter elements for which *O*<sup>1</sup> and *O*<sup>2</sup> are defined as kinematic control and dynamic control, respectively. The two objects have the same characteristics as the primary object (called "hybrid control") but with different values:


As can be seen, the two matter elements from Equations (4) and (5) describe the control types, the kinematic and the dynamic, briefly. The matter elements are customized for control types, but numerous other features can be added for which the matter characteristics are different according to the desired control type.

The contradiction between the two control types is found using the matter element characterization. The kinematic type has a better computational speed for a real-time controller. Still, when a robot is subject to inertial forces, it has worse positioning error and tracking speed. On the other hand, the dynamic control method takes into consideration the inertial forces that act on a robot and has a better tracking error. However, although the tracking error is better, the tracking speed is worse. The overall computational speed is greatly diminished, owing to the many calculations inside the control loop.

As a simple reference trajectory, an ideal trajectory of the foot (Figure 2) was used. When a robot foot has the role of support (the unbroken line in Figure 2), precise control is needed that considers the weight and inertia of the robot, so the robot's position does not oscillate on the vertical axis during the support phase. Additionally, the joints of a robot leg must complete or partially support the overall robot weight, including the other legs in the advancing stage. The dotted line in Figure 2 represents the leg balance trajectory when a robot takes a step for which the positioning is not required to be precise but must be fast and smooth. During the second motion phase, the leg joints support only their leg weight.

**Figure 2.** A simple trajectory for the robot foot.

325

Knowing the gross characterization of the two types of trajectories that a robot foot takes, the problem of choosing the control type is solved by checking the properties of the two matter elements defined by Equations (4) and (5).

Thereby, to control the robot during the uniform pull and weight support phase, the matter element R2 was chosen. Its properties provided better precision in tracking the position reference and considered the robot's inertia to compensate for the robot's weight and inertial motion forces.

When the robot foot must follow a curve in space during the advancing phase, the robot's weight was not supported by it, so we used matter element R1. The R1 properties better corresponded to the robot motion criteria. The kinematic controller was used when the robot needed to make a forward or reverse motion that was not in direct contact with the support plane. High positioning precision was not required for the advancing movement, only a faster speed to position the foot as quickly as possible on the next support point.

One of the properties of the two matter elements is "overall computation speed," which indicates how many mathematical operations are needed to compute the actual reference for each separate joint. Therefore, a kinematic controller is much more efficient in computational requirements, performing fewer mathematical operations than a dynamic one. Results have indicated that a kinematic controller supplies not only a better tracking speed but also minimal resource consumption.

When defining and separating the control type that is best for the job, a real-time switching method was required. Thus, with the help of neutrosophic logic, the robot leg phase was determined, based not on reference values but on sensor information. According to the data calculated by Extenics theory on which type of control law to use, a hybrid control could be obtained to resolve the transition problem between kinematic and dynamic control laws. As an offline result, it could be reiterated for future datasets to enhance control properties or add a second layer of details and properties.

#### **4. Neutrosophic Logic in Robot Control**

As defined in [41], neutrosophic logic is the foundation of neutrosophic mathematics. Neutrosophic logic works with neutrosophic sets that generalize fuzzy sets and describe neutrosophic elements. The elements are based on <A>, <anti A>, and <neutral A>, where <A> is an attribute, <anti A> is the opposite of the attribute, and <neutral A> is the neutral area between <A> and <anti A>.

In neutrosophic logic, every affirmation *Af* is *T%* true, *I%* undetermined (uncertain), or *F%* false. Therefore, we can say *Af* (*T, I, F*)*,* where *T, I*, and *F* are standard or non-standard subsets of the interval ] <sup>−</sup>0, 1+[ [41].

If *U* is the work universe and *M* is a set included in *U*, then one element *x* from *U* is written as *x* (*T*, *I*, *F*) according to set *M* and belongs to the same set in the following way: element *x* is *t%* true in set *M*; element *x* is *i%* undetermined in set *M* (either true or false); and element *x* is *f%* false in set *M*. The value of *t* varies in *T*, *i* varies in *I,* and *f* varies in *F* [42,43].

As described in the current paper, the robot control diagram presented used both kinematic and dynamic elements. At a specific time, the robot used only one of the control methods to maximize and optimize computing and motion speed or the positioning error. A precision element was needed to switch between the two control types. Using Extenics and extension theory, the contradictory elements were defined to separate the two control types between which the decision algorithm switched using neutrosophic theory.

The classic neutrosophic theory [25] chooses between the two control methods. The general equation is presented in Relation (6) and defines the generalized basic belief assignment:

$$\mathfrak{m}(\mathbb{C}) = \sum\_{\substack{A,B \in \mathcal{D} \\ A \cap \mathcal{B} = \emptyset}} A\_\prime B \in \mathcal{D}^{\Theta} \quad \mathfrak{m}\_1(A) \cdot \mathfrak{m}\_2(B), \forall \mathbb{C} \in \mathcal{D}^{\Theta} \tag{6}$$

where *<sup>D</sup>*<sup>Θ</sup> is a hyperpower set from the frame <sup>Θ</sup> <sup>=</sup> {*θ*1, *<sup>θ</sup>*2,..., *<sup>θ</sup>n*} of *<sup>n</sup>* exhaustive elements and *<sup>A</sup>*, *<sup>B</sup>* <sup>∈</sup> <sup>2</sup>Θ. The basic belief assignment is (·) : 2<sup>Θ</sup> <sup>→</sup> [0, 1], where <sup>2</sup><sup>Θ</sup> <sup>=</sup> {∅, *<sup>θ</sup>*1, *<sup>θ</sup>*2, *<sup>θ</sup>*3, *<sup>θ</sup>*<sup>1</sup> <sup>∪</sup> *<sup>θ</sup>*2, *<sup>θ</sup>*<sup>1</sup> <sup>∪</sup> *<sup>θ</sup>*3, *<sup>θ</sup>*<sup>2</sup> <sup>∪</sup> *<sup>θ</sup>*3, *<sup>θ</sup>*<sup>1</sup> <sup>∪</sup> *<sup>θ</sup>*<sup>2</sup> <sup>∪</sup> *<sup>θ</sup>*3} when <sup>Θ</sup> <sup>=</sup> {*θ*1, *<sup>θ</sup>*2, *<sup>θ</sup>*3}.

In the case of the presented robot, two belief assignments were assigned to the two observers. The two observers were the force and proximity sensors that must determine which type of control was required at one time.

The experimental data for the two observers are presented in Table 2. These values divided the sensors' measurement interval in a decision percentage, where the force sensor was more likely to decide on a dynamic control (75%) than the proximity sensor (65%). The rate was reversed for the kinematic control and was the same for the uncertain interval.

**Table 2.** Observer experimental data.


\* *θ<sup>D</sup>* = dynamic control; \*\* *θ<sup>C</sup>* = kinematic control; \*\*\* *θD*∪*θ<sup>C</sup>* is the indeterminate area.

The values meant that the decision could be computed with a certain approximation by using Equation (6) if the robot was in contact with the support surface, according to the data received from the sensors, and a decision was made whether it would switch from one control type to another. The kinematic control type was used in the foot balancing phase and the dynamic control type in the support phase. The decision was made between the two contradictory objects, defined with the help of Extenics and extension theory.

Table 3 presents the cases in which the meutrosophic values *m*1(*θD*)*, m*1(*θC*)*, m*2(*θD*)*, m*2(*θC*)*, m*1(*θD*∪*θC*), or *m*2(*θD*∪*θC*) can be found in any combination for A and B to correspond to Equation (6), meaning that *A∩B=C*. The results were obtained using Equation (6) and represent the neutrosophic probabilistic values of truth (certainty of a valid value), falsity (assurance of a false value), uncertainty (the unknown state between two possible outcomes), and contradiction (two observers provide contradictory information with high certainty for both).

**Table 3.** The experimental data after using Equation (6).


The values from Table 3 were computed in Equation (7).

$$\begin{aligned} m(\boldsymbol{\phi}) &= 0\\ m(\boldsymbol{\theta}\_{\mathcal{D}}) &= m\_1(\boldsymbol{\theta}\_{\mathcal{D}}) \times m\_2(\boldsymbol{\theta}\_{\mathcal{D}} \cup \boldsymbol{\theta}\_{\mathcal{C}}) + m\_1(\boldsymbol{\theta}\_{\mathcal{D}} \cup \boldsymbol{\theta}\_{\mathcal{C}}) \times m\_2(\boldsymbol{\theta}\_{\mathcal{D}}) + m\_1(\boldsymbol{\theta}\_{\mathcal{D}}) \times m\_2(\boldsymbol{\theta}\_{\mathcal{D}}) = 0.5575\\ m(\boldsymbol{\theta}\_{\mathcal{C}}) &= m\_1(\boldsymbol{\theta}\_{\mathcal{C}}) \times m\_2(\boldsymbol{\theta}\_{\mathcal{D}} \cup \boldsymbol{\theta}\_{\mathcal{C}}) + m\_1(\boldsymbol{\theta}\_{\mathcal{D}} \cup \boldsymbol{\theta}\_{\mathcal{C}}) \times m\_2(\boldsymbol{\theta}\_{\mathcal{C}}) + m\_1(\boldsymbol{\theta}\_{\mathcal{C}}) \times m\_2(\boldsymbol{\theta}\_{\mathcal{C}}) = 0.085\\ m(\boldsymbol{\theta}\_{\mathcal{D}} \cup \boldsymbol{\theta}\_{\mathcal{C}}) &= m\_1(\boldsymbol{\theta}\_{\mathcal{D}} \cup \boldsymbol{\theta}\_{\mathcal{C}}) \times m\_2(\boldsymbol{\theta}\_{\mathcal{D}} \cup \boldsymbol{\theta}\_{\mathcal{C}}) = 0.0025 \end{aligned} \tag{7}$$

$$m(\boldsymbol{\theta}\_{\mathcal{D}} \cap \boldsymbol{\theta}\_{\mathcal{C}}) = m\_1(\boldsymbol{\theta}\_{\mathcal{D}}) \times m\_2(\boldsymbol{\theta}\_{\mathcal{C}}) + m\_1(\boldsymbol{\theta}\_{\mathcal{C}}) \times m\_2(\boldsymbol{\theta}\_{\mathcal{D}}) = 0.355$$

where *m*(*θD*) and *m*(*θC*) are the probabilistic values of certainty to choose a certain control law; *m*(*θD*∪*θC*) is the probabilistic uncertainty value of the two sensors; and *m*(*θD*∩*θC*) is the probabilistic contradiction values between the two sensors. As a test, when all five values are added, their sum must be equal to 1 (100%): *m*(*ϕ*) *+ m*(*θD*) *+ m*(*θC*) *+ m*(*θD*∪*θC*) *+ m*(*θD*∩*θC*) *=* 1.

Using the computed values, each observer's decision (force and proximity sensor) had a certain probability that each of the two control systems required to control the robot.

Table 4 presents all cases presented in Figure 3a,b for the force sensor and proximity sensor where X and α were defined according to the sensor type.


**Table 4.** Control probability.

**Figure 3.** Control-deciding graphs: (**a**) force sensor graph; (**b**) proximity sensor graph.

For the last two cases in Table 4, the *C= θD*∪*θ<sup>C</sup>* or *C= θD*∩*θ<sup>C</sup>* uncertainty in decision making was due to the sensor values, leading to a contradiction. If, in the case of uncertainty, the control type running at that time could be kept, in the case of contradiction between sensor data, a decision must be made on which control should be used. Because the contradiction could appear only under specific conditions, a decision was made to use the same type of control as the robot in the case of uncertainty.

One exceptional or typical case is the robot stepping on very uneven ground. The force sensor indicates that the foot is on the floor, but the proximity sensor does not provide the same conclusion since it reads a value greater than the reference threshold. Therefore, the decision should be to switch to a dynamic controller. On the other hand, if a kinematic control is used and the foot is subject to external factors, the force sensor records high peak values in short periods, leading to the chattering effect. The algorithm switched from kinematic to dynamic control for any case of uncertainty. To prevent additional chattering effects, the algorithm switched the control method when the force sensor retained its

contradictory value for a minimum Δ*t* time interval. The time threshold provided a precision control law in uneven terrain and contradictory cases between input sensors and observers.

A supplementary condition was required in addition to the selected requirements for the control type. The condition was bound to the way the robot moves. Because the dynamic control was slower to compensate for high errors and its stationary points were unnecessary, we chose the control law based on robot kinematics to save computing time.

One could argue that the switching control law is unnecessary and uses simple triggers that act as switching mechanisms. However, a simple control switch cannot decide between options when the information received is inaccurate, which is one of the main reasons the neutrosophic switching mechanism was chosen and used.

#### **5. The Walking Robot Leg Control Architecture**

To control a walking robot, one has to design a control law for each leg, and the control has many walking phases that depend directly on the reference signal of the foot. Therefore, the design of a general control law is needed to control foot position and the motor's torque according to the computed reference and to use the sensor signal (force and proximity) for environmental interaction and detection.

Figure 4 presents the general control diagram for one leg of the walking robot. The graph contains a reference generation block to generate the foot trajectory using detailed data chosen to test the control law.

**Figure 4.** The general control diagram.

The reference generation was made in the operational space, and the data were converted to the joint space from the operational space by using inverse kinematics. An inverse kinematics algorithm based on the Jacobian transpose was used and is presented in Equation (8). Compared to other algorithms, it provides a reference speed for the leg joint motors and not the angular position reference.

$$\begin{aligned} 1. \qquad &\Delta e = e\_{\text{goal}} - e\_{\text{real}}\\ 2. \qquad &f/Tde = f \times f^T \times \Delta e\\ 3. \qquad &\alpha = \frac{\Delta x^T \times fITde}{fITde^T \times fITde} \quad . \tag{8} \\ 4. \quad \Delta \theta &= \left(\alpha \times f^T \times \Delta e\right)^T \end{aligned} \tag{9}$$

The speed reference value cannot be used to control the robot joints by the dynamic controller because the dynamic controller needs the angular reference for all the degrees of freedom it controls, and this is the reason why the angular values for each joint were computed using the foot position as the origin. The equations are:

$$\begin{aligned} q\_1 &= \arctan\left(\frac{Mx}{My}\right) \\ q\_2 &= 2 \times \arctan\left(\frac{\sin q\_2}{\sin^2 q\_2 + \cos^2 q\_2} + \cos q\_2\right) \\ q\_3 &= \arctan\left(-\frac{\sin q\_3}{\cos q\_3}\right) \end{aligned} \tag{9}$$

where the sine and cosine values are given by

$$\begin{aligned} \cos q\_2 &= \frac{(Mz - l\_1) \times (l\_2 + l\_3 \cos q\_3) + Mx \times l\_3 \sin q\_3}{(Mz - l\_1)^2 + Mx^2 + My^2}, \\ \sin q\_2 &= \sqrt{1 - \cos^2 q\_2}, \\ \cos q\_3 &= \frac{(Mz - l\_1)^2 + Mx^2 + My^2 - l\_2^2 - l\_3^2}{2l\_2l\_3}, \\ \sin q\_3 &= \sqrt{1 - \cos^2 q\_3}. \end{aligned} \tag{10}$$

For Equation (9) to be valid and to condition the leg posture, additional conditions were added:

$$\begin{array}{ll} 1: & \text{if } \text{ My} = 0 \text{ then} & \text{q1} = 0\\ 2: & q\_1 \in \left( -\frac{\pi}{2}, \frac{\pi}{2} \right) & \text{ .} \\ 3: & q\_3 \le 0 \end{array} \tag{11}$$

The two sensors' data (proximity and force) were used as input signals for the neutrosophic block to decide. Because generated information was used, the two sensors were simulated. Therefore, the proximity sensor had a function based on the calculated distance from the foot to the support surface considered a plane, but to which a sinusoidal signal was added to generate the measurement error of the sensor. Regarding the force sensor, the foot–ground interaction was simulated using the system from Figure 5. The simulation was achieved with the help of a damper and a spring.

**Figure 5.** Interaction between the robot and ground surface.

The equation used for contract modeling and determining the reaction force of ground interaction was the classical one:

$$F\_{tot} = -\left(k \cdot x + c \cdot \dot{x}\right) \tag{12}$$

where *k* and *c* are the constants of the spring and damper, respectively.

Having the two parameters, reaction force and proximity distance, as inputs for the decision method, the two control methods are defined in the following sections.

#### *5.1. The Kinematic Control Method*

This method used the data provided by the computing algorithm of inverse kinematics (Figure 6) and fed the output to the PI (proportional-integration) regulator that drove the robot joint motors.

**Figure 6.** The kinematic control diagram.

As previously described in the Extenics method, the control method has fewer calculations. Still, the positioning error is not the best because of the inverse kinematics method. It does not consider the inertial force that the robot experiences during the actual motion.

The main component of the controller is the Jacobian matrix:

$$J = \begin{bmatrix} -s\_1(l\_2s\_2 + l\_3s\_{23}) & c\_1(l\_2c\_2 + l\_3c\_{23}) & l\_3c\_1c\_{23} \\ c\_1(l\_2s\_2 + l\_3s\_{23}) & s\_1(l\_2c\_2 + l\_3c\_{23}) & l\_3s\_1c\_{23} \\ 0 & -l\_2s\_2 - l\_3s\_{23} & -l\_3s\_{23} \end{bmatrix} \tag{13}$$

where *si* = sin(*θi*), *ci* = cos(*θi*), *sij* = sin(*θ<sup>i</sup>* + *θj*), and *cij* = cos(*θ<sup>i</sup>* + *θj*).

The matrix was computed from the direct kinematics equations and was used to find the foot position in the operational space:

$$M(x,y,z) = \begin{bmatrix} c\_1(l\_2s\_2 + l\_3s\_{23}) \\ s\_1(l\_2s\_2 + l\_3s\_{23}) \\ l\_1 + l\_2c\_2 + l\_3c\_{23} \end{bmatrix}. \tag{14}$$

The entire kinematic control loop was based on the Jacobian matrix. First, the matrix containing the actual angular joint position was calculated. After it followed its transpose matrix and the operational space reference position, the positioning error Δ*θ* was obtained.

The positioning error was sent to two PI (proportional-integrative) feedback control loops for controlling the angular speed and motor torque. Thereby, the torque control for each joint was obtained, and the switch from one controller to another (from the kinematic control to the dynamic one, and vice versa) was more accessible since they both used torque to control the robot joints.

The transpose Jacobian method is not new and is based on using the transpose matrix of the Jacobian instead of the inverse matrix. Therefore, Δ*θ* was computed using Equation (15):

$$
\Delta \dot{q} = \alpha I^T e \tag{15}
$$

for specific values of constant α.

The transpose-Jacobian-matrix-based algorithm presented in Equation (8) eliminated stability problems. The algorithm was also chosen because it had a higher computation speed than the control values of other algorithms, even if the computed values were not as precise as the inverse-Jacobian-matrix-based method [44].

Because the method of solving the inverse kinematics problem uses the Jacobian matrix, the final results are always formed by angular speeds that the robot joints must follow. Therefore, the control is suitable for PI and PID regulators and for controlling angular velocities. The downside is that the method cannot be used to compute a dynamic control reference since it needs a precise joint angular value. In contrast, if the values given by the Jacobian-based inverse kinematic problem are integrated, the result is not as accurate as is required.

#### *5.2. The Dynamic Control Method*

The dynamic control method used the same reference data as the kinematic one. Nevertheless, it computed the torque reference of the motors considering kinematic parameters, the inertial ones provided by the inertia matrix, and the Coriolis and gravity force effects supplied by the Coriolis and gravity matrices.

Figure 7 presents the dynamic control diagram. The most critical control blocks are shown, including those that compute the inertial parameters and values used by the slide control block. The three control blocks that formed the dynamic controller from Figure 7 were the PID error controller, the fuzzy controller, and the slide control. The first block passed the positioning error through a PID controller so that the control method could consider the error variations. Using the PID error controller data, the fuzzy amplification was obtained through the membership functions presented in Figure 8a,b. The command torque for each motor joint could be calculated after computing the fuzzy gain, using the inertial data and the reference values [45].

**Figure 7.** The dynamic control scheme.

All the control values were computed from the presented robot structure, characteristics, structural weights, and measurements.

For Figure 8a,b the abbreviations are N = Negative, P = Positive, ZE = zero, S = Small, M = Medium, B = Big, and V = Very. For the membership functions, Table 5 presents the values for the membership parameters so the gain value *Kfuzzy* could be chosen. The membership functions that provided the gain were selected according to the values of the two parameters *<sup>s</sup>* and . *<sup>s</sup>*, where *<sup>s</sup>* represents the error through the PID error controller and . *s*

is its derivate. A constant gain was not desired for each case, leading to a standard-step fuzzy controller, but a function-based one was selected.

**Figure 8.** Membership functions: (**a**) member function for input s; (**b**) member function for input . *s*.


**Table 5.** The output fuzzy gain computation.

Using Table 5 data, the parabola in Figure 9 was considered for computing the *Kfuzzy* gain, according to the two inputs *<sup>s</sup>* and . *s*. The parabola equation was computed from Equation (16):

$$y(\mathbf{x}) = \mathbf{2}\mathbf{x}^2 + \mathbf{50},\tag{16}$$

and we modified it to introduce the fuzzy parameters:

$$K\_{fuzzy}(\dot{s}) = 2\left(\dot{s} - 10 \cdot s\right)^2 + 50.\tag{17}$$

**Figure 9.** Parameter *Kfuzzy* for *s=0* and . *s* between −20 and 20.

Equation (15) now provides the *Kfuzzy* parameter in the dynamic control.

The sliding control was made with the help of the slide control block (Figure 7). The control type was inspired by Shafiei [12] and modified to match the robot kinematic structure used, a design with three degrees of freedom instead of the two used by Shafiei [12]. Following that, the dynamic equations that allowed the dynamic controller's development are presented.

The basic dynamic control equation was:

$$H(q)\ddot{q} + \mathcal{C}(q, \dot{q})\dot{q} + \mathcal{G}(q) + \mathfrak{r}\_d = \mathfrak{r}.\tag{18}$$

From Equation (18), the signal for motor torque control was calculated. All the parameters from Equation (18) are required to be known. The unknown values are the torque *τ*, the matrices *H* (inertial parameters), *C* (Coriolis and centrifugal forces), and *G* (gravity effect), which are given by the following equations, in which the angles *θ* from the joint space are equal to the ones in the operational space:

$$H = M = \begin{bmatrix} M\_{11} & M\_{12} & M\_{13} \\ M\_{21} & M\_{22} & M\_{23} \\ M\_{31} & M\_{32} & M\_{33} \end{bmatrix} \tag{19}$$

where *M* is the inertial parameters matrix.

The inertial matrix parameters can be computed using the following:

*T*(*θ*, . *θ*) = <sup>1</sup> 2 . *q <sup>T</sup>* · *<sup>M</sup>* · . *q* = <sup>1</sup> <sup>2</sup> ∑*i*,*<sup>j</sup> Mij*(*q*) . *qi* . *qj* ≥ 0, *T*(*θ*, . *θ*) = <sup>1</sup> <sup>2</sup>*m*1( . − *x* 2 <sup>1</sup> + . − *y* 2 <sup>1</sup> + . − *z* 2 <sup>1</sup>) + <sup>1</sup> <sup>2</sup>*m*2( . − *x* 2 <sup>2</sup> + . − *y* 2 <sup>2</sup> + . − *z* 2 <sup>2</sup>) + <sup>1</sup> <sup>2</sup>*m*3( . − *x* 2 <sup>3</sup> + . − *y* 2 <sup>3</sup> + . − *z* 2 <sup>3</sup>) + <sup>1</sup> <sup>2</sup> *Iz*<sup>1</sup> . *θ*2 <sup>1</sup> + <sup>1</sup> <sup>2</sup> *Iz*<sup>2</sup> . *<sup>θ</sup>*<sup>1</sup> <sup>+</sup> . *θ*2 2 + 1 <sup>2</sup> *Iz*<sup>3</sup> . *<sup>θ</sup>*<sup>1</sup> <sup>+</sup> . *<sup>θ</sup>*<sup>2</sup> <sup>+</sup> . *θ*3 2 − *x*<sup>1</sup> = 0, . − *x*<sup>1</sup> = 0, − *y*<sup>1</sup> = 0, . − *y*<sup>1</sup> = 0, − *z* <sup>1</sup> = *r*1, . − *z* <sup>1</sup> = 0, − *x*<sup>2</sup> = *r*2sin*q*2·cos*q*1, . − *x*<sup>2</sup> = −*r*2sin*q*<sup>1</sup> − sin*q*2· . *q*<sup>1</sup> + *r*2cos*q*1·cos*q*2· . *q*2, − *<sup>y</sup>*<sup>2</sup> <sup>=</sup> *<sup>r</sup>*2sin*q*2·sin*q*1, . *y*<sup>2</sup> = *r*2cos*q*1·sin*q*2· . *q*<sup>1</sup> + *r*2sin*q*1·cos*q*2· . *q*2, − *<sup>z</sup>* <sup>2</sup> <sup>=</sup> *<sup>l</sup>*<sup>1</sup> <sup>+</sup> *<sup>r</sup>*2cos*q*2, . *z*<sup>2</sup> = −*r*2sin*q*2· . *q*2, − *x*<sup>3</sup> = cos*q*1(*l*2sin*q*<sup>2</sup> + *r*3sin(*q*<sup>2</sup> + *q*3)), − *y*<sup>3</sup> = sin*q*1(*l*2sin*q*<sup>2</sup> + *r*3sin(*q*<sup>2</sup> + *q*3)), − *<sup>z</sup>* <sup>3</sup> <sup>=</sup> *<sup>l</sup>*<sup>1</sup> <sup>+</sup> *<sup>l</sup>*2cos*q*<sup>2</sup> <sup>+</sup> *<sup>r</sup>*3cos(*q*<sup>2</sup> <sup>+</sup> *<sup>q</sup>*3), . − *<sup>x</sup>*<sup>3</sup> <sup>=</sup> <sup>−</sup>sin*q*1(*l*2sin*q*<sup>2</sup> <sup>+</sup> *<sup>r</sup>*3sin(*q*<sup>2</sup> <sup>+</sup> *<sup>q</sup>*3)). *<sup>q</sup>*<sup>1</sup> <sup>+</sup> cos*q*1(*l*2cos*q*<sup>2</sup> <sup>+</sup> *<sup>r</sup>*3cos(*q*<sup>2</sup> <sup>+</sup> *<sup>q</sup>*3)). *q*<sup>2</sup> + *r*3cos*q*1cos(*q*<sup>2</sup> + *q*3) . *<sup>q</sup>*3, . − *<sup>y</sup>*<sup>3</sup> <sup>=</sup> cos*q*1(*l*2sin*q*<sup>2</sup> <sup>+</sup> *<sup>r</sup>*3sin(*q*<sup>2</sup> <sup>+</sup> *<sup>q</sup>*3)). *<sup>q</sup>*<sup>1</sup> <sup>+</sup> sin*q*1(*l*2cos*q*<sup>2</sup> <sup>+</sup> *<sup>r</sup>*3cos(*q*<sup>2</sup> <sup>+</sup> *<sup>q</sup>*3)). *q*<sup>2</sup> + *r*3sin*q*1cos(*q*<sup>2</sup> + *q*3) . *<sup>q</sup>*<sup>3</sup> . − *<sup>z</sup>* <sup>3</sup> <sup>=</sup> <sup>−</sup>(*l*2sin*q*<sup>2</sup> <sup>+</sup> *<sup>r</sup>*3sin(*q*<sup>2</sup> <sup>+</sup> *<sup>q</sup>*3)). . (20)

$$\begin{aligned} z\_3 &= -(l\_2 \sin q\_2 + r\_3 \sin(q\_2 + q\_3)) \dot{q}\_2 - r\_3 \sin(q\_2 + q\_3) \dot{q}\_{34}, \\ I\_{xi} &= \frac{m\_i}{12} (w\_i^2 + h\_i^2), \ I\_{yi} = \frac{m\_i}{12} (l\_i^2 + h\_i^2), \ I\_{zi} = \frac{m\_i}{12} (l\_i^2 + w\_i^2) \\ &\quad \cdot \quad \cdot \quad \cdot \end{aligned}$$

where <sup>−</sup> *xi*, − *yi* , − *zi*, − *xi*, − *yi* , − *zi* are the coordinates of the center of mass for each element of a leg, and, respectively, their first derivate; and *Ixi*, *Iyi*, and *Izi* represent the inertia tensors of each leg element.

By using inertia matrix requirement parameters, the inertia matrix elements were computed by the following equations:

$$\begin{aligned} M\_{11} &= r\_2^2 m\_2 + r\_3^2 m\_3 + l\_2^2 m\_3 + \frac{1}{12} l\_1^2 m\_1 + \frac{1}{12} l\_1^2 m\_2 + \frac{1}{12} l\_2^2 m\_2 + \frac{1}{12} l\_3^2 m\_3 + \frac{1}{12} m^2 m\_3 + \frac{1}{12} m\_3^2 m\_1 \\ &\quad 2 l\_2 r\_3 m\_3 \sin(q\_2 + q\_3) - \cos^2(q\_2) (l\_2^2 m\_3 + r\_2^2 m\_2) - r\_3^2 m\_3 \cos^2(q\_2 + q\_3), \\\ M\_{12} &= \frac{1}{6} l\_2^2 m\_2 + \frac{1}{6} m^2 m\_2, \\\ M\_{21} &= \frac{1}{6} l\_2^2 m\_3 + \frac{1}{12} l\_1^2 m\_2 + \frac{1}{12} l\_2^2 m\_2 + \frac{1}{12} l\_1^2 m\_3 + \frac{1}{12} l\_2^2 m\_3 + 2 l\_2^2 m\_3 \sin[\sin q\_2 \sin(q\_2 + q\_3) + \cos q\_2 \cos(q\_2 + q\_3)], \\\ M\_{22} &= r\_2^2 m\_2 + l\_2^2 m\_3 \sin[\sin q\_2 \cdot \sin(q\_2 + q\_3) + \cos q\_2 \cdot \cos(q\_2 + q\_3)]. \end{aligned}$$

$$\begin{aligned} M\_{31} &= \frac{1}{6} l\_3^2 m\_{3\prime} \\ M\_{32} &= \frac{1}{6} w^2 m\_3 + \frac{1}{6} l\_3^2 m\_3 + 2r\_3^2 m\_{3\prime} \\ M\_{33} &= r\_3^2 m\_3 + \frac{1}{12} l\_3^2 m\_3 + \frac{1}{12} w^2 m\_{3\prime} \end{aligned}$$

The Coriolis matrix was computed using the following equation:

$$\mathcal{C}\_{ij}(q,\dot{q}) = \sum\_{k=1}^{3} \Gamma\_{ijk} \dot{q}\_k = \frac{1}{2} \sum\_{k=1}^{3} \left( \frac{\partial M\_{ij}}{\partial q\_k} + \frac{\partial M\_{ik}}{\partial q\_j} - \frac{\partial M\_{kj}}{\partial q\_i} \right) \dot{q}\_k \tag{22}$$

for which the Γ*ijk* parameters are:

Γ<sup>111</sup> = Γ<sup>122</sup> = Γ<sup>123</sup> = Γ<sup>132</sup> = Γ<sup>133</sup> = Γ<sup>212</sup> = Γ<sup>213</sup> = Γ<sup>221</sup> = Γ<sup>222</sup> = Γ<sup>231</sup> = Γ<sup>312</sup> = Γ<sup>313</sup> = Γ<sup>321</sup> = Γ<sup>323</sup> = Γ<sup>331</sup> = Γ<sup>333</sup> = 0, Γ<sup>112</sup> = 2*l*2*m*3*r*3(sin*q*2cos(*q*<sup>2</sup> + *q*3) + cos*q*2sin(*q*<sup>2</sup> + *q*3)) + 2*l* 2 <sup>2</sup>*m*3cos*q*2sin*q*2+ +2*m*2*r*<sup>2</sup> <sup>2</sup>cos*q*2sin*q*<sup>2</sup> + <sup>2</sup>*m*3*r*<sup>2</sup> <sup>3</sup>cos(*q*<sup>2</sup> + *q*3)sin(*q*<sup>2</sup> + *q*3) . *q*2, Γ<sup>113</sup> = 2*l*2*m*3sin*q*2cos(*q*<sup>2</sup> + *q*3) + 2*m*3*r*<sup>2</sup> <sup>3</sup>cos(*q*<sup>2</sup> + *q*3)sin(*q*<sup>2</sup> + *q*3) . *q*3 Γ<sup>121</sup> = 2*l*2*m*3*r*3(sin*q*2cos(*q*<sup>2</sup> + *q*3) + cos*q*2sin(*q*<sup>2</sup> + *q*3)) + 2*l* 2 <sup>2</sup>*m*3cos*q*2sin*q*2+ +2*m*2*r*<sup>2</sup> <sup>2</sup>cos*q*2sin*q*<sup>2</sup> + <sup>2</sup>*m*3*r*<sup>2</sup> <sup>3</sup>cos(*q*<sup>2</sup> + *q*3)sin(*q*<sup>2</sup> + *q*3) . *q*1, Γ<sup>131</sup> = 2*l*2*m*3sin*q*2cos(*q*<sup>2</sup> + *q*3) + 2*m*3*r*<sup>2</sup> <sup>3</sup>cos(*q*<sup>2</sup> + *q*3)sin(*q*<sup>2</sup> + *q*3) . *q*1 Γ<sup>211</sup> = − 2*l*2*m*3*r*3(sin*q*2cos(*q*<sup>2</sup> + *q*3) + cos*q*2sin(*q*<sup>2</sup> + *q*3)) + 2*l* 2 <sup>2</sup>*m*3cos*q*2sin*q*2+ +2*m*2*r*<sup>2</sup> <sup>2</sup>cos*q*2sin*q*<sup>2</sup> + <sup>2</sup>*m*3*r*<sup>2</sup> <sup>3</sup>cos(*q*<sup>2</sup> + *q*3)sin(*q*<sup>2</sup> + *q*3) . *q*1, <sup>Γ</sup><sup>223</sup> <sup>=</sup> <sup>2</sup>*l*2*m*3*r*3(sin*q*2cos(*q*<sup>2</sup> <sup>+</sup> *<sup>q</sup>*3) <sup>−</sup> cos*q*2sin(*q*<sup>2</sup> <sup>+</sup> *<sup>q</sup>*3)). *q*3, <sup>Γ</sup><sup>232</sup> <sup>=</sup> <sup>2</sup>*l*2*m*3*r*3(sin*q*2cos(*q*<sup>2</sup> <sup>+</sup> *<sup>q</sup>*3) <sup>−</sup> cos*q*2sin(*q*<sup>2</sup> <sup>+</sup> *<sup>q</sup>*3)). *q*2, <sup>Γ</sup><sup>233</sup> <sup>=</sup> <sup>4</sup>*l*2*m*3*r*3(sin*q*2cos(*q*<sup>2</sup> <sup>+</sup> *<sup>q</sup>*3) <sup>−</sup> cos*q*2sin(*q*<sup>2</sup> <sup>+</sup> *<sup>q</sup>*3)). *q*3, <sup>Γ</sup><sup>311</sup> <sup>=</sup> <sup>−</sup> 2*l*2*m*3sin*q*2cos(*q*<sup>2</sup> + *q*3) + 2*m*3*r*<sup>2</sup> <sup>3</sup>cos(*q*<sup>2</sup> + *q*3)sin(*q*<sup>2</sup> + *q*3) . *q*1, <sup>Γ</sup><sup>322</sup> <sup>=</sup> <sup>−</sup>2*l*2*m*3*r*3(sin*q*2cos(*q*<sup>2</sup> <sup>+</sup> *<sup>q</sup>*3) <sup>−</sup> cos*q*2sin(*q*<sup>2</sup> <sup>+</sup> *<sup>q</sup>*3)). *q*2, <sup>Γ</sup><sup>332</sup> <sup>=</sup> <sup>−</sup>2*l*2*m*3*r*3(sin*q*2cos(*q*<sup>2</sup> <sup>+</sup> *<sup>q</sup>*3) <sup>−</sup> cos*q*2sin(*q*<sup>2</sup> <sup>+</sup> *<sup>q</sup>*3)). *q*2. (23)

The last part of the dynamic equation is given by Equation (24), which computed the gravity effect matrix on the robot leg:

$$G(q) = N(q, \dot{q}) = \frac{\partial L}{\partial q} = \begin{bmatrix} \frac{\partial L}{\partial q\_1} \\ \frac{\partial L}{\partial q\_2} \\ \frac{\partial L}{\partial q\_3} \end{bmatrix} \tag{24}$$

where

$$\begin{aligned} \mathcal{U}(q) &= m\_1 \mathbf{x}\_1 \mathbf{g} + m\_1 \mathbf{y}\_1 \mathbf{g} + m\_1 \mathbf{z}\_1 \mathbf{g} + m\_2 \mathbf{g} \left( \mathbf{x}\_2 + \mathbf{y}\_2 + \mathbf{z}\_2 \right) + m\_3 \mathbf{g} \left( \mathbf{x}\_3 + \mathbf{y}\_3 + \mathbf{z}\_3 \right) \\ &= m\_1 r\_1 \mathbf{g} + m\_2 \mathbf{g} \left( l\_1 + r\_2 \cos q\_2 + r\_2 \sin q\_2 (\sin q\_1 + \cos q\_1) \right) + \\ &+ m\_3 \mathbf{g} \left( l\_1 + l\_2 \cos q\_2 + r\_3 \cos(q\_2 + q\_3) + (\sin q\_1 + \cos q\_1) \left( l\_2 \sin q\_2 + r\_3 \sin(q\_2 + q\_3) \right) \right) \end{aligned} \tag{25}$$

and its derivative components are:

$$\begin{aligned} \frac{\partial \mathcal{U}}{\partial q\_1} &= m\_2 r\_2 \text{sgn} q\_2 (-\sin q\_1 + \cos q\_1) + m\_3 \mathcal{g} (-\sin q\_1 + \cos q\_1) (l\_2 \sin q\_2 + r\_3 \sin (q\_2 + q\_3)) \\ &\qquad \frac{\partial \mathcal{U}}{\partial q\_2} = m\_2 \mathcal{g} \left( -r\_2 \sin q\_2 + r\_2 \cos q\_2 (\cos q\_1 + \sin q\_1) \right) \\ &+ m\_3 \mathcal{g} \left[ -l\_2 \sin q\_2 - r\_3 \sin (q\_2 + q\_3) + (\sin q\_1 + \cos q\_1) \left( l\_2 \cos q\_2 + r\_3 \cos (q\_2 + q\_3) \right) \right] \\ &\qquad \frac{\partial \mathcal{U}}{\partial q\_3} = m\_3 \mathcal{g} [-r\_3 \sin (q\_2 + q\_3) + r\_3 \cos (q\_2 + q\_3) (\sin q\_1 + \cos q\_1)]. \end{aligned} \tag{26}$$

Using the dynamic control equations, the PID sliding control can be developed, which computes the torque *τ* used in the joint motor torque control so that the position vector *q* can track the desired trajectory *qd*. The tracking error vector is defined as:

$$e = q\_d - q.\tag{27}$$

Sliding motion control requires a sliding surface, given by Equation (28), and contains both the derivative term and the integral one:

$$s = \dot{e} + \lambda\_1 e + \lambda\_2 \int\_0^t e dt \tag{28}$$

where *λ<sup>i</sup>* is a positive diagonal matrix; it turns out that, for *s* = 0, a stable sliding surface is obtained (as shown by Shafiei in [12]). The dynamic robot equations can be written by using the sliding surface equation:

$$H\dot{s} = -\mathbb{C}s + f + \mathbb{r}\_d - \mathbb{r} \tag{29}$$

where

$$f = H(\ddot{q}\_d + \lambda\_1 \dot{e} + \lambda\_2 e) + \mathbb{C} \left( \dot{q}\_d + \lambda\_1 e + \lambda\_2 \int\_0^t e dt \right) + \text{G.} \tag{30}$$

The control module input becomes:

$$
\pi = \hat{f} + K\_v s + K \text{sgn}(s) \tag{31}
$$

where

$$\hat{f} = \hat{H}(\ddot{q}\_d + \lambda\_1 \dot{e} + \lambda\_2 e) + \hat{\mathcal{C}} \left( \dot{q}\_d + \lambda\_1 e + \lambda\_2 \int\_0^t e dt \right) + \hat{\mathcal{G}}.\tag{32}$$

Equation (32) represents a force estimation *f*, and *Kvs* = *Kv* . *e* + *Kvλ*1*e* + *Kvλ*<sup>2</sup> / *t* <sup>0</sup> *edt* is the outer PID loop; *Kv* and *K* are positive diagonal matrices built so that the stability conditions are fulfilled and guaranteed. The *sgn*(*s*) function is the sign function. The function can also be written as:

$$\left| \tilde{f} \right| = \left| \tilde{H} (\ddot{q}\_d + \lambda\_1 \dot{e} + \lambda\_2 e) + \tilde{\mathcal{C}} \left( \dot{q}\_d + \lambda\_1 e + \lambda\_2 \int\_0^t e \, dt \right) + \tilde{\mathcal{G}} \right| \le F \tag{33}$$

where *f* )<sup>=</sup> *<sup>f</sup>* <sup>−</sup> <sup>ˆ</sup> *<sup>f</sup>* , *<sup>H</sup>*) <sup>=</sup> *<sup>H</sup>* <sup>−</sup> *<sup>H</sup>*<sup>ˆ</sup> , and *<sup>G</sup>*) <sup>=</sup> *<sup>G</sup>* <sup>−</sup> *<sup>G</sup>*ˆ. The vector *<sup>F</sup>* is:

$$F = \left| \tilde{H} (\ddot{q}\_d + \lambda\_1 \dot{e} + \lambda\_2 e) \right| + \left| \tilde{\mathcal{C}} (\dot{q}\_d + \lambda\_1 e + \lambda\_2 \int\_0^t e \, dt) \right| + \left| \tilde{G} \right|. \tag{34}$$

To control the system states *e*, . *e* and to reach the sliding surface *s =* 0 in a limited time by staying on the surface, the control law should be formulated so that Condition (35) is fulfilled:

$$\frac{1}{2}\frac{d}{dt}\left[\mathbf{s}^T H \mathbf{s}\right] < \eta \left(\mathbf{s}^T \mathbf{s}\right)^{\frac{1}{2}}, \ \eta > 0. \tag{35}$$

Using the sign function in the control law, high oscillations in the control torque are found as the undesired phenomenon called chattering. To overcome this drawback, a saturation function was used (36) for the discontinuous part of the control law:

$$sat\left(\frac{s}{\varrho}\right) = \left\{ \begin{array}{ll} 1 & s \geq \varrho \\ \frac{s}{\varrho} & -\varrho < s < \varrho \\ -1 & s \leq -\varrho \end{array} \right\}.\tag{36}$$

As a result, a layer *φ* around the sliding surface was obtained so that, when the robot foot trajectory was inside the layer, it remained there. The values of *λ*1, *λ*2, *K,* and *Kv* were adjusted to better position the mobile walking robot foot.

#### **6. Hybrid Control Simulation**

The simulation was built with the help of MATLAB Simulink software to test the proposed methods and control laws. Figure 10 presents the diagram of the main components of the hybrid controller. The reference generation block for the OXYZ axis in the Cartesian space is shown in Figure 11, and the constant generation block defining the walking robot is presented in Figure 12. All the values were sent to a reference system on the robot structure, illustrated in Figure 1b. The foot's vertical position was at a distance of 1.1 m from the origin set on the robot platform, not the foot.

**Figure 10.** MATLAB Simulink diagram for the hybrid control.

The three lines in Figure 11 represent the reference system as follows: the top signal (green line) is the reference for the robot foot on the OZ axis, the trapezoidal signal (blue line) is the reference for the robot foot on the OX axis, and for the OY axis, a zero-value signal was used (purple line). These three datasets represent the Cartesian position of the robot foot for a complete cycle of a leg's walking step. The reference on the OY axis is the heading direction of the robot and has a trapezoidal shape because the foot is moving relative to the robot platform.

**Figure 11.** Foot reference signals.

**Figure 12.** Constant values.

Figure 13 shows the diagram corresponding to the sliding control method made in MATLAB Simulink in which all the described elements are found. With their help, the command signal for the three joint motors was calculated.

Algorithm 1 controlled the kinematic control block. It computed the angular speeds using the Jacobian matrix and the formula from Equation (8), which provided the angular reference speed.

Figures 14 and 15 present the simulation diagrams for the two sensors used in determining which control law should be used at a particular moment in time according to the switching algorithm based on neutrosophic logic.

Using what was presented in Section 4 regarding the neutrosophic decision, the neutrosophic control switching block was implemented. It is illustrated in Figure 16 with its inputs and outputs. The two inputs already described are shown, bringing proximity and force information into the switching mechanism. In addition to these two, there was a third input called stable-state, and it provided the block with additional information. When the robot was homing or reached specific points, it was controlled only by the kinematic control law. The solution was chosen to save computing power and provide a higher speed for arriving at the initial position (homing phase).

**Algorithm 1** The kinematic control block

*function* [*Mx*, *My*, *Mz*, *qd*]= *fcn*(*Ref* \_*X*, *Ref* \_*Y*, *Ref* \_Z, *A*1, *L*2, *L*3, *q*1, *q*2, *q*3) *fi*1 = *q*1; *fi*2 = *q*2; fi3 = *q*3; *J*11 = −sin*d*(*fi*1) × (L2 × sind(*fi*2)+*L*3 × sin*d*(*fi*2 + *fi*3)); *J*12 = *L*2 × cos*d*(*fi*1) × cos*d*(*fi*2)+*L*3 × cos*d*(*fi*1) × cos*d*(*fi*2 + *fi*3); *J*13 = *L*3 × cos*d*(*fi*1) × cos*d*(*fi*2 + *fi*3); *J*21 = cos*d*(*fi*1) × (*L*2 × sin*d*(*fi*2)+*L*3 × sin*d*(*fi*2 + *fi*3)); *J*22 = *L*2 × sin*d*(*fi*1) × cos*d*(*fi*2)+*L*3 × sin*d*(*fi*1) × cos*d*(*fi*2 + *fi*3); *J*23 = *L*3 × sin*d*(*fi*1) × cos*d*(*fi*2 + *fi*3); *J*31 = 0; *J*32 = −*L*2 × sin*d*(*fi*2) −*L*3 × sin*d*(*fi*2 + *fi*3); *J*33 = −*L*3 × sin*d*(*fi*2 + *fi*3); *Jb* =[*J*11 *J*12 *J*13; *J*21 *J*22 *J*23; *J*31 *J*32 *J*33]; *Mx* = cos*d*(*fi*1) × (*L*2 × sin*d*(*fi*2)+*L*3 × sin*d*(*fi*2 + *fi*3)); *My* = sin*d*(*fi*1) × (*L*2 × sind(*fi*2)+L3 × sind(*fi*2 + *fi*3)); *Mz* = L2 × cosd(*fi*2)+*L*3 × cos*d*(*fi*2 + *fi*3)+*A*1; *M*\_*err* =[*Ref* \_*X* − *Mx*; *Ref* \_*Y* − *My*; *Ref* \_*Z* − *Mz*]; *JJTde* = *Jb* × *Jb xM*\_*err*; *qd* = *alpha* × *Jb* × *M*\_*err*;

**Figure 14.** Proximity sensor simulation.

**Figure 15.** Force sensor simulation.

**Figure 16.** Neutrosophic switching diagram.

The actual neutrosophic switching block followed the detailed conditions already described.

#### **7. Experimental Results**

Following the simulation results, we observed several things. One of them was that, to successfully simulate the control law, which was bounded by the interaction between the support surface and the robot, different conditions were needed by the decision and control methods. This case was observed during the support phase, for which the robot leg must hold the entire robot weight and carry out the forward robot motion. The force and proximity sensors must have values that assumed the support surface contact in actual case conditions. In contrast, in simulation conditions, if the positioning control error placed the robot foot slightly above the support surface, then the sensors could affect the control laws and the entire system. Consequently, the switching mechanism was built with the condition that switched the control law when there was permanent contact with the support surface. An example is the homing motion of the foot, for which the robot was controlled only through the kinematic control method.

Figure 17 presents the reference and position tracking for the robot foot in the operational space in Cartesian coordinates on the OX axis. The positioning error on the OX axis is shown in Figure 18. The movement represents the forward direction of motion for the robot and its legs. Thus, three steps are presented, for which the trapezoidal shape of the signal represents the forward and retreat motion relative to the robot platform. The movement was computed according to the reference system relative to the robot platform. Because the reference was considered in the robot's operational space, the first coordinate system was selected at the point where the first joint of the robot was placed.

**Figure 17.** Foot reference and position tracking on the OX axis.

**Figure 18.** Foot positioning error on the OX axis.

On average, the error on the OX axis was below 1 cm, but there were some spikes in the error signal. The high amplitude errors were due to the sudden change in the reference speed, which was used in controlling the angular velocity through the torque of the joint's motor. The high amplitude errors were found at the points where the reference changed its path slope and control type. The error had a more continuous shape when the kinematic control was in place, and in the case of the dynamic control, the error tended to oscillate.

Figure 19 presents the robot foot's reference, positioning, and error signals on the OY axis. The reference value was zero, and the positioning error was less than 1 mm. On the other two axes, spikes were found in the error signal at the moment when the control law changed.

**Figure 19.** Foot tracking position on the OY axis.

Figure 20 presents the diagram for the reference and positioning signals of the robot foot on the OZ axis, which corresponds to the perpendicular axis on the support surface, meaning the vertical motion. The diagram presents the foot position during the leg's swing phase. The leg was positioned on the vertical axis so it would not hit an obstacle or the support surface. Also, the vertical trajectory of the foot was in the support phase, for which the reference was zero. The foot followed a continuous and uniform reference value during the swing phase. In the support and moving-forward phase, a positioning error was observed. The error may have been due to the platform weight compensating at the moment the robot foot crossed the point of intersection with the platform center of the vertical gravity axis. The positioning error became zero on the OZ axis.

**Figure 20.** Foot reference and position tracking on the OZ axis.

Figures 17–21 present, in the same time frame, the motion of the robot leg stepping three times to move the robot forward. The diagrams show all motion stages for the robot foot to complete a step. They present reference and tracking signals. The homing occurred in the first second of the simulation, and a high error was observed. In the time interval of [2–5 s], the leg moved on the vertical axis and forward, controlled by the kinematic control law to reach a new position for the foot. In the next second of the virtual experiment at [5–6 s], the control method reached the vertical reference position to allow the robot leg to support the robot's weight. Between 6 and 9 s, the leg moved backward in relation to the robot platform and was controlled by the dynamic SMC method. A different error pattern is observed in Figures 18 and 21, considering that the robot leg supported the weight at this stage. After this stage was completed, the next step continued in the same manner, excluding the homing sequence.

**Figure 21.** Foot positioning error on the OZ axis.

In Figure 21, a maximum error of 4 cm was found at the amplitude peaks and an average value of 1 cm. The high amplitude values appeared as described above when the control laws were switched, which is the subject of future work to stabilize the system at the switch. The error peaks were also due to the sudden shape-change of the reference signal. By changing from a curve signal to a straight line, the derivative part of the controller received an extremely high value, which in turn affected the control signal. The influence should be attenuated or removed entirely in future work.

#### **8. Conclusions**

To summarize and conclude the results, Figure 22 presents the robot foot trace in a 3D space with the reference pattern. All three steps overlap in the same diagram. The coordinates are given in the Cartesian space. The first stage that was easily found was the homing curve, seen in the lower section of the image. The maximum error was found at the start or end of a step, where the reference system must be improved to avoid sharp changes of direction. For the simulation, a fixed Cartesian coordinates system was considered, with the origin placed in the first joint where the robot top platform joined with to the robot leg. The shape of the horizontal motion was not uniform. The trajectory had minor errors in the range of millimeters and hundreds of micrometers when the control method was not changed, and we considered the shape of the foot trajectory as close to the reference.

Overall, as presented, the dynamic controller was better at following a continuous reference than a simple positioning kinematic controller. Although the positioning was more precise when a dynamic-based controller was used, sudden changes were added in the reference value when changing from a linear trajectory to a half ellipse. Since these were the points where the decision algorithm should also switch the used control method, these points of interest became essential areas of disturbance in the system. We will dedicate our attention to mitigating the reference and switching effects in the reference-tracking algorithm in future work.

**Figure 22.** Foot trace in Cartesian coordinates.

The dynamic controller tended to be slower than the kinematic controller in compensating for the disturbance, but it did not override the PI kinematic controller. Moreover, the PI kinematic controller oscillated around the reference value when the robot leg was subjected to exterior forces. The gravitational acceleration acted upon the entire leg when high gains were used inside the control loops to lower the reference tracking time. It resulted in a high tracking error on the vertical axis during the kinematic control. The reference tracking time was considered the time difference between the change to the kinematic control method and until the foot reached the target point, with an error small enough to consider that the position was reached. The target position was chosen near the support surface but far enough for the leg to lower its speed before hitting the surface.

A PI kinematic-based controller was used during the swing motion of the robot leg because high precision was not required to move the robot foot. Instead, a constant foot speed was needed to reach the point of contact with the support surface in a short time. In addition, along with the positioning precision, the controller did not need to compensate for the gravity and inertial forces during the leg and robot motion and could have severe and undesired consequences in the support phase. Therefore, we concluded that a dynamicbased controller was required to compensate for all the inertial forces and to better track the reference.

Finally, the proposed hybrid control efficiently used the two control methods for the mobile walking robot leg. The biggest problem was found during the transition between the two control techniques.

The main conclusion of the paper was on the decision algorithm side. By having a twostage decision, the information that could be analyzed offline between simulations defined the outline of the critical decision in each case or phase of the robot. The final algorithm distinguished between robot motion phases and rejected contradictory conditions at the online stage.

The consequence of the presented hybrid force/position control with a two-stage decision algorithm was that it can successfully be used and further developed for other types of robots or tasks.

Our future work will focus on studies for removing the high peaks of positioning error. At the same time, new, improved simulations are required to visualize the leg motion cycle.

**Author Contributions:** Conceptualization, I.-A.G. and L.V.; simulation, I.-A.G.; validation, I.-A.G., L.V. and A.-C.C.; investigation, I.-A.G. and L.V.; resources, I.-A.G. and A.-C.C.; writing—original draft preparation, I.-A.G.; writing—review and editing, I.-A.G., L.V. and A.-C.C.; supervision, L.V. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research received no external funding.

**Institutional Review Board Statement:** Not applicable.

**Informed Consent Statement:** Not applicable.

**Data Availability Statement:** Not applicable.

**Acknowledgments:** This work was supported by the Institute of Solid Mechanics of the Romanian Academy and by an interacademic project of IMSAR–Yanshan University: "Joint Laboratory of Intelligent Rehabilitation Robot" (KY201501009), a collaborative research agreement between Yanshan University, China, and the Romanian Academy by IMSAR, RO.

**Conflicts of Interest:** The funders had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript; or in the decision to publish the results.

#### **Glossary**


345

#### **References**

