# Performance Improvement of an NMP Mini Segway Using Sample and Hold Inputs
## 7 Conclusions  
A mini-Segway (MS) platform was developed for implementing sample and hold input (SHI), converting a non-minimum phase (NMP) continuous-time system into a minimum-phase (MP) discrete-time system, to study the feasibility of using a low-cost microcontroller (Arduino). The inner-loop controller is a continuous-time linear quadratic regulator (LQR) implemented at a 100 Hz sample rate, and the outer-loop discrete-time LQR uses the square pulse sample and hold input (SPSHI) with a 5 Hz sampling rate. The SPSHI is used to convert the stabilized NMP system using the inner-loop LQR to a discrete-time MP system, meaning that the outer-loop high-gain LQR can further improve the performance. It is shown that both inner and outer-loop controllers affect the overall MS system performance. In order to optimize the dual-loop control scheme, a set of feasible inner-loop continuous-time LQRs (linear quadratic regulators) with guaranteed stability was obtained by varying the control weighting, and the best dual-loop controller was found by tuning the discrete outer-loop LQR controller to minimize the cart displacement magnitude. The exhaustive search found that selecting proper inner and outer-loop LQR control weightings is the key to optimizing overall MS system performance. Experiments were conducted to validate the analytical results for the controller tuning processes. With the dual-loop control scheme, the average cart displacement magnitude is reduced by more than 65% using the SPSHI. Note that even though the inner-loop LQR was optimized for the best performance prior to implementing the outer-loop controller, a significant performance improvement can still be achieved by using the outer-loop control with SHI. The main contribution of this paper is to demonstrate that the proposed sample and hold input scheme is capable of significantly improving system performance without utilizing expensive control hardware. Note that the main disadvantage of utilizing SPSHI is that it increases the required actuator size due to a magnified pulsive control signal. It is important to balance the SPSHI duty-cycle and resulting MP system property. There are many existing control approaches dealing with NMP systems using advanced control algorithms, which require relatively expensive control hardware; however, the proposed SHI scheme can be applied to NMP systems without expensive hardware. Future work in this area will be to compare its system performance improvement with other control schemes.  
\begin{table}
\begin{tabular}{c c c c c c c} \hline  & \multicolumn{6}{c}{**G\({}_{Rd}\) Value**} \\ \cline{2-7}  & **N/A** & **0.3** & **0.5** & **0.7** & **0.9** & **1.1** \\ \hline \(|x_{cart}|_{avg}\) & 12.17 & 3.85 & 5.39 & 6.29 & 6.84 & 7.36 \\ \(|\theta_{p}|_{avg}\) & 0.95 & 0.98 & 1.00 & 0.99 & 1.08 & 1.11 \\ (mm) & 0.69 & 0.47 & 0.52 & 0.55 & 0.56 & 0.57 \\ (V) & 0 & 0.047 & 0.04 & 0.03 & 0.027 & 0.023 \\ \hline \end{tabular}
\end{table}
Table 4: The mean absolute values of outer-loop LQR\({}_{d}\) tuning data.  
**Author Contributions:** Conceptualization, G.Z. and Y.W.; methodology, G.Z. and Y.W.; software, Y.W.; validation, Y.W.; formal analysis, Y.W.; investigation, G.Z. and Y.W.; resources, G.Z.; data curation, Y.W.; writing--original draft preparation, Y.W.; writing--review and editing, G.Z.; visualization, Y.W.; supervision, G.Z.; project administration, G.Z. All authors have read and agreed to the published version of the manuscript.  
This research received no external funding.  
**Data Availability Statement:** Not applicable.  
**Conflicts of Interest:** The authors declare no conflict of interest.