Discrete-time Flatness-based Control of a Gantry Crane

This article addresses the design of a discrete-time flatness-based tracking control for a gantry crane and demonstrates the practical applicability of the approach by measurement results. The required sampled-data model is derived by an Euler-discretization with a prior state transformation in such a way that the flatness of the continuous-time system is preserved. Like in the continuous-time case, the flatness-based controller design is performed in two steps. First, the sampled-data system is exactly linearized by a discrete-time quasi-static state feedback. Subsequently, a further feedback enforces a stable linear tracking error dynamics. To underline its practical relevance, the performance of the novel discrete-time tracking control is compared to the classical continuous-time approach by measurement results from a laboratory setup. In particular, it turns out that the discrete-time controller is significantly more robust with respect to large sampling times. Moreover, it is shown how the discrete-time approach facilitates the design of optimal reference trajectories, and further measurement results are presented.


Introduction
The concept of flatness has been introduced by Fliess, Lévine, Martin and Rouchon for nonlinear continuous-time systems in the 1990s (see e.g. [1], [2] and [3]). The popularity of flatness is due to the fact that it allows an elegant solution to motion planning problems as well as a systematic design of tracking This work has been supported by the Austrian Science Fund (FWF) under grant number P 32151.
Email addresses: johannes.diwold@jku.at (Johannes Diwold), bernd_kolar@ifac-mail.org (Bernd Kolar), markus.schoeberl@jku.at (Markus Schöberl) controllers. For the practical implementation of a flatness-based tracking control on a digital computer/processor, it is of course important to evaluate the continuous-time control law with a sufficiently high sampling rate. If, however, the processing unit or actuators/sensors are limited to lower sampling rates, a discrete evaluation of a continuous-time control law may lead to unsatisfactory results. As known from linear systems theory, an appropriate alternative is to design the controller directly for a suitable discretization of the system. Moreover, also other nonlinear control concepts have already been transferred successfully to the discrete-time framework, see e.g. [4] for a recent contribution addressing energy-based methods. Motivated by these considerations, in the present paper we utilize the notion of discrete-time flatness ( [5], [6], [7], [8]) and prove its practical applicability by designing discrete-time tracking controllers for the sampled-data model of a gantry crane.
So far, discrete-time flatness-based controllers are only rarely used in practical applications (except for linear systems, see e.g. [9]). A main obstacle for a broader usage of the discrete-time approach is the fact that the flatness of a continuous-time system is not necessarily preserved by an exact or approximate discretization. Thus, we present a simple strategy which combines a suitable state transformation and a subsequent Euler-discretization in such a way that the flatness of the system is preserved. Although only constructive, the method is applicable for many well-known nonlinear systems like the gantry crane, the VTOL aircraft or the induction motor, to mention just a few. Once a flat sampled-data model has been derived, the design of tracking controllers can be performed in a systematic way since also discrete-time flat systems can be exactly linearized by a dynamic state feedback, see e.g. [8]. For the considered sampled-data model of the gantry crane, we show that even an exact linearization by a quasi-static state feedback -as it is proposed e.g. in [10] for continuous-time systems -is possible. With the exactly linearized system, the design of a tracking control for the stabilization of reference trajectories becomes a straightforward task. An implementation of both the dynamic and the quasi-static controller on a laboratory setup has shown that especially the novel discrete-time quasi-static controller is quite robust with respect to low sampling rates. Another advantage of the discrete-time approach becomes apparent when reference trajectories shall be determined by optimization. In the continuoustime case, this leads to infinite-dimensional optimization problems, which are typically reduced to finite-dimensional ones by a discretization of the space of reference trajectories (using e.g. spline functions). In the discrete-time case, in contrast, the resulting optimization problems are inherently finite-dimensional (as long as finite time-intervals are considered). To illustrate this beneficial property, we also formulate and solve such an optimization problem for the considered sampled-data model of the gantry crane.
The paper is organized as follows: In Section 2 we recapitulate the concept of continuous-time as well as discrete-time flatness. We present a constructive method to derive a flat discretization and illustrate it with the gantry crane. Next, in Section 3, we use the sampled-data model to design tracking controllers based on a linearization by a dynamic and a quasi-static state feedback. Fur-thermore, we show how the controllers can be extended by integral parts to compensate for stationary errors caused by friction effects. In Section 4, we present measurement results and compare the novel discrete-time quasi-static controller with the continuous-time controller derived in [11] for different sampling rates. Moreover, we calculate an optimal trajectory which achieves a transition between two given rest positions while minimizing the acceleration of the load. Finally, we present measurement results for the optimized trajectory as well as for the tracking of a closed path in the shape of a lying eight.

