Model-Based Development of Control Systems for Forestry Cranes

Model-based methods are used in industry for prototyping concepts based on mathematical models. With our forest industry partners, we have established a model-based workflow for rapid development of motion control systems for forestry cranes. Applying this working method, we can verify control algorithms, both theoretically and practically. This paper is an example of this workflow and presents four topics related to the application of nonlinear control theory. The first topic presents the system of differential equations describing the motion dynamics. The second topic presents nonlinear control laws formulated according to sliding mode control theory. The third topic presents a procedure for model calibration and control tuning that are a prerequisite to realize experimental tests. The fourth topic presents the results of tests performed on an experimental crane specifically equipped for these tasks. Results of these studies show the advantages and disadvantages of these control algorithms, and they highlight their performance in terms of robustness and smoothness.


Introduction
Hydraulic technology has had a great impact on the development of modern industry, and it prevails as the primary component in mechanized heavy-duty equipment.We see a breakthrough of this technology in the forest industry, a business that has profoundly advance from manual labor to the use of very sophisticated machinery.The timber exploited with these machines provides the raw material for countless industrial products.
1.1.Overview of Forestry Machines.In the forest industry, success relies on first-class products and competitive costs.Therefore, forestry machines are equipped with highly robust and efficient hydraulic technology.Yet, the efficiency and the work profit depend heavily on the operators working with these machines.This working assignment is difficult and demands highly skilled people.For this reason, operators, particularly beginners, practice the work tasks by combining real and virtual training [1,2].
A typical job description involves working all year round in difficult and isolated areas.This working situation is unattractive for many people and, as a consequence, attracting new operators is becoming increasingly difficult.This problem is one of the primary motivations to design smart forestry machines that will help boosting up productivity [3][4][5].In fact, most machine manufacturers are already pioneering the development of machinery that can be more intelligent, user-friendly, and easier to learn.

Overview of Control of Forestry Cranes. Controlling
cranes through manual open-loop commands is a mature technology used for more than two decades.It primarily consists of a mechanical manipulator actuated with hydraulic cylinders.These cylinders produce the motion and they are controlled with hydraulic valves.The operator controls the machine from a chair located inside the cabin, an ergonomic chair equipped with joysticks and buttons.Maneuvering the joysticks produces motion, and because neither the crane nor the vehicle is equipped with sensors, controlling all degrees of freedom is challenging and burdensome.This scenario results in unintuitive technology, technology that is difficult to use and learn.
Work on other crane control modes is a subject of research for almost thirty years [6][7][8][9].Most research aims to simplify the control complexity by providing more intuitive methods.One example is to directly command the endeffector motions rather than the motion of each individual link.Methods of this kind can be seen in a line of work found in [10][11][12][13][14][15][16][17] and references therein.Many of these solutions are now practical and will be essential for developing a new line of machines.A pioneering of this is already seen in a trend of commercial solutions appearing on the market, such as cranes with built-in sensors [18], smoother motion control [19,20], and Cartesian end-effector control [19,21], just to mention a few.
The success in the performance of motion control methods depends on closed-loop control algorithms.In the literature, we find a variety of generalized methods that can be applied to manipulators actuated by hydraulic systems.These methods range from semilinear controllers [22][23][24][25][26] to nonlinear control methods [27], such as feedback linearization [28,29], passivity-based control [30,31], and adaptive nonlinear control methods [32,33], among many others.
From the variety of methods, Proportional-Integral-Derivative (PID) control is often adequate in most applications requiring closed-loop control [22,34].However, PID control lacks the ability to cope with unprecedented variations in model parameters and external disturbances [12].For these reasons, we are going beyond traditional PID structures.Instead, we are opting for robust nonlinear control algorithms having better performance [35].One of these methods is sliding mode control (SMC), a nonlinear control technique highly successful in industry.

