Control of Rotary Inverted Pendulum by Using On–Off Type of Cold Gas Thrusters †

Single Axis Attitude Controller Design Using Abstract: This article describes the control of a rotary inverted pendulum utilizing on–off-type cold gas thrusters as the actuators, which have high similarities with thruster actuated spacecrafts with slosh dynamics. The study is completed in three phases. Firstly, a Pulse Width Modulator (PWM) design method is utilized to obtain quasi-linear thrust output from the on–off-type thrusters. Then, a single axis angle controller is designed and tested on the setup along with the PWM scheme. Finally, a pendulum is connected to the other end of the platform and a rotary inverted pendulum (Furuta Pendulum) is constructed. In this way, an inherently unstable, under-actuated, on–off driven system is obtained. For the swing-up motion of the pendulum, an energy-based method is employed. Balancing of the pendulum is achieved by an observer-based state feedback controller under small angle assumption and quasi-linear outputs from the PWM driven thrusters. All of these control methodologies are realized on a real-time target machine. The pendulum is stabilized in seven seconds after ﬁve swings, which is comparable to the systems with electric motors.


Introduction
Cold gas thrusters have been used in the space industry since the 1960s. They are preferred for all ranges of orbits and inter-planetary missions [1]. The main reasons for their popularity are the cost effectiveness, environmentally friendly characteristics and highly reliable systems.
Due to their simple structures and use of propellants, which produce no contamination, it is easier to construct laboratory level cold gas thruster test setups [2]. In addition to that, other types of thruster systems also use similar pneumatic valves. Although there are differences in terms of dynamical characteristics between the cold gas types and other types of thruster systems, control strategies applied to the cold gas thrusters can also be applied to any kind of thruster system with some modifications. The inverted pendulum system is a classical control problem application that has been used for decades. The system, whether it is rotary or linear, has inherently unstable, under-actuated and nonlinear dynamical characteristics. Due to these dynamical characteristics, many researchers employed their newly proposed control schemes on the inverted pendulums.
In the literature, there are different types of inverted pendulums using various type of actuators. The most classical one is an electric motor directly controlling the rod or the cart position. Hydraulic and pneumatic cylinder actuated pendulums are also widely used [3]. In addition to those, there are inverted pendulum systems controlled by reaction control systems. Many applications use reaction masses and control moment gyroscopes as an actuator for the inverted pendulum system [4]. Reaction masses and control moment gyroscopes are commonly used for spacecraft attitude control applications.
In this work, another type of reaction control system, the cold gas thruster, is used as an actuator for the rotary inverted pendulum system. Cold gas thrusters have not been used as an actuator for the inverted pendulum systems before. The main difference and challenge when compared with other types of actuators is that the cold gas thruster system used in this work is an on-off type of actuator. Thus, this work extends the difficulties of the inverted pendulum system by adding on-off characteristics on the actuator.
To summarize, the motivation of this work stands on two pillars.
• Inverted pendulums have not been actuated by on-off-type thrusters before in the literature. This is the first study employing such actuators with the conventional control approach for rotary inverted pendulums. Nonlinearity of the system becomes higher compared to the other types of actuators.

•
The system has high similarities with the thruster actuated spacecrafts having slosh dynamics.
The approach used in this study can improve spacecraft control.
The rest of the article is organized as follows. The next section discusses the related background, and the dynamics of the inverted pendulum are summarized in Section 3. Controllers for swing-up and stabilization of the pendulum are introduced in Section 4. Then in Section 5, the performance of the controller is evaluated on the rotary inverted pendulum system. The paper is concluded with critical remarks and discussions of future works in Section 5.

Background
Related literature is elaborated under two main topics; cold gas thrusters and inverted pendulum control.