Flatness and Discretization
In this section, first we briefly recall the definition of flatness for continuoustime systems as well as a recent definition of (forward-)flatness for discrete-time systems, see e.g. [8], [12], or [6]. Subsequently, we show that for flat continuoustime systems which can be transformed into a structurally flat triangular representation, it is always possible to derive a forward-flat discretization that can be used for the flatness-based controller design. We illustrate this approach with the practical example of the gantry crane and derive a forward-flat sampleddata model. This discrete-time system serves as a basis for the controller design discussed in the remainder of the paper.

Flatness of continuous-time and discrete-time systems
A continuous-time system in state representatioṅ with dim(x) = n and dim(u) = m is flat, if there exists an m-tuple y = ϕ(x, u,u, . . . , u (q) ) and a multi-index r = (r 1 , . . . , r m ) such that locally i.e., x and u can be expressed by y and its time derivatives. The m-tuple y = ϕ(x, u,u, . . . , u (q) ) is a flat output. The map F = (F x , F u ) is necessarily a submersion and is denoted in the following as parameterizing map. From this map it can be observed that the trajectories (x(t), u(t)) of (1) can be parameterized by sufficiently often differentiable trajectories of the flat output y(t). More precisely, there exists a one-to-one correspondence between trajectories of (1) and (sufficiently differentiable) arbitrary trajectories y(t) of a trivial system. This idea can be transferred to the discrete-time framework, where time derivatives have to be replaced by shifts. In [8], we have shown that in general both forward-and backward-shifts can be taken into account. In the following, however, we restrict ourselves to the special case of forward-flat systems, since it is sufficient for the practical application considered in this paper. We call a discrete-time system in state representation with dim(x) = n, dim(u) = m and rank(∂ (x,u) f ) = n forward-flat, if there exists an m-tuple y = ϕ(x, u, u [1] , . . . , u [q] ) and a multi-index r = (r 1 , . . . , r m ) such that locally i.e., x and u can be expressed by y and its forward-shifts. Again, the map F = (F x , F u ) is necessarily a submersion and allows to parameterize the trajectories (x(k), u(k)) of (3) by arbitrary trajectories y(k) of the flat output. In contrast to the continuous-time case, the sequence y(k) does not need to be differentiable.
Remark 1. Both in the continuous-time and the discrete-time case, checking whether a system is flat or not is a challenging task. The reason is that there exist no systematically verifiable necessary and sufficient conditions. For forward-flatness of discrete-time systems, however, verifiable conditions have been derived in [12]. These conditions even lead to the computationally efficient test for forward-flatness presented in [13], which is a generalization of the test for static feedback linearizability (see e.g. [14]).

Discretization of flat continuous-time systems
In order to design a discrete-time flatness-based controller, a sampled-data model of the plant has to be derived. To capture the effect that in digital control circuits the control input is constant during each sampling interval, preferably an exact discretization is used. However, for most nonlinear systems determining an exact discretization is rather difficult. Furthermore, in general it does not preserve the flatness of a system, see e.g. [8]. From a practical point of view, using the explicit 1 Euler-discretization is much more convenient. However, even the Euler-discretization does not necessarily preserve flatness. Hence, in the following we show that it may be useful to perform a suitable state transformation before the Euler-discretization (5). In other words, we exploit the fact that state transformations and the Euler-discretization do not commute in general. Input transformations and the Euler-discretization, however, do commute, as the following diagram shows: Hence, the Euler-discretizations of continuous-time systems that are related by an input transformation are again related by the same input transformation. Since we make use of this fact in the sequel, we state the following lemma. Lemma 1. Input transformations u = Φ u (x,ū) and the Euler-discretization (5) commute.

