Volume 16, Issue 1 pp. 79-93
ORIGINAL RESEARCH PAPER
Open Access

Gravity compensation and optimal control of actuated multibody system dynamics

Saeed Rafee Nekoo

Saeed Rafee Nekoo

GRVC Robotics Lab., Universidad de Sevilla, Seville, Spain

Search for more papers by this author
José Ángel Acosta

Corresponding Author

José Ángel Acosta

GRVC Robotics Lab., Universidad de Sevilla, Seville, Spain

Correspondence

José Ángel Acosta, GRVC Robotics Lab., Universidad de Sevilla, Seville, 41092, Spain.

Email: [email protected]

Search for more papers by this author
Anibal Ollero

Anibal Ollero

GRVC Robotics Lab., Universidad de Sevilla, Seville, Spain

Search for more papers by this author
First published: 21 October 2021
Citations: 2

Abstract

This work investigates the gravity compensation topic, from a control perspective. The gravity could be levelled by a compensating mechanical system or in the control law, such as proportional derivative (PD) plus gravity, sliding mode control, or computed torque method. The gravity compensation term is missing in linear and nonlinear optimal control, in both continuous- and discrete-time domains. The equilibrium point of the control system is usually zero and this makes it impossible to perform regulation when the desired condition is not set at origin or in other cases, where the gravity vector is not zero at the equilibrium point. The system needs a steady-state input signal to compensate for the gravity in those conditions. The stability proof of the gravity compensated control law based on nonlinear optimal control and the corresponding deviation from optimality, with proof, are introduced in this work. The same concept exists in discrete-time control since it uses analog to digital conversion of the system and that includes the gravity vector of the system. The simulation results highlight two important cases, a robotic manipulator and a tilted-rotor hexacopter, as an application to the claimed theoretical statements.

1 INTRODUCTION

This paper declares that gravity compensation is necessary for continuous- and discrete-time optimal control. The common form of optimal control design considers the total system dynamics information for constructing the control law, Figure 1a. This generates a problem for regulation to desired conditions rather than equilibrium points or systems with non-zero gravity at the equilibrium point. We propose the gravity compensation in control law, Figure 1b, and prove that the stability of the system will be guaranteed for the total system using a common form of Lyapunov function, V ( x ) = x T K ( x ) x where K ( x ) is the optimal gain of the Riccati equation. Then we show the cost of this compensation and its deviation from optimality.

Details are in the caption following the image
Block diagram of pure optimal control and the one with gravity compensation

Gravity compensation is an important subject in robotics and multibody system dynamics, addressed by case-dependent novel mechanical designs; or controller-based mechanisms in the literature [1, 2]. It is usually difficult to compensate for the exact force [3]. The compensating mechanical design increases the total weight of the system though the actuation efficiency balances the cost-effectiveness of this point of view. The compensation mechanism was applied to counterbalance the constant weight of the system; however, for practical use, a mechanism for weight variation is necessary since the moving mechanism changes the centre-of-mass (CoM) of different parts [4]. Nakamoto and Matsuhira presented a collaborative manipulator with a gravity compensation mechanism compatible with the variation of load [5]. The idea was to use joint driving motors as counterweights in a compact design. The use of the gravity compensating mechanisms is quite diverse such as machining with manipulators [6], cooperative dual-arm robot [7], deployable mesh antenna [8] etc. Yun et al. researched the compensation mechanism for a dual-arm cooperative manipulator which was subjected to variable weight due to the change of the waist of the robot, or in other words, the CoM of the system [7]. Ugartemendia et al. investigated gravity compensation in rehabilitation robotics [9]. It was concluded that it is a mandatory feature in mechatronics systems for rehabilitations to present a neutral motion feeling for the people subjected to treatment.

On the one hand, it is not always possible to compensate the gravity with a mechanical mechanism due to space limitation, increase in the weight of the total system, cost-effectiveness of the design etc. On the other hand, some systems need gravity compensation, that is, unmanned aerial vehicles (UAVs), helicopters, autonomous underwater vehicles (AUVs) etc. For the later systems, gravity cannot be compensated mechanically; it needs additional thrust, force, or input signal. So, the gravity compensation is studied here, as a control point of view in the optimal input law. The proportional derivative (PD) control is a well-established method for independent control of the actuators, as a non-model-based approach. The structure is also simple, and the constant control gains are responsible for the tuning of the system in question. Appling a PD for systems working under gravity effect, that is, a spatial manipulator, requires high gains for achieving the regulation or trajectory tracking [10]. The classical nonlinear method, PD plus gravity is a good solution to address this problem, avoiding high gain selection [11]. Sliding mode control (SMC) [12], and feedback linearization (FL) [13, 14], are nonlinear controllers with gravity compensation mechanisms, naturally embedded inside the control law; though particular methods were introduced to study this subject as well. De Luca and Panzieri presented an iterative scheme for compensation of the gravity for flexible link manipulators [15]. The learning part found a feedforward term (a signal for gravity compensation) for cases that the modelling was not precise and the load at the end-effector was unknown. The same approach was extended under the input saturation constraint [16]. Bembli et al. applied terminal sliding mode control on a two-DoF exoskeleton limb to gain robust characteristics in gravity compensation [17].

Optimal control usually considers zero equilibrium point and constructs Hamiltonian function and applies a cost function to reach optimal control law. The control law is unified and includes all the system dynamics. On the contrary to PD plus gravity, FL and SMC, in optimal control policies, the gravity is inside the gain and re-scaled (enhanced or weakened). Razmi and Macnab presented a neural network near-optimal control with compensated gravity [18]. The performance was shown by comparison with a linear quadratic regulator (LQR), in which better results were gained after 400 learning iterations.

Adding feedforward gravity compensator to state-dependent Riccati equation (SDRE) controller was reported [19-21]; however, the stability proof only concerned the pure optimal control part (without feedforward gravity). This made the stability discussion vulnerable to severe criticism and also deviated from the results from optimality. So, the works [19-21], were not considered gravity in the stability proof. Here in this work, the stability proof and optimality analysis are addressed with the gravity compensation mechanism. The same subject is open in discrete-time control laws which include the gravity in the system in analog to digital (A/D) conversion of the system matrices. More clarification and the main contribution of this work will be presented in Section 2.

Section 2 expresses the problem statements. Section 3 reports the SDRE controller with stability and optimality analysis. Section 4 presents the same topic for the discrete-time domain. Simulation results for continuous- and discrete-time domains were shown in Section 5. Concluding results are summarized in Section 6.

