Russian Journal of Nonlinear Dynamics, 2021, vol. 17, no. 4, pp. 507-525. Full-texts are available at http://nd.ics.org.ru DOI: 10.20537/nd210411
NONLINEAR ENGINEERING AND ROBOTICS
MSC 2010: 70Q05, 70Exx, 49M37, 49K15
The Problem of Balancing an Inverted Spherical Pendulum on an Omniwheel Platform
A. S. Shaura, V. A. Tenenev, E. V. Vetchanin
This paper addresses the problem of balancing an inverted pendulum on an omnidirectional platform in a three-dimensional setting. Equations of motion of the platform-pendulum system in quasi-velocities are constructed. To solve the problem of balancing the pendulum by controlling the motion of the platform, a hybrid genetic algorithm is used. The behavior of the system is investigated under different initial conditions taking into account a necessary stop of the platform or the need for continuation of the motion at the end point of the trajectory. It is shown that the solution of the problem in a two-dimensional setting is a particular case of three-dimensional balancing.
Keywords: balancing of an inverted pendulum, omnidirectional platform, hybrid genetic algorithm, Poincare equations in quasi-velocities
Introduction
The modeling of complex dynamical systems is, as a rule, the first step towards investigating their behavior and controllability. The problem of controlling a complex dynamical system is a nontrivial problem of dynamics and optimal control. One of the classical problems is that of balancing an inverted pendulum [1]. The center of mass of the inverted pendulum is located above
Received November 18, 2021 Accepted December 15, 2021
This work was performed as part of the research project of the Udmurt Federal Research Center of the Ural Branch of the Russian Academy of Sciences "Artificial Intelligence in the Development, Training, and Support of Expert Systems for Presentation and Use of Knowledge in Natural, Engineering, and Socio-Humanitarian Sciences" AAAA-A19-119092690104-4. The work of E. V. Vetchanin (Section 1) is supported by the Russian Science Foundation (project no. 21-71-10039).
Alexander S. Shaura [email protected] Valentin A. Tenenev [email protected]
Udmurt Federal Research Center UB RAS
ul. Tatiany Baramzinoi 34, Izhevsk, 426067 Russia
Eugeny V. Vetchanin [email protected]
Ural Mathematical Center, Udmurt State University ul. Universitetskaya 1, Izhevsk, 426034 Russia
the point of its support and attachment. This makes its equilibrium unstable, so that constant balancing is required to hold the pendulum in the vertical position. An inverted pendulum is a mathematical abstraction (model) of many real-world systems [2] such as reusable missile systems [3], Segway, wheeled robots [4] and walking robots [5, 6], and is a classical problem in automatic control.
The model that has received the most attention in the relevant literature to date is the model of a two-dimensional pendulum whose point of support is fastened on a platform capable of moving in a horizontal line along some axis, and the problem on which the focus is placed is that of balancing the pendulum by controlling the motion of the platform. The equations of motion of such a system are presented in [7]. The problem of balancing an inverted pendulum in a two-dimensional setting is often used as a test problem to compare the efficiency of optimization and control algorithms [8]. The condition under which the platform is constrained to move only along one axis simplifies the problem considerably, and in this setting it is solved successfully by both classical and modern methods using fuzzy, neural network and evolutionary approaches.
The classical approach to solving the problem is based on the application of PID [9] and LQR [10] controllers or their combination [11]. The PID controller in [12] and the LQR controller in [13] are applied to solve the problem of stabilizing and controlling the motion of the system with an inverted pendulum along a prescribed trajectory.
Another well-known approach is based on the use of the Bellman equation. For example, S.Kumar [14] considers the balancing of a CartPole system with reinforcement learning by comparing it with the deep Q-neural network algorithm.
Artificial neural networks offer a variety of capabilities to construct complex controllers, therefore they find wide application at present, and various approaches are proposed. The authors of [15] use the convolutional neural network for generation of new pole-balancing networks (which play the role of artificially intelligent agents) without direct access to training data. Another possibility, that of applying the neuroevolutionary approach NEAT for growing the topology of the neural network in developing a controller for stabilization of an inverse pendulum, is shown in [16].
A fuzzy controller based on Mamdani's inference system for controlling a two-wheeled balancing robot is proposed in [4]. A similar fuzzy controller can be constructed immediately in PLD, as shown in [17], where it is able to successfully maintain control over a window of —10 < d < +10 degrees. In [18] it is shown that fuzzy control is more accurate in reference tracking, faster in response and more robust to disturbance than the PID and LQR controllers.
Much less attention has been given in the literature to the problem of balancing an inverted pendulum in a three-dimensional setting [3, 19], which is by far more complex and closer to real-world systems. The problem of controlling and balancing walking robots [5, 6], where the zero moment point (ZMP) based trajectory and the linear inverted pendulum model (LIPM) reduce the complexity of the dynamics for control purposes, is also a three-dimensional problem. In the case where the pendulum is placed on a cart, the question arises how to organize the motion of the cart in space. One possibility is to use a platform on omniwheels. This method of locomotion has been successfully applied in various systems and holds much promise for development of mobile robots and systems [20, 21]. A key feature is the complete controllability of such a cart: in [22, 23] it is shown that, if the cart is supported by no less than three driving omniwheels so that not all direction vectors of the axes of the wheels' rollers are parallel and the points of contact of the wheels with the plane do not lie on the same straight line, then one can always choose control torques in such a way as to ensure the necessary motion. The complexity of the problem of balancing the pendulum on an omnidirectional cart stems not only from the fact that the motion occurs in space and the dimension of the problem, as well as the number of control parameters, is larger than that in a two-dimensional setting, but also from the fact that the omnidirectional cart in itself is not an abstract platform, but a complex system with a set of real
physical characteristics and with their own laws of motion which must be taken into account in constructing the mathematical model.
In this paper we present a solution to the problem of spatial balancing of the pendulum on a platform with omniwheels using a hybrid genetic algorithm [24, 25], which has proved to be efficient in solving complex problems of global optimization.
1. The mathematical model
1.1. Kinematic relations
Consider the motion of an omnidirectional platform on a horizontal plane with an inverted spherical pendulum placed on it (see Fig. 1). We make the following assumptions concerning the system under consideration:
1° The platform moves without slipping of the wheels.
2° The pendulum is an axisymmetric rigid rod one end of which is fastened on a spherical hinge located on the platform. In addition, the rod cannot rotate about its symmetry axis.
To describe the motion of the system, we introduce three coordinate systems (see Fig. 1):
- a fixed (inertial) coordinate system OXYZ. We assume that the axes OX and OY are parallel to the plane on which the platform moves, and that the axis OZ is directed vertically upwards.
- a moving coordinate system Cxyz. Assume that point C is at the center of mass of the platform, the axes Cx and Cy lie in the plane of the platform, and the axis Cz is codirectional with the axis OZ.
- a moving coordinate system Cpx1x2x3 attached to the pendulum. We assume that the axis Cpx3 is directed along the symmetry axis of the rod, and point Cp coincides with the point of support of the pendulum.
c.
(b)
Fig. 1. (a) A schematic representation of the omnidirectional platform, the fixed coordinate system OXYZ, and the moving coordinate system Cxyz attached to the platform. The projection of the axis OZ coincides with point O, and the projection of the axis Cz coincides with point C. (b) A schematic representation of the platform, the spherical pendulum, the coordinate system OXYZ, the moving coordinate system Cxyz attached to the platform, and the moving coordinate system Cpxxx2x3 attached to the pendulum
We will specify the position of the platform relative to the fixed coordinate system by the radius vector R = (X, Y, 0) of point C, and its orientation, by the angle a between the positive directions of the axes OX and Cx which is measured from the axis OX counterclockwise. For the system considered here the motion of the platform is plane-parallel. Let v = (v1, v2, 0) denote the absolute velocity vector of the center of mass of the platform (point C), where v1 and v2 are the projections of this vector onto the moving axes Cx and Cy, and Q = (0, 0, Q) is the angular velocity vector of the platform. The following kinematic relations [26] hold:
X = v1 cos a — v2 sin a, Y = v1 sin a + v2 cos a, a = tt.
(1.1) (1.2)
Remark 1. In the general case, the platform can have any number N of omniwheels. In constructing the mathematical models, we will not fix the quantity N.
As in [29], we specify the position of the kth omniwheel relative to the platform by the radius vector rk. Let tk and nk denote the tangent and the normal unit vectors to the plane of the kth wheel, respectively, and ak = (ak, ak, 0) the unit vector directed along the axis of attachment of the rollers (see Fig. 2). Assume that the vector tk x nk is directed vertically upwards. Also, let denote the angle of rotation of the kth wheel, which is measured clockwise when viewed from the top of the vector nk.
(a) (b)
Fig. 2. A schematic representation of the omniwheel and the vectors characterizing it
To construct a nonholonomic constraint describing the no-slip condition of the kth wheel, we calculate the velocity of the motion of its axis
vn = v + QJrk, J
/0 —1 0\ 1 0 0 \0 0 0J
k = 1, ..., N
and the velocity of the contact point
Vq = va + khT k, k = 1, ■■■,N,
where h > 0 is the radius of the wheel.
(1.3)
(1.4)
The no-slip condition of the kth wheel is defined by the expression
(vq, ak) = 0, k = 1,...,N, (1.5)
which, in view of (1.3) and (1.4), can be represented in the following form:
/fc = tffc + ^-(v + fiJrfc,afc) = 0, k = l,...,N, (1.6)
where Sk = (tk, ak) =
Let d = (d1, d2, 0) denote the radius vector of the point of support, Cp, of the spherical pendulum, referred to the axes of the coordinate system Cxyz. The spherical pendulum can be considered as a Lagrange top rotating with angular velocity u = (w1, u2, w3), on which we impose the nonholonomic constraint w3 = 0 prohibiting the rotation about the symmetry axis [26]. In what follows, we will use the following notation for this nonholonomic constraint:
fo = ^3 = 0. (1.7)
In addition, we assume that the vector u is referred to the axes of the moving coordinate system Cpx1x2x3.
To describe the motion of the pendulum, we let a, 3, 7 denote the vectors directed along the axes of the fixed coordinate system. Their projections onto the axes of the moving coordinate system Cpx1x2x3 define the orthogonal transfer matrix:
(1.8)
Remark 2. We note that the coordinates a, 3 and 7 are redundant. However, they turn out to be more convenient for numerical calculations than the spherical coordinates since they have no singular points in contrast to the spherical coordinates and Euler angles.
The evolution of the vectors a, 3 and 7 is governed by the Poisson equations
a = a x u, ¡3 = 3 x u, 7 = 7 x u, (1.9)
in which the nonholonomic constraint (1.7) should be taken into account.
1.2. The Lagrangian of the system
The motion of the system under study is described by the Lagrangian
L = T - U, (1.10)
where T is the kinetic energy and U is the potential energy. In constructing the Lagrangian we will assume that the wheels possess the same mass and the same tensor of inertia. We write the components of the kinetic energy of the system:
- the kinetic energy of the platform
Tc = -2mc(v, v) + (1.11)
where mc is the mass of the platform and Ic is the moment of inertia of the platform relative to the axis Cz;
( a1 ft yA
Q = a2 P2 Y2 e SO(3)
\a3 Y3 )
the kinetic energy of the kth wheel
Tk = \mw{v, v) + mwQ(v, Jrk) + ^ (lw + mw(rk, rfe)) Q2 +
/0 -1 0\ J = 10 0
y0 0 0/
(1.12)
where mw is the mass of the wheel, Iw is the moment of inertia of the wheel relative to the diameter, Iw is the moment of inertia of the wheel relative to the axis, rk = (xk, yk, 0) is the radius vector of the center of mass of the kth wheel in the coordinate system Cxyz, and is the angle of rotation of the kth wheel relative to its axis;
- the kinetic energy of the pendulum
Tp = imp(v, v) + rnpQ(v, Jd) + ^mp(d, d)tt2+
+ mpl((v1 — d2Q) cos a — (v2 + d1Q) sin a)(a1w2 — a2w1)+ + mpl((v1 — d2Q) sin a + (v2 + d1 Q) cos a)(^1w2 — ^2w1) +
1 4mpl
2 3 ' ' 2
+ o+ + 0^3, (1-13)
where mp is the mass of the pendulum, l is the half length of the pendulum, and Ip is the moment of inertia of the pendulum relative to its symmetry axis.
The potential energy of the pendulum has the form
U = mpglY3, (1.14)
where g is the free-fall acceleration.
Thus, the Lagrangian of the system takes the form 1 1 1 N
L = -m(v, v) + mQ(v, Jz) + -IQ2 + -Iw £ 4>2 +
k=1
+ mpl((v1 — d2Q) cos a — (v2 + d1Q) sin a)(a1 w2 — a2w1)+ + mpl((v1 — d2Q) sin a + (v2 + d1 Q) cos a)(^1 w2 — (32w1)+
1 4mp l
2 3 ' ' 2
+ + w22) + t;Ipu>3 - ™pgli3 (1.15)
where
N
mpd + mwH rk
m = mc + Nmw + m,p, z = (z1, z2, 0) = —
m
N
1 = Ic + NIw + mw Y^ (rk, rk) + mp(d d).
k=1
1.3. Equations of motion
In classical mechanics the motion of nonholonomic systems is described by the Lagrange equations of the second kind with undetermined multipliers, which relate generalized accelerations to generalized coordinates and velocities [27]. As generalized coordinates in the system one can choose the quantities X, Y and a, which specify the position of the platform, and the Euler angles p £ [0, 2n), d £ [0, n], p £ [0, 2n), which parameterize the matrix (1.8) as follows [26]:
a = (cos p cos p — cos d sin p sin p, — sin p cos p — cos d sin p cos p, sin d sin p), f3 = (cos p sin p + cos d cos p sin p, — sin p sin p + cos d cos p cos p, — sin d cos p), (1.16)
Y = (sin p sin d, cos p sin d, cos d).
However, instead of the generalized velocities q = (X, Y, d, p, d, p) it is more convenient to use quasi-velocities w = (v1, v2, H, w1, u2, W3).1 In the problem of interest, the generalized velocities and quasi-velocities are related by the following linear equations:
= Y1 uSws' (L17)
s=1
where uf are the components of the following vector fields:
1 d d 2 d d
u = COS (7— + Sin (7 — , u = -Sin <7— + COS <7 — ,
dX dY dX dY
U3 = —, U* = + COS LP— --: 7. ~~ • (1.18)
da sin u dp du sin u dy
5 cos y d d cos U cos y d 6 d
sin u dp du sin u dy dy
Remark 3. The vector fields u4 and u5 have singularities for 0 = 0 and 0 = n. When one transforms to the redundant coordinates a, / and 7, these singularities disappear and do not influence further calculations.
We note that the vector fields (1.18) are left-invariant under the groups SE(2) and SO(3), respectively. A consequence of the left invariance is that there exist constant values of the structural coefficients cj :
c3l = c23 = c64 = c45 = c56 = 1,
(1.19)
-1,
which guarantee that the commutation relations (A.3) are satisfied.
1 The quantities vx, v2, H, w = (w1, w2, w3) are quasi-velocities because they are not the derivatives
of any coordinates, in contrast to the generalized velocities X, Y, à, p, u, y.
d 4 sin yd d cos u sin y d
c3l = c23 = c64 = c45 = c456
c32 = = cl3 = = c54 = c465 = c546
Thus, taking (1.19) into account, according to Appendix A we obtain the following equations governing the evolution of the quasi-velocities:
d dL _ dL ^ ul(L) + A ^ d dL _ dL ^ U2(L) + A ^
dt diu dv0 J diu ' dt dv0 diu J
1 2 j=o 12 1 j=0
2
d dL dL dL A df.
1 2 j=0
d dL dL dL 4. . ^ dfj
.U3-—U2+uHL) + (1.20)
3 j=o 1
j
dt dw1 duj2
d dL dL
dt dw2 duj3
d dL dL
dL 5 . r. A . dfj
dwi ' j dw2'
1 j=0 2
dL 6 . r. A . df j
j
dt dw3 dw1 dw2 ^ J dw3
where L is the Lagrangian (1.15).
Equations (1.20) need to be supplemented with equations describing the rotation of the wheels:
d dL dL df.
.. OT +VA,—k = l,...,N, (1.21)
where Mk is the torque applied to the kth wheel.
Let us write the sixth equation of (1.20) in the explicit form
IPUJ3 = A0. (1.22)
Differentiating the constraint (1.7) yields
A0 = 0. (1.23)
Differentiating the nonholonomic constraints (1.6) and substituting the corresponding expressions into equations (1.21), we obtain explicit expressions for the undefined multipliers:
Afc = -Mk - + QJrfc, ak), k = 1, ..., N. (1.24)
Taking into account the expressions (1.23) and (1.24), the first five of equations (1.20) can be represented as
N
Sw = f + £ Mk Qk, (1.25)
k=1
where the nonzero coefficients of the matrix S are defined by the following expressions:
„ « _ « _ V" '»"¡."Î „ _ „ _ m„ , V J«'afc(Jrfc> afc)
sn - m + h2s2 ' 12 - S21 - /72s2 ' S13 - S31 - + ¿^ /72g2 ■
k=1 k k=1 k k=1 k
s14 = s41 = -mpl(a2 cos a + (32 sin a), s15 = 51 = mpl(a1 cos a + /31 sin a),
Jw(ak)2 „ _ „ „ I Jwak(Jrk, ak)
->22 - m ^2s2 ' S23 - s32 - mzl + g2
k=1 k k=1 k
s24 = s42 = —mpl(—a2 sin a + (32 cos a), s25 = s52 = mpl(—a1 sin a + cos a),
„ _ny 4»(J^fe. afc)2 33 '
s34 = s43 = mpl(d2(a2 cos a + f32 sin a) — d1(—a2 sin a + (32 cos a)), s35 = s53 = —mpl(—d2(a1 cos a + /31 sin a) — d1(—a1 sin a + /31 cos a)),
4mp l2
S44 = S55 = ^ >
and the components of the vectors f and gk have the form
/1 = mQ(v2 + z1Q) + mpl(w1 + w|)(a3 cos a + f33 sin a), f2 = — mO(vj — z2Q) + mpl(^2 + a3 sin a + cos a), /3 = —mQ(z1v1 + z2v2) + mpl(wf + w^)(d2(a3 cos a — f33 sin a) + d1 (a3 sin a + cos a)), f4 = mpl(—a2 sin a + f32 cos a)Q(v1 — d2Q) — mpl(a2 cos a + (32 sin a)Q(v2 + d1 Q) + mplg^2, f5 = —mpl(—a1 sin a + cos a)Q(v1 — d2Q) + mpl(a1 cos a + sin a)Q(v2 + d1Q) — mplg^1,
g = 0 O' T
V hsk hsk hsk
Fig. 3. The configuration of the omnidirectional platform
Next, using Eqs. (1.25), we address the problem of bringing the pendulum to the vertical position. As an example we consider a four-wheeled platform which is characterized by the
symmetric position of the wheels (see Fig. 3):
ri = (a, b, 0), V2 = (-a, b, 0), r3 = (-a, -b, 0), r4 = (a, -b, 0),
<*i = a3= oj, a2 = a4= 0 j , (1.26)
tk = (0, 1, 0), nk = (-1, 0, 0) k = 1, 2, 3, 4.
In addition, we assume that the point of support of the pendulum is at the center of mass of the platform, i.e., d = 0, and hence, in view of (1.26), z = 0. We also fix the following parameter values:
mc = 3.5, mw = 0.05, mp = 0.1, a = l = 0.24, b = 0.15. (1.27)
2. The problem of balancing the pendulum
Consider the problem of balancing the pendulum in a given time interval T by controlling the value of the torques M1, M2, M3 and M4 applied to the omniwheels. In addition, we require that the values of velocities v1, v2, Q, w1, w2 and perhaps of the angle of rotation of the platform, a, are the same at the initial and final times t = 0 and t = T.
Thus, we have the Mayer problem with the fixed end:
F = (Y3(T) - 1)2 + (V1(T) - V1(0))2 + (V2(T) - V2(0))2 + (Q(T) - Q(0))2 +
+ K(T) - w1(0))2 + (u2(T) - w2(0))2 + p((a(T) - a(0)) mod 2n)2 ^ min (2.1)
and with the restrictions (1.25) and (1.2). In the functional (2.1) we have p = 1 if it is required that the orientation of the platform be the same at the initial and final times, and p = 0 if it is not required that the above restriction be satisfied.
We will also require that in the process of motion the pendulum not fall on the surface of the platform:
Y3(t) > 0, t e [0, T]. (2.2)
To numerically solve the problem (2.1), (1.25), (1.2), we introduce on the interval [0, T] discrete time t., j = 0, ..., n with a constant step t, and represent the control actions using piecewise linear functions:
Mk (t.,-,) - Mk (t.) jT
Mk(t) = Mk(tj) + (t- I,) " J -] " J . I G [tp tj+1), I, = J—. (2.3)
tj+1 tj n
Since in practice control torques are bounded quantities, we assume that
\Mk(t.)| < 1, k = 1, 2, 3, 4, j = 0, ..., n. (2.4)
Next, we define the values of the controls Mk(t.), k = 1, ..., 4, j = 0, ..., n which give a minimum to the functional (2.1) under the restrictions (1.25), (1.2) and (2.4). Thus, the initial problem reduces to that of constrained minimization with 4(n + 1) unknowns.
To solve the problem described above, we apply a hybrid genetic algorithm [24, 25] based on the genetic algorithm with real encoding with additional training of the leader of the population using the Davidon-Fletcher-Powell variable metric method.
Each individual (chromosome) of the genetic algorithm consists of a set of control torques Mk(t.), k = 1, ..., 4, j = 0, ..., n, and accordingly has dimension 4(n + 1). In the theory
of genetic algorithms the value of the functional (2.1) for a concrete individual is called Fitness. In order to take the restriction (2.2) into account, we will assume that
f F(T), Y3(j) > 0 yt3,j = 0,...,n Fitness = < (2.5)
1000, otherwise.
To estimate the fitness of individuals and each calculation of the value of the target function, it is necessary to solve the system of differential equations (1.25) and (1.2). To solve it numerically, we have used the Runge - Kutta - Verner method of the sixth order of accuracy with time increment At = 0.01 s.
Next, we consider several cases that differ in the initial conditions and in the motion pattern of the platform.
3. Numerical experiments
3.1. Balancing of the pendulum under deviation in one of the coordinate planes
We consider the case where the platform moves parallel to the axis OY and the pendulum lies in the plane Cyz.2 The control can be chosen so as to allow the pendulum to be brought to the vertical position.
1. The motion of the platform in the direction ±OY can be implemented using the following controls:
^1(tk) = M3 (tk) = Tu(tk), M2(tk) = M4(tk) = ±u(tk), (3.1)
where u(tk) > 0. Thus, in the case of one-dimensional motion the dimension of the optimization problem decreases four-fold.
Remark 4. The motion in the direction ±OX can be implemented using the following controls: Mi(tfc) = M2(tk) = M3(tk) = MA(tk) = Tu(tk).
To show the operation of the numerical algorithm, we choose the following initial conditions3:
X (0)= Y (0) = 0, a (0) = 0, v1(0)= v2 (0) = 0, Q(0) = 0,
w1(0) = w2(0) = 0, p(0) = p(0) = 0, 9(0) = —45°. ( . )
We will also assume that in the functional (2.1) p = 0.
The dependence of the nutation angle 9(t), which characterizes the deviation of the pendulum from the vertical, is shown in Fig. 4a. During motion the precession angle p and the angle of proper rotation p preserve zero values. The dependences of the translational velocity of the platform v2 and the angular velocity of the pendulum w1 are presented in Figs. 4b and 4c, respectively. The dependence of the control torque u(t) applied to all wheels according to (3.1) is shown in Fig. 4d. The decrease in the absolute values of the velocities of the platform and the pendulum as t ^ T is indicative of their stop at the end of the trajectory. The dependence of the ordinate of the center of the platform Y(t) is shown in Fig. 4e. During motion the component of the translational velocity v1 and the angular velocity of the platform Q preserve zero values,
2This case is an analog of the classical problem of balancing an inverted pendulum.
3It is convenient to specify the initial position of the pendulum by using Euler angles and then transforming them to the redundant variables a, ¡3, y.
Fig. 4. The result of solution to the problem of bringing the pendulum to the vertical position under the initial conditions (3.2) and restrictions on controls (3.1). (a) Dependence of the angle of deviation (nutation) of the pendulum 6(t). (b) The component v2 of the translational velocity of the platform. (c) The component of the angular velocity of the pendulum. (d) Optimal control u(t) for the platform moving along the axis OY. (e) Dependence of the ordinate of the platform, Y(t), as it moves along the axis OY
and thus the orientation of the platform in space remains unchanged. The component w2 of the angular velocity of the pendulum also preserves zero value.
2. To check the adequacy of the model and the algorithm for solving the problem of balancing, we consider a problem similar to the preceding one, but with an independent control of all four omniwheels.
Suppose that at the initial time the state of the system is determined by the same initial conditions (3.2), but the values of the control torques M1(tk), M2(tk), M3(tk) and M4(tk) are given independently. In this case, we obtain the solution presented in Figs. 5-8.
0.1 0.2 0.3 0.4
(a)
0.1 0.2 0.3 0.4 0.5
(b)
0.1 0.2 0.3 0.4 0.5
(c)
0.1 0.2 0.3 0.4 0.5
(d)
0.1 0.2 0.3 0.4 0.5
(e)
Fig. 6. (a) Time dependence of the component v1 of the translational velocity. (b) Time dependence of the component v2 of the translational velocity. (c) Time dependence of the angular velocity Q of the platform. (d) Time dependence of the component w1 of the angular velocity of the pendulum. (e) Time dependence of the component w2 of the angular velocity of the pendulum
Mk-M1
0 0.1 0.2 0.3 0.4 0.5
(a)
-Mx
M2
NX- /ft).
X?» S J
\ /
M4-MJ / V
'0 0.1 0.2 0.3 0.4 0.5 (b)
Fig. 7. (a) Time dependence of the control torque Ml. (b) Deviation of the values of the control torques M2, M3, M4 from the torque Mx
A comparison of Fig. 4a and Fig. 5a, Fig. 4b and Fig. 6b, Fig. 4c and Fig. 6d shows that the dependences of the nutation angle 9, the component v2 of the translational velocity of the point C of the platform and of the component of the angular velocity u1 of the pendulum are in qualitative agreement with each other. In addition, the control actions are in qualitative agreement as well (see Figs. 4d and 7). Since the minimization problem is solved numerically with some accuracy,
the control torques applied to different wheels differ only slightly (see Fig. 7b). Mismatch of the control torques gives rise to nonzero values of the component v1 of the translational velocity of the point C of the platform (see Fig. 6a), the angular velocity Q of the platform (see Fig. 6c) and the component w2 of the angular velocity of the pendulum (see Fig. 6e).
At the end point of the trajectory the deviation of the pendulum from the vertical is about 1-1.5°. For this deviation y3 = cos 9 > 0.9996, which corresponds to the values of the target function (2.1) on the level set 10_4 ... 10_3 for p = 0.
The omnidirectional platform is a fairly mobile device, and in the time of balancing of the pendulum equal to 0.55 sec with given mass-dimensional characteristics [23] and Mk £ [—1, 1] the platform overcomes the distance & 0.6 m (see Fig. 8a). A slight mismatch of the control torques gives rise to small deviations from straight-line motion (see Fig. 8b).
Fig. 8. (a) Time dependence of the ordinate Y of the point C of the platform. (b) Trajectory of the point C of the platform
Thus, despite the fact that in this case the platform was capable of performing an arbitrary motion in the plane, we obtained, as the optimal motion, the motion close to that along the axis OY, which is similar to that shown in Fig. 4e. This confirms the consistency of the two-dimensional and three-dimensional models of the system and the adequacy of the algorithm for solving the control problem.
When it comes to solving the problem of optimization, the problem with independent controls is the most difficult of those considered in this paper. This is due to some special features of the operation of the genetic algorithm. Specifically, since there is the possibility of an arbitrary motion and independently specifying the torques M1(tk), M2(tk), M3(tk) and M4(tk), the solution for which the cart moves only along one axis and M1(tk) = M2 (tk) = M3 (tk) = M4 (tk) is an optimal solution.
3.2. Spatial balancing of the pendulum
Consider the case where the deviation of the pendulum occurs not in the coordinate planes Cxz or Cyz. As shown in [22, 23], the omnidirectional platform is completely controllable and has the possibility of performing an arbitrary motion in the horizontal plane, and this motion is guaranteed by independently specifying the control torques M1(tk), M2(tk), M3(tk), M4(tk).
Let us define the following initial conditions:
X (0)= Y (0) = 0, a (0) = 0, vi(0)= V2 (0) = 0, Q(0)=0, w1(0) = w2(0) = 0, ^(0)=20°, 9(0) = 15°, ^(0) = 0.
At the initial and end points of the trajectory, the components v1, v2 of the translational velocity of the platform, the angular velocity Q of the platform and the components w1, w2 of the
angular velocity of the pendulum are zero (see Fig. 9). This indicates that the platform stops at the end point of the trajectory (see Fig. 10b).
Fig. 9. (a) Time dependences of the components v1 and v2 of the translational velocity of the point C of the platform. (b) Dependence of the angular velocity Q of the platform. (c) Time dependences of the components w1 and w2 of the angular velocity of the pendulum
One can clearly see from the change in the angular velocity Q in Fig. 9b that, in addition to performing translational motion, the platform rotates by changing its orientation in space. The components v1 and v2 of the translational velocity lie in the interval [—1.4, 0.6], and over certain segments of the trajectory |Q| exceeds 8 rad/sec. As a result, to correctly solve the optimization problem, it is necessary to increase the discretization frequency of the control torques (step t). However, a decrease in the value of t leads to a growth of time and computational expenditures for the search for an optimal control and balancing of the pendulum. In addition, to ensure a correct numerical solution of the equations of motion, the step of integration with respect to time must not exceed 0.01 s.
Fig. 10. (a) Time dependences of the precession angle ^ and the nutation angle 9. (b) Trajectory of the point C of the platform. (c) Time dependences of control torques
Figure 10c shows the time dependences of the control torques ensuring the motion described above. Figure 10a shows the time dependences of the nutation angle 9 and the precession angle It can be seen from Fig. 10a that the found control ensures that the pendulum is brought to a position close to the vertical one.
3.3. Spatial balancing of the pendulum with preservation of the direction of motion and the velocity of the platform
We now consider the problem of bringing the pendulum to the vertical position under the condition that the orientation of the platform be the same at the initial and final times. For this, we set p = 1 in the functional (2.1). Let us define the initial conditions
X (0) = Y (0) = 0, a(0) = 45°, u1(0) = 1, v2(0) = 0, Q(0) = 0, w1(0) = w2(0)=0, p(0) = 15°, 9(0) = 35°, ^(0) = 0.
(3.4)
The result of the solution of the optimization problem is presented in Figs. 11 and 12. In Fig. 11a it is clearly seen that the components v1 and v2 of the translational velocity of the platform at the initial and end points of the trajectory have similar values. In addition, the angular velocities of the platform Q and the pendulum are close to zero (see Figs. 11b and 11c).
2.5 2 1.5 1
0.5 0
-0.5 -1 -1.5,
/ \ \
/ \
\ \ /v2
\ \ *
N -...... /
0 0.1 0.2
0.3
(a)
0.4 0.5
w2 / \
/'.....\.........:............
.......... \.......:..........
—. • \ /
\ t \ \ / » ; / / v y
\y V / r
...............;.............y....... AI
.....:..........f\j
0.1 0.2
0.3
(c)
0.4 0.5
Fig. 11. (a) Time dependences of the components v1 and v2 of the translational velocity of the point C of the platform. (b) Dependence of the angular velocity Q of the platform. (c) Time dependences of the components w1 and w2 of the angular velocity of the pendulum
Fig. 12. (a) Time dependences of the precession angle p, the nutation angle 9 and the angle of rotation of the platform a. (b) Trajectory of the point C of the platform. (c) Time dependences of control torques
Figure 12a shows changes in the nutation angle 9 and the precession angle p. Figure 12a also shows a change in the rotation angle a of the platform. We see that the finite value of the angle a is close to the initial one. The trajectory of the platform which corresponds to the optimal control (see Fig. 12c) is shown in Fig. 12b. It can be seen from Fig. 12b that the initial and final segments of the trajectory have approximately the same angles of inclination of the tangents.
Given that after the balancing of the pendulum the original orientation of the platform a relative to the fixed coordinate system and the values of the components v1 and v2 of the translational velocity and the angular velocity Q are preserved, it can be concluded that the solution of the problem is correct.
4. Conclusion
In this paper, the problem of balancing an inverted spherical pendulum placed on a platform with omniwheels in a three-dimensional setting is presented. Equations of motion of the system are obtained and the possibility of balancing the pendulum by controlling the torques applied to the omniwheels is shown. To solve the problem of controlling the platform's motion and of balancing the pendulum, a hybrid genetic algorithm is applied. This algorithm uses the Runge-Kutta-Verner method of the sixth order of accuracy to solve the system of differential equations in calculating the target function.
The behavior of the platform-pendulum system is investigated for different initial and final states of the system. The possibility of balancing is shown for the case of the initial deflection of the pendulum by fairly large angles, namely, 90 = 15° ... 45°. As a rule, the results presented in [17] and obtained in a simpler, two-dimensional, setting correspond to the initial values of the deflection angle ranging from 0° to 10°.
In all cases considered above, the hybrid genetic algorithm allows an optimal control to be found. This means that in the future a real-time controller can be constructed by applying an approach similar to that described in [28]. Moreover, the possibility of preserving the prescribed direction and velocity of the motion of the platform during balancing implies that the joint problem of controlling the motion of the omnidirectional platform along the prescribed trajectory and of balancing the inverse pendulum can be considered.
In addition, the approach presented in this paper allows one to pass from the balancing of an abstract spherical pendulum to ensuring the stability of the object with a finite support area on the surface of a platform moving with variable accelerations.
In solving the problems presented it has been shown that it is possible to choose certain combinations and dependences of control torques for the omniwheels in order to ensure the predetermined type of motion of the platform, for example, straigth-line motion in the required direction. This leads to another avenue for future research — organizing a combined control which will make it possible to activate, on different trajectory segments, a certain type of control with the corresponding motion pattern: turning of the platform, straight-line motion in the chosen direction, etc.
Acknowledgments
The authors thank I. S. Mamaev, Dr. Sc. in Physics and Mathematics and Professor of RAS, A. A.Kilin, Professor and Dr. Sc. in Physics and Mathematics, and I.A.Bizyaev, Dr. Sc. in Physics and Mathematics, for useful discussions.
Appendix A. Poincare equations
Assume that the Lagrangian dynamical system is defined by generalized coordinates q = = (q1, ..., qn) and quasi-velocities w = (w1, ..., wk), which are related to the generalized
velocities by the following linear expressions:
k
(A.1)
s=1
In addition, we assume that the vector fields
d
i=1
form the closed system
[ui, uj] = cjus, i, j, s = 1, ...,k,
(A.2)
(A.3)
where cj are constants called .structural coefficients. Here the Lie bracket is defined as follows:
(A.4)
Then the equations of motion governing the evolution of quasi-velocities have the form
(A.5)
d dL s dL ifT. .
and are called the Poincaré equations [26].
n
r,s
References
[1] Lunberg, K.H. and Barton, T.W., History of Inverted-Pendulum Systems, IFAC Proc. Vols., 2010, vol. 42, no. 24, pp. 131-135.
[2] Kafetzis, I. and Moysis, L., Inverted Pendulum: A System with Innumerable Applications, in 9th International Week Dedicated to Maths. (Thessaloniki, Greece, March 2017), 12 p.
[3] Mahlstedt, B., Optimal VTOL of SpaceX's Grasshopper, Technical Report, http://cs229.stan-ford.edu/proj2012/Mahlstedt-OptimalVTOLofSpaceXsGrasshopper-FULL.pdf (Dec 2012), 26 p.
[4] Miller, P., Building a Two Wheeled Balancing Robot, USQ ePrints (2008).
[5] Kajita, S., Kanehiro, K., Yokoi, K., and Hirukawa, H. D., The 3D Linear Inverted Pendulum Mode: A Simple Modeling for a Bipedwalking Pattern Generation, in IEEE/RSJ Internat. Conf. on Intelligent Robots and Systems (IROS'2001), pp. 239-246.
[6] Sakka, S., Hayot, C., and Lacouture, P., A Generalized 3D Inverted Pendulum Model to Represent Human Normal Walking, in IEEE-RAS Internat. Conf. on Humanoid Robots (Memphis, Tenn., 2010), 7 p.
[7] Florian, R. V., Correct Equations for the Dynamics of the Cart-Pole System, Center for Cognitive and Neural Studies (2008).
[8] Brownlee, J., The Pole Balancing Problem: A Benchmark Control Theory Problem, Technical Report 7-01, Swinburne University of Technology, 2005.
[9] Yon, Y. L., Choon, L.H., and Yen, M.F. W., Stabilising an Invertedpendulum with PID Controller, MATEC Web Conf, 2018, vol. 152, Art. No. 02009, 14 p.
[10] Maneetham, D. and Sutyasadi, P., System Design for Inverted Pendulum Using LQR Control via IoT, Int. J. Simul. Multidiscip. Des. Optim., 2020, vol. 11, ID 12, 8 p.
[11] Prasad, L. B., Tyagi, B., and Gupta, H. O., Optimal Control of Nonlinear Inverted Pendulum System Using PID Controller and LQR: Performance Analysis without and with Disturbance Input, Int. J. Autom. Comput., 2014, vol. 11, no. 6, pp. 661-670.
[12] Mishra, S.K. and Chandra, D., Stabilization and Tracking Control of Inverted Pendulum Using Fractional Order PID Controllers, J. Eng., 2014, Art. ID 752918, 9 p.
[13] Kumar, E. V. and Jerome, J., Robust LQR Controller Design for Stabilizing and Trajectory Tracking of Inverted Pendulum, Procedia Eng., 2013, vol. 64, pp. 169-178.
[14] Kumar, S., Balancing a CartPole System with Reinforcement Learning: A Tutorial, arXiv:2006.04938 (2020).
[15] Chang, O., Kwiatkowski, R., Chen, S., and Lipson, H., Agent Embeddings: A Latent Representation for Pole-Balancing Networks, in AAMAS'19: Proc. of the 18th Internat. Conf. on Autonomous Agents and Multiagent Systems (Montreal, Canada, May 2019), 9 p.
[16] Lawrence, W. M., Solving XOR and Pole-Balancing Problems Using a Multi-Population NEAT, Master's Thesis, Centre of Computational Intelligence Faculty of Computing, Engineering and Media, De Montfort University, UK, 2020, 55 p.
[17] Minnaert, E., Hemmelman, B., and Dolan D., Inverted Pendulum Design with Hardware Fuzzy Logic Controller, J. Syst. Cybern. Inf., 2017, vol. 6, no. 3, pp. 34-39.
[18] Abdulbasid, I., Mukhtar, H., and Mustapha, M., Hybrid Fuzzy Control of Nonlinear Inverted Pendulum System, Bayero J. Eng. Technol, 2019, vol. 14, no. 2, pp. 200-208.
[19] Bratishchev, A. V., Control of Fluctuations of Pendulum on the Mobile Platform, Differential Equations and Control Processes, 2020, no. 4, pp. 76-87 (Russian).
[20] Oliveira, H. P., Sousa, A. J., Moreira, A. P., and Costa, P. J., Dynamical Models for Omni-Directional Robots with 3 and 4 Wheels, in Proc. of the 5th Internat. Conf. on Informatics in Control, Automation and Robotics (ICINCO'2008), pp. 189-196.
[21] Karavaev, Yu. L. and Kilin A. A., The Dynamics and Control of a Spherical Robot with an Internal Omniwheel Platform, Nelin. Dinam., 2015, vol. 11, no. 1, pp. 187-204 (Russian).
[22] Borisov, A. V., Kilin, A. A., and Mamaev, I.S., An Omni-Wheel Vehicle on a Plane and a Sphere, Nelin. Dinam., 2011, vol. 7, no. 4, pp. 785-801 (Russian).
[23] Kilin, A. A. and Bobykin, A.D., Control of a Vehicle with Omniwheels on a Plane, Nelin. Dinam., 2014, vol. 10, no. 4, pp. 473-481 (Russian).
[24] Tenenev, V. A. and Paklin, N.B., Hybrid Genetic Algorithm with Additional Leader Training, Intellect. Sist. Proizv., 2003, no. 2, pp. 181-206 (Russian).
[25] Tenenev, V.A. and Yakimovich, B.A., Genetic Algorithms in System Modeling, Izhevsk: IzhGTU, 2010 (Russian).
[26] Borisov, A. V. and Mamaev, I. S., Rigid Body Dynamics: Hamiltonian Methods, Integrability, Chaos, Izhevsk: R&C Dynamics, Institute of Computer Science, 2005 (Russian).
[27] Landau, L. D. and Lifshitz, E. M., Course of Theoretical Physics: Vol. 1. Mechanics, 3rd ed., Oxford: Pergamon, 1976.
[28] Vetchanin, E. V., Tenenev, V. A., and Shaura, A. S., Motion Control of a Rigid Body in Viscous Fluid, Computer Research and Modeling, 2013, vol. 5, no. 4, pp. 659-675 (Russian).
[29] Kilin, A. A. and Bobykin, A.D., Control of a Vehicle with Omniwheels on a Plane, Nelin. Dinam., 2014, vol. 10, no. 4, pp. 473-481 (Russian).