*Article* **Optimal Timing Fault Tolerant Control for Switched Stochastic Systems with Switched Drift Fault**

**Chenglong Zhu 1,2,\*, Li He 3, Kanjian Zhang 2,\*, Wei Sun <sup>1</sup> and Zengxiang He <sup>2</sup>**


**Abstract:** In this article, an optimal timing fault tolerant control strategy is addressed for switched stochastic systems with unknown drift fault for each switching point. The proposed controllers in existing optimal timing control schemes are not directly aimed at the switched drift fault system, which affects the optimal control performance. A cost functional with system state information and fault variable is constructed. By solving the optimal switching time criterion, the switched stochastic system can accommodate switching drift fault. The variational technique is presented for the proposed cost function in deriving the gradient formula. Then, the optimal fault tolerant switching time is calculated by combining the Armijo step-size gradient descent algorithm. Finally, the effectiveness of the proposed controller design scheme is proved by the safe trajectory planning for a four wheel drive mobile robot and numerical example.

**Keywords:** fault tolerant control; switching time fault; optimal timing control; switched stochastic systems; four wheel drive mobile robot

**MSC:** 93E20; 93C10; 93D09

#### **1. Introduction**

The switched system is a complex kind of hybrid system, which consists of a family of subsystems and a switch rule that coordinates the sequence of the subsystems. The switch rule is triggered by switching signals [1,2]. Compared with nonswitching systems, switching systems have higher control flexibility. Switched systems with unstable subsystems can be stabilized by designing reasonable switching rules [3,4]. Switched control systems have been given considerable attention, not only to the inherent complexity, but also the wide range of practical applications. There are numerous industrial control processes that could be modeled as the switched systems, such as wind energy conversion [5], chemical reactors [6], hybrid electric vehicles [7], robot motion planning [8], etc.

For switched systems, the optimal control problems have attracted wide attention from researchers [9–11]. Different from the traditional continuous systems, the objective of switched system optimal control is to calculate the optimal switching sequence and switching rules to optimize the cost function, see [12] for a recent survey. After years of development, the optimal timing control of continuous systems has made great progress [13–16]. However, these conclusions may be infeasible when the systems are complex switched systems. For a class of autonomous systems in which the sequence of continuous dynamics is predefined, the authors of [17] proposed the optimal time switching strategy by computing the cost function and the gradient over an underlying time grid. Considering the relatively simple cost functional, the study described in [18] combined with a gradient descent algorithm gives the gradient formula for the switching time. The previous results mostly focus

**Citation:** Zhu, C.; He, L.; Zhang, K.; Sun, W.; He, Z. Optimal Timing Fault Tolerant Control for Switched Stochastic Systems with Switched Drift Fault. *Mathematics* **2022**, *10*, 1880. https://doi.org/10.3390/ math10111880

Academic Editor: Quanxin Zhu

Received: 31 March 2022 Accepted: 27 May 2022 Published: 30 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/).

on the cost function containing only integral terms. Although the cost functional in [17] is relatively more general, it cannot meet the needs of some special working conditions, such as flexible satellite attitude optimization [19] or multi-agent vehicle formation planning [20]. It is necessary to study the time optimal switching problem of the generalized cost functional with the integral term and terminal term.

Since disturbance terms often exist in practical systems, it is almost impossible to construct an accurate mathematical model to describe practical switched systems [21–23]. At the same time, the stochastic disturbances lead to the stochastic characteristic of switched systems. From a practical application point of view, stochastic switched systems can model complex dynamics, uncertainty, randomness. Considering the inevitable effect of noise and stochastic disturbance, the authors of [24] investigated the time optimal switching strategy for linear stochastic switched systems. The optimal control strategy for discretetime bilinear systems is extended to switched linear stochastic systems in [25]. For general multi-switched time-invariant stochastic systems, the authors of [26] proposed the time optimization control approach by minimizing a cost functional with different costs defined on the states. However, it is worth mentioning that the aforementioned schemes are only applicable to systems in good operating conditions (i.e., fault free). Extra efforts are needed to analyze the fault tolerant control problem for switched stochastic systems.

With the increasing demand for safety critical systems in both military and civilian applications, the performance and safety issues need to be specially considered despite the presence of faults [27]. This stimulates the research of a fault tolerant control system that can accommodate unknown system faults and maintain its prespecified performance [28–30]. In consideration of the actuator fault, the authors of [31] designed the fault tolerant controller for a class of uncertain switched nonlinear systems. The actuator saturation fault has been investigated for a class of discrete-time switched systems [32]. For the switching point perturbation, the robust optimal control of switched autonomous systems is derived in [33]. For switched parabolic systems described by partial differential equations, the boundary system fault is researched in [34]. With the above observations, the fault tolerant control for stochastic switched systems has not been well developed yet. It is a common phenomenon that the switching time fault occurs in practical switched engineering systems. The switching signals are easily subject to electromagnetic interference and unknown abrupt phenomena such as component and interconnection failures. These factors can induce the switch time to have a delay [31] and drift faults. In addition, from the optimal control point of view, the cost function may increase rapidly and serious security accidents have occurred during the control process when the switching time exceeds or lags behind the designed optimal switch time. However, as far as we know, there are few results about optimal fault tolerant control for switched stochastic systems with switched drift fault. The challenges outlined above motivate us to focus on the optimal timing fault tolerant control problem for switched stochastic systems.

The remainder of this article is arranged as follows: The problem formulation and the control objective are stated in Section 2. Section 3 presents the main results for signal switching, more switchings and optimal fault tolerant algorithm. Section 4 illustrates the obtained result applications in a four wheel drive mobile robot and numerical example. Section 5 provides some concluding remarks.

#### **2. Problem Formulation**

Consider the switched stochastic system depicted as follows:

$$\dot{x}(t) = A\_i x(t) + B\_i \omega(t), \quad t \in [T\_{i-1}, T\_i], \quad i \in [1, 2, \dots, N+1], \tag{1}$$

where *<sup>x</sup>*(*t*) ∈ *<sup>n</sup>* is the state vector, *Ai* and *Bi* are a set of given constant real matrices of appropriate dimensions. *T*<sup>0</sup> denotes the initial time, *T*1, ··· , *TN* (*T*<sup>0</sup> < *T*<sup>1</sup> < ··· < *TN* < *TN*+<sup>1</sup> = *Tf*) denote the time switching signal and *Tf* denotes the final time. *ω* is the stochastic disturbance.

Initial condition *<sup>x</sup>*<sup>0</sup> ∈ *<sup>n</sup>* is a stochastic vector with mean *<sup>m</sup>*<sup>0</sup> and variance matrix *<sup>P</sup>*0,

$$E[\mathbf{x}(t\_0)] = m\_0, \quad Var[\mathbf{x}(t\_0)] = E[(\mathbf{x}\_0 - m\_0)(\mathbf{x}\_0 - m\_0)^T] = P\_0. \tag{2}$$

By employing the property of mathematical expectation for the stochastic initial vector, we have the mean vector *<sup>m</sup>*<sup>0</sup> ∈ *<sup>n</sup>* and variance matrix *<sup>P</sup>*<sup>0</sup> ⊂ *<sup>n</sup>* × *n*. Since the discretization of the time and dynamic input approaches can bring about computation explosions and result in inaccurate solutions, in this paper we focus on a class of switched autonomous systems. Then, the switching time signals are the system input variables.