2 THE DEFINITION OF THE SYSTEM AND MOTIVATION

An actuated-dynamical-multibody-mechanical system (robotic manipulator, multirotor aerial system, underwater vehicle, aircraft etc.) possesses a general second-order differential equation, usually in the form of:
M q q ̈ + c q , q ̇ + d q , q ̇ + g q = u , (1)
where q ( t ) R N is the generalized coordinate vector, N represents the degree-of-freedom (DoF) of the system, M ( q ( t ) ) : R N R N × N represents inertia, c ( q ( t ) , q ̇ ( t ) ) : R N × R N R N is the Coriolis and centrifugal vector, d ( q ( t ) , q ̇ ( t ) ) : R N × R N R N collects the terms related to friction, aerodynamics, drag etc., g ( q ( t ) ) : R N R N is gravity vector and u ( t ) R M includes the input force, moments, thrust, etc. in which M = N for fully actuated cases and M < N for under-actuated ones.
Selecting the state-vector as x ( t ) = [ q T ( t ) , q ̇ T ( t ) ] T , the state-space reduced-order differential equation is obtained:
x ̇ = f x + B x u = q ̇ M 1 q c q , q ̇ + d q , q ̇ + g q + 0 M 1 q u . (2)

Remark 1.It is common to assume that the equilibrium point of the system (2) is considered zero f ( 0 ) = 0 . This condition shows that i.e. an elevator mechanism (without physical weight compensation) is at an equilibrium point when all the coordinates are zero that results g ( 0 ) = 0 , which is on the ground. For other cases such as a multirotor drone, there is always a constant gravity force applying on the system g which violates the equilibrium condition f ( 0 ) 0 , see Figure 2. For a robotic manipulator, a configuration represents the equilibrium point in which the same condition holds, zero gravity, although the home position is usually a different configuration, see Figure 3. Note that gravity vector in robotic manipulators is not usually zero even at the equilibrium point, g ( 0 ) 0 , due to existence of trigonometric functions such as cosine function, cos 0 = 1 . So, there exist systems that correspond to f ( 0 ) 0 .

Remark 2.The regulation between two arbitrary points in the workspace, not necessarily regulation to the equilibrium point, results in g ( q des ) 0 , and consequently f ( x des ) 0 where index “des” represents the desired condition.

The error of the system is defined by e ( t ) = x ( t ) x des ( t ) and an arbitrary closed-loop negative-feedback control is considered:
u = X · e . (3)
where X ( · ) is linear/nonlinear stable control gain, for example LQR [22], PD, robust finite-time feedback linearization [23], H-infinity control [24] etc. To keep the system at rest, after the regulation to the desired condition, additional input is necessary since for a controllable system lim e 0 u ( e ) = 0 , where lim x x des f ( x ) 0 .
Details are in the caption following the image
The schematic view of a multirotor UAV in regulation
Details are in the caption following the image
The schematic view of a robotic manipulator in regulation
So, a control law:
u = X · e + g q , (4)
is required to compensate the gravity of the system after the regulation, to keep the system in a steady-state condition. PD plus gravity, computed torque method, feedback linearization, and sliding mode control have the compensating part in the design.
Case 1: In continuous-time optimal control, that is, LQR or the state-dependent Riccati equation, the design, and optimal control is based on the representation of the System (1) as a linearized system:
x ̇ = Ax + Bu , (5)
for LQR or a state-dependent coefficient (SDC) representation:
x ̇ = A x x + B x u , (6)
for SDRE. The corresponding optimal control law also covers the gravity inside the overall gain, similar to Equation (3).

Case 2: In discrete-time control, the Z-transform is done based on the linearized system (5) for the entire time of simulation or nonlinear SDC representation of the system (6) at each time step of simulation during the regulation. In the discrete case, the gravity vector is also inside the system matrices A or A ( x ( t ) ) and the control law possesses the digital version of input law (3).

In both cases 1 and 2, it is clear that the regulation to an arbitrary point, except to equilibrium point, results in zero error and therefore, zero control signal. So, how the system should compensate for the gravity to keep the system there. For the sake of brevity, the general nonlinear form A ( x ( t ) ) will be presented that includes the linear case A as well.

The main contribution of this work is to answer:
  • - Could we exclude the gravity from the system and then compensate it in control law, similar to Equation (4), in continuous optimal control? How does it violate stability or optimality?
  • - In discrete-time control, could we do the same gravity compensation? How should we manage it since the Z-transformed matrices are on the digital scale and the gravity vector is in the continuous-time domain?

In Section 3, the stability proof and optimality discussion for a control law in the type of (4) are provided and Section 4 presents the discrete version and its solution method.

3 THE CONTINUOUS-TIME SDRE CONTROLLER

The system in question is mechanical, Equation (2), for implementing nonlinear optimal control with gravity compensation and proof of stability and optimality. Excluding the gravity from the system, one could consider a nonlinear autonomous affine-in-control system as
x ̇ = A x x + B x u + g r x , (7)
where u ( t ) R m is an input vector and x ( t ) R n is a state vector. g r ( x ( t ) ) : R n R n includes all terms related to gravity, A ( x ( t ) ) : R n R n × n and B ( x ( t ) ) : R n R n × m are state-dependent coefficient parameterization of a nonlinear system x ̇ ( t ) = f ( x ( t ) ) + g ( x ( t ) , u ( t ) ) + g r ( x ( t ) ) where f ( x ( t ) ) : R n R n , g ( x ( t ) , u ( t ) ) : R n × R m R n , and g r ( x ( t ) ) are piecewise-continuous vector-valued functions that satisfy the Lipschitz condition:
A ( x ) = 0 I 0 M 1 q C q , q ̇ + D q , q ̇ , B ( x ) = 0 M 1 q , g r x = 0 M 1 q g q ,
in which c ( q , q ̇ ) = C ( q , q ̇ ) q ̇ and d ( q , q ̇ ) = D ( q , q ̇ ) q ̇ are held. The Lipschitz condition expresses that the components inside SDC matrices have bounded first derivatives [25], which implies the dynamic components of the system are limited to linear growth.
The dimension of the system is n = 2 N and m = M . The cost functional integral of continuous-time optimal control is1:
J c · = 1 2 x T t f F x t f x t f + 0 t f x T Q x x + u g q T R x u g q d t 0 t f , (8)
where Q ( x ( t ) ) : R n R n × n is symmetric positive semi-definite weighting matrix for states in t [ 0 , t f ) , F ( x ( t f ) ) R n × n is symmetric positive semi-definite weighting matrix for states at t = t f , and R ( x ( t ) ) : R n R m × m is symmetric positive definite weighting matrix for inputs in t [ 0 , t f ] .

