8.4: Model-Based Mini-Segway Control with Special Sample and Hold Input

Mechatronics: Fundamentals, Design, Integration, and Validation · LibreTexts

0%

Contents

    Text

    Size
    100%
    Theme
    Typeface
    Line length
    Spacing

    From LibreTexts, under CC BY-NC 4.0, as the source states it; its equations are written in TeX, which the PDF shows typeset. This page at LibreTexts.

    8.4: Model-Based Mini-Segway Control with Special Sample and Hold Input
    Learning Objectives

    After completing this section, you will be able to:

    1. Explain the concepts of minimal phase (MP) and non-minimal phase (NMP) dynamic systems.
    2. Convert a continuous-time NMP system to a discrete-time MP system with the square-pulse sample and hold input (SPSHI).
    3. Describe the dual-loop control architecture for mini-Segway pendulum stabilization using square-pulse sample and hold input.

    This section discusses the control design for non-minimum-phase (NMP) systems and minimal-phase (MP) systems. An NMP system transfer function has at least one zero located in the open-right complex plane. An MP system has all its zeros in the open-left complex plane (inside the unit circle for discrete-time systems). Root Locus analysis [3] indicates that the closed-loop system poles move towards the open-loop zeros as the system proportional gain increases. This change results in unstable closed-loop dynamics at high control gain, preventing our using a high-gain controller to achieve the desired closed-loop performance. In addition, asymptotic tracking is difficult to achieve when the plant system is NMP; control methods can achieve only approximate output tracking for NMP systems [19]–[22].

    In general, NMP systems are difficult to control, but discretization with zero-order-hold (ZOH) may alleviate the problem. References [23]–[29] show that an NMP continuous-time system can be mapped into an MP discrete-time system. This happens, for example, when a ZOH input is used with a sufficiently large sampling period [24]. Unfortunately, a precise mathematical formula for calculating the smallest feasible sampling period has not been found. For an NMP continuous-time system, a feasible sampling period is defined as one that results in an MP discrete-time system. Based on reference [24], the range of feasible sampling periods is determined by using a symbolic approach in [25] and genetic algorithms in [26]. These methods for finding feasible sampling periods with a ZOH input when the continuous-time system is minimum-phase (MP) can be found in [27]-[29]. For stable NMP systems, the Nyquist algorithm is used in [27]. These results were extended in [28] to unstable systems with no poles or zeros on the imaginary axis.

    A MATLAB plot showing an analog signal and its sampled signals using zero-order and square-wave sample and hold methods.
    Figure 8.14: The square-pulse sample and hold input.

    The mini-Segway system is NMP with at least one zero located in the open right-half complex plan, limiting the achievable performance. In reference [12], the special sample and hold input (SHI) functions, square-pulse, and forward and backward triangle SHIs, indicate that by selecting the proper sampling period and duty cycle, the resulting discrete-time system can be minimum phase (MP). This is so even though the original continuous-time system is not MP with extended feasible region compared with the zero-order SHI. This section studies the case utilizing the square-pulse sample and hold input to result in an MP discrete-time system. Figure 8.14 compares the square-pulse sample and hold input to the conventional zero-order sample and hold input. The top plot shows an analog signal \(u(t)\) (solid-line) sampled by the zero-order sample and hold input with a sample period of \(T_s\) (dotted-line). The middle plot shows the sampled (digital) signal \(u_z(t)\) by the zero-order sample and hold input. The bottom plot shows an analog signal \(\overline{u}(t)\) (solid-line) sampled by the square-pulse sample and hold input with the same sample period of \(T_s\) (solid-line). In order to ensure the sampled signal has magnitude comparable with the zero-order hold, we set the magnitude of \(\overline{u}(t)\) in such a way that the integrations of zero-order and square-pulse sample and hold inputs over one sample period \(T_s\) are the same with the following mathematical expression.

    \[\overline{u}(t)=\left\{ \begin{array}{cc} u_z\left(t\right), & t_k<t\le t_k+pT_s \ \\ 0, & t_k+pT_s<t\le t_k+T_s \end{array} \right. \label{8.65}\]

    where \(p\in (0,\ 1]\) is the duty-cycle of the switched input by the square-pulse sample and hold input. See the bottom plot of Figure 8.14 for a graphic definition; and \(u_z\left(t\right)\) is defined below.

    \[u_z\left(t\right)=u\left(t_k\right)/p, if\ t_k<t\le t_k+T_s\ for\ k=0,\ 1,\ 2,\ \ldots \label{8.66}\]

    where \(u(t_k)\) is sampled magnitude of continuous-time signal \(u(t)\) at time \(t_k\) by the zero-order sample and hold input. When \(p=1\), the square-pulse sample and hold input becomes the zero-order one. As a result, the zero-order sample and hold input is a special case of the square-pulse one. Before introducing the derivation of the discretized system of equation \ref{8.47} with \(D_p=0\), let’s introduce the concept of discrete-equivalent (DE) system for the linear system defined below.

    \[\begin{aligned} \dot{x}_p & = A_px_p+B_p \overline{u}, x_p\left(t_0\right) =x_0 \\[4pt] y & = C_px_p \end{aligned} \label{8.67}\]

    Definition 8.1 [12]

    The time-invariant linear system below, with zero-order sample and hold input,

    \[\begin{aligned} \dot{\overline{x}}_p & =  {\overline{A}}_p{\overline{x}}_p+{\overline{B}}_pu_z, \ \overline{x}_p\left(t_0\right)=x_0 \\[4pt] \overline{y} & =  {\overline{C}}_p{\overline{x}}_p  \end{aligned} \label{8.68}\]

    is a discrete-equivalent (DE) system of \ref{8.67} if the state variables of \ref{8.67} and \ref{8.68} match at the sampling times \(t_k\) for \(k=0,\ 1,\ 2,\ \cdots\).

    The state variables in system \ref{8.67} at time \(t_{k+1}=t_k+T_s\) can be derived in two steps. First, we derive the state time response from time \(t_k\) to \(t_k+pT_s\) as below.

    \[\begin{aligned} x_p\left(t_k+pT_p\right) & = e^{A_pT_sp}x_p\left(t_k\right)+\int^{pT_s}_0{e^{A_p\left({pT}_s-τ\right)}B_p\overline{u}}\left(t_k+τ\right)dτ \\[4pt] & = e^{A_pT_sp}x_p \left(t_k\right) + A^{-1}_p \left(e^{A_pT_sp}-I\right) \left(B_p/p\right)u\left(t_k\right) \end{aligned} \label{8.69}\]

    and then from time \(t_k\) to \(t_{k+1}\) as below, based on equation \ref{8.69}.

    \[\begin{aligned} x_p\left(t_{k+1}\right) & = e^{A_pT_s(1-p)}x_p\left(t_k+pT_p\right) \\[4pt] & = e^{A_pT_s}x_p\left(t_k\right)+A^{-1}_pe^{A_pT_s}\left(I-e^{-A_pT_sp}\right)\left(B_p/p\right)u\left(t_k\right) \end{aligned} \label{8.70}\]

    The state variables in system \ref{8.68} from time \(t_k\) to \(t_{k+1}\) can be derived as below.

    \[\begin{array}{ccc} {\overline{x}}_p\left(t_{k+1}\right) & = & e^{\overline{A}_pT_s}{\overline{x}}_p\left(t_k\right)+\int^{T_s}_0{e^{\overline{A}_p\left(T_s-τ\right)}{\overline{B}}_pu_z}\left(t_k+τ\right)dτ \\[4pt] & = & e^{\overline{A}_pT_s}{\overline{x}}_p\left(t_k\right) + {\overline{A}}^{-1}_p\left(e^{\overline{A}_pT_s}-I\right)\left({\overline{B}}_p/p\right)u\left(t_k\right) \end{array} \label{8.71}\]

    Comparing system models \ref{8.70} and \ref{8.71}, it is clear that system models \ref{8.67} and \ref{8.68} will be discrete-equivalent (DE) if the following conditions are met,

    \[{\overline{A}}_p=A_p,\ { \overline{B}}_p={\left(e^{A_pT_s}-I\right)}^{-1}e^{A_pT_s}\left({I-e}^{{-A}_ppT_s}\right)B_p \label{8.72}\]

    Now, we are ready to consider the following standard discrete-time (DT) system with the same initial conditions as the DE system in \ref{8.68}.

    \[\begin{aligned} x_p(t_{k+1}) & = A_{pd}x_p(t_k)+B_{pd}u(t_k), x_p\left(t_0\right)=x_0 \\[4pt] y(t_k) & = C_{pd}x_p\left(t_k\right) \end{aligned} \label{8.73}\]

    The DT system \ref{8.69} will have the same state and output variables as the DE system \ref{8.68} with square-pulse sample and hold input, described by \ref{8.68} and \ref{8.72}, at sampling time \(t_k\ (k=0,\ 1,\ 2,\ \cdots )\), if \(A_{pd}=e^{A_pT_s}\) and \(C_{pd}=C_p\) with the following condition satisfied.

    \[B_{pd}=A^{-1}_pe^{A_pT_s}\left(I-e^{{-A}_ppT_s}\right)B_p/p \label{8.74}\]

    The continuous-time system in \ref{8.68} with the SPSHI, its DE system \ref{8.72}, and the corresponding DT system \ref{8.73} have the same state and output variables at the sampling time \(t_k\ (k=0,\ 1,\ 2,\ \cdots )\).

    Remark 8.1

    The discrete-time (DT) system matrices \(A_{pd}\) and \(C_{pd}\) are the same for the zero-order and square-pulse sample and hold inputs. However, input matrix \(B_{pd}\) in equation \ref{8.74} is different from the zero-order one. Because the system zeros are affected by \(A_{pd}\), \(B_{pd}\), and \(C_{pd}\), with \(p\in (0,\ 1)\), the DT system \ref{8.73} could have different zeros comparing with the system with \(p=1\).

    Remark 8.2

    Equation \ref{8.74} indicates that in order to make the square-pulse sample and hold input work for \(p\in (0,\ 1)\), the continuous-time system matrix \(A_p\) cannot have any zero eigenvalue because the inverse of \(A_p\) is required in equation \ref{8.74}. If there is at least one eigenvalue at the origin of the complex plan, a stabilizing controller is needed before SPSHI can be applied. However, the solution for term \(A^{-1}_pe^{A_pT_s}\left(I-e^{{-A}_ppT_s}\right)\) exists even when \(A_p\) is not invertible because term \(\left(I-e^{{-A}_ppT_s}\right)\) has a factor of \(A_p\), which can be used to cancel the term \(A^{-1}_p\). In this case, calculating term \(A^{-1}_pe^{A_pT_s}\left(I-e^{{-A}_ppT_s}\right)\) requires Taylor series expansion of \(e^{{-A}_ppT_s}\) and summation of expanded series as below.

    \[A^{-1}_pe^{A_pT_s}\left(I-e^{{-A}_ppT_s}\right) = pT_se^{A_pT_s} \left( \dfrac{I{-A}_ppT_s}{2!} + \dfrac{\left(A_ppT_s\right)^2}{3!} -\dfrac{\left(A_ppT_s\right)^3}{4!} + \cdots \right) \label{8.75}\]

    Because there is no closed form solution of the series in equation \ref{8.75}, the existence of \(A^{-1}_p\) is required for simplified calculation.

    Note that this study uses the mini-Segway model described by equations \ref{8.47} in Section 8.3 with full state (six states), control, and output vectors defined below.

    \[x_p={\left[x_{cart},{\dot{x}}_{cart},θ_p,\ {\dot{θ}}_p,\phi ,\dot{\phi }\right]}^T, u_p={\left[u_{aL},\ u_{aR}\right]}^T, y={\left[θ_p,{\dot{θ}}_p\ \right]}^T \label{8.76}\]

    The associated system matrix values for system \ref{8.47} are provided below. For the rest of this section, these matrix values in equation \ref{8.77} are used for control design.

    \[ \begin{aligned} A_p &=\left[ \begin{array}{cc} \begin{array}{ccc} 0 & \ 1 & 0 \\ 0 & -6.8776 & -1.6517 \\ 0 & \ 0 & 0 \end{array} & \begin{array}{ccc} 0 & 0\ & \ 0 \\ 0 & 0 & 0 \\ 1 & 0 & 0 \end{array} \\ \begin{array}{ccc} 0 & 156.85 & \ 107.36 \\ 0 & 0 & \ 0 \\ 0 & 0 & \ 0 \end{array} & \begin{array}{ccc} 0 & 0 & 0 \\ 0 & 0 & 1 \\ 0 & 0 & -26.450 \end{array} \end{array} \right], \\[4pt] B_p &=\left[ \begin{array}{c} \begin{array}{cc} \ 0 & 0 \\ 2.4425 & 2.4425 \\ 0 \ & 0\ \end{array} \\ \begin{array}{cc} -55.7028 & -55.7028 \\ 0 & \ 0 \\ 19.3887 & -19.3887 \end{array} \end{array} \right] \\[4pt] C_p &=\left[ \begin{array}{cc} \begin{array}{ccc} 0 & 0 & 1 \\ 0 & 0 & 0 \end{array} & \begin{array}{ccc} 0 & 0 & 0 \\ 1 & 0 & 0 \end{array} \end{array} \right], \\[4pt] D_p&=\left[ \begin{array}{cc} 0 & 0 \\ 0 & 0 \end{array} \right] \end{aligned} \label{8.77}\]

    The full-state system defined by the matrices in equation \ref{8.77} has two poles located at the origin of the complex plan, making the system matrix \(A_p\) not invertible. As discussed in Remark 8.2, the square-pulse sample and hold and input technique cannot be applied directly to convert the continuous-time NMP system into a discrete-time MP system. Therefore, a continuous-time stabilizing LQR controller \(K_p\) (see Section 8.3) is designed with \(Q_p=diag\left[100,0.1,300,0.1,10,0.01\right]\) and \(R_p=diag[1,\ 1]\) to minimize the following cost function.

    \[J_p=\dfrac{1}{2}\int^{\infty }_0{\left(x^T_p\left(t\right)Q_px_p\left(t\right)+u^T_p(t)R_pu_p(t)\right)dt} \label{8.78}\]

    The designed controller \(K_p\) stabilizes the mini-Segway system by moving all the closed-loop poles to the open left-half complex plan. The closed-loop system matrix \(A_p+B_pK_p\) is then invertible with the following \(K_p\).

    \[K_p=\left[ \begin{array}{cc} \begin{array}{ccc} -7.07 & -9.49 & -14.64 \\ -7.07 & -9.49 & -14.64 \end{array} & \begin{array}{ccc} -0.91 & 2.24 & 0.08 \\ -0.91 & -2.24 & -0.08 \end{array} \end{array} \right] \label{8.79}\]

    Figure 8.15 shows the proposed dual-loop architecture for the SPSHI application. The inner-loop LQR controller stabilizes the mini-Segway system so that the SPSHI technique can be applied. The outer-loop utilizes the SPSHI for discrete-time control output with a standard ZOSHI to sample the sensor signals. During the implementation period, the continuous-time controller \(K_p\) will be implemented as a discrete-time controller with ZOSHI at a sample rate much faster than the outer-loop SPSHI discrete-time controller.

    A control block diagram illustrating the system architecture of dual-loop SPSHI (square pulse sample and hold input) stabilization using a linearized mini-Segway model.
    Figure 8.15: Dual-loop SPSHI stabilization system architecture.

    Note that stabilized pole locations of the inner-loop closed-loop system are listed in the equation below.

    \[ \begin{aligned} s_{1,2} &=-0.9647\pm 0.9081j, \\[4pt] s_3 &=-3.2859 \\[4pt] s_4 &=-26.3879 \\[4pt] s_{5,6} &=-30.1103\pm 21.5604j \end{aligned} \label{8.80}\]

    For sample period \(T_s\in (0, 1]\) and SPSHI duty-cycle \(p\in (0,\ 1]\), we can calculate the zero locations of the \(K_{cp}\) stabilized mini-Segway system. The shaded area in Figure 8.16 shows the sample and hold input (SHI) feasible region. It is the common area formed by the sampling period \(T_s\) and duty-cycle \(p\), resulting in a mini-Segway DT system for the closed-loop system with the inner-loop controller. We calculate the feasible region by an exhaustive search of sample period \(T_s\) and SPSHI duty-cycle \(p\) that results in a discrete-time MP system with respect to these outputs related to the pendulum angle states (\(θ_p,{\dot{θ}}_p)\), where output matrix \(C_p\) is defined in equation \ref{8.77}.

    The black thick horizontal line on the top of Figure 8.16 represents the feasible sampling periods of ZOSHI, a special case of SPSHI with \(p=\mathrm{1}\) (100% duty-cycle). The feasible region corresponding to these sample period \(T_s\mathrm{=}δ\) and square pulse duty-cycle \(p\) results in an MP discrete-time system. From Figure 8.16, the smallest feasible sampling period of ZOSHI (represented by the black-thick horizon line) is about as large as \(0.61\) second. This sampling period can be reduced to \(0.1184\) second using SPSHI with an extremely small duty-cycle \(p\). For example, if we select a sampling period of \(0.2\) second (see the vertical dotted-line), we can choose a wide range of duty-cycles between almost zero and \(0.6\). A small sampling period is very important for improving closed-loop system performance of the mini-Segway using the outer-loop controller.

    A MATLAB plot showing the feasible sample period of ZOSHI and SPSHI as a function of duty cycle marked with a red-dot indicating the selected sample period of 0.2 second with a 20-percent duty-cycle.
    Figure 8.16: Feasible sample period of ZOSHI and SPSHI as a function of \(T_s=δ\) and \(p\).

    Equation \ref{8.80} shows the pole locations for the inner-loop closed-loop system, with two oscillation frequencies at \(1.74\) (cart position) and \(33.5\ rad/s\) (pendulum position). The stabilized system bandwidths with the inner-loop LQR controller are calculated in \(Hz\). They are \(0.277\) and \(5.33\ Hz\) for cart displacement and pendulum pitch angle, respectively. To ensure the outer-loop controller sample frequency is adequate to cover system dynamics for both modes, the required sampling frequency is at least two times faster than the system dynamics based upon the Nyquist-Shannon theory (see Section 4.5). However, at least eight times the highest frequency is required, that is, \(42.65\) Hz for the outer-loop discrete-time controller with SPSHI. From Figure 8.16, we can see that it is impossible to have the outer-loop discrete-time controller cover system dynamics for both modes. Consequently, for the same reason, only the mode associated with the cart displacement is considered in this case. It requires a controller with a lowest sample frequency of \(1.816\ Hz\) (eight times its oscillation frequency) with a sample period of \(0.55\) second; see Section 4.5 and reference [30].

    Therefore, a small sampling period within the feasible region shown in Figure 8.16 is preferred. With the SPSHI, the smallest feasible sample period is about \(0.12\) second. Due to the experimental validation result in reference [31], a small duty-cycle leads to improved performance over a larger one. This can also be interpreted as the fast action effect of the SPSHI. As the SPSHI duty-cycle reduces, its reaction speed reduces. As a result, the outer-loop sampling period is chosen to be \(T_s\mathrm{=0.2}\) second (marked with the dashed line in Figure 8.16) with associated duty-cycle of square-pulse sample and hold input \(p\mathrm{=0.2}\) (20% duty-cycle). The selected SPSHI parameters \(T_s\) and \(p\) are marked by the red dot in Figure 8.16.

    Because the open-loop mini-Segway system is NMP, high gain control could destabilize the system [3]. With the SPSHI parameters selected in the previous paragraph, we can convert the continuous-time NMP mini-Segway system model into a discrete-time MP system. With the applied continuous-time controller \(K_p\), the equivalent discrete-time (DT) system becomes the system below.

    \[\begin{aligned} x_{pd}(k+1) & = A_{pd}x_{pd}(k) + B_{pd}u_d(k) \\[4pt] x_{pd}\left(t_0\right) &=x_0 \\[4pt] y(t_k) & = C_{pd}x_{pd}\left(k\right) \end{aligned} \label{8.81}\]

    where \(A_{pd}=e^{(A_p-B_pK_p)T_s}\) and \(C_{pd}=C_p\) with the \(B_{pd}\) defined below.

    \[B_{pd}=(A_p-B_pK_p)^{-1}e^{(A_p-B_pK_p)T_s}\left(I-e^{-(A_p-B_pK_p)pT_s}\right)B_p/p \label{8.82}\]

    Assume we want to further improve the stabilization performance of the mini-Segway system by reducing cart speed magnitude. To achieve this, we design the outer-loop controller—a discrete-time LQR (referred as DLQR)—with the SPSHI (see the outer-loop controller in Figure 8.15) based upon the system model \ref{8.81}. This provides additional control effort for further performance improvement, where the DLQR cost function is defined below.

    \[J_d=\dfrac{1}{2}\sum^{\infty }_{k=0}{x^T_{pd}\left(k\right)Q_dx_{pd}\left(k\right)+u^T_d(k)R_du_d(k)} \label{8.83}\]

    with weighting matrices \(Q_d=Q_p\), which is defined in the paragraph before equation \ref{8.78}, and \(R_d=diag[0.9,\ 0.9]\). The selection of DLQR weighting matrices (\(Q_d\) and \(R_d\)) is critical for this study. We must guarantee an adequate control effort while maintaining both actuators within their saturated input voltage of \(\pm 12\ V\). Reference [13] optimizes the control weighting matrix \(R_d\) with fixed \(Q_d\), and \(R_d=diag[0.9,\ 0.9]\) is within the optimal range.

    Using the MATLAB command \(dlqr\) to design the discrete-time controller \(K_d\) results in the following control gain.

    \[K_d=\left[ \begin{array}{cc} \begin{array}{ccc} -4.6017 & -4.6526 & -0.8251 \\ -4.6017 & -4.6526 & -0.8251 \end{array} & \begin{array}{ccc} -0.2143 & 0.6263 & 0.0236 \\ -0.2143 & -0.6263 & -0.0236 \end{array} \end{array} \right] \label{8.84}\]

    From the discrete-time control gain shown in equation \ref{8.84}, we can see that the control gains associated with the mini-Segway cart displacement and speed (the first and second columns) are much larger than the gains for the pendulum angle and angular velocity (the third and fourth columns). Recall that the sample period selected for the discrete-time controller can compensate only the cart displacement dynamics because the pendulum one is at a much higher frequency. The last two columns of the control gain in equation \ref{8.84} are associated with the cart turning angle. For the pendulum stabilization, these two feedback signals will cancel each other with respect to the pendulum and cart dynamics.

    Section Summary

    This section introduces control design for discrete-time controllers with a sample and hold input different from a conventional zero-order sample and hold input. First, we discuss the square pulse sample and hold input. The mini-Segway system is non-minimal phase (NMP) with at least one zero located in the open right-half complex plane; this limits the achievable performance [12] by closed-loop control strategy. We found that by utilizing the special sample and hold input, we can transfer a non-minimal phase continuous-time plan into a minimal phase (MP) discrete-time one. This section demonstrates this phenomenon using our mini-Segway model [13] as an example. It then proceeds to design a dual-loop stabilizing controller.

    Section Keywords

    Practice Problems

    1. Select the correct answer from the following list to complete the sentence: The square-pulse sample and hold input
      1. can convert a continuous-time NMP system into a discrete-time MP system.
      2. cannot change the continuous-time NMP property for the discretized system.
      3. can convert a continuous-time MP system into a discrete-time NMP system.
    2. Drawing on equation \ref{8.74}, discuss why inverse of \(A_p\) is required. Note that \(A^{-1}_p\left(e^{A_pT_s}-I\right)\) can be calculated even when \(A_p\) is not invertible.
    3. Why is an inner-loop stabilizing regulator needed before applying the square-pulse sample and hold input technique? Select the correct answer.
      1. The mini-Segway system is stable.
      2. The mini-Segway system has at least one pole at the origin of the complex plan.
      3. The mini-Segway system is unstable.
    4. Why can’t the selected sample period (\(T_s=0.2\) second) for the outer-loop discrete-time controller compensate the pendulum dynamics? Select the correct answer.
      1. The mode frequency of the pendulum dynamics is much higher than the sample frequency.
      2. The mode frequency of the pendulum dynamics is much lower than the sample frequency.

    This page titled 8.4: Model-Based Mini-Segway Control with Special Sample and Hold Input was last modified on Mon, 24 Aug 2026 21:01:12 GMT and is shared under a CC BY-NC 4.0 license and was authored, remixed, and/or curated by Guoming Zhu (Co-DREAM OER) .