Acta Polytechnica DOI:10.14311/AP.2019.59.0458 Acta Polytechnica 59(5):458–466, 2019 © Czech Technical University in Prague, 2019 available online at https://ojs.cvut.cz/ojs/index.php/ap INVERTED PENDULUM WITH LINEAR SYNCHRONOUS MOTOR SWING UP USING BOUNDARY VALUE PROBLEM Lukáš Koska, Slávka Jadlovská, Dominik Vošček, Anna Jadlovská∗ Technical University of Košice, Faculty of Electrical Engineering and Informatics, Department of Cybernetics and Artificial Intelligence, Letná 9, 042 00 Košice, Slovak Republic ∗ corresponding author: anna.jadlovska@tuke.sk Abstract. Research in the field of underactuated systems shows that control algorithms which take the natural dynamics of the system’s underactuated part into account are more energy-efficient than those utilizing fully-actuated systems. The purpose of this paper to apply the two-degrees-of-freedom (feedforward/feedback) control structure to design a swing-up manoeuver that involves tracking the desired trajectories so as to achieve and maintain the unstable equilibrium position of the pendulum on the cart system. The desired trajectories are obtained by solving the boundary value problem of the internal system dynamics, while the optimal state-feedback controller ensures that the desired trajectory is tracked with minimal deviations. The proposed algorithm is verified on the simulation model of the available laboratory model actuated by a linear synchronous motor, and the resulting program implementation is used to enhance the custom Simulink library Inverted Pendula Modeling and Control, developed by the authors of this paper. Keywords: Automatic model generator, pendulum on the cart, linear synchronous motor, feedfor- ward/feedback control structure, boundary value problem, swing-up control. 1. Introduction Underactuated systems are mechanical systems that have fewer control inputs than degrees of freedom to control, which make both the control design and the analysis more difficult when compared to their fully actuated alternatives. These systems exploit the natu- ral dynamics of the system in order to achieve a higher level of performance in terms of speed, efficiency, or robustness [1]. A system of interconnected pendu- lums on a stabilizing base such as a cart/rotary arm is a typical example of a benchmark underactuated system. This system has proven to be important in studying the dynamics of more complex higher-order systems, such as mobile (notably legged) robots, robot manipulators, segways, aircrafts or submarines [2] [3] [4] [5]. The basic control objective for pendulum-based un- deractuated systems is to stabilize each pendulum link in the vertical upright (inverted) position, often following a swing-up from the downward position. To perform the swing-up manoeuver, the pendulum can either be simply required to reach the upright posi- tion without regard to the trajectory tracked, or to reach it while simultaneously tracking the prescribed trajectory. The former approach can be realized via a number of methods, such as Furuta’s energy-based method [6], partial feedback linearization [7] or Lya- punov function design [8]. An example application of the latter was notably published in [9] and [10] where Graichen et al. studied the swing-up manoeuver prob- lem for a double pendulum on the cart-based combined feedforward/feedback control scheme resulting in a two-point boundary value problem (BVP) of the in- ternal dynamics of the system. The BVP solution for the pendulum swing-up for the triple pendulum on the cart was introduced in [11]. This paper is a follow-up to the research of our Underactuated Systems group at the Center of Mod- ern Control Techniques and Industrial Informatics (CMCT&II) at DCAI, FEEI, TU in the field of mod- elling and control of underactuated systems (http: //matlab.fei.tuke.sk/underactuated). The ob- tained results, such as functions that automate the generation of mathematical models for the n-link in- verted pendulum system on the cart or a rotary base, implemented control algorithms and demo simulations, have been included in the custom MATLAB/Simulink library, Inverted Pendula Modeling and Control (IP- MaC) [12], developed since 2011. The library has been gradually expanded, i.e. [13] describes the addi- tion of weight in the form of a sphere/ring/cylinder at the end of the pendulum, which is reflected in its inertia; additional benchmark models were intro- duced in [14]. Stabilizing control algorithms most importantly include state-feedback approaches, such as pole-placement or LQR, and the implementation of swing-up algorithms covers the energy method or the partial feedback linearization. The hybrid control structure, which enables switching between the swing- up and stabilizing controller, is used to meet the stated control objective [14] [15]. The development of the IPMaC as a framework for solving analysis/control problems of inverted pendulum systems also enabled us to unify and generalize the nomenclature and la- belling of input/output/state variables and physical 458 https://doi.org/10.14311/AP.2019.59.0458 https://ojs.cvut.cz/ojs/index.php/ap http://matlab.fei.tuke.sk/underactuated http://matlab.fei.tuke.sk/underactuated vol. 59 no. 5/2019 Swing-up of the inverted pendulum on a cart quantities used in mathematical modelling of these benchmark underactuated systems. The present paper proposes the algorithm for calcu- lating the swing-up trajectories and their subsequent tracking in the two-degree of freedom control scheme, which is then verified on the simulation model of the laboratory single inverted pendulum system on a cart (cart-pole system), The Multipurpose Workplace for Nondestructive Diagnostics with Linear Synchronous Motor, located in the CMCT&II’s Laboratory of Pro- duction Lines and Image Recognition at DCAI, FEEI TU in Košice. This laboratory model was first pre- sented in [16], where the process of obtaining its math- ematical model and parameter identification, as well as design and subsequent verification of swing-up and stabilizing control was described in detail. Unlike the approaches based on switching between swing-up and stabilizing control algorithms, the proposed approach has not yet been implemented in the IPMaC library, and therefore will enhance it. The structure of the paper is as follows. In section 2, the functionality of the IPMaC library regarding the generation of the mathematical model of the inverted pendulum on the cart with the force input will be presented and the model will further be adjusted to generate the optimal trajectory for the natural, under- actuated pendulum dynamics. In section 3, the paper describes the solution of the BVP with the objective of trajectory generation for pendulum swing-up using the two-degrees-of-freedom control structure. At the end of section 3, the optimal control algorithm for tracking desired trajectories is described, which en- sures the minimal deviations of the state-space vector from the generated trajectories. In section 4, the ex- tended functionality of the existing IPMaC library is presented, based on the proposed swing-up algorithm. In the end, the obtained results are evaluated and future research directions are outlined. 2. Inverted Pendulum Model Generated Via IPMaC library Determining the correct and sufficiently accurate mathematical model is a basic prerequisite for any further analysis of a given physical system. To de- sign advanced control algorithms such as swing-up trajectory planning/tracking for an underactuated system, such a mathematical model is essential [13]. The IPMaC library, via the Inverted Pendula Model Equation Derivator application, allows to derive the mathematical model of an inverted pendulum system in various configurations, considering a given number of links and several types of weights (or no weight) at the end of the pendulum [14]. The implemented algorithm uses the Lagrange equa- tions of the second kind to derive the model of a se- lected inverted pendulum system [12]. This method is based on the definition of the mass point coordinates and the determination of kinetic Ek and potential Ep energy with respect to the defined vector of the Figure 1. Pendulum on the cart (cart-pole) system generalized coordinates θθθ(t), which is specified for a n-link pendulum as: θθθ(t) = [ θ0(t) θ1(t) · · · θn(t) ] (1) where the θ0(t) represents the position of the cart and the remaining coordinates θ1(t), . . . ,θn(t) represent the angles of the individual pendulum links. Lagrangian (Lagrange function) for n mass points is defined as [17]: L(θθθ(t),θ̇θθ(t)) = n∑ i=0 Eki (θθθ(t),θ̇θθ(t))− n∑ i=0 Epi (θθθ(t)) (2) By deriving the Lagrange function with respect to time t and generalized coordinates θθθ(t), the resulting motion equations of the system can be obtained in the form: d dt ( ∂L(t) ∂θ̇̇θ̇θ(t) ) − ∂L(t) ∂θθθ(t) + ∂R(t) ∂θ̇̇θ̇θ(t) = QQQ∗(t) (3) where R(t) represents the Rayleigh dissipative func- tion (friction/damping) and QQQ∗(t) is the external gen- eralized force [17]. Our specific case is considered to have only one pendulum, as in Fig. 1. Thus, kinetic Ek and potential Ep energy is defined for two mass points, for the cart θ0(t) and for the pendulum θ1(t), respectively. We consider the model with a sphere at the end of the pendulum, which is the closest representation of the laboratory model. The external input to the system corresponds to the force F(t) applied on the cart. The resulting nonlinear differential equations have the form of a cart equation: (M + m0 + m1)θ̈0(t) + C cos(θ1(t))(M + m1)θ̈1(t)+ +δ0θ̇0(t) −C sin(θ1(t))θ̇20 (t)(M + m1) = F(t) (4) and the pendulum equation: C(M + m1) cos(θ1(t))θ̈0(t) + J1θ̈1(t)+ +δ1θ̇1(t) −C(m1 + M)g sin(θ1(t)) = 0 (5) with the parameters listed in Tab. 1. To find a trajectory for the underactuated part of the system, we declare the acceleration of the cart 459 L. Koska, S. Jadlovská, D. Vošček, A. Jadlovská Acta Polytechnica m0 [kg] weight of the cart m1 [kg] weight of the pendulum M [kg] weight of the sphere l1 [m] length of the pendulum C [m] distance between the centre of gravity (CoG) and the point of rotation: C = (m1l1/2 + M(l1 + R)) /(M + m1) R [m] radius of the weight J1 [kgm2] moment of inertia δ0 [kgm2/s] cart friction δ1 [kgm2/s] pendulum friction Table 1. Parameters of the inverted pendulum on the cart system θ̈0(t) to be the input of the pendulum subsystem (5). Hence, we consider the system of equations θ̈0(t) = u(t) (6) θ̈1(t) = C(M + m1) J1 cos(θ1(t))u(t) + δ1 J1 θ̇1(t)− − C(m1 + M)g J1 sin(θ1(t)) (7) where (6) represents the input-output dynamics of the cart [18] and (7) represents the internal dynamics of the system. For the design of desired (nominal) swing-up tra- jectories [θ∗1 (t) θ̇∗1 (t)] and the control input θ̈∗0 (t) for swing-up, we also have to take into account the follow- ing constraints resulting from the laboratory setup: |θ0(t)| < 0.45m, |θ̇0(t)| < 3.5m/s, |θ̈0(t)| < 12m/s2 (8) This concludes the modelling section. 3. Trajectory planning using BVP The problem of trajectory planning for the inverted pendulum system involves solving the task of pendu- lum swing-up from the downward equilibrium position to the upright unstable equilibrium position [19]. Let us suppose that the swing-up must be executed for the bounded time interval t ∈ [0,T]. The boundary conditions for the swing-up of the considered system from the initial downward to the terminal upward equilibrium are as follows: θ0(0) = 0, θ̇0(0) = 0, θ1(0) = −π, θ̇1(0) = 0 θ0(T) = 0, θ̇0(T) = 0, θ1(T) = 0, θ̇1(T) = 0 (9) In this paper, the design of the swing-up trajectory for the underactuated system of inverted pendulum on the cart is based on the solution of the two-point boundary value problem, considering the boundaries (8) for the input signal. The input signal represents the required acceleration of the cart θ̈∗0 (t), hence the obtained solution will be suitable for a subsequent implementation into the laboratory model [9] [16]. The result of the trajectory planning is represented not only by the trajectories of state variables of the selected system (θ∗0 (t) θ̇∗0 (t) θ∗1 (t) θ̇∗1 (t)), but also by the trajectory of the adequate input u∗(t) = θ̈∗0 (t) that performs the required behaviour [20]. The task of inverted pendulum swing-up is most commonly implemented in a way where the pendu- lum is simply required to reach the upright posi- tion without regard to the trajectory tracked; once close to the unstable equilibrium, the control law is switched to a stabilizing controller. This approach, known as the hybrid control structure, has already been successfully implemented as a part of the IP- MaC [14] [16]. Rather than this control structure, this paper uses the two-degrees-of-freedom (feedfor- ward/feedback) scheme shown in Fig. 2 to ensure the offline generation of desired trajectories based on a nonlinear feedforward design and their subsequent online tracking by feedback LQ control design. Upon the formulation of the BVP assumptions and constraints, the solution can be searched for. 3.1. Solution of the BVP From the equation describing the dynamics of the inverted pendulum (5), we obtained a nonlinear sec- ond order differential equation (7) where the input is the acceleration of the cart (6). The system of equa- tions (6)−(7), which is already in input-output normal form together with boundary conditions (9), defines a nonlinear two-point BVP for states θ0(t), θ̇0(t), θ1(t), θ̇1(t) that depends on the input trajectory u(t). Using the feedforward control principle design based on inverting the input-output dynamics of the cart (6) and solving the BVP of the internal dynamics of the pendulum (7), a feedforward control input u∗(t) = θ̈∗0 (t) that ensures that the pendulum performs the swing-up, is obtained. Such a control input u∗(t) can be expressed in the form of polynomial series, splines, harmonic functions or other functions that contain free parameters; hence the task transforms into the search for these free parameters [21]. The type of the input series depends on the choice of the expert [18]; in our case, we have chosen the cosine input series θ∗0 (t) = γ(t,σσσ) with free parameters for the cart position θ0(t) in the form: γ(t,σσσ) = − (σ1 + σ3) − (σ2 + σ4) cos ( πt T ) + + 5∑ i=2 σi−1 cos ( iπt T ) (10) The free parameters σσσ = (σ1,σ2,σ3,σ4) represent the coefficients of the cosine series for the highest fre- quencies. To evaluate these, we use the function bvp5c from MATLAB with an initial estimation given as σσσ = {0, 0, 0, 0} and the swing-up time set to T = 1.5s. Solving the BVP leads to the set of free parameters specified as σ1 = 0.1087, σ2 = 0.1588, σ3 = −0.0530, σ4 = −0.0611. The desired trajectories θ∗0 (t), θ̇∗0 (t) and θ̈∗0 (t) for the cart that result from this set of pa- rameters are shown in the Fig. 3. The desired trajecto- 460 vol. 59 no. 5/2019 Swing-up of the inverted pendulum on a cart Figure 2. Feedforward/feedback control structure 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 Time [s] -0.4 -0.2 0 Desired position 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 Time [s] -2 0 2 Desired velocity trajectory 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 Time [s] -10 0 10 Desired acceleration trajectory (input) Figure 3. The desired position θ∗0 (t), velocity θ̇∗0 (t) and acceleration θ̈∗0 (t) of the cart generated by the solution of the BVP 0 0.5 1 1.5 Time [s] -200 -100 0 Desired position trajectory of the pole Pole trajectory position [deg] 0 0.5 1 1.5 Time [s] -200 0 200 400 Desired velocity trajectory of the pole Pole trajectory velocity [deg/s] Figure 4. Desired trajectory of the pendulum angle θ∗1 (t) and pendulum angular velocity θ̇∗1 (t) generated by the solution of the BVP 461 L. Koska, S. Jadlovská, D. Vošček, A. Jadlovská Acta Polytechnica ries satisfying the control objective and constraints for the pendulum swing-up θ∗1 (t) and its angular velocity θ̇∗1 (t) are shown in Fig. 4. 3.2. Design of the control algorithm for tracking desired trajectories calculated by the BVP The generated inverted pendulum model (4)−(5) is only appropriate for trajectory tracking control design if the drive control unit allows the force input on the cart. Our system is actuated by means of a linear synchronous motor (LSM), hence it does not satisfy this condition. Therefore, we first need to modify the model by replacing the equation (4) with the linear approximation of the cart-LSM subsystem to obtain the simulation model of the laboratory system [16]. The state-space vector for the inverted pendulum with LSM remains unchanged and is of the form: xxx(t) = ( θ0(t) θ̇0(t) θ1(t) θ̇1(t) )T (11) and the same holds for the vector of desired trajecto- ries xxx∗(t) = (θ∗0 (t) θ̇∗0 (t) θ∗1 (t) θ̇∗1 (t))T . In this paper, we consider the cart-LSM subsystem as a linear system whose input is the desired (refer- ence) velocity θ̇∗0 (t) of the cart and the output is the actual velocity θ̇0(t) of the cart. The desired velocity trajectory θ̇∗0 (t) was obtained in the previous section by means of the cosine series (10). A first-order linear system is proposed in the form: θ̈0(t) + q0θ̇0(t) = p0θ̇∗0 (t) (12) The coefficients q0 and p0 of the linear differential equation (12) were obtained using the arx function from System Identification Toolbox, i.e. by perform- ing an experimental identification on the laboratory pendulum system, as in [16]. After combining the approximate cart-LSM repre- sentation (12) with the pendulum equation (5), we obtain the modified model of the inverted pendulum system in the form that is suitable for linearization [16]. For the design of the control algorithm which ensures tracking the desired trajectories obtained by the solution of the BVP, the algorithm based on time- varying LQ principle (feedback control ∆u(t)) and results of the BVP algorithm (feedforward control u∗(t)) are used in the control structure, which is de- picted in Fig. 2. To implement an optimal feedback time-varying LQ control ∆u(t), the linearized inverted pendulum model is used, which is characterized by the time-varying system dynamics matrix AAA(t) and input matrix BBB(t), given as follows: AAA(t) =   0 1 0 0 h3 −h2 0 −h1q0 0 0 0 1 0 0 0 −q0   ∣∣∣∣∣∣∣∣ [xxx∗(t),u∗(t)] BBB(t) =   0 h1p0 0 p0   ∣∣∣∣∣∣∣∣ [xxx∗(t),u∗(t)] where: h1 = C(m1 + M) J1 h2 = δ1 h3 = C(m1 + M)g J1 sin(θ1(t)) The proposed control algorithm law yields the optimal feedback LQ control ∆u(t) = −K(t)∆x(t), which minimizes the quadratic criterion: JLQ(t) = ∫ ∞ 0 (∆xxxT (t)QQQ∆xxx(t) + ∆uT (t)R∆u(t))dt (13) where QQQ ∈ R4×4 is a symmetric positive semidefinite matrix, R is a positive constant and ∆x(t) = x∗(t) − x(t) is a vector of desired trajectory perturbations. The feedback gain KKK(t) is represented as: KKK(t) = R−1BBBT (t)PPP (14) where PPP is the solution of the Riccati system of al- gebraic equations corresponding to the given time step: PBPBPB(t)R−1BBBT (t)PPP −PAPAPA(t) −AAAT (t)PPP −QQQ = 000 (15) The feedback gain vector KKK(t) was computed in each time step of 0.1 second for specific values of the state-space matrices with the built-in MATLAB function lqr with the weighting matrices adjusted manually to QQQ = diag(20000, 100, 1000, 220000) and R = 10000. The time behaviour of the feedback gain KKK(t) components obtained by the simulation is shown in the Fig. 5. 4. Enhancement of the IPMaC library The IPMaC library [12] contains algorithms enabling inverted pendulum control in the hybrid control struc- ture, i.e. by switching between the swing-up and sta- bilizing control algorithm. The swing-up manoeuver has been implemented either via the energy-based methods or via partial feedback linearization, without considering the swing-up trajectory. When the pendu- lum approaches the upright equilibrium, the switch to the state-feedback stabilizing control algorithm takes place, which has been implemented using methods 462 vol. 59 no. 5/2019 Swing-up of the inverted pendulum on a cart 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 Time [s] -1800 -1600 -1400 -1200 -1000 -800 -600 -400 -200 0 200 Time-varying LQ feedback gains Figure 5. Time-varying feedback gains k1(t), k2(t), k3(t), k4(t) 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 Time [s] -0.4 -0.2 0 0.2 Comparison of desired trajectories generated by BVP 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 Time [s] -300 -200 -100 0 Figure 6. Comparison of the desired cart position trajectories θ∗0 (t) and pendulum angle θ∗1 (t) generated by the MATLAB function bvp5c with different time intervals T1 = 1.5s,T2 = 1.8s for swing-up such as LQR, pole placement or model predictive control [12]. The modification of the IPMaC library presented in this paper consists of adding a control structure that uses the generated swing-up trajectories and a trajectory-tracking algorithm to raise the pendulum from the downward to the upward unstable equilib- rium position and stabilize it there. The simulation scheme in Fig. 7 is used to imple- ment the trajectories calculated offline by the BVP in the control structure depicted in the Fig. 2. The phys- ical parameters of the laboratory model, necessary for simulations, are listed in the Tab. 2. The parameters of the inertia moment J1 and the damping coefficient δ1 were obtained through an experimental identifica- tion. The procedure for obtaining these parameters is described in [16]. CoG 0.3098 [m] center of gravity J1 0.0613 [kg m2] moment of inertia m 0.5983 [kg] weight of the pendulum δ1 0.0027 [kg m2/s] pendulum friction p0 31.53 numerator coefficient of the cart subsystem q0 31.24 denominator coefficient of the cart subsystem Table 2. Numerical parameters of the simulation model of the laboratory pendulum model To calculate the swing-up trajectories, two time intervals were selected: T1 = 1.5s and T2 = 1.8s. For these settings, the bvp5c function returned two sets of parameters σσσ. The desired trajectories for the pendu- 463 L. Koska, S. Jadlovská, D. Vošček, A. Jadlovská Acta Polytechnica Figure 7. Simulation scheme for tracking the desired trajectories using the solution of the BVP and time-varying LQ algorithm lum swing-up based on these σσσ parameters are shown in the Fig. 6. The generated trajectories were verified and compared, and the trajectory corresponding to the time interval T = 1.5s was selected for further steps. Based on (10), parameters σσσ are used to generate the desired trajectories for the position θ∗0 (t), velocity θ̇∗0 (t) and acceleration θ̈∗0 (t) of the cart. The final tra- jectories of the cart position θ∗0 (t) and pendulum angle θ∗1 (t) are shown in the Fig. 8 and Fig. 9. It is shown that the proposed tracking control algorithm with the control law u(t) = u∗(t) + ∆u(t) and the suitably selected weight matrices QQQ and R exploits the effect of natural dynamics of the system and ensures that the desired trajectory is tracked with minimal deviations of the actual pendulum trajectory from the swing-up trajectories calculated by the BVP. Moreover, the proposed control algorithm reduces the control input of the feedback component against the feedforward component that plays the key role in the swing-up to the upward equilibrium. As suggested by Fig. 8 and Fig. 9, the proposed enhancing functions for the IPMaC library correctly fulfil the stated control objective. It can, therefore, be concluded that the designed control algorithm not only swings up the pendulum but also stabilizes it in the unstable equilibrium position. 5. Conclusions The aim of this paper was to introduce a modification of the swing-up control algorithm based on the feedfor- ward/feedback control scheme and to verify it on the simulation model of a cart-pendulum system, which is part of the laboratory model Multipurpose Work- place for Nondestructive Diagnostics with Linear Syn- chronous Motor. The control algorithm modification was included in our proprietary MATLAB/Simulink Inverted Pendula Modeling and Control library. First of all, the mathematical model of the single inverted pendulum system with an attached weight was generated via a GUI application, which is part of the IPMaC library. Considering the cart acceleration as the pendulum subsystem input together with con- straints resulting from the laboratory setup defines a two-point nonlinear boundary value problem with free parameters as the coefficients of the input cosine series. The solution of the boundary value problem is represented by the desired trajectories for state-space variables of the system during the swing-up phase. Simulations have confirmed that based on the cal- culated set of parameters of the input cosine series, the suitable feedforward component signal u∗(t) was generated. Before designing the control algorithm for the tra- jectory tracking, the model was modified from its generated form to mirror the actual laboratory im- 464 vol. 59 no. 5/2019 Swing-up of the inverted pendulum on a cart 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 Time [s] -0.4 -0.2 0 0.2 Tracking the desired trajectories by the laboratory model 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 Time [s] -2 -1 0 1 2 Figure 8. Tracking of the desired cart position θ∗0 (t) and the velocity θ̇∗0 (t) against the laboratory system position θ0(t) and velocity θ̇0(t) for T = 1.5s 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 Time [s] -200 -150 -100 -50 0 Tracking the desired trajectories by the laboratory model 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 Time [s] -200 0 200 400 Figure 9. Tracking of the desired pendulum angle θ∗1 (t) and the angular velocity θ̇∗1 (t) against the laboratory system pendulum angle θ1(t) and angular velocity θ̇1(t) for T = 1.5s plementation, using the linear approximation of the motor-cart subsystem. After the simulation model of the laboratory system was obtained, the control signal u∗(t) was able to steer the pendulum system from the downward equilibrium position to the up- ward, unstable equilibrium position. Tracking of the generated trajectories and subsequent stabilization in the unstable equilibrium were ensured by means of a time-varying LQ control. An actual implementation of the designed control algorithm into the laboratory model will require the hardware configuration of the model to be enhanced by a suitable embedded system. The trajectory planning problem considered in this paper is not only a relevant control objective for bench- marking underactuated systems, but it can also be applied in gait generation for bipedal or multi-legged robotic systems, with several different trajectories stored in the motion database and selected as the most appropriate for current conditions. Our research will further focus on the verification of this approach for more complicated underactuated systems such as the compass gait and other benchmarks for a passive legged locomotion. Acknowledgements This work has been supported by the grant KEGA Im- plementation of research results in the area of modelling and simulation of cyber-physical systems into the teaching process - development of modern university textbooks – 072TUKE-4/2018 (100%). 465 L. Koska, S. Jadlovská, D. Vošček, A. Jadlovská Acta Polytechnica References [1] R. Tedrake. Underactuated robotics: Learning, planning, and control for efficient and agile machines course notes for mit 6.832. Working draft edition p. 3, 2009. [2] O. Boubaker. The inverted pendulum: history and survey of open and current problems in control theory and robotics. The Inverted Pendulum in Control Theory and Robotics: From Theory to New Innovations 111:1, 2017. [3] Y. Wang, K. Zhu, B. Chen, H. Wu. A new model-free trajectory tracking control for robot manipulators. Mathematical Problems in Engineering 2018, 2018. [4] I. Kafetzis, L. Moysis. Inverted pendulum: A system with innumerable applications. In School of Mathematical Sciences. Aristotle University of Thessaloniki, 2017. [5] O. Boubaker. The inverted pendulum benchmark in nonlinear control theory: a survey. International Journal of Advanced Robotic Systems 10(5):233, 2013. [6] K. J. Åström, K. Furuta. Swinging up a pendulum by energy control. Automatica 36(2):287 – 295, 2000. doi:10.1016/S0005-1098(99)00140-5. [7] M. W. Spong. The swing up control problem for the acrobot. IEEE Control Systems Magazine 15(1):49–55, 1995. doi:10.1109/robot.1994.350934. [8] I. Fantoni, R. Lozano. Non-linear control for underactuated mechanical systems. Springer Science & Business Media, 2001. [9] K. Graichen, M. Treuer, M. Zeitz. Swing-up of the double pendulum on a cart by feedforward and feedback control with experimental validation. Automatica 43(1):63 – 71, 2007. doi:10.1016/j.automatica.2006.07.023. [10] K. Graichen, M. Treuer, M. Zeitz. Swing-up of the double pendulum on a cart by feedforward and feedback control with experimental validation. Automatica 43(1):63–71, 2007. [11] T. Glück, A. Eder, A. Kugi. Swing-up control of a triple pendulum on a cart with experimental validation. Automatica 49(3):801 – 808, 2013. doi:10.1016/j.automatica.2012.12.006. [12] S. Jadlovská, J. Sarnovský. Modelling of classical and rotary inverted pendulum systems–a generalized approach. Journal of Electrical Engineering 64(1):12–19, 2013. doi:10.2478/jee-2013-0002. [13] S. Jadlovská, J. Sarnovský, J. Vojtek, D. Vošček. Advanced generalized modelling of classical inverted pendulum systems. In Emergent trends in robotics and intelligent systems, pp. 255–264. Springer, 2015. doi:10.1007/978-3-319-10783-7_28. [14] S. Jadlovská, L. Koska, M. Kentoš. Matlab-based tools for modelling and control of underactuated mechanical systems. Transactions on Electrical Engineering 6(3):56–61, 2017. doi:10.14311/tee.2017.3.056. [15] S. Jadlovska, J. Sarnovsky. A complex overview of modeling and control of the rotary single inverted pendulum system. Advances in Electrical and Electronic Engineering 11(2):73–85, 2013. [16] A. Jadlovská, S. Jadlovská, D. Vošček. Cyber-physical system implementation into the distributed control system. IFAC-PapersOnLine 49(25):31 – 36, 2016. 14th IFAC Conference on Programmable Devices and Embedded Systems PDES 2016, doi:10.1016/j.ifacol.2016.12.006. [17] R. P. Feynman, R. B. Leighton, M. Sands. The Feynman lectures on physics, Vol. I: The new millennium edition: mainly mechanics, radiation, and heat, vol. 1. Basic books, 2011. [18] S. Ozana, M. Schlegel. Computation of reference trajectories for inverted pendulum with the use of two-point bvp with free parameters. IFAC-PapersOnLine 51(6):408 – 413, 2018. 15th IFAC Conference on Programmable Devices and Embedded Systems PDeS 2018, doi:10.1016/j.ifacol.2018.07.119. [19] S. Ozana, M. Pies, R. Hajovsky. Computation of swing-up signal for inverted pendulum using dynamic optimization. In IFIP International Conference on Computer Information Systems and Industrial Management, pp. 301–314. Springer, 2014. doi:10.1007/978-3-662-45237-0_29. [20] P. Boscariol, D. Richiedei. Robust point-to-point trajectory planning for nonlinear underactuated systems: Theory and experimental assessment. Robotics and Computer-Integrated Manufacturing 50:256 – 265, 2018. doi:10.1016/j.rcim.2017.10.001. [21] K. Graichen, M. Zeitz. Feedforward Control Design for Nonlinear Systems under Input Constraints, pp. 235–252. Springer Berlin Heidelberg, Berlin, Heidelberg, 2005. doi:10.1007/11529798_15. 466 http://dx.doi.org/10.1016/S0005-1098(99)00140-5 http://dx.doi.org/10.1109/robot.1994.350934 http://dx.doi.org/10.1016/j.automatica.2006.07.023 http://dx.doi.org/10.1016/j.automatica.2012.12.006 http://dx.doi.org/10.2478/jee-2013-0002 http://dx.doi.org/10.1007/978-3-319-10783-7_28 http://dx.doi.org/10.14311/tee.2017.3.056 http://dx.doi.org/10.1016/j.ifacol.2016.12.006 http://dx.doi.org/10.1016/j.ifacol.2018.07.119 http://dx.doi.org/10.1007/978-3-662-45237-0_29 http://dx.doi.org/10.1016/j.rcim.2017.10.001 http://dx.doi.org/10.1007/11529798_15 Acta Polytechnica 59(5):458–466, 2019 1 Introduction 2 Inverted Pendulum Model Generated Via IPMaC library 3 Trajectory planning using BVP 3.1 Solution of the BVP 3.2 Design of the control algorithm for tracking desired trajectories calculated by the BVP 4 Enhancement of the IPMaC library 5 Conclusions Acknowledgements References