Assumption 1.(Controllability condition, continuous-time domain). The pair of { A ( x ( t ) ) , B ( x ( t ) ) } is a completely controllable parameterization of a nonlinear system (7) [26].

Assumption 2.(Observability condition, continuous-time domain). The pair of { A ( x ( t ) ) , Q 1 / 2 ( x ( t ) ) } is a completely observable parameterization of a nonlinear system (7) [26].

The Hamiltonian is shaped:
H x , λ , u = J c + λ T x ̇ = 1 2 u T R x u 2 g T q R x u + g T q R x g q + x T Q x x + λ T A x x + B x u + g r x , (9)
where λ is the co-state vector. Considering λ = K ( x ) x and applying the stationary condition H ( x , λ , u ) u = 0 on Hamiltonian (9) result in the control law
R x u R x g q + B T x λ = 0 u = R 1 x B T x K x x + g q , (10)
in which q x and K ( x ) : R n R n × n is the symmetric positive definite control gain. The necessary condition for optimality H ( x , λ , u ) x = λ ̇ = K ̇ ( x ) x K ( x ) x ̇ and substitution of the system (7) in that, also delivers:
1 2 x T Q x T x + 1 2 u T R x T u + 1 2 g x T Rg + 1 2 g T R x g + 1 2 g x T Rg g x T Ru u T R x g + x T A x T + u T B x T + g r x T Kx + KBg + K g r + K ̇ + KA + A T K KB R 1 B T K + Q x = 0 ,
which could be simplified considering g r ( x ) = B ( x ) g ( q ) as:
1 2 x T Q x T x + 1 2 u T R x T u + 1 2 g T R x g + g x T Rg g x T Ru u T R x g + x T A x T + u T B x T + g r x T Kx + K ̇ + KA + A T K KB R 1 B T K + Q x = 0 . (11)
Substituting control law (10), and [ g ( q ) ] m × 1 = [ G ( x ) ] m × n [ x ] n × 1 , into Equation (11), we will find:
1 2 x T Q x T x + 1 2 x T KB R 1 R x T R 1 B T Kx 1 2 x T KB R 1 R x T Gx 1 2 x T G T R x T R 1 B T Kx + 1 2 x T G T R x T Gx + 1 2 x T G T R x Gx + g x T RGx + g x T R R 1 B T Kx g x T RGx + x T KB R 1 R x Gx x T G T R x Gx + x T A x T x T KB R 1 B x T + x T G T B x T + g r x T Kx + K ̇ + KA + A T K KB R 1 B T K + Q x = 0 ,
which can be rewritten considering [ R x ] T = R x and R R 1 = I :
1 2 x T Q x T x + 1 2 x T KB R 1 R x T R 1 B T Kx + g x T B T Kx + x T A x T x T KB R 1 B x T + x T G T B x T + g r x T Kx + K ̇ + KA + A T K KB R 1 B T K + Q x = 0 . (12)
Since there are matrix derivatives in Equation (12), it should be rewritten (using x T [ Q x ] T = [ Q x x ] T [27]) to deliver a compatible version to the SDRE and avoid having tensor:
1 2 Q x x T + 1 2 R x R 1 B T Kx T R 1 B T K + g x T B T K + A x x T B x R 1 B T Kx T + B x Gx T + g r x T K x + K ̇ + KA + A T K KB R 1 B T K + Q x = 0 . (13)
Equation (13) is divided into two parts, first one, the “SDRE necessary condition for optimality” [28]:
1 2 Q x x T + 1 2 R x R 1 B T Kx T R 1 B T K + g x T B T K + A x x T B x R 1 B T Kx T + B x Gx T + g r x T K x Λ x x , (14)
where Λ ( x ) is an upper-bound matrix. The reason for representing (14) as a matrix is compatibility with the dimension of the SDDRE as:
Λ n × n x x n × 1 + SDDRE n × n x n × 1 = 0 .
The matrix derivatives could be found in Ref. [19]; it was stated that Equation (14) possesses a negligible value [29]. The second part of (13) shapes the state-dependent differential Riccati equation [19, 30]:
K ̇ x = K x A x + A T x K x K x B x R 1 x B T x K x + Q x , (15)
with K ̇ ( x ( t f ) ) = F ( x ( t f ) ) . For a N-DoF system, N ( 2 N + 1 ) equations must be solved to find K ( x ) .

Remark 3.The general form of gravity compensated control (10) is:

u = R 1 x B T x K x x x des + g q ,

where lim x x des e = 0 ; similar to Equation (10) when x 0 ; so, for the sake of simplicity in the derivation process, we consider control law (10) in the derivation. Considering Remark 1, for manipulators with g ( 0 ) 0 , and cases in which the desired condition is shifted from zero to another position, the application of the proposed control law (10) preserves the generic view of the approach.

Remark 4.The gravity compensation was used in the literature, that is, Refs. [19, 21], however, the stability/optimality proof for the new form (10) was not presented. Theorem 1 and 2 are addressing the proofs.

Theorem 1.(Stability) The nonlinear system (7), considering Assumptions 1 and 2 and quadratic cost function (8), can be controlled by the gravity-compensated input law (10) in which K ( x ) is the symmetric positive definite solution to SDDRE (15) in finite time t [ 0 , t f ] , subjected to boundary condition K ̇ ( x ( t f ) ) = F ( x ( t f ) ) .

Proof.A Lyapunov candidate is used, V ( x ) = x T K ( x ) x > 0 , concerning V ( 0 ) = 0 , to prove the stability by computing the first derivative and following condition V ̇ ( x ) 0 :

V ̇ x = x ̇ T K x x + x T K ̇ x x + x T K x x ̇ . (16)