Remark 2.
For an exact discretization it is just vice versa: state transformations and exact discretization commute, whereas input transformations and exact discretization do in general not commute. If we introduceū via a feedback u = Φ u (x,ū) which explicitly depends on x, it is clear that for piecewise constant u the new inputū will in general not be constant over a sampling interval. Thus, an exact discretization with piecewise constantū will lead to a non-equivalent discrete-time system.
Before we state the main result of this section, we introduce a certain structurally flat triangular system representation that has two useful properties. First, it allows to determine the parameterizing map (2) in a straightforward way. Second, with such a representation the property of flatness is preserved by an Euler-discretization, as we show below.
The rank conditions (7) guarantee that all states and inputs can be expressed as functions of the flat output y and its time derivatives by solving the equations (6) from top to bottom. Since the Euler-discretization of a continuous-time system (6) has the same triangular structure, we immediately get the following theorem.
Theorem 1. The Euler-discretization of a continuous-time system in structurally flat triangular form (6) is forward-flat, and the flat output y = (y p , . . . , y 1 ) is preserved.
Proof. The Euler-discretization of (6) is given bȳ and due to the rank conditions (7) all statesx and inputsū can be expressed as functions of the flat output y and its forward-shifts by solving the equations (8) from top to bottom. Thus, the discrete-time system (8) is forward-flat with the flat output y = (y p , . . . , y 1 ). (6) is actually more restrictive than necessary. With a more complex notation, it would be possible to state a more general version of (6) that still possesses a forward-flat Eulerdiscretization. Alternative flat normal forms can be found e.g. in [15], [16], [17] or [18]. Furthermore, it should be noted that the flat output of (6) depends only on state variables. Thus, only x-flat systems can possess a triangular form (6).

Remark 3. The structurally flat triangular form
If it is possible to transform a system (1) by state-and input transformations into the structurally flat triangular form (6), then a combination of this transformation and a subsequent Euler-discretization apparently yields a forward-flat discrete-time system. Nevertheless, a discretization where the original input u is preserved would be favorable. This is indeed possible, since by Lemma 1 the structurally flat discrete-time triangular form (8) can also be obtained by discretizing the system (1) after the state transformation (9a) and performing the input transformation (9b) afterwards. Since an input transformation does not affect the flatness of a system, we get the following corollary.
Corollary 1. If a flat continuous-time system can be transformed into a structurally flat triangular form (6) by a transformation (9), then the Euler-discretization We want to mention that the choice of a state is not unique, and hence it is justified to perform a suitable state transformation prior to the discretization. Nevertheless, it should be noted that not every flat continuous-time system possesses a triangular representation (6). However, for many practical examples like e.g. the gantry crane [11], the VTOL aircraft [3], or the induction motor [19] such a representation exists.

Forward-flat sampled-data model of a gantry crane
In Fig. 1, the schematic model of the considered gantry crane is shown. The position of the trolley is denoted by x T , the rotation angle of the rope drum is denoted by ϕ, and θ describes the pendulum angle. With the length of the rope l = Rϕ, the position of the load is given by x L = x T − Rϕ sin(θ) and y L = Rϕ cos(θ). The mass of the trolley is denoted by m T , and J represents the moment of inertia of the rope drum. The load has the mass m L , and the gravitational acceleration g points in the positive y-direction. The driving force F which acts on the trolley and the driving torque M which acts on the rope drum are the control inputs. The equations of motion can be found e.g. in [11] and read as A state representation (1) is given bẏ with the state x = (x T , ϕ, θ, v T , ω ϕ , ω θ ) and the input u = (F, M ). It is wellknown that the model of the gantry crane is flat and that the position of the load is a flat output y = (x T − Rϕ sin(θ), Rϕ cos(θ)). In order to derive a sampleddata model, in a first attempt one may simply compute the Euler-discretization of (10). However, it can be shown that the resulting discrete-time system does not meet the necessary conditions given in [12] and is thus not forward-flat. In fact, the test for forward-flatness stated in [13] fails already in the second step. Thus, we follow the approach suggested in Section 2.2 and search for a state-and input transformation (9) that transforms (10) into a structurally flat triangular representation (6). It turns out that for the gantry crane such a transformation indeed exists. A suitable state transformation is given by where the transformed statex = (x L , y L , v L,x , v L,y , θ, ω θ ) contains the flat output and its first time derivative. In such coordinates, the system equations read asẋ If we additionally introduce the new inputū = (a L,x , α θ ) defined by i.e., the acceleration a L,x of the load in x-direction and the angular acceleration α θ , we obtain a structurally flat triangular representatioṅ with the flat output y = (x L , y L ). Due to the triangular structure the Eulerdiscretization of (13) is forward-flat (see Theorem 1), and because of Corollary 1 the same applies to the Euler-discretization of (12) with the original inputs (F, M ) given by The corresponding parameterizing map (4) is of the form [3] , y L, [3] ) [4] , y L, [4] ) (15) and will be used in the next section for the design of two different tracking controllers. For simplicity, in the remainder of the paper the bar-notation will be omitted.

