Decoupled Multi-Loop Robust Control for a Walk-Assistance Robot Employing a Two-Wheeled Inverted Pendulum

: This paper develops a decoupled multi-loop control for a two-wheeled inverted pendulum (TWIP) robot that can assist user’s with walking. The TWIP robot is equipped with two wheels driven by electrical motors. We derive the system’s transfer function and design a robust loop-shap-ing controller to balance the system. The simulation and experimental results show that the TWIP system can be balanced but might experience velocity drifts because its balancing point is affected by model variations and disturbances. Therefore, we propose a multi-loop control layout consisting of a velocity loop and a position loop for the TWIP robot. The velocity loop can adjust the balancing point in real-time and regulate the forward velocity, while the position loop can achieve position tracking. For walking assistance, we design a decoupled control structure that transfers the linear and rotational motions of the robot to the commands of two parallel motors. We implement the designed controllers for simulation and experiments and show that the TWIP system employing the proposed decoupled multi-loop control can provide satisfactory responses when assisting with walking.


Introduction
Robot research has drawn much attention and resulted in many applications in industry [1] and services [2]. Biped robots and two-wheeled inverted pendulum (TWIP) robots are frequently used as homecare robots [3] because they can feature humanoid behaviors. This paper extends the one-dimensional control design of a TWIP robot in [4] to a two-dimensional motion control to assist user's with walking, where the balance control and the steering control can be decoupled and independently designed.
Biped robots can perform complex movement patterns, such as jumping and climbing stairs, but they also have a number of drawbacks, including slow movements, high costs, complicated mechanisms, and sophisticated control designs [5][6][7]. A biped robot normally has at least two degrees of freedom (DOF) in each leg and requires advanced control. For instance, Medrano-Cerda and Akdas [8] built a model of a twelve-DOF biped robot and designed linear quadratic regulator controllers to stabilize the robot. Lu et al. [9] developed a twelve-DOF biped robot and applied the zero-moment point (ZMP) criterion for turning and walking. Kim et al. [10] applied force-resisting balance control to a twelve-DOF walking robot and used the ZMP stability region with genetic algorithms to attenuate disturbances. The design of the joint mechanism can improve the locomotion and performance of biped robots. For example, Aoustin and Hamon [11] controlled the locomotion of a biped robot using a knee joint design based on a four-bar linkage. Hosoda et al. [12] proposed an antagonistic muscle mechanism that regulated joint compliance to achieve three dynamic locomotion modes in a biped robot. Joe and Oh [13] developed a balance control for a humanoid robot that could walk on unknown and uneven terrain. Liu et al. [14] proposed a real-time balance control for a small-sized biped robot and applied a gyroscope and an accelerometer to detect the robot inclination and balance it when being pushed. Xi and Chen [15] applied inverse kinematics and reinforcement learning to balance a biped robot on an oscillating platform.
By contrast, TWIP robots can achieve fast responses with a simple configuration and low cost, so they are frequently considered for home applications [16]. Their parallelwheel structure allows for turning-on-the-spot. However, TWIP robots are naturally unstable and have highly nonlinear dynamics. Therefore, advanced control strategies are usually applied to TWIP robots to improve system performance. Three types of control are typically used for TWIP systems: balance, velocity, and position control. For balance control, Dai et al. [17] applied friction compensation and a Kalman filter to design a sliding mode controller for upright balance. Zhou and Wang [18] introduced a robust integral sliding mode controller for self-balancing and yaw motion of a TWIP. Unluturk and Aydogdu [19] developed a neural-network-based adaptable switching controller to balance a TWIP system on different surfaces. Kim and Kwon [20] discussed the influence of inertia and applied a state-dependent Riccati equation to balance the TWIP system. Jamin et al. [21] applied a fuzzy logic controller to a two-wheeled wheelchair with a movable payload, where the control parameters were optimized by the spiral dynamic algorithm. S'anchez et al. [22] developed a full-order observer without using the unavailable state variables. They applied the algorithm to an inverted pendulum system and achieved a steady-state error of less than 1°. For velocity control, Grasser et al. [23] developed decoupled statespace controllers to control a TWIP system at a speed of 1.5 m/s. Huang et al. [24] considered parameter uncertainties and external disturbances and proposed a sliding mode control to track velocity commands of up to 2 m/s. Bature et al. [25] proposed fuzzy logic control, neural-network inverse model control, and an adaptive neuro-fuzzy inference system for the speed tracking of a TWIP system. Oliveira et al. [26] proposed a bounded torque approach for a TWIP system and achieve a settling time of 5.5 s with a maximum speed of 5.5 m/s. For position control, Ha and Yuta [27] designed optimal controllers for a TWIP system and achieved the desired position with acceptable steady-state errors by modifying the velocity command. Chiu et al. [28] developed an adaptive output recurrent cerebellar model articulation controller that allowed a TWIP system to stand upright and track position commands. Herrera et al. [29] designed an LQR controller and optimized the parameters by genetic algorithms to improve the reference tracking performance of a TWIP system. Zhou et al. [30] applied sliding mode control and an extended Kalman filter to enable a TWIP robot to track a reference position or velocity trajectory on uneven ground. Jin and Ou [31] developed a learning method for a TWIP robot to guarantee pathfollowing and balance.
Many studies have focused on balance and tracking control of TWIP systems. However, the best way to adjust the balancing point is not clear, because the balancing point might be influenced by model variations and disturbances during operations. That is, the balancing point needs real-time adjustment to guarantee system stability. This paper addresses this issue and proposes a multi-loop control architecture that consists of the balance, velocity, and position loops. The balance loop can stabilize the TWIP system, while the velocity loop can adjust the balancing point in real-time and the position loop can achieve position tracking. Furthermore, this paper develops a decoupled control structure that allows the two parallel motors to independently control the linear and rotational motions of the TWIP system. The simulation and experimental results show that the TWIP system employing the proposed decoupled multi-loop control can provide satisfactory responses for walking assistance. The main contributions of this paper include: (1) developing a decoupled multi-loop control for a TWIP robot that can assist user walking; (2) presenting a multi-loop control layout that is composed of the balance, velocity, and position control loops; (3) proposing a decoupled control structure that can independently control the linear and rotational motions of the robot. This paper is organized as follows: Section 2 introduces the TWIP system and derives its dynamic model. Section 3 applies the model to design a robust loop-shaping controller. The simulation and experimental results show that the system can be balanced but might have drifting velocities because its balance point varies during motions. Therefore, in Section 4, we propose a multi-loop control structure that comprises the velocity and position loops. The velocity loop can adjust the balancing point in real-time to guarantee static balance, while the position loop can track the position commands. The designed control structure is then implemented for simulations and experiments. Section 5 develops a decoupled control layout consisting of two independent loops for simultaneous control of the linear and rotational motions by two parallel motors. Lastly, we draw conclusions in Section 6.