Substituting, x ̇ from Equation (7) and K ̇ ( x ) from Equation (15) into Equation (16), results in:
V ̇ x = x T A T x K x x + u T B T x K x x + g r T x K x x x T K x A x x x T A T x K x x + x T K x B x R 1 x B T x K x x x T Q x x + x T K x A x x + x T K x B x u + x T K x g r x ,
which can be simplified as:
V ̇ x = u T B T x K x x + g r T x K x x + x T K x B x R 1 x B T x K x x x T Q x x + x T K x B x u + x T K x g r x . (17)
Replacing the control law (10) into Equation (17) provides:
V ̇ x = g T q B T x K x x + g r T x K x x x T Q x x x T K x B x R 1 x B T x K x x + x T K x B x g q + x T K x g r x . (18)
Considering that g r ( x ) = B ( x ) g ( q ) , Equation (18) is rewritten as:
V ̇ x = g T q B T x K x x g T q B T x K x x x T Q x x x T K x B x R 1 x B T x K x x + x T K x B x g q x T K x B x g q = x T K x B x R 1 x B T x K x + Q x x 0 ,
which is negative definite and that concludes the proof.

Remark 5.The effect of gravity compensation on stability was checked in Theorem 1 and proved that the gravity compensated control law (10) guarantees stability similar to the case when the gravity is inside A ( x ) matrix. The new form answers the main intention of this work, to provide the signal after reaching the desired condition x des ( t ) , which was not possible in previous versions. The use of gravity compensation was reported though the stability was not discussed with input law (10) substituted into the Lyapunov function.

The next subject is that how much we deviate from the optimality. The linearized system A = f ( x ) x | x = 0 , B = g ( x , u ) u | x = 0 , and constant weighting matrices R and Q provide the optimal control for the algebraic matrix Riccati equation at equilibrium point x = 0 with the constant gain K. The solution K ( x ) to the SDDRE tends to the optimal value near the equilibrium point f ( 0 ) wherein a sufficiently small neighborhood we are close to optimality [31]. Assumption 3 is an extended form which was previously stated in Ref. [31], without the excluded gravity vector g r ( x ) . Theorem 2 is also an extended representation of asymptotically optimal results, presented for the systems without gravity compensation [28].

Assumption 3.The matrices A ( x ) , B ( x ) , g ( q ) , Q ( x ) , R ( x ) and K ( x ) and their gradients Q ( x ) x , R ( x ) x , A ( x ) x , g ( q ) x are bounded in a neighborhood around the equilibrium point.

Theorem 2.(Optimality). Considering Assumption 3 and guaranteed gravity-compensated control law (10), for the system (7), limited to cases with g ( 0 ) = 0 and constant g . , the necessary condition for optimality H ( x , λ , u ) x = λ ̇ is asymptotically satisfied near the equilibrium point when x 0 , with a quadratic rate with respect to x.

Proof.To prove the optimality, the three conditions, obtained from Pontryagin's minimum principle, must be held. Considering Hamiltonian function (9), the first necessary condition for optimality results in:

H x , λ , u λ = A x x + B x u + g r x = x ̇ .

The stationary condition also provides:
H x , λ , u u = 0 R x u R x g q + B T x λ = 0 . (19)
Substituting control law (10) and λ = K ( x ) x into stationary condition, Equation (19), obtains:
R x R 1 x B T x K x x + g q R x g q + B T x K x x = 0 ,
which verifies H ( x , λ , u ) u = 0 . Based on Theorem 2, the second necessary condition for optimality must be asymptotically satisfied in a quadratic rate for x. Substituting λ ̇ = K ( x ) x ̇ + K ̇ ( x ) x into λ ̇ = H ( x , λ , u ) x results in Equation (11).

Since we solve the SDDRE (15) to obtain the symmetric positive definite gain K ( x ) , H ( x , λ , u ) x = λ ̇ turns into Equation (14).

Regarding q x , and using g ( x ) = G ( x ) x , also substituting control law (10) into Equation (14), result in:
1 2 x T Q x T x + 1 2 x T KB R 1 R x T R 1 B T Kx + g x T B T Kx + x T A x T x T KB R 1 B x T + x T G T B x T + g r x T Kx Λ x x ,
which can be rewritten as a quadratic form:
x T Π x x : = x T 1 2 Q x T + 1 2 KB R 1 R x T R 1 B T K + x T g x T B T K + A x T KB R 1 B x T + G T B x T + x T g r x T K x , (20)
where x is generalized-inverse of x and that plays the role of factorization from the matrices ( g x ) T and [ g r x ] T . Under the boundedness of matrices and their derivatives, in Assumption 3, and guaranteed stability in Theorem 1, there is a constant positive definite matrix such that [30]:
max x T Π x x x T Υ x , (21)
where Υ is a positive constant matrix and that shows Equation (7) is asymptotically satisfied (bounded above) with a quadratic rate, and consequently H ( x , λ , u ) x = λ ̇ holds near x 0 .
There are three possible cases for gravity:
  1. g ( 0 ) = 0 , when g ( q ) includes direct position coordinate or sin ( · ) function which results in G ( 0 ) = 0 , since lim q = 0 sin ( q ) q = 0 . In this case, the optimality discussion is straightforward and is based on the presented proof.

  2. g ( 0 ) 0 , when g ( q ) includes i.e. cos ( · ) function (robotic manipulators). Since lim q = 0 cos ( q ) q = , the gravity parameterized matrix tends to infinity G ( 0 ) = , for the system with f ( 0 ) 0 , the necessary condition for optimality, Equation (20), is not satisfied and Π ( 0 ) , so we cannot find a upper-bounded matrix Υ for the case of f ( 0 ) 0 .

  3. Optimality for a special case, flying objects. Theorem 2 stated that if g ( 0 ) 0 , the necessary condition for optimality is not satisfied; however, there is a special case for systems with constant g . where we have the optimality. For that case, we consider constant gravity and put the derivatives equal to zero, then Equation (20) turns into:

    x T Π x x : = x T 1 2 Q x T + 1 2 KB R 1 R x T R 1 B T K + A x T KB R 1 B x T + G T B x T + x T g r x T K x . (22)

Substituting g r into Equation (22) results in
x T Π x x : = x T 1 2 Q x T + 1 2 KB R 1 R x T R 1 B T K + A x T KB R 1 B x T K x . (23)
in which ( x ) T [ g r x ] T = ( x ) T x T G T [ B x ] T cancels the gravity term and provides the upper-bounded condition (21) similar to case (a) g ( 0 ) = 0 . So, for the drones, i.e. one example presented in Section 5, the optimality condition is satisfied.