Discrete-time Flatness-based Tracking Control
The design of a continuous-time flatness-based tracking control is typically divided into two steps. First, the system is exactly linearized by either an endogenous dynamic feedback or a quasi-static state feedback, see e.g. [2] and [10]. Subsequently, a further feedback is applied in order to stabilize reference trajectories. However, since the resulting control law is assumed to be evaluated continuously, it actually cannot be realized on a digital computer/processor with only a finite sampling rate. Nevertheless, for applications where the sampling rate can be chosen sufficiently high, a discrete-time evaluation of the control law usually leads to satisfying results.
In this section, however, we propose an alternative approach and design flatness-based tracking controllers directly for the sampled-data model (14) of the gantry crane. Like in the continuous-time case, we follow the two-step design philosophy with an exact linearization and a subsequent stabilizing feedback. For the exact linearization we use two different approaches based on a dynamic as well as a quasi-static state feedback. Furthermore, we demonstrate how the controllers can be extended by integral parts in order to compensate for stationary deviations caused e.g. by model uncertainties.

Tracking control with linearization by endogenous dynamic feedback
In [8], we have shown that discrete-time flat systems (including both forwardand backward shifts) can be linearized by a certain class of dynamic feedback that closely mimics the class of endogenous dynamic feedback from the continuoustime case. In the following, we demonstrate the construction of such a linearizing dynamic feedback as well as an additional feedback to stabilize reference trajectories.
First, we extend the parameterizing map (4) by a map z = F z (y, . . . , y [r−1] ) with dim(z) = m j=1 r j − n, such that the combined map F xz = (F x , F z ) has a regular Jacobian matrix and is hence invertible. Since F x is a submersion, such an extension always exists. Next, we define the map Φ(y, . . . , y [r] ) given by and its inverseΦ(x, z, v) given by As shown in [8], a linearizing dynamic feedback follows by evaluating 2 The state-and input transformation (17) would transform the closed-loop into Brunovsky normal form y j [rj ] = v j for j = 1, . . . , m. In such coordinates, a tracking controller for a reference trajectory y d (k) can now be designed easily. For this purpose, we introduce the tracking error and its forward-shifts as In order to stabilize a reference trajectory we use a linear tracking error dynamics of the form where the coefficients a j i are chosen such that the roots of (20) are located within the unit circle. By substituting the definition (19) of the tracking error into (20) and solving for y [rj ] = v, the stabilizing feedback for the new input v follows as In a last step, we have to express the forward-shifts of the flat output that appear in (21) by the system state x and the controller state z. By substituting (y, . . . , y [r−1] ) =F xz (x, z) according to the map (17) into (21) and subsequently (21) into (18), the complete control law follows as It depends on the state x of the system (3), the controller state z, and the reference trajectory y d as well as its forward-shifts. Thus, for a practical implementation, the state x has to be measured or estimated by an observer.
The order of the resulting tracking error dynamics (20) is given by r = (4, 4). As we show in the next section, a lower order can be achieved by a linearization with a quasi-static feedback.