System Description and Modeling
The TWIP system shown in Figure 1a equips the two wheels driven by direct current (DC) motors [32] with absolute rotary encoders. We applied an inertial measurement unit (IMU) [33] to measure the body motions and implemented the controllers on an Arduino Due microcontroller with a sampling time of 0.025 s [34]. Each motor consumed an average power of about 9 watts, so we implemented two 22.2V/2600 mAh Li-Po batteries to sustain the system operation for about 6 h. The system architecture is shown in Figure 1b, while the system specifications are illustrated in Table 1. Note that some parameters in Table 1 were estimated by software packages. For example, the inertial moments Jψ and φ J were estimated by using Solidwork and SimMechanics. We drew the design in Solidwork then converted it to a SimMechanics model, which could calculate the theoretical inertial moments. The friction fbw was estimated from the steady-state responses. We assumed that the motor output torque was equivalent to the friction torque in the steadystate responses, so that we could calculate fbw by the input voltage and the angular velocity of the motor.  Gear ratio 15 fbw Friction between the motor and the body 0.45 Nms/rad The mathematical model of the TWIP system is derived in Appendix A. Considering the translational motion of the TWIP system, the block diagram of the model can be illustrated in Figure 2 represents the Laplace transform of ( ) f t . ψ is the pitch angle of the cart, θ is the wheels' rotational angle, θ m is the motor's rotational angle, and ψ T is the applied torque to the cart. Substituting the system parameters shown in Table 1, the system transfer function from the motor voltage to the pitch angle of the cart can be described as follows:

Robust Loop-Shaping Control Design for System Stability
This section applies robust loop-shaping control to stabilize the TWIP system. The model in Equation (3) represents a linear system, so we can regard system nonlinearities and variations during operation as model uncertainties and apply robust control to cope with these uncertainties. Suppose the transfer function S G of equation (3) can be represented by the following normalized left coprime factorization [35]: The gap between the nominal plant S G and the perturbed plant ∆ G is defined as [35]: The smallest value of The closed-loop system with a perturbed plant ∆ G and a controller K can be expressed as in Figure 3a. As system stability is independent of the input and output of the system, we can rearrange the system block diagram, as in Figure 3b. From the Small Gain Theorem [36], the closed-loop system is internally stable for all perturba- Hence, we can define the system's stability margin ( ) , S b G K as follows [36]: The system is internally stable for all uncertainties ∆ with The philosophy of robust control design can be illustrated as in Figure 3c for the design of a controller K for the nominal plant S G such that the stability margin ( ) . We consider the model of (3) with the following variations: (i) friction We divide each variation into ten equivalent sections and calculate the system perturbation between these 11 3 models and the nominal model S G . The maximum system perturbation found to be 0.180. Therefore, the designed robust controller should have a stability margin greater than 0.180 to guarantee system stability during operations. The principles of loop shaping [37] can be summarized as follows: (i) increasing system gains at the low-frequency ranges for disturbance rejection; (ii) decreasing system gains at the high-frequency range for attenuating noises; (iii) limiting the slope of the magnitude plots around crossover frequencies less steep than −40 dB/decade for stability considerations. Referring to the nominal plant of (3), we iteratively adjusted the weighting functions and verified the system performance by experiments. That is, we set the weighting functions and implemented the derived controllers for simulation and experiments. Then, we checked the system performance, such as the overshoot, steady state error, and settling time. The controller should be a compromise between these performance considerations. Finally, we selected the following weighting function: and applied the MATLAB command ncfsyn (ncfsyn designs an optimal controller that provides the maximum stability margin for the weighted plant) to design the robust controller, as follows: which gives a stability margin of 0.40 As the stability margin is greater than the system gap of 0.180, system stability can be guaranteed during operations. Note that any parameter variation can be considered in a similar way. The designed controller can cope with mixed parameter variations as long as the gap between the perturbed model ∆ G and the nominal plant S G is less than the stability margin, i.e., ( , ) 0.4018 We implemented the designed controller   Figure 4g showed that the control signal was saturated at the first 0.1 s because the TWIP robot needs to be balanced from We also implemented the designed control on the microcontroller for experiments. The experimental setting is shown in Figure 5a, where the TWIP was set to balance at two locations from an initial angle of . (0) 9 5 ψ − =°. Considering the balance control loop shown in Figure 4a with 0 ψ =°r ef , the experimental responses are illustrated in Figure 5.
At place 1, the pitch angle approached zero, but the velocity oscillated around zero when the system was balanced. The situation was more noticeable at place 2, where the velocity was drifting (see in Figure 5e) because the reference ref ψ differed from the system's balance point. Figure 5f showed that the control signal was saturated at the first 0.1 s because the TWIP robot needs to be balanced from . (0) 9 5 ψ − =° to 0°.
Both simulation and experimental results (see Figure 4 and Figure 5) suggest that the balancing point has changed because of model variations and disturbances. That is, the reference command ψ ref should be adjusted in real-time. Therefore, we propose a multiloop control structure in the next section to update the reference angle ψ ref in real-time.

The Multi-Loop Control Structure
This section proposes a multi-loop control structure to solve the velocity-drifting problem of the TWIP system. The multi-loop structure is composed of a velocity loop and a position loop. The velocity loop can regulate the forward velocity and adjust the reference angle in real-time, while the position loop control can achieve position tracking. We design the corresponding controllers and demonstrate the effectiveness of this control structure by simulation and experiments.