The conclusion is that optimality, based on Theorem 2, is satisfied for systems with f ( 0 ) = 0 and systems with the constant gravity vector. However, stability is guaranteed for all systems f ( 0 ) = 0 and f ( 0 ) 0 since the control law and Lyapunov function use g ( q ) without factorization. That concludes the optimality proof. The deviation from optimality for case (a) is defined by Equation (20) and for case (c) is computed by Equation (23). It is clear that lim x 0 x T Π ( x ) x = 0 .

For linear systems, the LQR problem, the optimality is completely satisfied since the gradient terms in Assumption 3 are zero. For the SDRE problem, considering the differential form of the Riccati equation, the deviation from optimality is found in the optimality proof, a negligible value; however, this value avoids naming the SDRE as an optimal controller. For that, the SDRE/SDDRE controller has been referred to as a suboptimal controller in the literature [21, 26, 3133].

4 THE DISCRETE-TIME SDRE CONTROLLER

To present the discrete-time-control design, system (7) must be transformed into discrete-time domain by the Z-transform algorithm and a sampling time T s ( s ) . Simple systems could be transformed analytically nevertheless complex ones could be transformed at each sample time after updating with measured feedback. Similar to Section 3, putting gravity inside the system matrices A ( x ) and B ( x ) imposes a glitch in implementation on systems with gravity g ( 0 ) 0 or at arbitrary desired conditions, x des 0 . So, the discretization is done on system (7).

Suppose there exists the corresponding discrete-time system:
x k + 1 = A x k x k + B x k u k , (24)
with appropriate dimensions such as (7). The initial condition, at t = 0 or first step, is x ( 0 ) = x [ 1 ] = x 0 .
Optimal control intends to minimize the cost function [34]:
J d · = 1 2 x T N d F x N d x N d + min k = N d 1 1 × x k u k T Q x k S x k S T x k R x k x k u k , (25)
and finish a control task in a finite predefined time t [ 0 , t f ] , and [ Q ( x [ k ] ) S ( x [ k ] ) S T ( x [ k ] ) R ( x [ k ] ) ] > 0 . Here in Equation (25), N d is the last step of control loop, Q ( x [ k ] ) : R n R n × n and F ( x [ N d ] ) R n × n penalize the states in k [ 1 , N d 1 ] and at N d with respect (both symmetric positive semi-definite); R ( x [ k ] ) : R n R m × m weights the inputs and is positive definite, also symmetric.

Assumption 4.(Controllability Condition, discrete-time domain). The pair of { A ( x [ k ] ) , B ( x [ k ] ) } is a completely controllable parameterization of the system (24).

Assumption 5.(Observability Condition, discrete-time domain). The pair of { A ( x [ k ] ) , Q 1 / 2 ( x [ k ] ) } is a completely observable parameterization of the system (24).

The minimization of Equation (25) starts from N d , the last step of control loop backward in time. Introducing a solution K ( x [ k ] ) in a Lyapunov function
V k = x T k K x k x k ,
and computing the next step, result in:
V k + 1 = x T k + 1 K x k + 1 x k + 1 . (26)
System (24) is substituted in Equation (26)
V k + 1 = B x k u k + A x k x k T × K x k + 1 A x k x k + B x k u k ,
and is rewritten as:
V [ k + 1 ] = x k u k T A T x k K x k + 1 A x k A T x k K x k + 1 B x k B T x k K x k + 1 A x k B T x k K x k + 1 B x k x k u k . (27)
Expressing Hamilton-Jacobi-Bellman equation:
V * k = min u k x k u k T Q x k S x k S T x k R x k x k u k + V * k + 1 } ,
and using Equation (27), one could present:
V * k = min u k x T k u T k χ x k x k u k , (28)
where
χ x k = χ 11 x k χ 12 x k χ 12 T x k χ 22 x k = A k T K k + 1 A k + Q k A k T K k + 1 B k + S k B k T K k + 1 A k + S k T B k T K k + 1 B k + R k .
To satisfy χ ( x [ k ] ) > 0 , both χ 11 ( x [ k ] ) and χ 22 ( x [ k ] ) must be positive. Using Schur complement to force χ 22 ( x [ k ] ) > 0 , one could find [35]:
x k T χ 11 χ 12 χ 22 1 χ 12 T x k = V k = x k T K k x k . (29)
Expanding Equation (28) provides:
min u k x k T χ 11 x k + x k T χ 12 u k + u k T χ 12 T x k + u k T χ 22 u k = V k . (30)
Adding and subtracting x k T { χ 12 χ 22 1 χ 12 T } x k to Equation (30) and mathematical manipulation result in a complete square form:
min u k x k T χ 11 x k + u k + χ 22 1 χ 12 T x k T χ 22 u k + χ 22 1 χ 12 T x k x k T χ 12 χ 22 1 χ 12 T x k 1 1 = V k . (31)
It is clear that holding Equation (31), similar to Equation (29), requires u k + χ 22 1 χ 12 T x k = 0 , that generates the control law:
u k = B k T K k + 1 B k + R k 1 B k T K k + 1 A k + S k T x k , (32)
where K k + 1 is the positive definite symmetric solution to the discrete-time SDRE, resulting from Equation (29):
K x k = A k T K k + 1 A k + Q k A k T K k + 1 B k + S k × B k T K k + 1 B k + R k 1 B k T K k + 1 A k + S k T . (33)

Considering backward counting of k in Equations (32) and (33), the current loop is k and gain is updated by the K k + 1 solution, in the loop k + 1 where k counts from N d 1 to 1 .

Remark 6.Control law (32) must be used in the backward solution to find the gain K ( x [ k ] ) over discrete steps, k, that covers the time span t [ 0 , t f ] . After completing the backward solution, the control law for the forward (main) control loop is Equation (32); however, k counts forward from 1 to N d 1 .

Remark 7.The system Equation (24), for the backward solution, is changed to:

x k = A x k + 1 x k + 1 + B x k + 1 u k + 1 ,

where k counts backward from N d 1 to 1.

Implementation.It is necessary to use a digital to analog (D/A) converter to bring back the input Equation (32) to the scale of the continuous-time domain (a continuous step-like signal using, i.e. zero-order hold) and send the signal to the actuators [36]. Revisiting the main objective of this work, Equation (32) does not provide the necessary input for the system at the steady-state position or arbitrary desired condition, rather than x [ N d ] = 0 .