Tracking control with linearization by quasi-static state feedback
In [10], it is shown that every flat continuous-time system can be linearized by a quasi-static state feedback. In contrast to the linearization by dynamic feedback, the resulting control law is static but involves time derivatives of the closed-loop input. Despite these time derivatives of the new input, the approach is very useful for the design of flatness-based tracking controls. The main advantage over designs with dynamic feedback linearization is that it leads to lower order tracking error dynamics. In the following, we transfer this idea to discrete-time systems and design a tracking control based on a linearization by a discrete-time quasi-static state feedback for the sampled-data model (14) of the gantry crane.
The exact linearization of flat systems by quasi-static feedback discussed in [10] is based on the concept of generalized state representations. According to [20], for discrete-time systems generalized state representations are of the form and can also depend on forward-shifts of the input (instead of time derivatives in the continuous-time case). Such a generalized system representation follows from (3) by a generalized state transformation of the form with rank(∂ x Ψ x ) = n. The rank condition ensures that the generalized state transformation (22) which consist of the components of the flat output and its forward-shifts up to some order κ − 1 = (κ 1 − 1, . . . , κ m − 1) with dim(x B ) = n and κ j ≤ r j .
In accordance with the continuous-time case [10], we call (23) a generalized Brunovsky state. With a feedback of the form which is constructed by replacing the n components of y, . . . , y [κ−1] in the map F u of (4) with the Brunovsky statex B and the remaining components y [κ] , . . . , y [r] with the new input and its forward-shifts v, . . . , v [r−κ] , we get an input/output behaviour of the form In the continuous-time case discussed in [10], such a feedback is called a quasistatic state feedback 4 . With the linear input/output behaviour (25), it is now easy to construct a further feedback in order to introduce e.g. a linear tracking error dynamics The coefficients a j i must be chosen such that the roots of (26) are located within the unit circle. By substituting the definition (19) of the tracking error into (26) and solving for y [κj ] = v, the stabilizing feedback follows as The forward-shifts of v that are required for the quasi-static feedback (24) follow as , which is a consequence of (25), we get the set of linear equations . . .  Since future values of the flat output can in general not be measured, the resulting control law is obviously difficult to implement. Thus, we try to replace the flat output and its forward-shifts beforehand, which is possible if two assumptions are met. First, we assume that with where we have inserted (23) as well as (25) and its forward-shifts into the map F x of (4), the condition rank(∂x B F x ) = n is met. This guarantees by the implicit function theorem that the Brunovsky state can be expressed as Substituting (28) into (24) yields the linearizing feedback which introduces the same input/output behaviour (25) as (24) but depends on x instead ofx B . However, we also have to determine v, v [1] , . . . , v [r−κ] as a function of x instead ofx B . For this purpose, we substitute (28) into (27) and obtain a set of in general nonlinear equations. Thus, our second assumption is that this set of nonlinear equations can nevertheless be solved for v, .
Finally, by substituting (30) into (29), we obtain a static control law of the form which only depends on the state x as well as the reference trajectory y d and its forward-shifts. Thus, like for the dynamic tracking controller of Section 3.1, only the state x is required for an implementation.
For the sampled-data model (14) of the gantry crane, a generalized Brunovsky state (23) is given by 5x B = (x L , . . . , x L, [3] , y L , y L, [1] ) . Since both above assumptions are met, a control law of the form (31) can be derived. Compared to the dynamic controller of Section 3.1, the order of the resulting tracking error dynamics (26) is reduced to κ = (4, 2).

Extension of the tracking error dynamics by integral parts
In this section, we show how the discrete-time tracking control with dynamic feedback of Section 3.1 can be extended by discrete-time integral parts in order to avoid stationary errors caused e.g. by model uncertainties. In the case of the gantry crane, such errors occur mainly due to friction effects. With the "integrated" tracking error e I given by To obtain a stable error dynamics, the coefficients a j I and a j i must be chosen such that all eigenvalues of the matrices A j are located within the unit circle. The extended stabilizing feedback for the exactly linearized system follows asv j = v j − a j I e j I , j = 1, . . . , m , where v represents the feedback without integral parts obtained in Section 3.1. For the controller with quasi-static state feedback of Section 3.2, an extension by integral parts is possible in a similar way. With respect to the gantry crane, the integral parts increase the order of the error dynamics to (5,5) for the dynamic controller and (5, 3) for the quasi-static controller.

Trajectory Planning and Measurement Results
In the following, we present measurement results for the novel discretetime quasi-static controller of Section 3.2, which was implemented on a laboratory model of the gantry crane depicted in Fig. 2. In particular, in Section 4.1 we compare its tracking performance for different sampling rates with the continuous-time quasi-static tracking controller discussed in [11]. Moreover, in Section 4.2 we show how the discrete-time approach facilitates the design of optimal reference trajectories. We formulate and solve an optimization problem and present measurement results for the computed trajectories. Finally, in Section 4.3 we show further measurement results for the tracking of a closed path.
Like in [11], for all experiments the control law (31) is extended by a feedforward compensation of the friction in order to improve the tracking behaviour. The required reference trajectories for the velocity of the trolley v T and the angular velocity ω ϕ of the rope drum can be computed from the reference trajectories of the flat output y = (x L , y L ) by the inverse of the state transformation (11) and the parameterizing map (15). The friction compensation (32) is simply added to the values of the control inputs F and M determined by the tracking control law (31) derived in Section 3.2. Like in [11], we use an asymmetric friction compensation, i.e., the friction coefficients depend on the sign of the velocities v T,d and ω ϕ,d . In addition to the compensation of the friction, we also use integral parts (cf. Section 3.3) to avoid steady-state control deviations. As it is common practice for continuous-time systems, these integral parts are activated only at the end of the transitions, i.e., after the reference trajectory has already reached the final desired position.