The Velocity Loop Control
We apply a velocity loop control structure to adjust the reference angle ψ ref , as shown in Figure 6a. If the TWIP system is statically balanced, the pitch angle should approach the balancing point and the linear velocity should converge to zero. The following calibration function v H is derived in Appendix A: The block diagram of Figure 6a can be simplified as in Figure 6b, where We applied the modified plant v G to design the velocity controller v C by robust loop-shaping techniques, where the weighting function was iteratively tuned and verified. Finally, we selected the following weighting function: 0.01 0.5 0.03 = + v W s (12) to derive the robust controller, as follows: As the weighted controller W K was eighth-order and might increase the difficulties of hardware implementation, we considered the following proportional-integral (PI) control: The values of p K and i K were tuned to provide similar responses to those of the standard robust controller. Finally, we selected the following PI controller: We implemented the designed controllers on MATLAB for simulation. We set  Figure 6. First, the PI control achieved similar responses to the standard robust controller, but with a much simpler form. Second, ψ ref was successfully adjusted to the balancing point (see Figure 6c), while the pitch angle ψ approached 1° (see Figure   6d). Third, the corresponding control signal is shown in Figure 6e, where the saturation function was activated before 0.2 s to balance the system from Fourth, the forward velocity converged to zero, as illustrated in Figure 6f, i.e., the system was statically balanced by the velocity loop. Lastly, Figure 6f showed that the displacements were oscillating, so that we needed to add a position loop to improve position tracking.  Figure 7. First, Figure 7a shows that the velocity loop adjusted the reference balance point in real-time, while Figure 7b shows how the pitch angle ψ tracked the reference angle ref ψ . Second, the motor control signal ψ V was frequently saturated at the first two seconds, as shown in Figure 7c, to balance the TWIP robot from the initial angel of . (0) 9 5 ψ − =°. Third, the velocity approached zero, as shown in Figure 7d (i.e., the system was statically balanced). However, Figure 7e shows that the TWIP was statically balanced at different positions, which cannot be specified. This problem can be solved by the position loop control.

The Position Loop Control
The position-loop control structure is shown in Figure 8a, where the velocity command  Figure   8a can be further simplified as Figure 8b, where the modified plant p G is: We also applied robust loop-shaping control to the position control, with the following weighting function: The robust controller was designed as follows: This provided system responses similar to the standard robust controller but with a much simpler form. We implemented the designed control on MATLAB for simulation. We set  Figure 8. First, the responses employing the proportional control and the robust control are similar, allowing us to simplify the control implementation using the proportional control for the experiments. Second, Figure 8c shows that the reference velocity was adjusted in real-time, and the system was statically balanced.
Third, the pitch angle ψ approached zero (see Figure 8d) with the corresponding control shown in Figure 8e. Finally, the linear velocity v approached zero (see Figure 8f) and the position p also converged to zero, as shown in Figure 8f, indicating that the TWIP can remain at specified places. Figure 8h shows the zoom-in position responses, which slightly oscillated before converging to zero. We also implemented the designed control on a microcontroller for experimental verification. We applied the P controller of (19) to simplify hardware implementation, because it provided similar responses to the standard robust controller but with a much simpler form. We set  Figure 9a. Second, Figure 9b shows that the angle ψ approached to the balancing point. Third, the corresponding control signal is shown in Figure 9c, where the motors continuously regulated the velocity and position of the TWIP robot. Fourth, the forward velocity approached zero (see Figure 9d), while the TWIP remained at the starting place (see Figure 9e). Figure 9f shows the zoom-in position responses after settling, where the TWIP robot oscillated within about ±1cm. Finally, the statistical data are shown in Table  2, where the mean absolutely error (MAE) and the root mean square error (RMSE) after the settling time are defined as (21) in which e indicates the corresponding error, T=15 s, and s t is the settling time, when the error of the pitch angel is less than o 0.475 (i.e., 5% of the step from 9.5 −° to 0°) afterwards. From the table, in place 1 and place 2, the rise time were 0.4 s, while the MAE and RMSE of ψ were less than 0.178° and 0.224°, respectively. The position responses converge to zero with an MAE of less than 8.9 mm and an RMSE of less than 9 mm. That is, the TWIP system can be statically balanced at specified positions by the proposed multiloop control layout.