For practical implementation, we add the gravity after D/A conversion to the control signal:
u gc t = u t + g q t ,
where u gc ( t ) denotes gravity compensated control law and u ( t ) is the converted input of u [ k ] in Equation (32) using zero-order hold, etc. In that case, the real input signals to the actuators compensate for the gravity and control the system.
For computer simulations, the input Equation (32) is augmented by the gravity g ( q ( k ) ) , and the system:
x k + 1 = A x k x k + B x k u k B x k g q k ,
will cancel the gravity to complete the simulation.

5 SIMULATIONS

5.1 Continuous-time control, robotic manipulator

Consider a 3-DoF articulated-joint manipulator [37], see Figure 3 for a schematic view of the system. The second and third links of the manipulator are subjected to gravity. The home position of the robot requires a steady-state input for maintaining the robot in that position. The length of the links are d 1 = 0.6 , a 2 = 0.5 and a 3 = 0.4 m with respect. The mass of the links and load are m 1 = m 2 = m 3 = 2 and m p = 0.25 kg ; gravity constant is g = 9.81 m / s 2 ; the friction terms in the joints are presented by D = diag ( 0.05 , 0.05 , 0.05 ) kgm / s ; the moment of inertia of the links are I c , 1 = diag ( 6.25 × 10 4 , 6.25 × 10 4 , 0.06 ) kg m 2 , I c , 2 = diag ( 0.0417 , 6.25 × 10 4 , 6.25 × 10 4 ) kg m 2 and I c , 3 = diag ( 0.0267 , 6.25 × 10 4 , 6.25 × 10 4 ) kg m 2 with respect. The complete dynamic equation could be derived by general codes, presented in Appendix of Ref. [20].

The time of simulation was set t f = 10 s , the start point and endpoint were also defined A ( 0 , 0.2 , 0.2 ) and B ( 0.5 , 0.4 , 1.2 ) m which results in initial and final conditions in joint space:
x 0 = 1.5708 , 0.2419 , 2.1235 , 0 , 0 , 0 T ,
x t f = 0.6747 , 0.9529 , 0.4510 , 0 , 0 , 0 T .

The control parameters were chosen as R = 0.1 × I 3 × 3 , Q = diag ( 1 , 1 , 1 , 0.5 , 0.5 , 0.5 ) and F = 2 Q . An increase in Q increases the precision and reduction in R also enhances the amplitude of the input signal [21, 38]; an increase in F provides more accuracy in regulation near the final time. The configuration of the system and the trajectory are presented in Figure 4, successfully regulated to the desired condition, x des 0 and g ( x des ) 0 , with 0.0015 mm end-effector error. The input torque signals to the system are presented in Figure 5. The steady-state value of the first input was gained zero since it was not subjected to gravity based on the configuration though the other two links need gravity compensation. The norm of the input and gravity vector are illustrated in Figure 6. It is clear that without gravity compensation, the system would fail to stay at desired condition since it needs to hold the weight of the second and third links in addition to the weight of load at the end-effector.

Details are in the caption following the image
Trajectory and configuration of the robot in regulation, continuous-time control
Details are in the caption following the image
The input of the manipulator in regulation, continuous-time control
Details are in the caption following the image
The norm of the input and gravity vector

Noticing Figure 6 brings up this question that optimizing the gain for gravity is necessary or not. Considering a system with precise modelling and lack of disturbance, one knows the value of gravity in a trajectory. The necessary input for compensation of the gravity should be the closest value. Enhanced gain provides excessive use of energy and smaller gains reduce the performance. The proposed gravity compensated control law balances the known gravity value and presents an optimal control policy.

5.2 Discrete-time control, hexacopter with tilted rotors

Multirotor unmanned aerial vehicles with fixed vertical rotors can generate a total thrust parallel to the axis of the rotor. The total thrust on the body frame can be projected to the global frame providing three components, though the system is under-actuated. Cascade design is a common way to solve the under-actuation problem for multirotor UAVs [39]. The method benefits from a virtual constraint to define the desired orientation of the system for translation control. Rotating the rotor axis around the connecting rod between the motor and the centre of mass (CoM) of the UAV generates thrust in all three axes x c , y c , z c , rather than only z c , for parallel rotors. This new configuration allowed full-actuation for multirotor UAVs [40]. The schematic view of a multirotor copter with fixed titled rotors is presented in Figure 7.