Cold Gas Thrusters
In some spacecraft applications it is not possible to use aerodynamic control surfaces. Since aerodynamic force is proportional to the medium density and the relative velocity between the fin and the medium, performances of control actuation fins are not sufficient at high altitude atmosphere, out of atmosphere and at low velocity applications. In addition to these conditions, high maneuverability is not possible with the fin actuator due to the separation limits of the fin. For this case, reaction control systems are used for control applications. One of the most used reaction control systems are thrusters. Cold, warm and hot gas thrusters are the types of thrusters based on the output temperature of the expelled gases. For thruster actuated systems, generally on-off type of valves are used because of their simpler structures. There are few moving elements inside and they are highly cheap compared to the servo/proportional valves.
Most used control techniques for on-off type of actuators are bang-bang and pulse modulators. Bang-bang control requires nonlinear analysis. By using pulse modulators, a quasi-linear output can be obtained from an on-off actuator and linear control techniques can be applied. Pulse Width Modulation (PWM) is the most common pulse modulation technique. Many works presented in the literature are related to the study are about PWM design for thrust control applications [5][6][7][8][9][10][11]. Furthermore, there are studies on duty cycle limits affecting the performance of thruster valves. In a related study, Suzuki et al. [12] focused on the minimum pulse-width that can be achieved by the on-off valves. They improved the performance of the controller using the results obtained in the experiments. Jeon et al. [13] performed several experiments on the thrust output to determine the opening and closing characteristics of the thrusters. After these systematic experiments, they used the results to obtain the limit cycle characteristics in their setup. In a similar study, Bals and Kienitz [14] utilized the valve opening and closing times to determine the maximum switching frequencies for their modulation approach.
There are several studies on PWM design and the restrictions on the switching of on-off valves in literature. For instance, Taghizadeh et al. [15] proposed a simplification approach for PWM control applications. They derived a static model between the spool position and the duty cycle input. In another study, Topcu et al. [16] studied electrically operated pneumatic fast-switching valve, which can be used for the position control of pneumatic systems. After investigating the characteristics of the valve, they used the results for the design of PWM.