Comparison continuous-time and discrete-time flatness-based control
In this section, we compare the tracking performance of the discrete-time quasi-static controller designed in Section 3.2 with the continuous-time quasistatic controller of [11]. For this purpose, as a benchmark, we use a transition of the load from the rest position y d,0 = (0.2 m, 0.7 m) to the rest position y d,T = (1.0 m, 0.5 m) in a transition time of T = 1.7 s. Before presenting measurement results, we briefly discuss the design of the reference trajectories in the continuous-time as well as in the discrete-time case.
In general, a continuous-time flatness-based control law involves not only the reference trajectory y d (t) itself but also its time derivatives. Hence, the trajectory needs to be sufficiently often differentiable. Since we transfer the load between two rest positions, it must satisfy the initial-and final conditions and for i = 1, . . . , r j − 1 and j = 1, . . . , m. For the gantry crane, we have both for the x-and the y-direction four conditions at t = 0 as well as four conditions at t = T . Thus, the simplest approach are polynomial trajectories of order seven with suitably chosen coefficients c x,i and c y,i . In the discrete-time case, the control law (31) depends on the desired sequence y d (k) and its forward-shifts. In contrast to the continuous-time case, differentiability is not required. However, since we want to achieve a transition between rest positions, the reference trajectory needs to satisfy the conditions for j = 1, . . . , m with T = N T s , which are the discrete-time counterpart to (33) and (34). Thus, in principle, for the gantry crane we could again use a polynomial ansatz of order (7,7). However, in the following we simply evaluate the continuous-time reference trajectory at the time instants t = kT s . Since (35) is used to connect rest positions, the conditions (36) are obviously satisfied. Both the continuous-time and the discrete-time tracking controller have been implemented on a dSPACE ® real-time system with different sampling times T s . The continous-time control law of [11] is simply evaluated at the time instants t = kT s . In the first experiment, we compare both controllers without integral parts and a sampling time of T s = 10 ms. The corresponding measurements are shown in Fig. 3 and Fig. 4. It can be observed that with both controllers the reference trajectory is almost perfectly tracked. Fig. 5 shows the corresponding tracking errors. The small deviations and stationary errors are caused mainly by the non-ideal compensation of the friction.
In the second experiment, the sampling time is increased to T s = 80 ms. It turns out that this sampling time is too large for the continuous-time controller, t (s)  whereas the discrete-time controller still transfers the load between the rest positions as desired. The corresponding measurements are shown in Fig. 6. However, it can be observed that the reference trajectory is no longer tracked that well. The reason is that the Euler-discretization is not exact and the approximation error increases with the sampling time. Nevertheless, the novel discrete-time controller seems to be quite robust with respect to high sampling times (as further experiments up to T s = 100 ms have shown). In Fig. 7, both the actual control inputs as well as the pure feedforward part (including the friction compensation) of the control law are depicted. It can be seen that at the end of the transition both inputs do not exactly have the expected stationary values. This is due to the steady-state deviation caused by static friction and will be discussed in more detail in the next section.