Details are in the caption following the image
Schematic view of the multirotor UAV with fixed tilted rotors
The global fixed frame is named [ X , Y , Z ] and the local moving body frame is named [ x c , y c , z c ] . The orientation variables are [ ϕ , θ , ψ ] rotating around [ X , Y , Z ] with respect, considering the right-hand rule. So, the generalized coordinates of the system are selected q ( t ) = [ ξ 1 T ( t ) , ξ 2 T ( t ) ] T = [ x c ( t ) , y c ( t ) , z c ( t ) , ϕ ( t ) , θ ( t ) , ψ ( t ) ] T , ( m , rad ) . The derivatives of them (on the local body frame) are υ 1 ( t ) = [ u ( t ) , v ( t ) , w ( t ) ] T ( m / s ) and υ 2 ( t ) = [ p ( t ) , q ( t ) , r ( t ) ] T ( rad / s ) ; the angular velocities are set on [ x c ( t ) , y c ( t ) , z c ( t ) ] with respect. This definition provides the kinematics relations:
ξ ̇ 1 = R Z Y X ξ 2 υ 1 , (34)
ξ ̇ 2 = T ξ 2 υ 2 . (35)
There is an input torque vector τ B ( t ) = [ τ ϕ ( t ) τ θ ( t ) τ ψ ( t ) ] T ( N . m ) , acting against three Euler angles [ ϕ ( t ) , θ ( t ) , ψ ( t ) ] for the rotational dynamics. Fully-actuation design also provides three independent forces F B ( t ) = [ f x ( t ) f y ( t ) f z ( t ) ] T ( N ) acting against body frame [ x c , y c , z c ] . To project the local force into the global frame, the rotation matrix is used F ( ξ 2 ) = R Z Y X ( ξ 2 ) F B . Dynamics equations of motion for both translation and orientation of the UAV are found using the Lagrange method:
m ξ ̈ 1 + m g e 3 = F ( ξ 2 ) = R Z Y X ξ 2 F B , (36)
J ξ 2 ξ ̈ 2 + C ξ 2 , ξ ̇ 2 ξ ̇ 2 = τ B , (37)
where g ( m / s 2 ) is the gravity constant, m ( kg ) represents total mass and e 3 = [ 0 , 0 , 1 ] T . J ( ξ 2 ) = W T ( ξ 2 ) IW ( ξ 2 ) is an inertial matrix (in global frame) in which I = diag ( I x x , I y y , I z z ) ( kg m 2 ) is local inertia matrix; T ( ξ 2 ) = W 1 ( ξ 2 ) and [ C ( ξ 2 , ξ ̇ 2 ) ξ ̇ 2 ] is a vector consists of Coriolis and centrifugal terms.
Assuming that the regulations and tracking cases will be performed with small changes in orientation of the UAV, hovering condition, the following assumptions are valid ξ ̇ 2 ( t ) υ 2 ( t ) and ξ ̇ 1 ( t ) υ 1 ( t ) . So, the state-vector is selected as x ( t ) = [ ξ 1 T ( t ) , ξ 2 T ( t ) , υ 1 T ( t ) , υ 2 T ( t ) ] T = [ x c , y c , z c , ϕ , θ , ψ , u , v , w , p , q , r ] T . Considering the kinematic Equations (34)–(35) and the dynamics of the system Equations (36) and (37), the state-space equation is found:
x ̇ t = ξ ̇ 1 t ξ ̇ 2 t υ ̇ 1 t υ ̇ 2 t = R ZYX ξ 2 υ 1 T ξ 2 υ 2 1 / m I 3 × 3 R ZYX ξ 2 F B mg e 3 D f ξ ̇ 1 J 1 ξ 2 τ B C ξ 2 , ξ ̇ 2 ξ ̇ 2 , (38)
where υ ̇ 1 ( t ) ξ ̈ 1 ( t ) = R ̇ Z Y X ( ξ 2 ) 0 υ 1 + R Z Y X ( ξ 2 ) I υ ̇ 1 and υ ̇ 2 ( t ) ξ ̈ 2 ( t ) hold based on hovering assumption; and D f = diag ( D x , D y , D z ) ( kg / s ) denotes the aerodynamics effect [41].
Unified SDC: The state-dependent coefficient parameterization is structured based on Equation (24) on the system (38). The SDC design for under-actuated quadrotors was designed in two separate translation and orientation parts [39]; however, for the fully-actuated system in this research, a unified SDC design is proposed:
A x = 0 6 × 6 W 1 x 0 6 × 6 W 2 x , B x = 0 6 × 6 W 3 x ,
where
W 1 x = R Z Y X ξ 2 0 3 × 3 0 3 × 3 T ξ 2 , (39)
W 2 x = 1 m × D f 0 3 × 3 0 3 × 3 J 1 ξ 2 C ξ 2 , ξ ̇ 2 , W 3 x = 1 m × R Z Y X ξ 2 0 3 × 3 0 3 × 3 J 1 ξ 2 .

In hovering condition, Equation (39), is almost an identity matrix W 1 ( x ) = I 6 × 6 satisfying the proposed SDC structure.

The control law is designed based on generalized force and moments in global coordinates u ( t ) = [ F T ( ξ 2 ) τ B T ] T . To define the local force vector for applying force limitation, the following relation is used F B = R Z Y X T ( ξ 2 ) F ( ξ 2 ) .

Mixer matrix and actuator limit: The ultimate control inputs of the multirotor UAV are the voltage signals to the motors, attached to the propellers. The input voltage signals define the angular velocity of the rotors. The relation between the input force/moment vector and the angular velocities of the motor is indicated by a linear map, a mixer matrix. The mixer matrix for common quadrotors is straightforward and could be calculated easily. The mixer matrix for fixed tilted rotors, specifically with two rotations, is more complex.

To define the mixer matrix, the centre of mass of the UAV is named O and the position of the i-th motor is named O i . The distance between CoM and each motor is O O ¯ i = L ( m ) , illustrated in Figure 8. The first rotation is around z c axis is defined by λ i = ( i 1 ) π / 3 that results in the first rotation matrix. The second rotation is constant α i = ( 1 ) i 1 α , around O O ¯ i axis for all six motors; however, the sign is negative for 2, 4, and 6. The third rotation is constant β, around y 2 axis, for all motors toward the outside of the UAV:
R 1 = cos λ i sin λ i 0 sin λ i cos λ i 0 0 0 1 , R 2 = 1 0 0 0 cos α i sin α i 0 sin α i cos α i , R 3 = cos β 0 sin β 0 1 0 sin β 0 cos β .
Details are in the caption following the image
Illustration of coordinates for tilted rotors; (a) first rotation around z c , (b) second rotation around O O ¯ i , (c) third rotation around y 2 , i
The combination of the rotation matrices is:
R P , i = R 1 R 2 R 3 = c β c λ i s α i s β s λ i c α i s λ i c λ i s β + s α i c β s λ i c β s λ i + s α i c λ i s β c α i c λ i s β s λ i s α i c β c λ i c α i s β s α i c α i c β .

The third column of R P , i is named R P 3 , i .