Inverted Pendulum Control
An inverted pendulum system is an inherently unstable, nonlinear, non-minimum phase and under-actuated control problem that has been widely used for decades as an experimental test setup to demonstrate and verify different kinds of control schemes. Swing-up, balancing, switching and trajectory control are the main tasks for the inverted pendulum test setups. The inverted pendulum problem can be considered as an example for thrust vectoring during vertical launch, vertical take off and landing (VTOL) of aircraft, control of a robotic arm and humanoid robots.
Matsumoto [17] used the analogy of the inverted pendulum problem for the hovering strategy of VTOL unmanned aerial vehicles (UAVs). The inverted pendulum phenomenon is also utilized commonly to stabilize the unstable fuel slosh of a spacecraft with sloshable fuel. The traditional way of minimizing the fuel slosh is to add baffles to the fuel tank. However, this method increases the weight of the spacecraft and adds structural complexity to it [18]. There are many works in the literature that use a fuel slosh sensor and controller to overcome the slosh problem of spacecrafts [19][20][21][22][23]. In this way, the necessity of baffles disappears. Slosh dynamics are generally modeled as a pendulum or a mass-spring-damper system. When slosh dynamics are modeled as a pendulum, the problem becomes the same with the stabilization of an inverted pendulum and rod tracking. The slosh control problem is also underactuated and unstable.
The most common type of inverted pendulum is the cartesian type. In this type, moving mass is actuated by a linear force and the pendulum is attached to the mass by a revolute joint. Different types of controllers are proposed for the control of cartesian type inverted pendulums. Kumar [24] proposed a linear quadratic regulator for balancing the motion. Chen [25] used sliding-mode control with fuzzy modeling for the same goal. Wai [26] proposed adaptive sliding-mode control for a dual-axis cartesian inverted pendulum. El-Hawwary [27] proposed an adaptive fuzzy control for the stabilization.
A rotary inverted pendulum test setup was first introduced by Furuta [28] in 1991. It is a system composed of a rotating pendulum attached to a rotating arm by a revolute joint. Compared to the conventional pendulum on a cart system, it requires less space and fewer unmodeled dynamics since all of the joints are revolute joints. In addition to that, the rotating arm can rotate infinitely by using proper sensor wirings. Infinite rotation provides convenience and a large area for trajectory control during the experimentation.
Throughout the years, many different controller types have been proposed and tested for rotary inverted pendulum test setups. Furata first [28] used a bang-bang type of state feedback algorithm for the swing-up controller and optimal quadratic regulator for the balancing controller. Yang [29] proposed trajectory planning for the swing-up motion and an adaptive neural network controller for the stabilization. Sainzaya [30] reported experimental results of the Linear Quadratic Regulator with a refined PID controller for balancing the motion.
Another type of inverted pendulum is the reaction mass pendulum (RMP). It is a pendulum link attached to the ground by a revolute joint and the rotating controllable mass is attached to the pendulum. The reaction mass control is based on the conservation of momentum and this phenomenon is generally used for attitude control of spacecrafts. Andrievsky [18] used an energy based speed gradient control scheme for the swing-up motion and variable structural control for the stabilization of the RMP. Spong [31] experimentally compared feedback linearization and pole placement methods. The work resulted that feedback linearization and approximate linearization with pole placement methods are comparable. Scalera et al. [32] used feedback linearization control and online trajectory planning based on adaptive frequency oscillators for three-degrees-of-freedom an underactuated pendulum-like cable driven robot. In another study, Garcia-Sanchez et al. [33] implemented a hierarchical controller approach to a differential drive wheeled mobile robot, which is an underactuated and non-holonomic system. Martinez et al. [34] handled actuator nonlinearities by a regulator containing the sigmoid mapping.
There are experimental cartesian inverted pendulum setups driven by pneumatic or hydraulic cylinders [3,[35][36][37]. Compared with the electrically driven ones, although similar control strategies can be applied, differences emerging from the pneumatic or hydraulic characteristics should also be considered and modeled for these types.

Dynamics of the Rotary Inverted Pendulum
In this section, the equation of motion is obtained by constructing the dynamical model of the rotary inverted pendulum. The Lagrangian method is used to model the rotary inverted pendulum dynamics. Figure 1 shows the free body diagram of the rotary inverted pendulum. In this schematic, α is defined as the rod angle and θ is the pendulum angle. Although the system is spatial, it can be separated as two planar systems. Since centrifugal forces are not effective on the control action of the system, they are not considered on the free body diagram and are not going to be taken into consideration. Using the free body diagram, the kinematic equations for point A can be written as Kinematic equations for point B with respect to the point A are According to the relative motion principlė Mass moment of inertia of the rod about mass center of the rod is Mass moment of inertia of the pendulum about the mass center of the pendulum is Total kinetic energy is Total potential energy is V = m pen gLcosα (12) Then, the Lagrangian function is written as In the above equation, the Q term is the input and for the particular system it is the thrust force. For q = θ: For q = α: The linearized version of Equation (17) is Parameters related to Equations (18) and (19) are given in Table 1. Since the balancing controller is used near the equilibrium position, the peak torque is required around the equilibrium position. The limit is determined as 10 degrees from the upper equilibrium position. The required torque to balance the pendulum is calculated as below.
T pen = m pen sin(10)L = 5.86 × 10 −4 Nm (20) Required acceleration at the point A is The required thruster torque is lower than the maximum thrust torque (1.25 Nm) of the actuator as given below.

Controller Design
In this section, the design of the inverted pendulum controller is presented. Due to the nonlinearity of the pendulum motion, pendulum dynamics are linearized around the upper equilibrium point. Thus, the pendulum motion is divided into two phases. One is the swing-up motion and the other is the balancing motion. In this way, the balancing motion is accomplished using a linear controller. If the angle of the pendulum is smaller than 10 degrees, a balancing controller is used. For angles higher than 10 degrees, a swing-up controller is activated. The transition between the controllers is realized by a switch. Since the conventional methodology for the control of inverted pendulums is followed in this study, the complexity of the controller is highly similar to the ones in the literature [29].
In the rest of this section, swing-up, balancing and switch controllers are presented.

Swing-Up Controller
A swing-up controller is used to overcome the nonlinearity of the system. Since the system is linearized near the equilibrium position, swing-up tries to bring the system near the equilibrium position. The energy control method is used for the swing-up action. This method calculates kinetic and potential energies of the pendulum. By knowing the total energy at the equilibrium position, the algorithm applies the necessary torque to the system [38]. The total energy of the pendulum system at any instant of the motion is The derivative of the energy equation is Multiplying the equation of motion with the velocity of the pendulum and obtaining the energy change as Using the above equation, the energy of the pendulum can be controlled simply by changing the acceleration of the rod. This can be accomplished by applying the necessary torque on the rod.
Controllability is lost when the coefficient of acceleration vanishes. This occurs whenα is zero or α is 180 degrees. To increase energy, the acceleration of the rod should be positive when the quantitẏ αcosα is negative. Then, the required acceleration of the rod can be found as below [38].
The above equation can be utilized to adjust the required acceleration using real time energy as the feedback value. When the total energy approaches the equilibrium energy, it lowers the acceleration. An appropriate k swing gain value should be selected for this system. k swing is related to the torque limit and the time allowing for the swing-up motion.

Balancing Controller
The state feedback controller is employed as the balancing controller. It is designed after the state space model is obtained. Later, the state observer is designed to observe some non-measurable states. Details of the design are elaborated in the following subsections.

State Space Model of the Rotary Inverted Pendulum
In this part, the state space model of the inverted pendulum is constructed. Equations (18) and (19) are formed as below, respectively.
where a = J A0 + m pen r 2 The states are rod position, rod velocity, pendulum position and pendulum velocity. The state space form of the equation of motion is When numerical values are utilized, the below matrices are obtained.
A controllability matrix is constructed and it is shown that it is a full rank matrix.

State Space Model and Controllability in Discrete Domain
In this part, due to the nature of the PW modulated actuator, a discrete model is constructed and its controllability is examined.
The discrete model is constructed from a continuous time state space form.
Firstly, the state space equation is converted to discrete domain for 2 Hz PWM frequency. For this case, the state and the controllability matrices are given in Equations (45)-(47). Since the matrix is not a full rank matrix, the system is not controllable for the selected sampling period. The minimum PWM frequency to ensure the controllability is calculated as 6 Hz by checking the rank of the controllability matrix. Considering the valve opening and closing dynamics, the PWM frequency is set to 20 Hz for better controllability. Later, the discrete domain state space form is constructed. For the selected frequency, the controllability matrix is full rank. It is observed that as PWM frequency is lowered, controllability is lost.

Full State Feedback Controller
In this part, a linear control method, full state feedback controller is designed. Controller gains are calculated for this commonly used control method. All states are assumed as measurable.
A block diagram of the full state feedback controller is given in Figure 2. In this figure, K is the state feedback gain matrix. The mathematical expression of the overall closed loop system iṡ The term in the parenthesis in the above equation determines the characteristics of the closed loop system. The eigenvalues of this term must be equal to the desired pole locations. Calculation of the K matrix to satisfy the requirements of the eigenvalues is done by Ackermann's formula, which is given in Equations (49) and (50).
φ(A) is given below. In the below equation α 1 , α 2 , α 3 and α 4 are the coefficients of the desired characteristic equations.
Coefficients of the desired characteristic equations are tuned by selecting the desired pole locations for stability [39] without saturated controller outputs. The highest possible system bandwidth is selected as 0.6. The damping ratio is selected as 1 for no overshoot. Poles of the characteristic equations are calculated using the below equations.

Switching Controller
The switching controller switches the controller scheme between the swing-up and the balancing controllers. It decides which controller is to be used according to the angular position of the pendulum. Figure 3 shows the phases of the controllers. When the absolute value of the pendulum angle (α) is smaller than 10 degrees, the balancing controller is used as stated in Equation (55). For the remaining range, the swing controller is active. The transition between the controller phases is provided by a switch controller.

Simulation Results
To be able to observe the swing-up motion and the effects of the nonlinearities, the nonlinear inverted pendulum model is constructed in Matlab-Simulink. Simulations are done with different PWM frequencies and controller gains.
The angular position simulation was run for 10 Hz PWM frequency and discrete analysis. The controller was unable to catch and balance the inverted pendulum at the upright position. Another simulation was run with 20 Hz PWM frequency and continuous analysis. This controller was also unable to catch and balance the inverted pendulum at the upright position. Figure 4 shows the angular position of the pendulum for 20 Hz PWM frequency and gains calculated by the discrete controller. According to the figure, it takes about eight seconds to swing up the pendulum to the up-right position. The simulation result is satisfying with discrete analysis and high frequency PWM. Figure 5 shows thrust output, the control input during the inverted pendulum simulation.

Results of the Experiments
In this section, the details of the experimental test setup are first presented. Then, the results of the single axis and the inverted pendulum experiments are discussed. Discrepancies between the simulation and the experimentation results are elaborated.

Experimental Test Setup
For the single axis and the inverted pendulum test setups, almost the same components were used. The only difference was a rotary encoder mounted on the single axis platform for the inverted pendulum. The pendulum was directly attached to the rotary encoder. Test setup parts can be separated as the parts related to structural, pneumatic, data acquisition and control duties. These parts are listed in Table 2. The structural part of the test setup was composed of a base part and a rod attached to the base part via a bearing. The base part, rod and other mechanical parts were manufactured using a 3D printer. The bearing provides unlimited and low frictional rotational motion.
The pneumatic part of the test setup was composed of a pressure regulator, two on-off solenoid valves, pipes and a rotating pneumatic fitting. Pressured gas was provided to the pressure regulator. The pressure regulator ensures constant pressure for the valves. It was placed at the outside of the test setup, but the valves were placed on the rotating platform. The valves operated without considerable delays. A low friction rotating pneumatic fitting was used to provide air supply from the regulator to the valves without preventing the rotational motion.
The data acquisition, control and signal/power routing part of the test setup were composed of a real time target machine, two incremental rotary type encoders, a slip ring and DC power supply. Inputs and outputs were interfaced via an FPGA-based board on the real-time target machine due to its availability in the lab. The target machine was run at 1 kHz frequency, which is much faster than the frequency of the PWM (20 Hz). Rotary encoders are the sensors of the control loop and they measure the rotational positions of the rod and the pendulum. The real time target machine takes encoder data, processes and generates control commands for the valves. Signals and power were delivered to the valve and the encoders using a rotational slip ring. In the test setup, unlimited and low frictional rotational motion was achieved by using the pneumatic rotating joint and the slip ring. Figures 6 and 7 are photographs of the single axis and the rotary inverted pendulum test setups, respectively. Figure 8 shows the general block diagram of the test setup.    Figure 9 shows the angular position of the rotational platform during the single axis motion. For this particular experiment, a 180 degree angle command was applied to the system. According to the results, it takes two seconds for the closed loop system to reach the reference position. The system does not have any overshoot and the RMS value of the steady state error is 2.4 degrees. Figure 10 shows the thruster output during the single axis motion.   Figure 11 shows the angular position of the pendulum during the swing-up and the balancing motions. According to the results, it takes four swings for the pendulum to reach the unstable equilibrium position. The balancing controller does not have any overshoot and it has no steady state error as desired. Figure 12 shows the thruster output during this motion.  The inverted pendulum test result is comparable with the simulation results provided in Figure 4. The main reasons of the discrepancies between the model and the simulation are considered to be the piping and the slip ring.

Discussions
The best use of the proposed controller schemes in this work might be the multi-input multi-output (especially under-actuated ones) on-off thruster actuated spacecraft attitude control problems. For these kind of problems and to be able to control all the states simultaneously, independent torques are required for the three axes. If the system is completely state controllable, the controller for the system can be designed by linear state space analysis. Thus, required quasi-linear thrust can be obtained by proper PW modulator and sampler dynamics of the modulator can be taken into account by discrete analysis. The required fast response can be obtained for any angular position. Thruster-actuated vertical take off and landing (VTOL) vehicles might be the specific example of thruster actuated inverted pendulums. VTOL vehicles have similar dynamics, with inverted pendulums having additional freedoms, and the stabilization of them can be accomplished by side thrusters [40].
PW linearized thrust outputs cannot be used in systems requiring high bandwidths. The approach followed in this study is only applicable on low bandwidth systems.
Inverted pendulum applications are accomplished with different types of actuators using different configurations. This work extends the topic by using another type of actuator with different dynamics. The used actuator brings an extra challenge, low frequency on-off actuator dynamics.

Conclusions
In this work, PWM actuated cold gas thrusters were used for the control of a rotary inverted pendulum. The relationship between the system bandwidth and the PWM frequency is examined. On-off cold gas thruster actuators were used for the first time on inverted pendulum systems.
Single axis angle control and inverted pendulum application were tested on the laboratory level test setups. Although a slip ring and rotary pneumatic joint were used to have less friction on the rotational motion, spring and damping effects of the piping and the pneumatic rotary joint were pretty effective. Under these circumstances, designed modulators and controllers were employed on both the single axis angular position and the rotary inverted pendulum control test setups. The performance of the controllers was satisfying. However, discrepancies are observed between the model and the experimentation results. It is evaluated that the major causes of the discrepancies are the friction and the spring effects.
Regarding future works, other equipment may also be modeled to observe the dynamics of each component. During modeling and tests, air is preferred as a propellant. Instead of air, widely used cold gas propellants like nitrogen or helium can be used in the upcoming studies. The control structure in this work is limited by a linear state feedback controller. Other nonlinear control topologies may also be applied.