Overview of Model-Based Design as a Tool to Go from Research to Product Development.
Model-based design (MBD) is currently applied in a variety of industries.Just as computer-aided design (CAD) provides a geometric way of describing equipment, MBD helps to incorporate dynamics and performance requirements to properly describe an overall system in a simulation environment.Moreover, modern MBD benefits from automatic code generation that facilitates rapid prototyping.
In the forest industry MBD is important to develop new embedded control solutions.The interest is to use models all along the development cycle: from design to implementation.This working method is cost-efficient and facilitates collaboration among engineers of different disciplines and knowledge levels.For the machine manufacturers working with us, this is an attractive option because it helps to adopt new technologies without great efforts.This is a workflow that we have established for more than a decade and some of the results can be seen in our line of work [12,14,15,23,24,[36][37][38][39][40].
1.4.Paper Organization.The remaining of this paper presents a procedure to design motion tracking controllers for a forwarder crane.We use SMC theory, but the mathematical models are explicitly formulated for those who would be interested in applying other nonlinear control methods.In terms of development, our aim is to show a complete description of the models and the methods applied for a variety of tasks, including simulation, model calibration, control synthesis/tuning, and verification/validation.The resulting control systems are automatically deployed in the machines' main computers and we are interested to know how they perform without further online tuning.This is a challenging requirement, as the performance of the control loops relies extensively on the models used for design.With this control method, we are seeking a trade-off among good tracking performance, robustness, and smoothness.
The paper is organized as follows.First, the mathematical models are presented in Section 2. Second, we formulate the control laws in Section 3. Third, with the purpose of implementing the controllers in both simulation and practice, Section 4 presents an offline model calibration method using recorded data.To conclude this presentation, the results of hardware-in-the-loop tests are discussed in Section 5, and some concluding observations are given in Section 6.

System Modeling
We model the system based on first principle laws describing the interaction in between the mechanical crane and its hydraulic actuation.Briefly, this task consists in describing the mathematics for (i) the rigid body dynamics, including friction forces, (ii) the mechanical torque that results from the force exerted by the hydraulic actuators, (iii) the hydraulic dynamics produced by the circulation of oil from the pump and reservoir to the hydraulic actuator.
Due to the complexity of this task and in order to provide a detailed review and exemplification of our findings, the inner boom denoted by  2 in Figure 1 is fully analyzed and presented below.The remaining links will be used to alter model parameters and introduce external disturbances during experimental studies.However, interested readers are referred to [37][38][39] for the complete modeling of forwarder cranes.

Mechanics.
Seen as a single link manipulator, the crane dynamics can be approximated by the second-order differential equation: where and   represents inertial parameters, [ 3 ,  2 ,  6 ] are length values shown in Figure 2,  20 = 0.0496 rad, and  is the constant of gravity.We assume that the telescopic opening  4 is static and fully retracted; that is,  4 = 0.In contrast,  3 can be placed at different positions, but for the nominal model it will be located at its minimum  3 ≈ −0.2 (rad).Both  4 and  3 will be varied to test performance to unmodeled dynamics, parameters variations, and external disturbances.

Friction Forces.
The behavior of the motion differs according to the direction [37]; therefore, we approximate friction forces by a model accounting for asymmetries [41]: where the terms with a bar denote the mean values for the coefficients of Coulomb (  ) and viscous ( V ) friction.In additions, Δ (⋅) denotes the bias from these mean values.

Relation between Hydraulic Force and Mechanical Torque.
The relation between hydraulic force and mechanical torque is defined by the following expression [34]: where  2 is the force produced by the cylinder and  2 / 2 denotes the change of the cylinder's piston displacement with respect to the link's angular position.Referring to Figure 2, this relation is given by differentiating in respect of  2 , which yields 2.4.Hydraulic Cylinder Dynamics.The actuator's force (see Figure 3) can be calculated from measurements of pressures as where   ,   denote the areas of chambers ,  respectively and  (⋅) denotes their pressures.Due to the configuration of the electrovalve (see Figure 4), the pressure in chambers  and  behaves differently.Dynamics of the pressure in chamber  can be derived from the mass balance equation: where  denotes the Bulk modulus,  the hydraulic volume, and  the input/output flow.Looking at the schematics in Figure 3, the volume in chamber  can be defined as and the rate of change in volume is given by the derivative Considering internal leakages, dynamics of the pressure inside chamber  can be mathematically approximated by the differential equation: where   denotes flow into chamber ,   is the coefficient for the internal leakage, and   is the coefficient of leakage out of the cylinder.The pressure on chamber  follows another dynamical principle, because it is connected to the tank directly (see Figure 4).This configuration is known as regenerative and it is used to gain potential energy regeneration [42].The nominal pressure in this chamber is equal to the tank atmospheric pressure, and we model the small variations as a system formed by a resistance and a capacitance [22,34]; the capacitance is the chamber, and the resistance is the hose where the oil flows: where   denotes the tank's pressure and   the capacitance constant [34].

Electrohydraulic Valve.
To drive the oil, the system uses proportional bidirectional valves.These valves have orifices with variable areas controlled by the internal spool's displacement.The flow through an orifice is given by the general equation: where  is the cross section of the orifice, Δ is the pressure drop across the orifice, and  is the density of the fluid.The discharge coefficient is   and we assume it is constant.Considering that the area  depends on the spool displacement  V and that [  , ] are nearly constant, we can rewrite (14) as where   denotes the valve constant.Additionally, we can assume that  V =  because the electronics have fast dynamics in comparison to the overall process.Referring to Figure 4,  is the electrical input to the valve and, therefore, it is the control signal for the process.Without loss of generality, any nonunity gain between  V and  is taken care of by the constant   ; that is, Based on these observations, the flow can be modeled as where and   is the pressure supplied by the pump.
In hydraulic systems, a well-known nonlinear phenomenon is asymmetry; that is, the response of the system differs according to the direction of motion.This phenomenon is mathematically described by ( 17) and (18), where the flow changes according to the sign of the control signal .This implicates that the model parameter   , can be direction dependent.To place this in mathematical terms, we can consider from ( 17) and ( 18) that which can be shortened as 2.6.Hydraulic Force as a Function of the Control Input.The differential equation describing dynamics of the hydraulic force can be found by differentiating (8); that is, which in combination with ( 12) and ( 20) yields the change of force as response to the input signal  in the simplified form: where

Mechanical Motion as a Function of the Control Input.
To determine the dynamics of the output position  2 as response to the control input , we take the time derivative of (1) as ... where so that ( 24) is rewritten as ...
in which Equation ( 26) is important for control design because it shows the input/output relationship.Additionally, the model ( 27) is explicitly written to apply most nonlinear control methods.

Nonlinear Control Design
Discrepancies, or mismatches, are always present when we compare real behavior againts mathematical models.These differences arise from external disturbances, unknown parameters, and unmodeled dynamics.Designing control laws in the presence of these uncertainties is a very challenging task for a control engineer.Therefore, developing robust control methods is an interesting but difficult subject.One particular robust control approach is the so-called sliding mode control (SMC) technique.Robustness, finite-time convergence, and reduced-order compensated dynamics are advantages of this method.Two variations of this control technique are presented below.

First-Order Sliding Mode
Control.The first step to design SMC is to define a sliding surface/function () ∈ R corresponding to the dynamics of the error between the system's response and the desired behavior [35,43].A sliding mode exists if () converges to zero in finite time and () ṡ () < 0, a fundamental condition for SMC.To design this controller, we start by defining a  3 -smooth desired trajectory   2 () and the error between  2 and   2 as Thus, the sliding mode () follows that where () is the dynamics of the error (28) and it can be selected as any dynamical system that drives the error dynamics to an exponentially stable behavior.For instance, Note that, on the surface (), the error dynamics are governed by the relation In order to achieve asymptotic convergence of the error to zero, that is, lim  → ∞ () = 0, with a given convergence rate and in the presence of a bounded disturbance (), we have to drive the sliding surface () in (30) to zero in finite time by the control input .To design this control input, we differentiate (30), yielding ṡ = ...
Thus, by introducing (26) in the equation above, that is, we find the relationship between  and .The problem is to design a feedback control law that drives this system to zero asymptotically.One choice is [35,43,44] where   is the main control action to account for nonlinear dynamics.On the other hand,   plays three roles: (1) it determines the reaching time to the sliding surface, (2) it gives robustness to model uncertainty, and (3) it provides disturbance rejection.These two can be postulated as follows: where sgn is the signum function and the larger , the shorter reaching time.In this form, the stability condition () ṡ () < 0 is satisfied.We refer the reader to the stability analysis presented in [35].

Second-Order Sliding Mode Control.
As defined in the work [45], a second-order SMC is defined by the sliding surface: which represents a set of band-pass filters that are tuned according to   and  0 .The integral term is used to reach zero steady-state errors.The unfactored form of (37), with  = 3, yields where   are constant values that ensure an exponentially stable behavior.The purpose of the second-order SMC is to make () = ṡ () = 0.The control action can be found by taking the derivative of (38) as presented below: such that stability is guaranteed if the controller (34) is designed as [45] where  1 ,  2 ∈ R.

Controller Implementation
Referring to Figures 1 and 5, the machine is equipped with the following hardware: (1) three angular and one linear position quadrature encoders with a resolution of 4000 pulses/rev, (2) eight analog pressure transducers with a range of [0, 200] bar, and (3) one off-the-shelf rapid prototyping platform with a sampling frequency of 1 kHz [46].This hardware is used for recording data, real-time visualization, and testing.Most nonlinear control methods use mathematical models as an attempt to cancel nonlinear dynamics.To compute reliable input signals in practice, the model parameters have to be known with a certain degree of certainty.However, a common engineering problem is to have unknown parameters that represent physical properties.
The geometry of the system is usually known from CAD drawings.The remaining unknown parameters, masses, inertias, and friction values, have to be found through experimental system identification.This method serves to calibrate the model for simulation and to tune control laws for real-time implementation [47].The steps used with this purpose are presented below.

Model Calibration.
We use three different sets of equations, that is, (1) for the mechanical system, (12) for the pressure dynamics of chamber , and (13) for chamber .The coefficients for the valve are found intrinsically within (12).For (1), the unknown parameters relate to the inertial terms denoted by   and the friction coefficients of the model (4).Similarly, for (22), the unknown parameters relate to the flow coefficients in (20), the Bulk modulus , and the coefficients of leakage in (12).

Estimation of the Mechanical System
Coefficients.We apply algorithms of least-square regression.To this end, we start by rewriting the system (1) as The layout presents the configuration of our control system setup, which includes the measurement devices and the rapid prototyping unit.The valve is equipped with magnetic coils to provoke the motion of the internal spools and a power amplifier that accepts regular PWM signals. where Given measurements of [ 2 (), q 2 (), q 2 ()] and () for a finite time , the parameters of   can be found by least-square regression [47]: The estimation of velocities and accelerations is done by Kalman filtering [48].We use periodic input signals to identify nonlinear behavior [39,49].Three cases of recorded data are presented in Figure 6.The results of the estimation with (43) are presented in Figure 7, results that compare the simulated torque  2 against the measured one.

Estimation of the Hydraulic System Coefficients of Cham-
ber A. This is done based on (12).To this end, we rearrange the mathematical expression as which combines ( 12) with ( 20) and conveniently expresses the estimate of the input signal  as the dependent variable.This relation is chosen over ̂ṗ  to avoid numerical differentiation errors.(The pressure is measured with analog transducers.Hence, its derivative has to be found by numerical differentiation.)Our aim is to estimate    , Δ   ,   ,   , and  that best reproduce the behavior of the measured signal .For this task, we use an objective function to quantitatively compare the model behavior to the measured data: where  is the quantity to be minimized and it accounts for the error between the predicted and observed data.For our particular purposes, this algorithm is programmed in MATLAB applying the Global Optimization Toolbox [47,50].This toolbox gives the possibility to work with large amounts of recorded data sets and find global solutions.The search is constrained by defining boundaries according to theoretical values.An example of the data set is presented in Figure 8.The comparison between  and û is shown in Figure 9.These results demonstrate that the models are able to capture the motion dynamics with sufficient accuracy.

Estimation of the Hydraulic System Coefficients of Chamber B
. This is done based on (13).Rearranging the mathematical expression in the linear form we apply least-square estimation The data used for the estimation is presented in Figure 8, Displacement q 2 (t) Displacement q 2 (t) Displacement q 2 (t) Velocity 2 (t) Velocity 2 (t)   while the results validating the estimation are presented in Figure 10.

Reducing the Sliding-Mode Chattering.
Chattering is a common problem of SMC, a behavior that is inadvisable in electrohydraulically actuated servomechanisms.Chattering leads to low control accuracy and it can provoke the wearing of the moving actuators or damage the servo valves.Different methods exist for avoiding chattering.Among these methods, one that performs satisfactorily in practice is via statedependent time-varying switching gains [43].One example for first-order SMC is the modification of ( 36) by where the gain / varies proportionally to the value of the sliding surface .The constant  1 is a sufficiently small value.Unlike first-order SMC, the second-order option (40) leads to a control law that is free of chattering.This is one of the benefits of higher order sliding-mode dynamics.However, higher order SMC can also benefit from state-dependent modifications to improve performance.One example is to modify (40) as

Mathematical Considerations.
In some cases, control algorithms present mathematical operations that might not be feasible in the formal sense.For instance, the control law (24) needs the derivative of the friction forces defined in (4).Friction forces involve the signum function; therefore, the derivative at zero crossing is undefined in the ordinary sense.It is always possible, however, to consider two separate dynamical models according to the direction of the movement.In that case, the Coulomb friction reduces to a constant value, since sgn( q 2 ) is equal to 1 or −1.The derivative of this constant is zero and can be assumed as such in a small vicinity of zero velocity.In this way, the relation τ  can be numerically implemented.We follow similar concept to implement the control laws (47) and (48).

Experimental Results
After detailing our model-based control design, we proceed with experimental results.To begin, we recall that our aim is to investigate how our controllers work without the necessity of online tuning.
Cranes and particularly the hydraulic actuation present three different challenges.First, these manipulators have long reaching distance and, therefore, they are highly flexible specially while lifting logs.Second, the hydraulic cylinders work as actuators and suspension systems simultaneously.As a consequence, they are highly flexible to avoid mechanical stress while lifting loads.Third, these cranes can lift up to twice their own weight, an amount that introduces high uncertainty in model parameters.All of these problems make control design quite challenging, and our aim in this section is to verify the SMC performance to these effects.Our interest is to obtain a trade-off in between good tracking performance, robustness, and smoothness.The smoothness can be observed by the amplitude of oscillations in the hydraulic pressure and the robustness by the ability to cope with unmodeled dynamics or external disturbances.To introduce these effects, the telescope ( 4 in Figure 1) is placed at 70% of its maximum opening, a situation that introduces serious flexibility and causes oscillatory response.Similarly, the outer boom ( 3 in Figure 1) is placed to 10% its maximum range, and the gripper is loaded with logs of an approximated weight of 130 kg.All of these changes alter our nominal conditions and will be helpful to observe the control performance.The results are organized as follows: (1) Figures 11 and 12 show experimental validation of the first-order SMC; (2) Figures 13 and 14 show experimental validation of the second-order SMC.

Results with
First-Order SMC.For Figure 11, the initial conditions were varied to verify the asymptotic convergence to the desired trajectory.The modified control law (47) has a faster settling time, but the tracking accuracy slightly reduces.This is observed in the first row of Figure 11, where we show a superimposed plot of angular position measurements and the desired trajectory.We also observe that the chattering phenomenon is reduced by the control law (47), as we show in the second row of Figure 11   for achieving smoother movements, as it is observed in the third row of Figure 11, where the control law (47) shows less oscillatory amplitude.
For Figure 12, we modified dynamics by changing the links configurations and including load.The crane was initially positioned far from the desired trajectory to verify asymptotic convergence.Despite the changes, the controller is able to keep all characteristics described earlier.In addition, the modified control law (47) behaves better than the original one.

Results with
Second-Order SMC.For Figure 13, the crane was initially positioned near the trajectory to verify the tracking performance.The modified control law (47) has a slower settling time, but the tracking accuracy in both cases is nearly similar.This can be observed in the first row of Figure 13 that shows a superimposed plot of angular position measurements and the desired trajectory.We verified that second-order SMC can suppress chattering, a result observed in the second row of Figure 13.The state-dependent control law (48), however, improves smoothness, as it can be qualified by the torque observed in the third row of Figure 13.In both cases, we see improvements of higher order SMC if we compare Figure 11 with Figure 13.
For the results in Figure 14, we modified dynamics as explained earlier.The crane was positioned relatively far from the desired trajectory to verify asymptotic convergence.The modified control law (47) has a faster settling time; however, the tracking accuracy in both cases is similar.The first row of Figure 14 shows this behavior with a superimposed plot of angular position measurements and the desired trajectory.In addition, the second-order SMC suppresses chattering without the modification (48), but the state-dependent control law (48) improves smoothness.Figure 14 shows these properties.

Conclusion
The main objective was to present a model-based development workflow.In control engineering, this working method involves using mathematical models to design controllers.Successful application of model-based design involves modeling, control design, simulation, and practical verification.We have presented all of these steps with sufficient details.  47) and the gray signal shows results with the original formula (36).(c) Computed torque from pressure measurements.The bold signal shows the results applying the chattering reduction method (47) and the gray signal shows results with the original formula (36).
The subject of study was output tracking motion control for a forestry crane actuated by hydraulic cylinders.This system presents challenges related to flexibility, oscillatory response, and unpredictable model uncertainty.Achieving desirable performance under these effects is a difficult control problem.
In relation to system modeling, we have presented first principle laws that explain the motion dynamics.We believe that this is an important step, because (1) the hydraulic configuration used in these systems has different characteristics to what is commonly found in literature and (2) these mathematical models are essential to derive nonlinear control laws.The model parameters were found by system identification tests.The simulation results showed agreement between the experimental data and simulated quantities.
For control design, we have presented nonlinear sliding mode control techniques considering two alternatives: firstorder SMC and second-order SMC.For both cases, we have tested the case of static and state-dependent control parameters to reduce chattering.Results of experimental tests suggest that state-dependent control has better performance over static gains.Additionally, for tracking and model uncertainty, second-order SMC performs slightly better than the firstorder option.Nevertheless, we experienced that first-order SMC is easier to implement and the benefits of higher order SMC might not be so much better to justify the efforts of implementation.We conclude that first-order SMC with state-dependent parameters meets all of our expectations.As a concluding remark, the control laws were tuned applying the Robust Control Toolbox of MATLAB.The results presented show the performance of control parameters found with this software; online tuning was not done.We implemented these controllers using automatically generated embedded code, thus completing out model-based development workflow.