Decoupled Control Loops
The TWIP system consists of two control loops: the balance loop and the steering loop. The balance control loop stabilizes the system, while the steering control loop regulates the movement direction, as illustrated in Figure 10a. This section proposes a method to decouple these two control loops. From Appendix A, the transfer function matrix from the motor voltages ( r V and l V ) to the balancing angle ψ and the steering angle φ can be represented as follows:  (23) by a suitable c D . That is, the transfer function matrix from input motor voltages ( ψ V and φ V ) to the output angles ( ψ and φ ) are as follows: Therefore, the system can be decoupled if the following two off-diagonal terms are zeros: ( ) as shown in Figure 10c. That is, the balancing loop and the steering loop can be decoupled and independently controlled. We can further integrate the balancing loop with the aforementioned velocity and position loops, as shown Figure 11. Substituting the parameters of Table 1, the balancing sub-model is ψ = s G G , as shown in Equation (3), while the steering sub-model is: .
Similarly, we applied robust loop-shaping control to φ G and selected the following weighting: The robust controller We implemented the designed controllers in Figure 11 to demonstrate the position tracking of the TWIP system. Suppose the TWIP is balanced and then given a target on the forward left, with an angle of 45° and a distance of 1 m; the system responses are shown in Figure 12. First, the system remains balanced during the tracking process, as shown in Figure 12a. Second, the velocity and position responses are illustrated in Figure  12b and 12c, respectively. Third, the steering response is shown in Figure 12d and is much faster than the position/velocity/balance responses because the steering loop is independently controlled. The motor voltages, ψ V and φ V , are illustrated in Figure 12e,f, where the TWIP robot made a swift turn at t = 10 then moved forward until it reached the target position and settled there according to the control loop.

Walking Assistance by the TWIP Robot
We applied the TWIP robot to assist users with walking. The TWIP provides physical support to the user during motion, while the user gives commands based on visual feedback. We implemented two force sensors [38] on the handrail, as shown in Figure 13a, so that the users can control the direction of the TWIP robot by applying forces to the handrail. Suppose l F and r F represent the measured forces on the left and the right sensors, respectively. The applied force F and torque T are estimated as: where d is the distance between the force sensors and the center of the handrail. We set a threshold of 2 N to filter disturbances when estimating the user's intention. The force F is then transferred to an motion error P e by a function We conducted experiments to demonstrate the walking assistance function of the TWIP robot. The user was asked to walk in a straight line and then turn 90° to the right [39]. The system responses are illustrated in Figure 14. First, the TWIP robot remained stable during the whole process of assisting with walking, as shown in Figure 14a. That is, the designed robust controller can cope with the system uncertainties and disturbances during motion. Second, when the force sensors detected the applied force (see Figure 14c), the robot began to move forward and remained stable using the designed decoupled multi-loop control. Lastly, the robot allowed a right turn (see Figure 14b) when a torque of about −0.5 Nm was estimated at around 11 s, as shown in Figure 14d, indicating that the user intended to make a right turn. Note that the applied force was estimated as zero, because the right sensor force r F was less than 2N. Therefore, the parallel-wheel structure allowed the robot to turn on the spot, as illustrated in Figure 14e

Conclusions
This paper proposed a decoupled multi-loop controller for a TWIP system. We derived its model and applied robust loop-shaping control to balance the system. The designed controller was then implemented for simulation and experiments. The results showed that the robot might experience velocity drifting because the balancing point is influenced by model variation and disturbances. Therefore, we proposed a multi-loop control structure, which consisted of a velocity control loop and a position control loop. The former achieved static balance, while the latter accomplished position tracking in realtime. Finally, we proposed a decoupled control layout for the TWIP robot, where the balance control loop and the steering control loop can be independently designed. We implemented the designed controllers and demonstrated that the TWIP robot employing the proposed decoupled multi-loop control can effectively assist users with walking. In the future, the TWIP system can be integrated with extra sensor, such as the Kinect camera and IMU sensors, for user tracking [40], obstacle avoidance [41], and falling detection [42].