Design of reference trajectories by optimization
In the following, we use the flatness of the gantry crane to design reference trajectories that minimize a given objective function. Instead of searching for state-and input trajectories, which are constrained by the system equations, we formulate the optimization problem in terms of the flat output. As it is well-known, the advantage of the latter approach is that the trajectories of the flat output are free and the system equations do not need to be taken into account as constraints. In the continuous-time case, the possible trajectories of the flat output belong to an infinite-dimensional space. Thus, in order to get a finite-dimensional optimization problem, the trajectories are usually restricted to a set of functions described by a finite number of parameters, see e.g. [22]. Possible approaches are the use of spline curves or the method applied in [11]. In the discrete-time case, in contrast, the optimization problem is inherently finite-dimensional since we are dealing with sequences instead of functions.
In the following, we formulate and solve such an optimization problem for the sampled-data model (14) of the gantry crane. The goal is to achieve a transition between the two rest positions of Section 4.1 in T = 3 s while minimizing the absolute acceleration a L = f 2 a L,x + f 2 a L,y of the load. The functions f a L,x and f a L,y are the same as in (12). By the use of the parameterizing map (15), a L can now be expressed as a function of the flat output and its forward-shifts. The optimization problem can be formulated as with k = 0, . . . , N − 1. The inputs have been limited by F max = 10 N and M max = 0.2 Nm. 6 Since the load shall be transferred from one rest position to another, the reference trajectory needs to satisfy the conditions (36) and the vector of optimization variables is reduced to p = [ε, y d (4), . . . , y d (N − 1)]. In Fig. 8, the calculated optimal trajectory for a sampling time of T s = 10 ms as well as the polynomial trajectory, which was used as initial value for the optimization, are shown. The absolute value a L of the acceleration of the load is shown in Fig. 9 for both the polynomial as well as the optimized trajectory. It can be observed that for the optimal trajectory the acceleration is constant during almost the whole transition. The corresponding input trajectory F (k) temporarily reaches the limits ±F max at the beginning, in the middle, and at the end of the transition, while the constraint |M (k)| ≤ M max is never active. Figures 10 to 13 show measurement results for the determined optimal trajectory. In Fig. 10, it can be observed that the reference trajectories are again almost perfectly tracked. Particularly interesting are the horizontal and vertical velocities of the load depicted in Fig. 11, which increase and decrease for most of the time with a constant slope. This is in accordance with the almost constant acceleration of Fig. 9. The corresponding control inputs are shown in Fig. 13. It can be seen that because of the additional friction compensation already the feedforward part slightly exceeds the limit |F (k)| ≤ F max . However, the resulting control input, including the feedback part, remains within the input limitations of the laboratory setup. At the end of the transition at t = 4 s, it can again be observed that the inputs F and M do not exactly have the expected stationary values because the end position of the load slightly differs from its desired position. Thus, the controller attempts to compensate this error. Since the resulting force F and torque M are too small to overcome the static friction of the trolley and the rope drum, these input values would be applied permanently. For this experiment, however, we have used the extended control law with integral parts, which are activated after the transition of the reference trajectory is completed. Consequently, as can be observed in Fig. 13, the applied inputs increase after t = 4 s until they are large enough to overcome the static friction.

Tracking a closed path
As already mentioned in Section 4.1, in the continuous-time case the reference trajectory y d (t) needs to be sufficiently often differentiable. Moreover, in order to track a reference trajectory y d (t), all time derivatives up to y (r) d (t) must be computed beforehand. In the discrete-time case, in contrast, there are no restrictions on the reference trajectory y d (k) such as differentiability, and instead of time derivatives the control law involves only forward-shifts of y d (k). This simplifies the implementation, since these forward-shifts can be constructed easily by chains of unit delays.
To show the flexibility of the discrete-time approach, in the last experiment a closed path with the shape of a lying eight is used as reference trajectory. In Fig. 14, it can be seen that y d (k) is tracked well and that the stationary   errors at the end of the reference trajectory are compensated by the integral parts. Fig. 15 shows the desired and the measured trajectory in the xy-plane.
The small deviations at the reversal points of the load are caused by the strong friction of the trolley on the rail.

Conclusion
We have shown by means of the laboratory model of a gantry crane that the concept of discrete-time flatness is well-suited for the design of tracking controllers in practical applications. For nonlinear systems, the difficulty lies in determining a flat sampled-data model of the plant. In order to overcome this problem, we have proposed a constructive method which relies on a combination of a suitable state transformation and a subsequent Euler-discretization. Although the Euler-discretization is not exact, experiments with the gantry crane have shown that the novel discrete-time flatness-based controller can be used over a significantly wider range of sampling rates than its continuous-time counterpart. Moreover, we have shown that the property of discrete-time flatness is also beneficial in the context of trajectory planning by optimization.
An important topic for future research are alternative, more precise discretization methods which also preserve the flatness. The goal is to achieve a better tracking performance for even lower sampling rates. In contrast to the proposed approach via the Euler-discretization, such methods may possibly lead to discrete-time systems which are flat in the more general sense of [8] and not necessarily forward-flat.