Figure 1 :
Figure 1: Forwarder crane used for our study.It resembles a kinematically redundant manipulator with four degrees of freedom.The gripper is attached at the boom tip and is used for collecting forest biomaterials.

Figure 2 :
Figure 2: Geometry of the first link joint  2 as a function of the cylinder's displacement  2 .The schematics show the portion related to the motion  2 from Figure 1.

Figure 5 :
Figure5: The layout presents the configuration of our control system setup, which includes the measurement devices and the rapid prototyping unit.The valve is equipped with magnetic coils to provoke the motion of the internal spools and a power amplifier that accepts regular PWM signals.

Figure 6 :
Figure 6: Example of recorded trajectories which resemble finite Fourier series.Each column represents a different data set, which results from an average of many periods.(a) Measured angular position  2 () in (rad).(b) Estimated angular velocity q 2 () in (rad/sec).(c) Estimated angular acceleration q 2 () in (rad/sec 2 ).

Figure 7 :
Figure 7: Result of validation for three different recorded sets of data.The plot shows the simulated response of the input torque  2 () in (Nm) (dark bold line) versus the measured one (grey line).

Figure 8 :
Figure 8: Each column depicts a different recorded capture used for identification.(a) Cylinder displacement  2 () in meters.(b) Pressure   () in chamber  in bars.(c) Pressure   () in chamber  in bars.(d) Control input ().All data is presented for a period of 60 seconds.

Figure 9 :Figure 10 :
Figure 9: Validation results.The data presents a comparison of the measured control input  (grey signal) with the estimation û (bold signal) found according to the model (44).

Figure 11 :Figure 12 :
Figure 11: Experimental results of tracking performance with a first-order SMC.(a) Angular link displacement in radians.The bold signal shows the results applying the chattering reduction method (47), the striped signal shows results with the original formula(36), and the gray signal is the reference trajectory.(b) Control input.The bold signal shows the results applying the chattering reduction method (47) and the gray signal shows results with the original formula(36).(c) Computed torque from pressure measurements.The bold signal shows the results applying the chattering reduction method (47) and the gray signal shows results with the original formula(36).

Figure 13 :Figure 14 :
Figure13: Experimental results of tracking performance with a second-order SMC.(a) Angular link displacement in radians.The bold signal shows the results applying the state-dependent method(48), the striped signal shows results with the original formula(40), and the gray signal is the reference trajectory.(b) Control input.The bold signal shows the results applying the state-dependent method(48) and the gray signal shows results with the original formula(40).(c) Computed torque from pressure measurements.The bold signal shows the results applying the state-dependent method(48) and the gray signal shows results with the original formula(40).