For the stochastic disturbance, the following condition is imposed.

**Assumption 1.** *The stochastic disturbance ω is the zero-mean Gaussian white noise process, which is independent of x*(*t*0)*. The following statistical properties are satisfied:*

$$\text{Cov}[\omega(t), \omega(\tau)] = E[\omega(t)\omega^T(\tau)] = Q\_0 \delta(t-\tau), \tag{3}$$

$$\text{Cov}[\mathbf{x}(t\_0), \omega(\boldsymbol{\tau})] = E[(\mathbf{x}\_0 - \boldsymbol{m}\_0)\omega^T(\boldsymbol{\tau})] = \mathbf{0},\tag{4}$$

*where δ*(*t*) *is the Dirac delta function,*

$$\int\_{-\infty}^{+\infty} \delta(t)dt = 1, \quad \delta(t) = \begin{cases} 0, & t \neq 0, \\ +\infty, & t = 0. \end{cases} \tag{5}$$

The normal switching time is denoted as *T* = (*T*1, ··· , *TN*). The actuator switched fault is an unpermitted deviation *T* of the designed standard switching signal input *T*. The unknown switched drift fault for each switching point can be described as:

$$T\_{\mathfrak{c}} = (T\_1 + \mathfrak{e}\_1 \cdot \dots \cdot, T\_i + \mathfrak{e}\_i \cdot \dots \cdot, T\_N + \mathfrak{e}\_N)\_{\prime} \tag{6}$$

where the *<sup>i</sup>* is unknown drift parameters.

**Assumption 2.** *The drift fault parameters are limited to the bounded region,* −*δ<sup>i</sup>* ≤ *<sup>i</sup>* ≤ *δi, where δ<sup>i</sup> is a given small positive constant. For δi, Ti* + *δ<sup>i</sup>* ≤ *Ti*+1*, the predefined triggered sequence of subsystems is continuous and there is no jump. In addition, the switched system states are continuous at the switching time which is different from the general hybrid system.*

**Remark 1.** *Assumption* 1 *is reasonable and commonly used. In fact, for the practical engineering system, the stochastic noise disturbance is generated by the equipment plant, and is independent of the initial state of the system model. An actuator switched drift fault is a common type of fault. The drift fault parameter <sup>i</sup> is brought by electromagnetic interference, transmission delay, equipment aging and mechanical wear in modern engineering applications. It is meaningful and reasonable to limit the amplitude of the drift fault parameter i. The subsystem triggered sequence does not jump. Assumption* 2 *is the foundation of fault tolerant control switch system research.*

Due to the stochastic characteristic of the system state *x*(*t*), the nominal cost functional *J*<sup>0</sup> is described as:

$$J0 = E\{\Psi(\mathbf{x}(t\_f))\} + \sum\_{i=0}^{N} \int\_{T\_i}^{T\_{i+1}} L\_{i+1}(\mathbf{x}(t))dt\},\tag{7}$$

where *Li*+1(*x*(*t*)) = <sup>1</sup> <sup>2</sup> *<sup>x</sup>T*(*t*)*Qix*(*t*) are the running cost functions. <sup>Ψ</sup>(*x*(*tf*)) = <sup>1</sup> <sup>2</sup> *<sup>x</sup>T*(*tf*)*PTx*(*tf*) denote the terminal cost term at the final time. The coefficient matrices *PT* = *P<sup>T</sup> <sup>T</sup>* ≥ 0, *Qi* = *Q<sup>T</sup> <sup>i</sup>* ≥ 0 are the weight matrices for the present and terminal states, where *PT* ⊂ *<sup>n</sup>* × *<sup>n</sup>* and *Qi* ⊂ *<sup>n</sup>* × *n*.

Motivated by the integral mean value theorem, a novel cost functional mechanism is investigated to achieve an appropriate compromise between drift fault compensation and the optimal process.

*<sup>J</sup>* <sup>=</sup> *<sup>E</sup>*{Ψ(*x*(*tf*)) + <sup>1</sup> 2*<sup>N</sup>* ∏*<sup>N</sup> <sup>i</sup>*=<sup>1</sup> *δ<sup>i</sup> δ*<sup>1</sup> −*δ*<sup>1</sup> ··· *<sup>δ</sup><sup>N</sup>* −*δ<sup>N</sup>* [ *T*1+<sup>1</sup> *t*0 *L*1(*x*(*t*))*dt* + ··· + *Ti*+1+*i*+<sup>1</sup> *Ti*+*<sup>i</sup> Li*+1(*x*(*t*))*dt* + ··· + *tf TN*+*<sup>N</sup> LN*+1(*x*(*t*))]*d<sup>N</sup>* ··· *d*1}. (8)

**Remark 2.** *It is worth mentioning that the cost function (8) is the mean value of the integral over the switch fault time T. When the drift fault parameter δ<sup>i</sup>* → 0*, <sup>i</sup>* → 0*, i.e., fault free, by utilizing the L'Ho*ˆ*pital's rule, the cost functional (8) becomes the nominal cost functional J*0*. The constructed cost functional J includes system state information and a fault variable, then the optimal switching time obtained by this cost functional is a relatively accommodated switching drift fault.In addition, the proposed cost functional mixes the integral term and terminal term. Therefore, the cost functional (8) we investigate in this paper is general and powerful enough to describe many industrial process.*

Control objective: The main purpose of this paper is to deduce the gradient formula for the corresponding cost function with respect to a switched stochastic system (1). Then, under Assumptions 1 and 2, we solve the optimal switching signal criterion, such that the the proposed cost function (8) is minimized in spite of the switched drift fault (6).

#### **3. The Main Results**

In this section, we firstly take *N* = 1 as one switching time for the system. By employing the calculus of variations and some computation, the increment of the cost functional will be deduced according to the switching signal increment. Based on the gradient descent algorithm, the optimal time fault tolerant control of the switched stochastic system is proposed. Then, the multi-switchings time case can be achieved as the single switching time extension. Finally, the optimal fault tolerant algorithm is proposed with a flow chart.

#### *3.1. Single Switching*

Consider the case of a single switching for the linear switched autonomous stochastic system with switching time drift fault ,

$$\dot{\mathbf{x}}(t) = \begin{cases} A\_1 \mathbf{x}(t) + B\_1 \omega, & t \in [t\_0, T\_1 + \epsilon], \\ A\_2 \mathbf{x}(t) + B\_2 \omega, & t \in [T\_1 + \epsilon, t\_f]. \end{cases} \tag{9}$$

For the switching time, we take a positive variation Δ*t*. Compared with the nominal system (9), we denote *x*˜ to represent the state trajectory of the system switching time after the increment of Δ*t*, that is, the switching time is *T*<sup>1</sup> + + Δ*t*. The increment system *x*˜ is defined as:

$$\hat{\mathfrak{x}}(t) = \begin{cases} A\_1 \mathfrak{x}(t) + B\_1 \omega, & t \in [t\_0, T\_1 + \mathfrak{c} + \Delta t], \\ A\_2 \mathfrak{x}(t) + B\_2 \omega, & t \in [T\_1 + \mathfrak{c} + \Delta t, t\_f]. \end{cases} \tag{10}$$

A portion of the grid is presented in Figure 1 to illustrate the different switching times.

**Figure 1.** Switching times within the time grid.

In order to make the induced variation cost functional Δ*J* clear and easy to be represented, one can consider the statistical properties of the stochastic states with the nominal system *x* and the increment systems *x*˜.

The second-order origin moment matrix of the system states *x*(*t*) and *x*˜(*t*) satisfy the following matrix differential equation:

$$\dot{m}\_x(t) = \begin{cases} A\_1 m\_x(t) + m\_x(t) A\_1^T + B\_1 Q\_0 B\_1^T, & t \in [t\_0, T\_1 + \epsilon], \\ A\_2 m\_x(t) + m\_x(t) A\_2^T + B\_2 Q\_0 B\_2^T, & t \in [T\_1 + \epsilon, t\_f] \end{cases} \tag{11}$$

with the initial state *mx*(0) = *P*<sup>0</sup> + *m*0*m<sup>T</sup>* 0 .

$$\dot{m}\_{\mathcal{X}}(t) = \begin{cases} A\_1 m\_{\mathcal{X}}(t) + m\_{\mathcal{X}}(t) A\_1^T + B\_1 Q\_0 B\_1^T, & t \in [t\_0, T\_1 + \epsilon + \Delta t], \\ A\_2 m\_{\mathcal{X}}(t) + m\_{\mathcal{X}}(t) A\_2^T + B\_2 Q\_0 B\_2^T, & t \in [T\_1 + \epsilon + \Delta t, t\_f], \end{cases} \tag{12}$$

with the same initial state *mx*˜(0) = *P*<sup>0</sup> + *m*0*m<sup>T</sup>* <sup>0</sup> = *mx*(0). Then, the second-order origin moment matrix *mx*(*t*) and *mx*˜(*t*) have the uniform derivative equation on the interval [*t*0, *T*<sup>1</sup> + ].

Next, we will analyze the induced variation cost functional *J*. The cost functional *J* and ˜*J* have a main discrepancy with the nominal system state *x* and the increment systems state *x*˜ on the interval [*T*<sup>1</sup> + , *T*<sup>1</sup> + + Δ*t*]. We subdivide the time interval according to the background grid points falling between *t*<sup>0</sup> and *tf* , after the switching time *T*<sup>1</sup> + + Δ*t*. The nominal cost functional *J* can be described as

$$\begin{split} \|f\| &=& E\{\Psi(\mathbf{x}(t\_f)) + \frac{1}{2\delta} \int\_{-\delta}^{\delta} [\int\_{t\_0}^{T\_1+\varepsilon} L\_1 dt + \int\_{T\_1+\varepsilon}^{t\_f} L\_2 dt] d\varepsilon\} \\ &=& E\{\Psi(\mathbf{x}(t\_f)) + \frac{1}{2\delta} \int\_{-\delta}^{\delta} [\int\_{t\_0}^{T\_1+\varepsilon} L\_1 dt + \int\_{T\_1+\varepsilon}^{T\_1+\varepsilon+\Delta t} L\_2 dt + \int\_{T\_1+\varepsilon+\Delta t}^{t\_f} L\_2 dt] d\varepsilon\} \\ &\doteq& f\_0 + f\_1 + f\_2 + f\_3. \end{split} \tag{13}$$

The increment cost functional ˜*J* can be described as

$$\begin{split} \tilde{f} &=& E\{\Psi(\vec{x}(t\_f)) + \frac{1}{2\delta} \int\_{-\delta}^{\delta} [\int\_{t\_0}^{T\_1 + \mathfrak{c} + \Delta t} L\_1 dt + \int\_{T\_1 + \mathfrak{c} + \Delta t}^{t\_f} L\_2 dt] d\varepsilon \} \\ &=& E\{\Psi(\vec{x}(t\_f)) + \frac{1}{2\delta} \int\_{-\delta}^{\delta} [\int\_{t\_0}^{T\_1 + \mathfrak{c}} L\_1 dt + \int\_{T\_1 + \mathfrak{c}}^{T\_1 + \mathfrak{c} + \Delta t} L\_1 dt + \int\_{T\_1 + \mathfrak{c} + \Delta t}^{t\_f} L\_2 dt] d\varepsilon \} \\ &\doteq& J\_0 + J\_1 + J\_2 + J\_3. \end{split} \tag{14}$$

The major results in this paper are briefly summarized as the following theorem:

**Theorem 1.** *For the linear switched autonomous stochastic system (9) with the single switching time T*<sup>1</sup> *and the unknown switching drift fault , if the system stochastic disturbance satisfies Assumption 1 and the drift fault parameter satisfies Assumption 2, we design the general cost functional J, as presented in Equation (13). Then, the derivative d J*/*dT*<sup>1</sup> *of the cost function J with respect to the switching time T*<sup>1</sup> *has the following form:*

$$\begin{split} \frac{d\boldsymbol{I}}{d\boldsymbol{T}\_{1}} &= \quad \frac{1}{4\delta} \int\_{-\delta}^{\delta} \mathrm{tr}(\boldsymbol{m}\_{\boldsymbol{x}}(\boldsymbol{T}\_{1}+\boldsymbol{\epsilon})(\boldsymbol{Q}\_{1}-\boldsymbol{Q}\_{2}))d\boldsymbol{\epsilon} \\ &+ \frac{1}{4\delta} \int\_{-\delta}^{\delta} \int\_{T\_{1}+\boldsymbol{\epsilon}}^{t\_{f}} \mathrm{tr}(\boldsymbol{e}^{A\_{2}(t-T\_{1}-\boldsymbol{\epsilon})} \boldsymbol{M}\_{1}\boldsymbol{e}^{A\_{2}^{T}(t-T\_{1}-\boldsymbol{\epsilon})} \boldsymbol{Q}\_{2})d\boldsymbol{t} d\boldsymbol{\epsilon} \\ &+ \frac{1}{2} \mathrm{tr}((\boldsymbol{e}^{A\_{2}(t\_{f}-T\_{1}-\boldsymbol{\epsilon})} \boldsymbol{M}\_{1}\boldsymbol{e}^{A\_{2}^{T}(t\_{f}-T\_{1}-\boldsymbol{\epsilon})})\boldsymbol{P}\_{\boldsymbol{T}})\_{\prime} \end{split} \tag{15}$$

*where <sup>M</sup>*<sup>1</sup> = (*A*<sup>1</sup> − *<sup>A</sup>*2)*mx*(*T*<sup>1</sup> + ) + *mx*(*T*<sup>1</sup> + )(*A<sup>T</sup>* <sup>1</sup> − *<sup>A</sup><sup>T</sup>* <sup>2</sup> ) + *<sup>B</sup>*1*Q*0*B<sup>T</sup>* <sup>1</sup> − *<sup>B</sup>*2*Q*0*B<sup>T</sup>* 2 *, and mx*(*T*<sup>1</sup> + ) *takes the value of the following matrix differential equation at t* = *T*<sup>1</sup> + *:*

$$\begin{array}{rcl}\dot{m}\_{\mathbf{x}}(t) &=& A\_1 m\_{\mathbf{x}}(t) + m\_{\mathbf{x}}(t) A\_1^T + B\_1 Q\_0 B\_1^T, \\ m\_{\mathbf{x}}(0) &=& P\_0 + m\_0 m\_0^T. \end{array} \tag{16}$$

*The cost function has the fault tolerant performance for the switching time fault.*

**Proof.** According to the division of the time interval in Figure 1, through the following four steps, we complete the proof of the theorem.

**Step 1.** On the interval *t* ∈ [*t*0, *T*<sup>1</sup> + ], the systems (9) and (10) can be redescribed as

$$\dot{\mathbf{x}}(t) = A\_1 \mathbf{x}(t) + B\_1 \omega, \qquad \qquad t \in [t\_0, T\_1 + \epsilon], \tag{17}$$

$$\dot{\mathfrak{x}}(t) = A\_1 \mathfrak{x}(t) + B\_1 \omega, \qquad t \in [t\_0, T\_1 + \mathfrak{e}]. \tag{18}$$

The induced variation in the cost functional *J* and ˜*J*,

˜*J*<sup>1</sup> <sup>−</sup> *<sup>J</sup>*<sup>1</sup> <sup>=</sup> *<sup>E</sup>*{ <sup>1</sup> 2*δ δ* −*δ T*1+ *t*0 *<sup>L</sup>*1*dtd*} − *<sup>E</sup>*{ <sup>1</sup> 2*δ δ* −*δ T*1+ *t*0 *L*1*dtd*} <sup>=</sup> <sup>1</sup> 2*δ δ* −*δ T*1+ *t*0 *E*(*L*1(*x*˜) − *L*1(*x*))*dtd* <sup>=</sup> <sup>1</sup> 2*δ δ* −*δ T*1+ *t*0 1 2 *E*(*x*˜ *<sup>T</sup>*(*t*)*Q*1*x*˜(*t*) <sup>−</sup> *<sup>x</sup>T*(*t*)*Q*1*x*(*t*))*dtd*. (19)

Owing to the diagonal properties of weight matrices *Q*1, we obtain

$$\begin{split} E(\mathbf{x}^T(t)Q\_1\mathbf{x}(t)) &= E(\operatorname{tr}(\mathbf{x}^T(t)Q\_1\mathbf{x}(t))) = E(\operatorname{tr}(\mathbf{x}(t)\mathbf{x}^T(t)Q\_1)) \\ &= \operatorname{tr}(E(\mathbf{x}(t)\mathbf{x}^T(t))Q\_1) = \operatorname{tr}(\mathfrak{m}\_x(t)Q\_1). \end{split} \tag{20}$$

Under the same initial condition *x*(0) = *x*˜(0), combining with (11), (12), (17) and (18), we can conclude that

$$m\_{\mathcal{X}}(t) = m\_{\mathcal{X}}(t), \quad t \in [t\_0, T\_1 + \epsilon]. \tag{21}$$

Then, Equation (20) is converted into

$$E(\mathbf{x}^T(t)Q\_1\mathbf{x}(t)) = tr(m\_\mathbf{x}(t)Q\_1) = tr(m\_\mathbf{x}(t)Q\_1) = E(\tilde{\mathbf{x}}^T(t)Q\_1\mathbf{x}(t)).\tag{22}$$

Combining the above equation with (19), the following equation can be obtained:

$$\tilde{f}\_1 - f\_1 = \frac{1}{2\delta} \int\_{-\delta}^{\delta} \int\_{t\_0}^{T\_1 + \varepsilon} \frac{1}{2} E(\tilde{\mathbf{x}}^T(t) Q\_1 \tilde{\mathbf{x}}(t) - \mathbf{x}^T(t) Q\_1 \mathbf{x}(t)) dt d\varepsilon = 0. \tag{23}$$

**Step 2.** On the interval *t* ∈ [*T*<sup>1</sup> + , *T*<sup>1</sup> + + Δ*t*], the systems in (9) and (10) are described as

$$\dot{\mathbf{x}}(t) = A\_2 \mathbf{x}(t) + B\_2 \boldsymbol{\omega}, \qquad t \in [T\_1 + \epsilon, T\_1 + \epsilon + \Delta t], \tag{24}$$

$$
\hat{\mathbf{x}}(t) = A\_1 \hat{\mathbf{x}}(t) + B\_1 \omega, \qquad t \in [T\_1 + \epsilon, T\_1 + \epsilon + \Delta t]. \tag{25}
$$

The increment of the cost function is

$$\begin{split} \|f\_{2} - f\_{2}\| &= \quad \frac{1}{2\delta} \int\_{-\delta}^{\delta} \int\_{T\_{1} + \epsilon}^{T\_{1} + \epsilon + \Delta t} E(L\_{2}(\tilde{\mathbf{x}}) - L\_{1}(\mathbf{x})) dt d\varepsilon \\ &= \quad \frac{1}{4\delta} \int\_{-\delta}^{\delta} \int\_{T\_{1} + \epsilon}^{T\_{1} + \epsilon + \Delta t} E(\tilde{\mathbf{x}}^{T}(t) Q\_{2} \tilde{\mathbf{x}}(t) - \mathbf{x}^{T}(t) Q\_{1} \mathbf{x}(t)) dt d\varepsilon \\ &= \quad \frac{1}{4\delta} \int\_{-\delta}^{\delta} \int\_{T\_{1} + \epsilon}^{T\_{1} + \epsilon + \Delta t} tr(m\_{1} Q\_{1} - m\_{\chi} Q\_{2}) dt d\varepsilon. \end{split} \tag{26}$$

Consider the second-order origin moment matrix *mx*(*t*), *mx*˜(*t*) and Equations (11) and (12). By applying Taylor expansion, *mx*(*t*) and *mx*˜(*t*) at *T*<sup>1</sup> + can be calculated as:

$$\begin{aligned} m\_x(t) &= \begin{aligned} m\_x(T\_1 + \epsilon) + (A\_2 m\_x(T\_1 + \epsilon) + m\_x(T\_1 + \epsilon)A\_2^T \\ &+ B\_2 Q\_0 B\_2^T)(t - T\_1 - \epsilon) + o(t - T\_1 - \epsilon) \\ &= m\_x(T\_1 + \epsilon) + m\_1(t - T\_1 - \epsilon) + o(t - T\_1 - \epsilon), \end{aligned} \tag{27}$$
 
$$\begin{aligned} m\_{\mathcal{X}}(t) &= \begin{aligned} m\_{\mathcal{X}}(T\_1 + \epsilon) + (A\_1 m\_{\mathcal{X}}(T\_1 + \epsilon) + m\_{\mathcal{X}}(T\_1 + \epsilon)A\_1^T \\ &+ B\_1 Q\_0 B\_1^T)(t - T\_1 - \epsilon) + o(t - T\_1 - \epsilon) \\ &= m\_{\mathcal{X}}(T\_1 + \epsilon) + \bar{m}\_1(t - T\_1 - \epsilon) + o(t - T\_1 - \epsilon). \end{aligned} \tag{28}$$

It can be seen that *mx*(*T*<sup>1</sup> + ) = *mx*˜(*T*<sup>1</sup> + ) from (11) and (12). Note that at *t* = *T*<sup>1</sup> + + Δ*t*, the *mx*(*t*) is not equal to *mx*˜(*t*), then, we have

$$\begin{aligned} tr(m\_{\vec{x}}Q\_1 - m\_{\vec{x}}Q\_2) &= -tr(m\_{\vec{x}}(T\_1 + \epsilon)(Q\_1 - Q\_2) + o(t - T\_1 - \epsilon) \\ &+ (\vec{m}\_1 Q\_1 - m\_1 Q\_2)(t - T\_1 - \epsilon)). \end{aligned} \tag{29}$$

Substituting the above equation into (26), one has

$$\begin{split} l\_{2} - l\_{2} &= \quad \frac{1}{4\delta} \int\_{-\delta}^{\delta} tr(m\_{x}(T\_{1} + \epsilon)(Q\_{1} - Q\_{2})) \Delta t \\ &\quad + \int\_{T\_{1} + \epsilon}^{T\_{1} + \epsilon + \Delta t} \left( tr(M\_{11})(t - T\_{1} - \epsilon) + o(t - T\_{1} - \epsilon) \right) dt d\varepsilon \\ &= \quad \frac{1}{4\delta} \int\_{-\delta}^{\delta} tr(m\_{x}(T\_{1} + \epsilon)(Q\_{1} - Q\_{2})) \Delta t + \frac{1}{2} tr(M\_{11}) \Delta t^{2} + o(\Delta t) d\varepsilon \\ &= \quad \frac{\Delta t}{4\delta} \int\_{-\delta}^{\delta} tr(m\_{x}(T\_{1} + \epsilon)(Q\_{1} - Q\_{2})) d\varepsilon + o(\Delta t). \end{split} \tag{30}$$

By dividing Δ*t* on both sides of the above equation and taking the limit operation Δ*t* → 0, one has

$$\lim\_{\Delta t \to 0} \frac{f\_2 - f\_2}{\Delta t} = \frac{1}{4\delta} \int\_{-\delta}^{\delta} \text{tr}(m\_\chi (T\_1 + \epsilon)(Q\_1 - Q\_2)) d\epsilon. \tag{31}$$

**Step 3.** On the interval *t* ∈ [*T*<sup>1</sup> + + Δ*t*, *tf* ], the systems can be represented as

$$\dot{\mathbf{x}}(t) = A\_2 \mathbf{x}(t) + B\_2 \omega, \qquad t \in [T\_1 + \epsilon + \Delta t, \ t\_f], \tag{32}$$

$$
\dot{\mathfrak{x}}(t) = A\_2 \mathfrak{x}(t) + B\_2 \omega, \qquad t \in [T\_1 + \mathfrak{e} + \Delta t, \ t\_f]. \tag{33}
$$

The increment of the cost function is

$$\begin{split} \mathcal{J}\_3 - \mathcal{J}\_3 &= \quad \frac{1}{2\delta} \int\_{-\delta}^{\delta} \int\_{T\_1 + \varepsilon + \Delta t}^{t\_f} E(L\_2(\tilde{\mathbf{x}}) - L\_2(\mathbf{x})) dt d\varepsilon \\ &= \quad \frac{1}{4\delta} \int\_{-\delta}^{\delta} \int\_{T\_1 + \varepsilon + \Delta t}^{t\_f} E(\tilde{\mathbf{x}}^T(t) \mathbf{Q}\_2 \tilde{\mathbf{x}}(t) - \mathbf{x}^T(t) \mathbf{Q}\_2 \mathbf{x}(t)) dt d\varepsilon \\ &= \quad \frac{1}{4\delta} \int\_{-\delta}^{\delta} \int\_{T\_1 + \varepsilon + \Delta t}^{t\_f} \text{tr}((m\_{\tilde{\mathbf{x}}} - m\_{\tilde{\mathbf{x}}}) \mathbf{Q}\_2) dt d\varepsilon. \end{split} \tag{34}$$

Recalling the Taylor expansion at *T*<sup>1</sup> + for the *mx*(*t*) and *mx*˜(*t*),

$$\begin{aligned} m\_{\mathfrak{X}}(T\_1 + \epsilon + \Delta t) - m\_{\mathfrak{x}}(T\_1 + \epsilon + \Delta t) &= & (\tilde{m}\_1 - m\_1)\Delta t + o(\Delta t) \\ &\doteq & M\_1 \Delta t + o(\Delta t). \end{aligned} \tag{35}$$

By applying Taylor series expansion at *T*<sup>1</sup> + + Δ*t*, the *mx*(*t*) and *mx*˜(*t*) can be described as

$$\begin{split} m\_{\boldsymbol{x}}(t) &= \; m\_{\boldsymbol{x}}(T\_1 + \epsilon + \Delta t) + \dot{m}\_{\boldsymbol{x}}(T\_1 + \epsilon + \Delta t)(t - T\_1 - \epsilon - \Delta t) \\ &+ \cdots + m\_{\boldsymbol{x}}^{(n)}(T\_1 + \epsilon + \Delta t) \frac{(t - T\_1 - \epsilon - \Delta t)^n}{n!}, \end{split} \tag{36}$$

$$\begin{split} m\_{\mathfrak{X}}(t) &= \, ^t m\_{\mathfrak{X}}(T\_1 + \mathfrak{c} + \Delta t) + \dot{m}\_{\mathfrak{X}}(T\_1 + \mathfrak{c} + \Delta t)(t - T\_1 - \mathfrak{c} - \Delta t) \\ &+ \cdots + m\_{\mathfrak{X}}^{(n)}(T\_1 + \mathfrak{c} + \Delta t) \frac{(t - T\_1 - \mathfrak{c} - \Delta t)^n}{n!} . \end{split} \tag{37}$$

By employing the mathematical calculations, we have

$$m\_{\tilde{x}}(t) - m\_x(t) = e^{A\_2(t - T\_1 - \varepsilon - \Delta t)} M\_1 e^{A\_2^{\tilde{T}}(t - T\_1 - \varepsilon - \Delta t)} \Delta t + o(\Delta t). \tag{38}$$

Substituting the above equation into (34), and dividing it by Δ*t* and taking the lim Δ*t* → 0, we obtain

$$\begin{split} \lim\_{\Delta t \to 0} \frac{f\_3 - f\_3}{\Delta t} &= \lim\_{\Delta t \to 0} \frac{1}{4\delta \Delta t} \int\_{-\delta}^{\delta} \int\_{T\_1 + \varepsilon + \Delta t}^{t\_f} tr((m\_\Upsilon - m\_x)Q\_2) dt d\varepsilon \\ &= \lim\_{\Delta t \to 0} \frac{1}{4\delta \Delta t} \int\_{-\delta}^{\delta} \int\_{T\_1 + \varepsilon + \Delta t}^{t\_f} tr(e^{A\_2(t - T\_1 - \varepsilon - \Delta t)} M\_{12} e^{A\_2^T(t - T\_1 - \varepsilon - \Delta t)} Q\_2 \Delta t) dt d\varepsilon \\ &= \frac{1}{4\delta} \int\_{-\delta}^{\delta} \int\_{T\_1 + \varepsilon}^{t\_f} tr(e^{A\_2(t - T\_1 - \varepsilon)} M\_1 e^{A\_2^T(t - T\_1 - \varepsilon)} Q\_2) dt d\varepsilon. \end{split} \tag{39}$$

**Step 4.** For *t* = *tf* , we analyze the difference of terminal cost item of the cost functional,

$$\begin{aligned} J\_0 - J\_0 &=& E\{\Psi(\ddot{\mathbf{x}}(t\_f))\} - E\{\Psi(\mathbf{x}(t\_f))\} \\ &=& E\{\frac{1}{2}\ddot{\mathbf{x}}^T(t\_f)P\_T\ddot{\mathbf{x}}(t\_f) - \frac{1}{2}\mathbf{x}^T(t\_f)P\_T\mathbf{x}(t\_f)\} \\ &=& \frac{1}{2}tr((m\_\mathcal{x}(t\_f) - m\_\mathbf{x}(t\_f))P\_T). \end{aligned} \tag{40}$$

Recalling the Taylor expansion at *T*<sup>1</sup> + + Δ*t* for the *mx*(*t*) and *mx*˜(*t*), we have

$$m\_{\mathcal{R}}(t\_f) - m\_{\mathcal{X}}(t\_f) = e^{A\_2(t\_f - T\_1 - \mathfrak{c} - \Delta t)} M\_1 e^{A\_2^\top (t\_f - T\_1 - \mathfrak{c} - \Delta t)} \Delta t + o(\Delta t). \tag{41}$$

Substituting the above equation into (40), and dividing it by Δ*t* and taking the lim Δ*t* → 0, we obtain

$$\lim\_{\Delta t \to 0} \frac{\tilde{l}\_0 - l\_0}{\Delta t} = \lim\_{\Delta t \to 0} \frac{1}{2\Delta t} tr((m\_\mathcal{E}(t\_f) - m\_\mathcal{X}(t\_f))P\_T)$$

$$\begin{split} &= \lim\_{\Delta t \to 0} \frac{1}{2\Delta t} tr((e^{A\_2(t\_f - T\_1 - \varepsilon - \Delta t)} M\_1 e^{A\_2^T(t\_f - T\_1 - \varepsilon - \Delta t)} \Delta t + o(\Delta t))P\_T) \\ &= \frac{1}{2} tr((e^{A\_2(t\_f - T\_1 - \varepsilon)} M\_1 e^{A\_2^T(t\_f - T\_1 - \varepsilon)})P\_T). \end{split} \tag{42}$$

Combining the above four steps, we can complete the proof.

#### *3.2. Multi-Switchings*

In this subsection, we consider the case of more switchings (*N* > 1). Recall that the switched stochastic systems (1) have *N* + 1 linear time-invariant autonomous stochastic subsystems and the cost function (8) in Section 2. The major results in this paper with more switchings are briefly summarized as the following theorem:

**Theorem 2.** *For the linear switched autonomous stochastic system (1) with the multi-switching time T and the unknown switching drift fault , if the system stochastic disturbance satisfies Assumption 1 and the drift fault parameter satisfies Assumption 2, we design the general cost functional J, as presented in Equation (8). Then, the partial derivatives ∂J*(*T*)/*∂Ti* (*i* = 1, ... , *N*) *with respect to the ith switching time have the following form:*

$$\begin{split} \frac{\partial \bar{I}}{\partial T\_{i}} &= \quad \frac{1}{2^{N+1} \prod\_{i=1}^{N} \delta\_{i}} \int\_{-\delta\_{1}}^{\delta\_{1}} \cdots \int\_{-N\_{N}}^{\delta\_{N}} \left( tr \Big( e^{A\_{N+1} \left( t\_{j} - T\_{N} - \varepsilon\_{N} \right)} \Gamma\_{jN} e^{A\_{N+1}^{\top} \left( t\_{j} - T\_{N} - \varepsilon\_{N} \right)} P\_{T} \Big) \\ &+ \sum\_{i=j}^{N} \int\_{T\_{i} + \varepsilon\_{i}}^{T\_{i+1} + \varepsilon\_{i+1}} tr \Big( e^{A\_{i+1} \left( t - T\_{i} - \varepsilon\_{i} \right)} \Gamma\_{j\bar{i}} e^{A\_{i+1}^{\top} \left( t - T\_{i} - \varepsilon\_{i} \right)} Q\_{i+1} \Big) \mathrm{d}t \\ &+ tr \Big( m\_{x} \big( T\_{j} + \varepsilon\_{j} \big) \big( Q\_{j} - Q\_{j+1} \big) \Big) \mathrm{d}\varepsilon\_{N} \cdots \mathrm{d}\varepsilon\_{1}. \end{split} \tag{43}$$

*where the symbol tr*(·) *is defined as the trace function*

$$\begin{aligned} \Gamma\_{\overline{j}\overline{i}} &= M\_{\overline{j}}, \quad j = 1, \dots, N\_{\prime} \\ \Gamma\_{\overline{j}\overline{i}} &= e^{A\_{i}(T\_{i}-T\_{i-1})} \Gamma\_{\overline{j},i-1} e^{A\_{i}^{\top}(T\_{i}-T\_{i-1})}, \quad i = j+1, \dots, N\_{\prime} \\ M\_{\overline{j}} &= \left(A\_{\overline{j}} - A\_{\overline{j+1}}\right) m\_{\text{x}} \left(T\_{\overline{j}} + \varepsilon\_{\overline{j}}\right) + m\_{\text{x}} \left(T\_{\overline{j}} + \varepsilon\_{\overline{j}}\right) \left(A\_{\overline{j}}^{\top} - A\_{\overline{j+1}}^{\top}\right) + B\_{\overline{j}} Q\_{0} B\_{\overline{j}}^{\top} - B\_{\overline{j+1}} Q\_{0} B\_{\overline{j+1}}^{\top}. \end{aligned}$$

*The second-order origin moment matrix mx*(*t*) *satisfies the following matrix differential equation:*

$$\begin{aligned} \dot{m}\_{\boldsymbol{x}}(t) &= \begin{cases} A\_{i}m\_{\boldsymbol{x}}(t) + m\_{\boldsymbol{x}}(t)A\_{i}^{\top} + B\_{i}Q\_{0}B\_{i}^{\top} & t \in \left(T\_{i-1}, T\_{i}\right], i = 1, \dots, N\_{\boldsymbol{x}}, \\ A\_{N+1}m\_{\boldsymbol{x}}(t) + m\_{\boldsymbol{x}}(t)A\_{N+1}^{\top} + B\_{N+1}Q\_{0}B\_{N+1}^{\top} & t \in \left(T\_{N}, t\_{f}\right) \end{cases} \\ m\_{\boldsymbol{x}}(t\_{0}) &= P\_{0} + m\_{0}m\_{0}^{\top}. \end{aligned}$$

*The cost function has the fault tolerant performance for the switching time fault.*

#### *3.3. Optimal Fault Tolerant Algorithm*

After taking into account the gradient of the cost functional in the above theorems, the next problem is to calculate the optimal switching time. In this subsection, the steepest descent algorithm with Armijo step sizes is explained in Figure 2. By denoting the initial parameters *<sup>α</sup>* <sup>∈</sup> (0, 1), *<sup>β</sup>* <sup>∈</sup> (0, 1) and *<sup>λ</sup>*(*k*) :<sup>=</sup> *<sup>β</sup>i*(*k*), the step size can be designed as *i*(*k*) = min3 *i* ≥ 0 : *J <sup>τ</sup>*(*k*) − *<sup>β</sup><sup>i</sup> D J*(*τ*(*k*)) − *<sup>J</sup>*(*τ*(*k*)) ≤ −*αβ<sup>i</sup> D J*(*τ*(*k*)) <sup>2</sup> 4 .

**Figure 2.** The steepest descent algorithm flow chart.

#### **4. Simulation**

In this section, the four wheel drive autonomous mobile robot system and numerical example are proposed to prove the feasibility of the designed optimization fault tolerant algorithm. The dynamic model of the four wheel drive mobile robot system represented in reference [35] is subject to actuator faults. It is shown that even with external stochastic disturbance and unknown switch draft fault in the actuator switched mechanism, the proposed optimization fault tolerant algorithm can explain the safety switch control of the different trajectory tasks for the autonomous mobile robot.

#### *4.1. Practical Example*

In consideration of the external stochastic disturbance, we select the lateral velocity and yaw angle of the center of gravity as the state variables. The kinematic model of the simplified four wheel drive mobile robot as shown in [35] is

$$a\_x = \frac{dV\_x}{dt} - V\_y \frac{d\theta}{dt} = \dot{V}\_x - V\_y \Omega\_{z\_\prime}$$

$$a\_y = \frac{dV\_y}{dt} + V\_x \frac{d\theta}{dt} = \dot{V}\_y + V\_x \Omega\_{z\_\prime} \tag{44}$$

where *ax* is the longitudinal acceleration, *ay* is the lateral acceleration, *Vx* and *Vy* are the forward velocity and lateral velocity of vehicle mass center, respectively, Ω*<sup>z</sup>* is the yaw motion around the *Z* axis. The mobile robot vehicle dynamics equation is as follows:

$$\begin{aligned} Ma\_x &= M(\dot{V}\_x - V\_y \Omega\_z) = F\_{xf} \cos \delta\_f + F\_{xr} - F\_{yf} \sin \delta\_f, \\ Ma\_y &= M(\dot{V}\_y + V\_x \Omega\_z) = F\_{yf} \cos \delta\_f + F\_{yr} + F\_{xf} \sin \delta\_f, \\ I\_z \Omega\_z &= l\_1 F\_{yf} \cos \delta\_f - l\_2 F\_{yr} + l\_1 F\_{xf} \sin \delta\_f, \end{aligned} \tag{45}$$

where *δ<sup>f</sup>* is the front wheel angle, *Fx f* and *Fy f* are the longitudinal and lateral forces of the front wheel, respectively. *Fxr* and *Fyr* are the longitudinal and lateral forces of the rear wheel, respectively. *l*<sup>1</sup> is the distance from the center of mass to the front axis, and *l*<sup>2</sup> is the distance from the center of mass to the rear axis. In consideration of the lateral characteristics of the tire, we have

$$\begin{aligned} F\_{yf} &= \mathbb{C}\_f \mathfrak{a}\_{f\prime} \\ F\_{yr} &= \mathbb{C}\_r \mathfrak{a}\_{r\prime} \end{aligned} \tag{46}$$

where

$$
\alpha\_f = \delta\_f - \frac{l\_1 \Omega\_z + V\_y}{V\_x}, \quad \alpha\_r = \frac{l\_2 \Omega\_z - V\_y}{V\_x}.
$$

By substituting the kinematic model and the tire characteristics into the vehicle dynamics equation, we can obtain

$$\dot{V}\_{y} = -\frac{1}{M} \frac{\left(\mathbb{C}\_{f} + \mathbb{C}\_{r}\right)}{V\_{x}} V\_{y} - \left(V\_{x} + \frac{l\_{1}\mathbb{C}\_{f} - l\_{2}\mathbb{C}\_{r}}{M V\_{x}}\right) \Omega\_{z} + \frac{\mathbb{C}\_{f}}{M} \delta\_{f}.$$

$$\Omega\_{z} = -\frac{l\_{1}\mathbb{C}\_{f} - l\_{2}\mathbb{C}\_{r}}{l\_{z}V\_{x}} V\_{y} - \frac{l\_{1}^{2}\mathbb{C}\_{f} + l\_{2}^{2}\mathbb{C}\_{r}}{l\_{z}V\_{x}} \Omega\_{z} + \frac{l\_{1}\mathbb{C}\_{f}}{l\_{z}} \delta\_{f}.\tag{47}$$

The forward velocity of the mobile robot along the *X* axis is considered constant. Then, the car has only two degrees of freedom. In order to simplify the expressions, we introduce the change in coordinates:

$$\begin{aligned} a\_{11} &= -\frac{1}{M} \frac{\left(\mathbf{C}\_{f} + \mathbf{C}\_{r}\right)}{V\_{\mathbf{x}}}, \quad a\_{12} = -\left(V\_{\mathbf{x}} + \frac{l\_{1}\mathbf{C}\_{f} - l\_{2}\mathbf{C}\_{r}}{MV\_{\mathbf{x}}}\right), \quad b\_{1} = \frac{\mathbf{C}\_{f}}{M}, \\\ a\_{21} &= -\frac{l\_{1}\mathbf{C}\_{f} - l\_{2}\mathbf{C}\_{r}}{I\_{z}V\_{\mathbf{x}}}, \quad a\_{22} = -\frac{l\_{1}^{2}\mathbf{C}\_{f} + l\_{2}^{2}\mathbf{C}\_{r}}{I\_{z}V\_{\mathbf{x}}}, \quad b\_{2} = \frac{l\_{1}\mathbf{C}\_{f}}{I\_{z}}, \\\ x\_{1} &= V\_{\mathbf{y}}, \quad x\_{2} = \Omega\_{\mathbf{z}}. \end{aligned} \tag{48}$$

By employing the external stochastic disturbance on the front wheel angle *δ<sup>f</sup>* , we select the coupling friction coefficients *b*<sup>1</sup> = 0, *b*<sup>2</sup> = 1 and *b*<sup>1</sup> = 1, *b*<sup>2</sup> = 0 to represent the the switched stochastic systems term *Biω*. The forward velocity of the mobile robot along the *X* axis is considered constant. Thus, the four wheel drive mobile robot system has only two state variables, *x*<sup>1</sup> = *Vy*, *x*<sup>2</sup> = Ω*z*. In complex road conditions, the friction coefficient of tires is different. In addition, we can note that the different trajectory tasks require a different forward velocity *Vx*. Therefore, by different trajectory tasks, under the complex road conditions and external stochastic disturbance, the following switched stochastic systems equation is obtained for a four wheel drive mobile robot with safe trajectory planning:

$$\dot{\mathbf{x}}(t) = \begin{cases} A\_1 \mathbf{x}(t) + B\_1 \omega, & t \in [t\_0, T\_1], \\ A\_2 \mathbf{x}(t) + B\_2 \omega, & t \in (T\_1, t\_f], \end{cases} \tag{49}$$

where the system matrices are

$$A\_1 = \begin{bmatrix} -1 & 0 \\ 1 & 2 \end{bmatrix}, B\_1 = \begin{bmatrix} 0 \\ 1 \end{bmatrix}, A\_2 = \begin{bmatrix} 1 & 1 \\ 0 & -2 \end{bmatrix}, B\_2 = \begin{bmatrix} 1 \\ 0 \end{bmatrix}.$$

As presented in the four wheel drive mobile robot example, the robot safe trajectory planning problems can be translated into the studied switched stochastic systems. Then, the proposed optimal timing fault tolerant control strategy can solve the safe trajectory planning problem effectively.

In order to illustrate the effectiveness of the proposed algorithm with multi-switching times, the system is repeatedly switched. The system is described by three switching points, as follows:

$$\dot{\mathbf{x}}(t) = \begin{cases} A\_1 \mathbf{x}(t) + B\_1 \omega, & t \in [t\_0, T\_1], \\ A\_2 \mathbf{x}(t) + B\_2 \omega, & t \in (T\_1, T\_2], \\ A\_1 \mathbf{x}(t) + B\_1 \omega, & t \in (T\_2, T\_3], \\ A\_2 \mathbf{x}(t) + B\_2 \omega, & t \in (T\_3, t\_f], \end{cases} \tag{50}$$

where the initial state *x*(0)=[1, 0] *<sup>T</sup>*, the initial time *t*<sup>0</sup> = 0, the final time *tf* = 1, the initial switching time *T*<sup>1</sup> = 0.3, *T*<sup>2</sup> = 0.5, *T*<sup>3</sup> = 0.7. By the switch control mechanism, the four wheel drive mobile robot system executes the desired different trajectory tasks. We need to calculate the optimal switching time *T*1, *T*2, *T*<sup>3</sup> to minimize the cost functional *J*. The weight coefficient matrices are designed as the unit matrix. The steepest descent parameters are *α* = *β* = 0.5, the threshold value = 0.05, *kmax* = 200. The experiments are implemented with Matlab2015a on a desktop PC with i7-6700 3.4 GHz CPU, 16 GB memory and Windows 1064 bit OS. The simulation results are described in Figures 3 and 4.

**Figure 3.** The designed step size *λ*(*k*), the cost functional *J*(*τ*(*k*)) and gradient *dJ*(*τ*(*k*)) with *k* iterations.

The optimal switching time is *T* = [0.2609, 0.4677, 0.7749] after ten iterations. Based on the proposed algorithm, we obtain the corresponding optimal cost *J* = 2.8185. From Figure 3, it is easy to see that the cost *J* quickly converges to a minimum value and the gradient function *d J*(*τ*(*k*)) reaches the termination value. In addition, the system state trajectories with respect to the switching time signal *τ*(*k*) are illustrated in Figure 4.

**Figure 4.** The trajectories of states *x*1(*t*) and *x*2(*t*).

The blue dotted lines explain the state trajectories with the iterate progress switching time vector *τ*(*k*). As a comparison, the red solid line explains the optimal trajectories with respect to the optimal switching time signal.

#### *4.2. Numerical Example*

Consider the following switched nonlinear systems:

$$\dot{x}(t) = \begin{cases} A\_1 x(t) + B\_1 \omega, & t \in [t\_0, T\_1], \\ A\_2 x(t) + B\_2 \omega, & t \in (T\_1, T\_2], \\ A\_3 x(t) + B\_3 \omega, & t \in (T\_2, T\_3], \\ A\_4 x(t) + B\_4 \omega, & t \in (T\_3, t\_f], \end{cases} \tag{51}$$

where the system matrices are

$$A\_1 = \begin{bmatrix} -1 & 1\\ 0 & 2 \end{bmatrix}, A\_2 = \begin{bmatrix} 1 & 0\\ 1 & -2 \end{bmatrix}, A\_3 = \begin{bmatrix} -1 & 0\\ 1 & 2 \end{bmatrix}, A\_4 = \begin{bmatrix} 1 & 1\\ 0 & -2 \end{bmatrix}.$$

$$B\_1 = B\_3 = \begin{bmatrix} 0\\ 1 \end{bmatrix}, B\_2 = B\_4 = \begin{bmatrix} 1\\ 0 \end{bmatrix}.$$

We select the initial state *x*(0)=[1, −1] *<sup>T</sup>*, the initial time *t*<sup>0</sup> = 0, the final time *tf* = 0.9, the initial switching time *T*<sup>1</sup> = 0.3, *T*<sup>2</sup> = 0.5, *T*<sup>3</sup> = 0.7. The weight coefficient matrices are designed as *Q*<sup>1</sup> = *I*, *Q*<sup>2</sup> = 2*I*, *Q*<sup>3</sup> = 3*I*, *Q*<sup>4</sup> = 4*I*, *P* = *I*, where *I* denotes the unit matrix. The cost function *J*(*τ*(*k*)) and the gradient function *d J*(*τ*(*k*)) with *k* iterations and the trajectories of the states *x*1(*t*) and *x*2(*t*) are shown in Figures 5 and 6 when employing the proposed optimal timing fault tolerant control strategy.

7KHV\VWHP[

**Figure 6.** The trajectories of states *x*1(*t*) and *x*2(*t*).

It is worth noting that the switched subsystems are different in the numerical example which can describe the more general systems.

#### **5. Conclusions**

In this paper, an novel optimal timing fault tolerant control algorithm is proposed for switched stochastic systems with an unknown drift fault for each switching point. The designed optimal timing fault tolerant controller can not only realize the optimal performance, but also accommodate switching drift fault. Moreover, in this process, the cost functional has the general form with the integral terms and the terminal terms with the switched stochastic systems state variable. The variational technique is exploited to deduce the gradient formula. The steepest descent algorithm with Armijo step sizes is utilized to calculate the optimal switching time. The safety trajectory switching of a four wheel drive vehicle is taken as a practical application case to illustrate the effectiveness of the proposed method. Owing to the special structure of the gradient formula, how to extend the suggested methods to large-scale systems, multi-agent systems and practical systems are is a problem worthy of research.

**Author Contributions:** Conceptualization, C.Z.; methodology, C.Z., L.H. and K.Z.; software, C.Z. and L.H.; supervision, K.Z., W.S. and Z.H.; validation, C.Z., L.H. and Z.H.; writing, original draft, C.Z. and K.Z. All authors have read and agreed to the published version of the manuscript.

**Funding:** This work was funded by the Natural Science Foundation of China (No. 61973083, No. 61973077 and No. 61773118), and by the Fundamental Research Funds for the Central Universities: 2242022k30038.

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

**Informed Consent Statement:** Not applicable.

**Data Availability Statement:** Not applicable.

**Conflicts of Interest:** The authors declare no conflict of interest.

#### **References**