There are three main contributing components in the mixer matrix. The first is the thrust (force) parallel to z 3 axis, presented by T i ( t ) = k ω i 2 ( t ) where k ( N s 2 / ra d 2 ) is lift constant or thrust factor and ω i ( t ) is the rotor's angular velocity of the i-th motor. Since the thrust only projects on z 3 axis, it collects the third column of the rotation matrix:
c β c λ i s α i s β s λ i c α i s λ i c λ i s β + s α i c β s λ i c β s λ i + s α i c λ i s β c α i c λ i s β s λ i s α i c β c λ i c α i s β s α i c α i c β 0 0 k ω i 2 t = R P 3 , i k ω i 2 t .
The second contributing term is the applied torque by each rotor, the cross product of thrust, and L:
L c o s λ i s i n λ i 0 × R P 3 , i k ω i 2 t .
The third contributing term of the mixer is caused by the drag force of the propellers k ψ ω i 2 ( t ) where k ψ is drag constant ( Nm s 2 / ra d 2 ) . The direction of the propellers is different for even and odd numbers that make the sign of drag force different. To assemble these three contributing components in the mixer matrix, one could shape [42]:
F B τ B 6 × 1 = k A k LG + k ψ H M X ω 2 t 6 × 1 ,
where
A = R P 3 , 1 , R P 3 , 2 , R P 3 , 3 , R P 3 , 4 , R P 3 , 5 , R P 3 , 6 3 × 6 , (40)
G = G M , 1 , G M , 2 , G M , 3 , G M , 4 , G M , 5 , G M , 6 3 × 6 , (41)
H = R P 3 , 1 , R P 3 , 2 , R P 3 , 3 , R P 3 , 4 , R P 3 , 5 , R P 3 , 6 , (42)
in which:
G M , i = cos λ i sin λ i 0 × R P 3 , i .
Replacing the values into Equations (40)–(42), the components of the mixer are defined:
A = s β 1 / 2 s β 3 / 2 c β s α 3 / 2 c β s α 1 / 2 s β s β 1 / 2 s β 3 / 2 c β s α 1 / 2 s β + 3 / 2 c β s α c β s α 3 / 2 s β + 1 / 2 c β s α 3 / 2 s β + 1 / 2 c β s α c β s α 3 / 2 s β + 1 / 2 c β s α 3 / 2 s β + 1 / 2 c β s α c α c β c α c β c α c β c α c β c α c β c α c β , G = 0 3 / 2 c α c β 3 / 2 c α c β 0 3 / 2 c α c β 3 / 2 c α c β c α c β 1 / 2 c α c β 1 / 2 c α c β c α c β 1 / 2 c α c β 1 / 2 c α c β c β s α c β s α c β s α c β s α c β s α c β s α , H = s β 1 / 2 s β + 3 / 2 c β s α 3 / 2 c β s α 1 / 2 s β s β 1 / 2 s β 3 / 2 c β s α 1 / 2 s β 3 / 2 c β s α c β s α 3 / 2 s β 1 / 2 c β s α 3 / 2 s β + 1 / 2 c β s α c β s α 3 / 2 s β + 1 / 2 c β s α 3 / 2 s β 1 / 2 c β s α c α c β c α c β c α c β c α c β c α c β c α c β .
The angular velocities of the rotors are limited to ω i , max , so the following constraint is limiting the performance of the system if ω i 2 ( t ) > ω i , max 2 , ω i 2 ( t ) = ω i , max 2 , where
ω t = M X 1 F B τ B . (43)

The parameters of the hexacopter are presented in Table 1. The initial condition of the UAV was set on zero condition, the equilibrium point, and the desired position was defined as x des ( t f ) = [ 0.5 , 0.75 , 0.8 , 0.1 , 0.05 , 0.05 , 0 1 × 6 ] T . The simulation time was 10 seconds and the weighting matrices were chosen as R = I 6 × 6 , Q = diag ( 0.1 × 1 1 × 3 , 0.01 × 1 1 × 3 , 0.2 × 1 1 × 3 , 0.001 × 1 1 × 3 ) , in which 1 1 × 3 = [ 1 , 1 , 1 ] and F = 10 × Q . Considering the number of discretisation N d = 49 , the error of the regulation was found 24 mm . The configuration and trajectory of the UAV are depicted in Figure 9. The position states of the hexacopter are demonstrated in Figure 10. The translation forces of the system are presented in Figure 11. Since the desired orientation of the UAV is not zero, the translation forces are not zero in X , Y directions. The mixer matrix defines the angular velocities of the system, Figure 12, and reduces to the steady-state values. The steady-state values of the rotors’ angular velocities are not similar since we have the desired pose.

TABLE 1. Parameters of the hexacopter
Par. Values Units Definition
L 0.2 m Dist. motor & CoM
R 0.125 m radius of the propeller
k 2.98 × 10 5 N s 2 / ra d 2 lift constant - thrust factor
k ψ 1.14 × 10 6 Nm s 2 / ra d 2 drag constant
I x x 7 × 10 3 kg m 2 moment of inertia X axis
I y y 7.3 × 10 3 kg m 2 moment of inertia Y axis
I z z 3.3 × 10 3 kg m 2 moment of inertia Z axis
m 1.2 kg mass of the quadrotor
D f [ 0.25 0 0 0 0.25 0 0 0 0.25 ] kg/s drag matrix
ω max 282.83 rad/s Max. Ang. Vel. of rotors
α π/6 rad rotation around O O ¯ i axis
β π/6 rad rotation around y 2 axis
Details are in the caption following the image
Configuration and trajectory of the hexacopter in regulation, discrete-time control
Details are in the caption following the image
Translation states of the hexacopter, discrete-time control
Details are in the caption following the image
Input force of the hexacopter, discrete-time control
Details are in the caption following the image
Angular velocity of the rotors, discrete-time control

The angular velocities of the rotors, presented in Figure 12, are limited between two positive bounds, [ 2700 , 2970 ] rpm . If the gravity is not compensated by the control law and one gets zero error and the end of the simulation, therefore, zero inputs, Equation (43) fails to deliver a solution. The reason is that all the control signals tend to zero (without gravity compensation) and the angular velocities of the rotors will be found around zero after a couple of oscillations. The second reason for failure without gravity compensation is that Equation (43) does not release negative values because of the square root. So, the steady-state shift in thrust input is necessary for the successful simulation. Optimal control without gravity compensation is not able to deliver a solution in a unified manner. In other words, the drone needs around 2830 rpm for hovering in the desired condition steadily.

6 CONCLUSION

Gravity compensation in the framework of the optimal control was investigated to check the effect of the modified control law plus gravity on the stability and the deviation from the optimality. The stability proof was guaranteed using the Lyapunov method and the optimality was analysed by the implementation of Pontryagin's Minimum Principle. The simulation results confirmed the proposed structure and showed successful results for the continuous- and discrete-time control domain. In brief, we presented a new optimal control that optimized the control signal around the steady-state value of the gravity vector (see the introduced cost function (8)) whether it is zero or not. The stability proof for this special presentation of the systems was presented for the first time and the deviation from optimality was shown.

For the systems with the state and input constraint, the stability and optimality proof, presented in this work, are held. The state constraint is applied by modification of the weighting matrix Q, preserving the symmetric positive definite form and observability condition [43]. The input constraint is applied externally on the input signal [19]; hence, the derivation and stability/optimality analysis are valid. An example for the input constraint has been considered in simulation, Section 5, see Equation (43).

ACKNOWLEDGEMENT

This work is supported by the ERC as part of GRIFFIN advanced Grant 2017, Action 788247, and by the EU H2020 under AERIAL-CORE project contract 871479, and HYFLIERS project 779411.

    CONFLICT OF INTEREST

    The authors declare no conflict of interests.

    DATA AVAILABILITY STATEMENT

    Data sharing not applicable – no new data generated.

    • 1 In cost function and derivation of the control, [ g ( q ) ] m × 1 should not be confused with [ g r ( x ) ] n × 1 .